public byte[] Serialize() { var _SerializationWriter = new SerializationWriter(); if (StorageURIs == null) _SerializationWriter.WriteUInt32(0); else _SerializationWriter.WriteUInt32((UInt32)StorageURIs.Count); foreach (String uri in StorageURIs) _SerializationWriter.WriteString(uri); _SerializationWriter.WriteString(StorageType); _SerializationWriter.WriteUInt64(StorageSize); return _SerializationWriter.ToArray(); }
private void Serialize(ref SerializationWriter mySerializationWriter, DirectoryEntry myDirectoryEntry) { try { #region Write the InlineData mySerializationWriter.Write(myDirectoryEntry._InlineData); #endregion #region Write the INodePositions mySerializationWriter.WriteUInt32((UInt32)myDirectoryEntry.INodePositions.Count); foreach (var _ExtendedPosition in myDirectoryEntry.INodePositions) { _ExtendedPosition.StorageUUID.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt64(_ExtendedPosition.Position); } #endregion #region Write the ObjectStreamsList mySerializationWriter.WriteUInt32((UInt32)myDirectoryEntry.ObjectStreamsList.Count); foreach (var _ObjectStreamType in myDirectoryEntry.ObjectStreamsList) mySerializationWriter.WriteString(_ObjectStreamType); #endregion myDirectoryEntry.isDirty = false; } catch (SerializationException e) { throw new SerializationException(e.Message); } }
public override void Serialize(ref SerializationWriter mySerializationWriter) { try { #region Write Common attributes mySerializationWriter.WriteUInt64(_CreationTime); mySerializationWriter.WriteUInt64(_LastAccessTime); mySerializationWriter.WriteUInt64(_LastModificationTime); mySerializationWriter.WriteUInt64(_DeletionTime); mySerializationWriter.WriteUInt64(_ObjectSize); #endregion #region Object Safety and Security mySerializationWriter.WriteByte((Byte)_IntegrityCheckAlgorithm); mySerializationWriter.WriteByte((Byte)_EncryptionAlgorithm); #endregion #region Write list of ObjectLocatorPositions mySerializationWriter.WriteUInt64(_ObjectLocatorLength); mySerializationWriter.WriteUInt64(_ObjectLocatorCopies); mySerializationWriter.WriteUInt16((UInt16)Math.Min(_ObjectLocatorPositions.Count, MaxNumberOfObjectLocatorPositions)); for (int i=0; i < Math.Min(_ObjectLocatorPositions.Count, MaxNumberOfObjectLocatorPositions - 1); i++) { _ObjectLocatorPositions[i].StorageUUID.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt64(_ObjectLocatorPositions[i].Position); } #endregion #region Write list of INodePositions mySerializationWriter.WriteUInt16((UInt16)Math.Min(_INodePositions.Count, MaxNumberOfINodePositions)); // for (int i=0; i < Math.Min(_INodePositions.Count, MaxNumberOfINodePositions - 1); i++) <- Why -1? for (int i=0; i < Math.Min(_INodePositions.Count, MaxNumberOfINodePositions); i++) { _INodePositions[i].StorageUUID.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt64(_INodePositions[i].Position); } #endregion #region Write State mySerializationWriter.WriteByte((Byte)_ObjectLocatorStates); #endregion } catch (SerializationException e) { throw new SerializationException(e.Message); } }
private void Serialize(ref SerializationWriter mySerializationWriter, DBUInt64 myValue) { mySerializationWriter.WriteUInt64((UInt64)myValue._Value); }
public override void Serialize(ref SerializationWriter mySerializationWriter) { if (mySerializationWriter != null) { try { ParentTypeUUID.Serialize(ref mySerializationWriter); mySerializationWriter.WriteBoolean(_IsUserDefined); mySerializationWriter.WriteBoolean(_IsAbstract); mySerializationWriter.WriteString(_Comment); mySerializationWriter.WriteUInt32((UInt32)_Attributes.Count); foreach (var pValPair in _Attributes) { pValPair.Key.Serialize(ref mySerializationWriter); pValPair.Value.Serialize(ref mySerializationWriter); } mySerializationWriter.WriteUInt32((UInt32)_TypeSettings.Count); foreach (var pValPair in _TypeSettings) mySerializationWriter.WriteObject(pValPair.Value); mySerializationWriter.WriteUInt32((UInt32)_UniqueAttributes.Count); foreach (var pValPair in _UniqueAttributes) pValPair.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt32((UInt32)_MandatoryAttributes.Count); foreach (var pValPair in _MandatoryAttributes) pValPair.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt16((UInt16)ObjectDirectoryShards); #region Indices mySerializationWriter.WriteUInt32((UInt32)_AttributeIndices.Count); foreach (var idx in _AttributeIndices) { idx.Key.Serialize(ref mySerializationWriter); mySerializationWriter.WriteUInt32((UInt32)idx.Value.Count); foreach (var idxType in idx.Value) { mySerializationWriter.WriteString(idxType.Key); mySerializationWriter.WriteString(idxType.Value.FileSystemLocation.ToString()); mySerializationWriter.WriteString(idxType.Value.IndexEdition); mySerializationWriter.WriteString(idxType.Value.IndexName); mySerializationWriter.WriteString(idxType.Value.IndexType); mySerializationWriter.WriteBoolean(idxType.Value is UUIDIndex); mySerializationWriter.WriteUInt64(idxType.Value.GetKeyCount()); mySerializationWriter.WriteUInt64(idxType.Value.GetValueCount()); mySerializationWriter.WriteUInt16(idxType.Value.AttributeIdxShards); } } #endregion } catch (Exception e) { throw new SerializationException("The GraphDBType could not be serialized!\n\n" + e); } } }
public override void Serialize(ref SerializationWriter mySerializationWriter) { try { #region NotificationHandling mySerializationWriter.WriteByte((Byte)_NotificationHandling); #endregion #region DefaultRule mySerializationWriter.WriteByte((Byte)_DefaultRule); #endregion #region AllowACL // Write number of AllowACL items mySerializationWriter.WriteUInt64((UInt64)_AllowACL.Count); foreach (KeyValuePair<RightUUID, HashSet<EntityUUID>> _KeyValuePair in _AllowACL) { // KEY: RightUUID mySerializationWriter.Write(_KeyValuePair.Key.GetByteArray()); // VALUE: // Write number of HashSet elements mySerializationWriter.WriteUInt64((UInt64)_KeyValuePair.Value.Count); // Write the elements itself foreach (EntityUUID _HashItem in _KeyValuePair.Value) mySerializationWriter.Write(_HashItem.GetByteArray()); } #endregion #region DenyACL // Write number of DenyACL items mySerializationWriter.WriteUInt64( (UInt64) _DenyACL.Count); foreach (KeyValuePair<RightUUID, HashSet<EntityUUID>> _KeyValuePair in _DenyACL) { // KEY: mySerializationWriter.Write(_KeyValuePair.Key.GetByteArray()); // VALUE: // Write number of HashSet elements mySerializationWriter.WriteUInt64( (UInt64) _KeyValuePair.Value.Count); // Write the elements itself foreach (EntityUUID _HashItem in _KeyValuePair.Value) mySerializationWriter.Write(_HashItem.GetByteArray()); } #endregion } catch (SerializationException e) { throw new SerializationException(e.Message); } }