public MainFormTest()
        {
            InitializeComponent();
            App.LogEvent += LogEvent;

            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");

            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            txtConsole.Text = Quotes[new Random().Next(0, Quotes.Length)];

            if (FormatTools == null)
            {
                FormatTools = new FormatTools();
            }
            if (ModelTools == null)
            {
                ModelTools = new ModelTools();
            }
            if (MapTools == null)
            {
                MapTools = new MapTools();
            }
            if (TextureTools == null)
            {
                TextureTools = new TextureTools();
            }

            this.Title = $"XBC2ModelDecomp v{Assembly.GetEntryAssembly().GetName().Version.ToString(2)}-{ThisAssembly.Git.Commit}";
        }
Exemple #2
0
            public XBC1 FileBySearch(string search)
            {
                XBC1 xbc1 = Files[Array.FindIndex(Files, x => x.Name.Contains(search))];

                xbc1.Data = FormatTools.ReadZlib(Data, xbc1.OffsetInFile + 0x30, xbc1.FileSize, xbc1.CompressedSize);
                return(xbc1);
            }
Exemple #3
0
 public        XBC1[] FilesBySearch(string search, bool unique = false)
 {
     XBC1[] xbc1s = Files.Where(x => x.Name.Contains(search)).ToArray();
     for (int i = 0; i < xbc1s.Length; i++)
     {
         xbc1s[i].Data = FormatTools.ReadZlib(Data, xbc1s[i].OffsetInFile + 0x30, xbc1s[i].FileSize, xbc1s[i].CompressedSize);
     }
     return(xbc1s);
 }
Exemple #4
0
        public void DumpXBC1s(Stream sData, Structs.XBC1[] XBC1s)
        {
            List <string> filenames = new List <string>();

            App.PushLog($"Saving {XBC1s.Length} file(s) to disk...");
            for (int i = 0; i < XBC1s.Length; i++)
            {
                using (MemoryStream XBC1Stream = FormatTools.ReadZlib(sData, XBC1s[i].OffsetInFile + 0x30, XBC1s[i].FileSize, XBC1s[i].CompressedSize))
                {
                    string fileName  = XBC1s[i].Name.Split('/').Last();
                    int    dupeCount = filenames.Where(x => x == XBC1s[i].Name).Count();
                    string saveName  = $"{XBC1s[i].Name}{(string.IsNullOrWhiteSpace(fileName) ? "NOFILENAME" : "")}{(dupeCount > 0 ? $"-{dupeCount}" : "")}";

                    ft.SaveStreamToFile(XBC1Stream, saveName, App.CurOutputPath + @"\RawFiles\");
                    if (App.ShowInfo)
                    {
                        App.PushLog($"Saved {saveName} to disk...");
                    }
                    filenames.Add(XBC1s[i].Name);
                }
            }
        }