Example #1
0
        public static void SaveBink(string Filename, CacheBase Cache, CacheBase.IndexItem Tag)
        {
            var bik = DefinitionsManager.bink(Cache, Tag);
            var raw = Cache.GetRawFromID(bik.RawID);

            if (!Filename.EndsWith(".bik"))
            {
                Filename += ".bik";
            }

            if (!Directory.GetParent(Filename).Exists)
            {
                Directory.GetParent(Filename).Create();
            }

            var fs = new FileStream(Filename, FileMode.Create, FileAccess.Write);
            var bw = new BinaryWriter(fs);

            for (int i = 0; i < (raw.Length); i += 4)
            {
                Array.Reverse(raw, i, 4);
            }

            bw.Write(raw);

            bw.Close();
            bw.Dispose();
        }