コード例 #1
0
            public void Deserialize(byte[] mySerializedBytes)
            {
                var _SerializationReader = new SerializationReader(mySerializedBytes);

                ObjectLocation = _SerializationReader.ReadString();
                NewDefaultRule = _SerializationReader.ReadOptimizedByte();
            }
コード例 #2
0
ファイル: NSD_StorageEngine.cs プロジェクト: TheByte/sones
            public void Deserialize(byte[] mySerializedBytes)
            {
                SerializationReader reader = new SerializationReader(mySerializedBytes);

                ServiceGlobalUniqueName         = reader.ReadString();
                String _ServiceUri              = reader.ReadString();
                ServiceType                     = (DiscoverableServiceType)reader.ReadOptimizedByte();

                if (!Uri.TryCreate(_ServiceUri,UriKind.Absolute,out ServiceUri))
                    throw new NotificationException_InvalidNotificationPayload("IP not parseable. Notification Packet invalid!");
            }
コード例 #3
0
ファイル: LicensedFeatures.cs プロジェクト: TheByte/sones
        public void Deserialize(ref SerializationReader mySerializationReader)
        {
            Features = new List<FeatureIDs>();
            UInt32 cnt = mySerializationReader.ReadUInt32();

            for (int i = 0; i < cnt; i++)
            {
                byte entry = mySerializationReader.ReadOptimizedByte();
                Features.Add((FeatureIDs)entry);
            }

            NumberOfLicensedCPUs = mySerializationReader.ReadInt32();
            NumberOfLicensedRAM  = mySerializationReader.ReadInt32();
        }
コード例 #4
0
        private object MyDeserialize(SerializationReader reader, System.Type type)
        {
            var result = (SettingInvalidReferenceHandling)base.Deserialize(reader, type);
            result.Behaviour = (BehaviourOnInvalidReference)reader.ReadOptimizedByte();

            return result;
        }
コード例 #5
0
        private object MyDeserialize(SerializationReader reader, System.Type type)
        {
            var result = (SettingUndefAttrBehaviour)base.Deserialize(reader, type);
            result.Behaviour = (UndefAttributeBehaviour)reader.ReadOptimizedByte();

            return result;
        }
コード例 #6
0
ファイル: INode.cs プロジェクト: TheByte/sones
        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!
        }
コード例 #7
0
ファイル: AccessControlObject.cs プロジェクト: ipbi/sones
        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

            }

            catch (Exception e)
            {
                throw new GraphFSException_AccessControlObjectCouldNotBeDeserialized("AccessControlObject could not be deserialized!\n\n" + e);
            }
        }
コード例 #8
0
ファイル: LicensedFeatures.cs プロジェクト: TheByte/sones
        public object Deserialize(SerializationReader mySerializationReader, Type type)
        {
            LicensedFeatures thisObject = (LicensedFeatures)Activator.CreateInstance(type);

            thisObject.Features = new List<FeatureIDs>();
            UInt32 cnt = (UInt32)mySerializationReader.ReadObject();

            for (int i = 0; i < cnt; i++)
            {
                Byte entry = mySerializationReader.ReadOptimizedByte();
                thisObject.Features.Add((FeatureIDs)entry);
            }

            thisObject.NumberOfLicensedCPUs = mySerializationReader.ReadInt32();
            thisObject.NumberOfLicensedRAM  = mySerializationReader.ReadInt32();

            return thisObject;
        }
コード例 #9
0
ファイル: TypeAttribute.cs プロジェクト: TheByte/sones
        public void Deserialize(ref SerializationReader mySerializationReader)
        {
            UInt32 _Capacity;

            try
            {

                if (mySerializationReader != null)
                {

                    UUID = new AttributeUUID();
                    UUID.Deserialize(ref mySerializationReader);
                    DBTypeUUID = new TypeUUID();
                    DBTypeUUID.Deserialize(ref mySerializationReader);
                    KindOfType = (KindsOfType)mySerializationReader.ReadOptimizedByte();
                    TypeCharacteristics = new TypeCharacteristics();
                    TypeCharacteristics.Deserialize(ref mySerializationReader);

                    Name = mySerializationReader.ReadString();

                    var hasEdgeType = mySerializationReader.ReadBoolean();

                    if (hasEdgeType)
                    {
                        try
                        {
                            EdgeType = (IEdgeType) mySerializationReader.ReadObject();
                        }
                        catch(Exception ex)
                        {
                            //NLOG: temporarily commented
                            //Logger.Fatal("Could not deserialize EdgeType");
                            throw new GraphDBException(new Error_UnknownDBError(ex));
                        }

                    }

                    RelatedGraphDBTypeUUID = new TypeUUID();
                    RelatedGraphDBTypeUUID.Deserialize(ref mySerializationReader);

                    if (TypeCharacteristics.IsBackwardEdge)
                        BackwardEdgeDefinition = (EdgeKey) mySerializationReader.ReadObject();

                    DefaultValue = (IObject) mySerializationReader.ReadObject();

                    #region Read Settings

                    _Capacity = mySerializationReader.ReadUInt32();

                    _Settings = new Dictionary<String, ADBSettingsBase>();

                    for (var i = 0; i < _Capacity; i++)
                    {

                        var _SettingObject = (ADBSettingsBase) mySerializationReader.ReadObject();

                        if (_SettingObject != null)
                            _Settings.Add(_SettingObject.Name, _SettingObject);

                        /*Type settingType = (Type)mySerializationReader.ReadObject();
                        ADBSettingsBase _SettingObject = null;
                        try
                        {
                            _SettingObject = (ADBSettingsBase)Activator.CreateInstance(settingType);
                        }
                        catch
                        {
                            Logger.Error("Could not create an instance of setting " + settingType.ToString());
                        }
                        Byte[] Bytes = (Byte[])mySerializationReader.ReadObject();
                        if (_SettingObject != null)
                        {
                            _SettingObject.Deserialize(new SerializationReader(Bytes));
                            _Settings.Add(_SettingObject.Name, _SettingObject);
                        }*/
                    }

                    #endregion

                }
            }

            catch (Exception e)
            {
                throw new SerializationException("The Setting could not be deserialized!\n\n" + e);
            }
        }