Example #1
0
        public void SaveAsFile()
        {
            if (Loading.FilePath != null)
            {
                SaveSTBLXMLDialog.InitialDirectory = Path.GetDirectoryName(Loading.FilePath);
                SaveSTBLXMLDialog.FileName         = Path.GetFileName(Loading.FilePath);
            }

            if (SaveSTBLXMLDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string saveFilePath = SaveSTBLXMLDialog.FileName;

            SaveSTBLXMLDialog.InitialDirectory = "";
            SaveSTBLXMLDialog.FileName         = "";

            try {
                Loading.SaveFile(saveFilePath);
            } catch (Exception saveException) {
                ShowSaveFailureDialog(saveException);
            }

            EntryBrowser.RefreshItems();
        }
Example #2
0
        private void MenuStripFileMergeItem_Click(object sender, EventArgs e)
        {
            MergeWith mergeForm = new MergeWith();

            mergeForm.ShowDialog();

            EntryBrowser.SetupRows();
        }
Example #3
0
        public void ImportFromPackageFile()
        {
            Import importDialog = new Import();

            importDialog.ShowDialog();

            EntryBrowser.SetupRows();
        }
Example #4
0
 private void FilterActiveCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     if (FilterActiveCheckBox.Checked)
     {
         if (CurrentBrowserFilter != null)
         {
             EntryBrowser.FilterItems(CurrentBrowserFilter.GetFilterPredicate());
         }
     }
     else
     {
         EntryBrowser.UnfilterAll();
     }
 }
Example #5
0
        private void FilterAdvancedButton_Click(object sender, EventArgs e)
        {
            SelectorFilterOptions filterOptionsForm = new SelectorFilterOptions();

            filterOptionsForm.ShowDialog();

            if (filterOptionsForm.GeneratedFilter != null)
            {
                CurrentBrowserFilter = filterOptionsForm.GeneratedFilter;

                if (FilterActiveCheckBox.Checked)
                {
                    EntryBrowser.FilterItems(CurrentBrowserFilter.GetFilterPredicate());
                }
            }
        }
Example #6
0
        private void AddEntryButton_Click(object sender, EventArgs e)
        {
            SelectorNew selectorNewForm = new SelectorNew();

            selectorNewForm.ShowDialog();

            STBLXMLEntry createdEntry = selectorNewForm.CreatedEntry;

            if (createdEntry == null)
            {
                return;
            }

            EntryBrowser.SetupRows();
            EntryBrowser.ScrollToItem(createdEntry, selectItem: true);
        }
Example #7
0
        private void MenuStripEditSelectedResetKeysItem_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow selectedEntryRow in EntryBrowser.GetAllSelectedItems())
            {
                STBLXMLEntry entry = EntryBrowser.FindEntry(selectedEntryRow);

                if (entry != null)
                {
                    continue;
                }

                entry.Key = STBL.GetRandomUIntKey(blockedKeys: Loading.GetAllEntryKeys());
            }

            EntryBrowser.RefreshItems();
        }
Example #8
0
        public Selector()
        {
            InitializeComponent();

            EntryBrowser.SetupRows();

            UpdateStatusBarItemsLabel();
            UpdateStatusBarSelectedLabel();

            Loading.FileChanged += Loading_Changed;
            Loading.BecameClean += Loading_Changed;
            Loading.BecameDirty += Loading_Changed;

            EntryBrowser.ItemCountUpdate     += EntryBrowser_ItemCountUpdate;
            EntryBrowser.SelectedCountUpdate += EntryBrowser_SelectedCountUpdate;
        }
Example #9
0
        public bool OpenFile()
        {
            if (Loading.IsDirty)
            {
                DialogResult unsavedDialogResult = ShowUnsavedDialog();

                if (unsavedDialogResult == DialogResult.Yes)
                {
                    SaveFile();
                }
                else if (unsavedDialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            if (Loading.FilePath != null)
            {
                OpenSTBLXMLDialog.InitialDirectory = Path.GetDirectoryName(Loading.FilePath);
            }

            if (OpenSTBLXMLDialog.ShowDialog() == DialogResult.Cancel)
            {
                return(false);
            }

            string openFilePath = OpenSTBLXMLDialog.FileName;

            OpenSTBLXMLDialog.InitialDirectory = "";
            OpenSTBLXMLDialog.FileName         = "";

            try {
                Loading.OpenFile(openFilePath);
            } catch (Exception openException) {
                ShowOpenFailureDialog(openException);
            }

            EntryBrowser.SetupRows();

            return(true);
        }
Example #10
0
        public bool NewFile()
        {
            if (Loading.IsDirty)
            {
                DialogResult unsavedDialogResult = ShowUnsavedDialog();

                if (unsavedDialogResult == DialogResult.Yes)
                {
                    SaveFile();
                }
                else if (unsavedDialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            Loading.NewFile();
            EntryBrowser.SetupRows();

            return(true);
        }
Example #11
0
 public void UpdateStatusBarSelectedLabel()
 {
     FormStatusStripSelectedCount.Text = string.Format(Localization.GetString(statusBarSelectedTextIdentifier), EntryBrowser.GetSelectedItemCount());
 }
Example #12
0
 public void UpdateStatusBarItemsLabel()
 {
     FormStatusStripItemsCount.Text = string.Format(Localization.GetString(statusBarItemsTextIdentifier), EntryBrowser.GetItemCount());
 }
Example #13
0
 private void MenuStripEditSelectedRemoveAllItem_Click(object sender, EventArgs e)
 {
     EntryBrowser.RemoveSelectedItems();
 }
Example #14
0
 private void MenuStripEditDeselectAllItem_Click(object sender, EventArgs e)
 {
     EntryBrowser.DeselectAllItems();
 }