Ejemplo n.º 1
0
        private void openFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Multiselect = true;
            fileDialog.Filter      = "Pak file (*.pak)|*.pak|Spak file (*.spak)|*.spak|All files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string fileName in fileDialog.FileNames)
                {
                    Pak pk = new Pak();
                    if (pk.LoadPak(fileName))
                    {
                        AddPak(pk);
                    }
                }

                if (Paks.Count > 0)
                {
                    ChangePak(Paks.Count - 1);
                    UpdateControls();
                }

                SetGeneralStatus((Paks.Count > 0 ? Paks.Count.ToString() : "No") + " pak file" + (Paks.Count == 1 ? " was" : "s were") + " loaded");
            }
        }
Ejemplo n.º 2
0
        private void AddPak(Pak toAdd, string filename = null)
        {
            if (filename != null)
            {
                toAdd.fileName = filename;
            }

            fileList.Items.Add(Path.GetFileName(toAdd.fileName));
            Paks.Add(toAdd);
        }