Пример #1
0
        public void fillDataGridView(TPF menuTPF, DRB menuDRB)
        {
            iconBindingSource.Clear();
            textures = new List <string>();
            foreach (TPF.Texture entry in menuTPF.Textures)
            {
                textures.Add(entry.Name);
            }

            List <string> sortedNames = new List <string>(textures);

            sortedNames.Sort();
            dgvIconsTextureCol.DataSource = sortedNames;

            drb     = menuDRB;
            sprites = new List <SpriteWrapper>();

            DRB.Dlg icons = menuDRB.Dlgs.Find(dlg => dlg.Name == "Icon");
            foreach (DRB.Dlgo dlgo in icons.Dlgos.Where(dlgo => dlgo.Shape is DRB.Shape.Sprite))
            {
                sprites.Add(new SpriteWrapper(dlgo, textures));
            }
            sprites.Sort();
            iconBindingSource.DataSource = sprites;
        }
Пример #2
0
 private void closeFiles()
 {
     iconBindingSource.Clear();
     drb      = null;
     textures = null;
     sprites  = null;
     enableControls(false);
 }
Пример #3
0
        private void loadFiles(string gameDir, bool silent = false)
        {
            if (File.Exists($@"{gameDir}\DARKSOULS.exe"))
            {
                remastered = false;
            }
            else if (File.Exists($@"{gameDir}\DarkSoulsRemastered.exe"))
            {
                remastered = true;
            }
            else
            {
                ShowError($"Dark Souls executable not found in directory:\n{gameDir}", silent);
                return;
            }

            TPF    menuTPF;
            string tpfPath = $"{gameDir}{TPF_PATH}{(remastered ? ".dcx" : "")}";

            try
            {
                menuTPF = TPF.Read(tpfPath);
            }
            catch (Exception ex)
            {
                ShowError($"Failed to read TPF:\n{tpfPath}\n\n{ex}", silent);
                return;
            }

            DRB    menuDRB;
            string drbPath = $"{gameDir}{DRB_PATH}{(remastered ? ".dcx" : "")}";

            try
            {
                menuDRB = DRB.Read(drbPath, remastered);
            }
            catch (Exception ex)
            {
                ShowError($"Failed to read DRB:\n{drbPath}{ex}", silent);
                return;
            }

            fillDataGridView(menuTPF, menuDRB);
            enableControls(true);
        }
Пример #4
0
        private void OpenDRB(string path, bool dsr, bool silent = false)
        {
            try
            {
                Drb     = DRB.Read(path, dsr);
                DrbPath = path;
                Dsr     = dsr;

                statusStripLblPath.Text = $"[{(dsr ? "DSR" : "PTDE")}] {path}";
                lbxDlgs.Enabled         = Drb.Dlgs.Count > 0;
                lbxDlgs.ClearSelected();
                lbxDlgs.DisplayMember = "Name";
                lbxDlgos.ClearSelected();
                lbxDlgos.DisplayMember            = "Name";
                lbxDlgs.DataSource                = Drb.Dlgs;
                saveToolStripMenuItem.Enabled     = true;
                texturesToolStripMenuItem.Enabled = true;
                TextureForm?.SetTextures(Drb.Textures);
            }
            catch (Exception ex)
            {
                ShowError($"Failed to open DRB:\n{path}\n\n{ex}", silent);
            }
        }