本文整理汇总了C#中SerializationReader.ReadByteArray方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader.ReadByteArray方法的具体用法?C# SerializationReader.ReadByteArray怎么用?C# SerializationReader.ReadByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationReader
的用法示例。
在下文中一共展示了SerializationReader.ReadByteArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var reader = new SerializationReader(mySerializedBytes);
ObjectLocation = reader.ReadString();
RightUUID = new UUID(reader.ReadByteArray());
EntitiyUUID = new UUID(reader.ReadByteArray());
}
示例2: Deserialize
public void Deserialize(byte[] mySerializedBytes)
{
var _SerializationReader = new SerializationReader(mySerializedBytes);
FailedCopy = _SerializationReader.ReadInt32();
MaxNumberOfCopies = _SerializationReader.ReadInt32();
SerializedObjectStream = _SerializationReader.ReadByteArray();
}
示例3: Deserialize
private object Deserialize(ref SerializationReader mySerializationReader, DirectoryEntry myDirectoryEntry)
{
try
{
#region Read the Inlinedata
myDirectoryEntry._InlineData = mySerializationReader.ReadByteArray();
#endregion
#region Read the INodePositions
var _NumOfINodePositions = mySerializationReader.ReadUInt32();
if (_NumOfINodePositions > 0)
{
for (var j = 0UL; j < _NumOfINodePositions; j++)
{
StorageUUID ID = new StorageUUID();
ID.Deserialize(ref mySerializationReader);
myDirectoryEntry._INodePositions.Add(new ExtendedPosition(ID, mySerializationReader.ReadUInt64()));
}
}
#endregion
#region Read the ObjectStreamsList
var _NumberOfObjectStreamTypes = mySerializationReader.ReadUInt32();
if (_NumberOfObjectStreamTypes > 0)
{
for (var j = 0UL; j < _NumberOfObjectStreamTypes; j++)
myDirectoryEntry._ObjectStreamsList.Add(mySerializationReader.ReadString());
}
#endregion
}
catch (GraphFSException e)
{
throw new GraphFSException("DirectoryEntry could not be deserialized!\n\n" + e);
}
myDirectoryEntry.isDirty = true;
return myDirectoryEntry;
}
示例4: Deserialize
private object Deserialize(ref SerializationReader mySerializationReader, ADBSettingsBase myValue)
{
#region Read Basics
try
{
if (myValue != null)
{
myValue.Name = mySerializationReader.ReadString();
myValue.Description = mySerializationReader.ReadString();
myValue.OwnerID = (EntityUUID)mySerializationReader.ReadObject();
myValue.Type = new TypeUUID(mySerializationReader.ReadByteArray());
myValue.Default.SetValue(mySerializationReader.ReadObject());
myValue._Value.SetValue(mySerializationReader.ReadObject());
}
else
{
Name = mySerializationReader.ReadString();
Description = mySerializationReader.ReadString();
OwnerID = (EntityUUID)mySerializationReader.ReadObject();
Type = new TypeUUID(mySerializationReader.ReadByteArray());
Default.SetValue(mySerializationReader.ReadObject());
_Value.SetValue(mySerializationReader.ReadObject());
}
}
catch (Exception e)
{
throw new GraphFSException_EntityCouldNotBeDeserialized("ADBSetting could not be deserialized!\n\n" + e);
}
#endregion
return myValue;
}
示例5: Deserialize
private object Deserialize(ref SerializationReader mySerializationReader, DirectoryEntry myDirectoryEntry)
{
try
{
#region Read the Inlinedata
myDirectoryEntry._InlineData = mySerializationReader.ReadByteArray();
#region Estimated Size
if (myDirectoryEntry._InlineData != null)
{
myDirectoryEntry._estimatedSize += Convert.ToUInt64(myDirectoryEntry._InlineData.Length) * EstimatedSizeConstants.Byte;
}
#endregion
#endregion
#region Read the INodePositions
#region Estimated Size
myDirectoryEntry._estimatedSize += EstimatedSizeConstants.HashSet;
#endregion
var _NumOfINodePositions = mySerializationReader.ReadUInt32();
if (_NumOfINodePositions > 0)
{
for (var j = 0UL; j < _NumOfINodePositions; j++)
{
StorageUUID ID = new StorageUUID();
ID.Deserialize(ref mySerializationReader);
myDirectoryEntry._INodePositions.Add(new ExtendedPosition(ID, mySerializationReader.ReadUInt64()));
#region Estimated Size
myDirectoryEntry._estimatedSize += EstimatedSizeConstants.ExtendedPosition;
#endregion
}
}
#endregion
#region Read the ObjectStreamsList
#region Estimated Size
myDirectoryEntry._estimatedSize += EstimatedSizeConstants.HashSet;
#endregion
var _NumberOfObjectStreamTypes = mySerializationReader.ReadUInt32();
if (_NumberOfObjectStreamTypes > 0)
{
for (var j = 0UL; j < _NumberOfObjectStreamTypes; j++)
{
myDirectoryEntry._ObjectStreamsList.Add(mySerializationReader.ReadString());
#region Estimated Size
myDirectoryEntry._estimatedSize += EstimatedSizeConstants.Char * EstimatedSizeConstants.EstimatedObjectStreamNameLength;
#endregion
}
}
#endregion
}
catch (GraphFSException e)
{
throw new GraphFSException("DirectoryEntry could not be deserialized!\n\n" + e);
}
myDirectoryEntry.isDirty = true;
return myDirectoryEntry;
}
示例6: Deserialize
//.........这里部分代码省略.........
// Multiply the value of the second byte with 8
EncryptionParameters_Length = reader.ReadByte() << 3;
if (EncryptionParameters_Length > mySerializedData.Length - HeaderLength - IntegrityCheckValue_Length)
throw new GraphFSException_InvalidEncryptionParametersLengthField("The length of the encryption parameters is invalid!");
#endregion
#region Read Padding lengths
DataPadding_Length = (Int32) reader.ReadByte();
AdditionalPadding_Length = (Int32) (256 * reader.ReadByte() + reader.ReadByte()) << 3;
if ((HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length + AdditionalPadding_Length) >= mySerializedData.Length)
throw new GraphFSException_InvalidAdditionalPaddingLengthField("The length of the additional padding is invalid!");
reader.ReadBytesDirect(2); // Read reserved bytes
#endregion
#region Read Integrity Check Value and Encryption Parameters
IntegrityCheckValue_Position = reader.BaseStream.Position;
if (IntegrityCheckValue_Length > 0)
IntegrityCheckValue = reader.ReadBytesDirect(IntegrityCheckValue_Length);
if (EncryptionParameters_Length > 0)
EncryptionParameters = reader.ReadBytesDirect(EncryptionParameters_Length);
#endregion
#region Verify the integrity of the data
if (myIntegrityCheckAlgorithm != null && IntegrityCheckValue_Length > 0)
{
// Save the read IntegrityCheckValue
IntegrityCheckValue = new Byte[IntegrityCheckValue_Length];
Array.Copy(mySerializedData, IntegrityCheckValue_Position, IntegrityCheckValue, 0, IntegrityCheckValue_Length);
// Zero the IntegrityCheckValue within the serialized data
var AllZeros = new Byte[IntegrityCheckValue_Length];
Array.Copy(AllZeros, 0, mySerializedData, IntegrityCheckValue_Position, IntegrityCheckValue_Length);
// Calculate the actual IntegrityCheckValue
actualIntegrityCheckValue = myIntegrityCheckAlgorithm.GetHashValueAsByteArray(mySerializedData);
// Compare read and actual IntegrityCheckValue
if (IntegrityCheckValue.CompareByteArray(actualIntegrityCheckValue) != 0)
throw new GraphFSException_IntegrityCheckFailed(String.Concat("The IntegrityCheck failed as ", actualIntegrityCheckValue.ToHexString(), " is not equal to the expected ", IntegrityCheckValue.ToHexString()));
}
#endregion
#region Decrypt the remaining data
//EncryptedData_Length = (UInt64) (mySerializedData.Length - (HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length + AdditionalPadding_Length));
//EncryptedData = new Byte[EncryptedData_Length];
//Array.Copy(mySerializedData, HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length, EncryptedData, 0, (Int64) EncryptedData_Length);
//#endregion
//#region Decrypt Data
// Decrypt Data, sooon...!
//if ( (UInt64) DataPadding_Length >= EncryptedData_Length)
// throw new GraphFSException_InvalidDataPaddingLengthField("The length of the data padding is invalid!");
//DecryptedData = new Byte[EncryptedData_Length - (UInt64) DataPadding_Length];
//Array.Copy(EncryptedData, 0, DecryptedData, 0, (Int64) (EncryptedData_Length - (UInt64) DataPadding_Length));
#endregion
#region Deserialize Inner Object
_StructureVersion = BitConverter.ToUInt16(reader.ReadBytesDirect(2), 0);
ObjectUUID = new ObjectUUID(reader.ReadByteArray()); // n or at least 16 Bytes
Deserialize(ref reader);
#endregion
}
catch (GraphFSException_IntegrityCheckFailed e)
{
throw new GraphFSException_IntegrityCheckFailed("The AGraphStructure could not be deserialized as its integrity is corrupted!\n\n" + e);
}
catch (Exception e)
{
throw new GraphFSException_AGraphStructureCouldNotBeDeserialized("The AGraphStructure could not be deserialized!\n\n" + e);
}
_SerializedAGraphStructure = mySerializedData;
_EstimatedSize = (UInt64) _SerializedAGraphStructure.LongLength;
}
示例7: Deserialize
public override void Deserialize(ref SerializationReader mySerializationReader)
{
try
{
//var _count = mySerializationReader.BaseStream.Length - mySerializationReader.BaseStream.Position;
//_ObjectData = new Byte[_count];
//var b = mySerializationReader.BaseStream.Read(_ObjectData, 0, (int)_count);
_ContentType = mySerializationReader.ReadString();
_ObjectData = mySerializationReader.ReadByteArray();
}
catch (Exception e)
{
throw new GraphFSException_FileObjectCouldNotBeDeserialized("The FileObject could not be deserialized!\n\n" + e);
}
}
示例8: Deserialize
public override void Deserialize(ref SerializationReader mySerializationReader)
{
mySerializationReader.CheckNull("mySerializationReader");
_IPAddress = new System.Net.IPAddress(mySerializationReader.ReadByteArray());
}
示例9: Deserialize
public override void Deserialize(ref SerializationReader mySerializationReader)
{
UInt16 NumberOfObjectLocatorPositions;
UInt16 NumberOfINodePositions;
try
{
#region Read Common attributes
_CreationTime = mySerializationReader.ReadUInt64();
_LastModificationTime = mySerializationReader.ReadUInt64();
_LastAccessTime = mySerializationReader.ReadUInt64();
_DeletionTime = mySerializationReader.ReadUInt64();
_ObjectSize = mySerializationReader.ReadUInt64();
#endregion
#region Object Safety and Security
_IntegrityCheckAlgorithm = (IntegrityCheckTypes)mySerializationReader.ReadOptimizedByte();
_EncryptionAlgorithm = (SymmetricEncryptionTypes)mySerializationReader.ReadOptimizedByte();
#endregion
#region Read list of ObjectLocatorPositions
_ObjectLocatorLength = mySerializationReader.ReadUInt64();
_ObjectLocatorCopies = mySerializationReader.ReadUInt64();
NumberOfObjectLocatorPositions = mySerializationReader.ReadUInt16();
_ObjectLocatorPositions = new List<ExtendedPosition>();
for (int i = 1; i <= NumberOfObjectLocatorPositions; i++)
_ObjectLocatorPositions.Add(new ExtendedPosition(new StorageUUID(mySerializationReader.ReadByteArray()), mySerializationReader.ReadUInt64()));
#endregion
#region Read list of INodePositions
NumberOfINodePositions = mySerializationReader.ReadUInt16();
_INodePositions = new List<ExtendedPosition>();
for (int i = 1; i <= NumberOfINodePositions; i++)
_INodePositions.Add(new ExtendedPosition(new StorageUUID(mySerializationReader.ReadByteArray()), mySerializationReader.ReadUInt64()));
#endregion
#region Read State
_ObjectLocatorStates = (ObjectLocatorStates)mySerializationReader.ReadOptimizedByte();
#endregion
}
catch (Exception e)
{
throw new GraphFSException_INodeCouldNotBeDeserialized("INode could not be deserialized!\n\n" + e);
}
//isDirty = true; // this is not useful!
}
示例10: Deserialize
public override void Deserialize(ref SerializationReader mySerializationReader)
{
#region Data
UInt64 _NumberOfACLs;
RightUUID _RightUUID;
EntityUUID _EntityUUID;
UInt64 _NumberOfEntityUUIDs;
HashSet<EntityUUID> _EntityUUIDHashSet;
#endregion
try
{
#region NotificationHandling
_NotificationHandling = (NHAccessControlObject)mySerializationReader.ReadOptimizedByte();
#endregion
#region DefaultRule
_DefaultRule = (DefaultRuleTypes)mySerializationReader.ReadOptimizedByte();
#endregion
#region AllowACL
_AllowACL = new Dictionary<RightUUID, HashSet<EntityUUID>>();
_NumberOfACLs = mySerializationReader.ReadUInt64();
for (UInt64 i=0; i<_NumberOfACLs; i++)
{
#region KEY
_RightUUID = new RightUUID(mySerializationReader.ReadByteArray());
#endregion
#region VALUE
_EntityUUIDHashSet = new HashSet<EntityUUID>();
_NumberOfEntityUUIDs = mySerializationReader.ReadUInt64();
for (UInt64 j=0; j<_NumberOfEntityUUIDs; j++)
{
_EntityUUID = new EntityUUID(mySerializationReader.ReadByteArray());
_EntityUUIDHashSet.Add(_EntityUUID);
}
// Finally... add it to the AllowACL!
_AllowACL.Add(_RightUUID, _EntityUUIDHashSet);
#endregion
}
#endregion
#region DenyACL
_DenyACL = new Dictionary<RightUUID, HashSet<EntityUUID>>();
_NumberOfACLs = mySerializationReader.ReadUInt64();
for (UInt64 i=0; i<_NumberOfACLs; i++)
{
#region KEY
_RightUUID = new RightUUID(mySerializationReader.ReadByteArray());
#endregion
#region VALUE
_EntityUUIDHashSet = new HashSet<EntityUUID>();
_NumberOfEntityUUIDs = mySerializationReader.ReadUInt64();
for (UInt64 j=0; j<_NumberOfEntityUUIDs; j++)
{
_EntityUUID = new EntityUUID(mySerializationReader.ReadByteArray());
_EntityUUIDHashSet.Add(_EntityUUID);
}
// Finally... add it to the DenyACL!
_DenyACL.Add(_RightUUID, _EntityUUIDHashSet);
#endregion
}
#endregion
}
//.........这里部分代码省略.........