public FileId(string path, ulong length, Omnix.Serialization.RocketPack.Timestamp lastWriteTime) { if (path is null) { throw new System.ArgumentNullException("path"); } if (path.Length > 1024) { throw new System.ArgumentOutOfRangeException("path"); } this.Path = path; this.Length = length; this.LastWriteTime = lastWriteTime; { var __h = new System.HashCode(); if (this.Path != default) { __h.Add(this.Path.GetHashCode()); } if (this.Length != default) { __h.Add(this.Length.GetHashCode()); } if (this.LastWriteTime != default) { __h.Add(this.LastWriteTime.GetHashCode()); } __hashCode = __h.ToHashCode(); } }
public OmniAgreementPrivateKey(Omnix.Serialization.RocketPack.Timestamp creationTime, OmniAgreementAlgorithmType algorithmType, System.ReadOnlyMemory <byte> privateKey) { if (privateKey.Length > 8192) { throw new System.ArgumentOutOfRangeException("privateKey"); } this.CreationTime = creationTime; this.AlgorithmType = algorithmType; this.PrivateKey = privateKey; { var __h = new System.HashCode(); if (this.CreationTime != default) { __h.Add(this.CreationTime.GetHashCode()); } if (this.AlgorithmType != default) { __h.Add(this.AlgorithmType.GetHashCode()); } if (!this.PrivateKey.IsEmpty) { __h.Add(Omnix.Base.Helpers.ObjectHelper.GetHashCode(this.PrivateKey.Span)); } __hashCode = __h.ToHashCode(); } }
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)); }
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)); }