Ejemplo n.º 1
0
            public OmniAgreement Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                Omnix.Serialization.RocketPack.Timestamp p_creationTime = Omnix.Serialization.RocketPack.Timestamp.Zero;
                OmniAgreementAlgorithmType p_algorithmType = (OmniAgreementAlgorithmType)0;

                System.ReadOnlyMemory <byte> p_publicKey  = System.ReadOnlyMemory <byte> .Empty;
                System.ReadOnlyMemory <byte> p_privateKey = System.ReadOnlyMemory <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // CreationTime
                    {
                        p_creationTime = r.GetTimestamp();
                        break;
                    }

                    case 1:     // AlgorithmType
                    {
                        p_algorithmType = (OmniAgreementAlgorithmType)r.GetUInt64();
                        break;
                    }

                    case 2:     // PublicKey
                    {
                        p_publicKey = r.GetMemory(8192);
                        break;
                    }

                    case 3:     // PrivateKey
                    {
                        p_privateKey = r.GetMemory(8192);
                        break;
                    }
                    }
                }

                return(new OmniAgreement(p_creationTime, p_algorithmType, p_publicKey, p_privateKey));
            }
Ejemplo n.º 2
0
            public FileId Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                string p_path   = string.Empty;
                ulong  p_length = 0;

                Omnix.Serialization.RocketPack.Timestamp p_lastWriteTime = Omnix.Serialization.RocketPack.Timestamp.Zero;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Path
                    {
                        p_path = r.GetString(1024);
                        break;
                    }

                    case 1:     // Length
                    {
                        p_length = r.GetUInt64();
                        break;
                    }

                    case 2:     // LastWriteTime
                    {
                        p_lastWriteTime = r.GetTimestamp();
                        break;
                    }
                    }
                }

                return(new FileId(p_path, p_length, p_lastWriteTime));
            }