public void RopWriteStreamMethod(OpenModeFlags openFlag, bool isExceedMax, out CPRPTErrorCode error)
{
TaggedPropertyValue[] tagPtyValues = new TaggedPropertyValue[1];
if (this.cprptCurrentType == ServerObjectType.Folder)
{
tagPtyValues[0] = this.GetTaggedPropertyTag(ObjectToOperate.ThirdObject);
}
else
{
tagPtyValues[0] = this.GetTaggedPropertyTag(this.cprptCurrentObj);
}
PropertyTag[] ptyTags;
ptyTags = new PropertyTag[1];
ptyTags[0] = tagPtyValues[0].PropertyTag;
uint objHandle = 0;
switch (this.cprptCurrentObj)
{
case ObjectToOperate.FirstObject:
objHandle = this.cprptFirstObjectHandle;
break;
case ObjectToOperate.SecondObject:
objHandle = this.cprptSecondObjectHandle;
break;
default:
break;
}
RopGetPropertiesSpecificResponse getPropertiesSpecificResponse = this.RopGetPropertiesSpecific(objHandle, 0, 0, ptyTags);
bool canBeRetrieval = false;
bool isChangInDB = true;
bool forErrorCode = false;
if (isExceedMax)
{
this.RopSeekStream(this.cprptCurrentHandle, (byte)Origin.Beginning, int.MaxValue, true);
}
RopSeekStreamResponse seekStreamResponse1 = this.RopSeekStream(this.cprptCurrentHandle, (byte)Origin.Current, 0, true);
RopWriteStreamResponse writeStreamResponse = this.RopWriteStream(this.cprptCurrentHandle, WriteData, false);
RopSeekStreamResponse seekStreamResponse2 = this.RopSeekStream(this.cprptCurrentHandle, (byte)Origin.Current, 0, true);
bool isWriteSizeElemetRight = false;
if (seekStreamResponse2.NewPosition - seekStreamResponse1.NewPosition == writeStreamResponse.WrittenSize)
{
isWriteSizeElemetRight = true;
}
if (writeStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
{
this.RopSeekStream(this.cprptCurrentHandle, (byte)Origin.Current, (long)(0 - WriteData.Length), true);
RopReadStreamResponse readStreamResponse = this.RopReadStream(this.cprptCurrentHandle, (ushort)WriteData.Length, 0x70000000, false);
if (WriteData == Encoding.ASCII.GetString(readStreamResponse.Data))
{
canBeRetrieval = true;
}
RopGetPropertiesSpecificResponse getPropertiesSpecificResponse1 = this.RopGetPropertiesSpecific(objHandle, 0, 0, ptyTags);
if (Common.CompareByteArray(getPropertiesSpecificResponse.RowData.PropertyValues[0].Value, getPropertiesSpecificResponse1.RowData.PropertyValues[0].Value))
{
isChangInDB = false;
}
}
else
{
forErrorCode = true;
}
this.VerifyRopWriteStream(writeStreamResponse, openFlag, WriteData, canBeRetrieval, isChangInDB, forErrorCode, isWriteSizeElemetRight);
error = (CPRPTErrorCode)writeStreamResponse.ReturnValue;
}