public PxzRecord(string data, string name, PxzRecordType recordType = PxzRecordType.Text, bool protectedRecord = false) { var content = new PxzRecordContent(data, protectedRecord); var header = new PxzRecordHeader { Checksums = new PxzRecordChecksum(content), Size = new PxzRecordSize(content), Naming = new PxzRecordNaming { RecordName = name, StoredName = $"{Guid.NewGuid()}.record", DataType = recordType } }; ProtectedRecord = protectedRecord; Header = header; Content = content; }
public PxzRecordChecksum(PxzRecordContent content) { if (content.RawRecord.Length == 0) { return; } if (content.AutoRecord.Length == 0) { return; } var dec = MD5Helper.CalculateMd5Hash(content.AutoRecord); if (dec == null) { return; } RawMd5 = MD5Helper.CalculateMd5Hash(content.RawRecord); DecMd5 = MD5Helper.Md5ToHex(dec); }
public PxzRecordSize(PxzRecordContent content) { RawSize = content.RawRecord.Length; DecSize = RawSize > 0 ? content.AutoRecord.Length : 0; }