Пример #1
0
        public static int GetDataStart(BinaryReader br)
        {
            int SinVer = GetSinVersion(br);

            switch (SinVer)
            {
            case 2:
                return(SinFileV2.GetDataStart(br));

            case 3:
                return(SinFileV3.GetDataStart(br));

            default:
                throw new Exception("GetDataStart: Unknown Version (" + SinVer + ")");
            }
        }
Пример #2
0
        public static void ExtractSin(BackgroundWorker sender, string sinfile, string outfile, bool log = true)
        {
            using (FileStream stream = new FileStream(sinfile, FileMode.Open, FileAccess.Read))
                using (BinaryReader br = new BinaryReader(stream))
                {
                    if (log)
                    {
                        Logger.WriteLog("Verifying extracted Sin File");
                    }
                    ;
                    if (!SinFile.VerifySin(br))
                    {
                        sender.CancelAsync();
                        return;
                    }

                    List <SinFile.BlockInfoHeader> bihs = null;
                    int SinVer = SinFile.GetSinVersion(br);
                    switch (SinVer)
                    {
                    case 2:
                        bihs = SinFileV2.GetBIHs(br);
                        break;

                    case 3:
                        bihs = SinFileV3.GetBIHs(br);
                        break;
                    }
                    if (log)
                    {
                        Logger.WriteLog("Extracting image from Sin File " + Path.GetFileName(sinfile));
                    }

                    SinExtract.ExtractSinData(sender, br, bihs, outfile, log);
                }
        }