コード例 #1
0
        private void LoadCATFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.DefaultExt = "cat";
            openFileDialog.Filter     = "Cat Files|*.cat|All Files|*.*";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Cat cat = new Cat(openFileDialog.FileName);
                assetsListBox.Items.Clear();
                loadedImages.Clear();
                UpdateStatusBarText("Loading CAT file...");
                for (int i = 0; i < cat.files.Count; i++)
                {
                    string         filepath = Path.GetFileNameWithoutExtension(openFileDialog.FileName);
                    ShandalarAsset asset    = new ShandalarAsset(filepath, cat.files[i].data, ImageType.Cat);
                    asset.childIndex = i;
                    asset.parentName = filepath;
                    asset.filename   = cat.files[i].name;
                    asset.image      = CATImageDecoder.DecodeCatImage(asset);
                    assetsListBox.Items.Add(cat.files[i].name);
                    loadedImages.Add(asset);
                    SetProgressBarValue((int)Math.Round(100f * ((float)i / (float)cat.files.Count)));
                }
                SetProgressBarValue(0);
                UpdateStatusBarText("Finished loading CAT file.");
            }
            exportToolStripMenuItem.Enabled    = true;
            exportAllToolStripMenuItem.Enabled = true;
        }
コード例 #2
0
        public void OpenWvlFileTest(string path)
        {
            byte[]         data  = File.ReadAllBytes(path);
            ShandalarAsset asset = new ShandalarAsset(path, data, ImageType.Cat);

            asset.filename = Path.GetFileName(path);
            path           = path.Replace(".tif", "").Replace(".wvl", ".png"); //replace both extensions seperately, because a few card image files don't have the tif file extension
            CATImageDecoder.DecodeCatImage(asset).Save(path);
        }