private ArrayList getDataSegments(MemoryStream ms, long endPosition) { // read and validate UUID value // TODO: Implement a real exception handler for this if ("55534D5421D24FCEBB88695CFAC9C740" != BU.ByteArrayToStringHex(br.ReadBytes(16))) { throw new ApplicationException("Atom data supplied is not of type SonyPspTag."); } // read atom's internal data size this.internalSize = BU.ReverseToUInt32(br.ReadBytes(4)); // validate next marker in header // TODO: Implement a real exception handler for this if ("4D544454" != BU.ByteArrayToStringHex(br.ReadBytes(4))) { throw new ApplicationException("Atom data supplied is not of type SonyPspTag."); } // read segment count this.segmentCount = BU.ReverseToUInt16(br.ReadBytes(2)); // we should now be at the start of the first segment ArrayList result = new ArrayList(); SonyPspTagDataSegment ds = null; while (getNextDataSegment(out ds, endPosition, null)) { result.Add(ds); } // TODO: throw exception if we still have a null result // or if arraylist item count != this.segmentCount return(result); }
internal MpegBox.BoxUuidType GetUuidType(byte[] uuidBytes) { string s = BU.ByteArrayToStringHex(uuidBytes); MpegBox.BoxUuidType result = MpegBox.BoxUuidType.Unknown; switch (s) { case "55534D5421D24FCEBB88695CFAC9C740": // MsvTag { result = MpegBox.BoxUuidType.MsvTag; break; } case "C0EDBABEA7EBADF00DA7DEADBEEFCAFE": // MyCustomTag, registered (see below) { // NOTE: This is a registered UUID, do not use it for your // own purposes. You can generate and register one for // free at: http://www.itu.int/ITU-T/asn1/uuid.html result = MpegBox.BoxUuidType.MyCustomTag; break; } default: { // leave the return initialized as Unknown break; } } return(result); }