ADBaseLibrary.Matroska.Matroska.MatroskaHash C# (CSharp) Method

MatroskaHash() public static method

public static MatroskaHash ( string inpath, string outpath ) : void
inpath string
outpath string
return void
        public static void MatroskaHash(string inpath, string outpath)
        {
            FileInfo f = new FileInfo(inpath);
            Stream i = File.OpenRead(inpath);
            BinaryReader reader = new BinaryReader(i);
            Container c = new Container();
            c.Read(reader, (ulong)f.Length);
            FixUIDS(c);
            EbmlBinary segmentuid = NormalizeHeader(c);
            MoveTagInfoToTracks(c);
            Shrink(c);
            FixPositions(c);
            Stream o = File.Open(outpath, FileMode.Create, FileAccess.Write);
            BinaryWriter writer = new BinaryWriter(o);
            MD5 md5 = MD5.Create();
            c.Write(writer, md5);
            //Using Cluster Data MD5 as segment UID
            byte[] b = new byte[0];
            md5.TransformFinalBlock(b, 0, 0);
            byte[] hash = md5.Hash;
            segmentuid.Value = hash;
            writer.BaseStream.Seek((long)segmentuid.OutputValueOffset, SeekOrigin.Begin);
            writer.Write(hash);
            writer.Close();
            reader.Close();
            i.Close();
            o.Close();
        }