public override void WriteToStream(System.IO.Stream stream) { //Owner identifier <text string> $00 //Identifier <up to 64 bytes binary data> UniqueFileIdentifierFrame frame = (UniqueFileIdentifierFrame)this.FrameToWrite; List <Field> fields = new List <Field>(); // Declare the fields to write. fields.Add(TextField.CreateTextField(frame.Owner, EncodingScheme.Ascii)); fields.Add(new BinaryField(frame.UniqueIdentifier, 0, frame.UniqueIdentifier.Length)); // Write the header int length = 0; foreach (Field f in fields) { length += f.Length; } HeaderWriter.WriteHeader(stream, new FrameHeader(this.FrameID, length)); // Write the fields foreach (Field f in fields) { f.WriteToStream(stream); } }
public void TestReadDate() { UniqueFileIdentifierFrame frame = new UniqueFileIdentifierFrame(ffs, _data); Assert.AreEqual(_expOwnerID, frame.OwnerID); CollectionAssert.AreEqual(_expValue, frame.GetData()); }
// Other frames private void SetUFID(FrameFlagSet ffs, byte[] data) { UniqueFileIdentifierFrame frame = new UniqueFileIdentifierFrame(ffs, data); if (this._UFID == null || this._UFID.Length == 0) { this._UFID = new UniqueFileIdentifierFrame[] { frame }; } else { this._UFID = Generic.Add(this._UFID, frame); } }
public void TestInvalidUfidDataException() { byte[] _invalidData = new byte[] { 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x63, 0x64, 0x64, 0x62, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x69, 0x64, 0x33, 0x2F, 0x74, 0x61, 0x67, 0x69, 0x6E, 0x66, 0x6F, 0x31, 0x2E, 0x68, 0x74, 0x6D, 0x6C, 0x00, 0x33, 0x43, 0x44, 0x33, 0x4E, 0x39, 0x33, 0x51, 0x32, 0x36, 0x39, 0x33, 0x36, 0x35, 0x39, 0x33, 0x32, 0x55, 0x32, 0x31, 0x38, 0x35, 0x43, 0x34, 0x43, 0x41, 0x31, 0x34, 0x44, 0x35, 0x43, 0x44, 0x32, 0x32, 0x39, 0x46, 0x38, 0x38, 0x37, 0x37, 0x32, 0x36, 0x42, 0x30, 0x31, 0x31, 0x36, 0x44, 0x38, 0x42, 0x38, 0x42, 0x42, 0x50, 0x32, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }; UniqueFileIdentifierFrame frame = new UniqueFileIdentifierFrame(ffs, _invalidData); }
public UniqueFileIdentifierFrameWriter(UniqueFileIdentifierFrame frameToWrite, Writers.FrameHeaderWriter frameHeaderWriter, string frameID, EncodingScheme encoding) : base(frameToWrite, frameHeaderWriter, frameID, encoding) { }