Example #1
0
        private bool ShowFlexibleMessageBox(int option, string msg, string caption, MessageBoxDefaultButton defaultButton, LinkClickedEventHandler handler)
        {
            switch (option)
            {
            case 0:
                FlexibleMessageBox.Show(this, msg, handler);
                break;

            case 1:
                FlexibleMessageBox.Show(this, msg, caption, handler);
                break;

            case 2:
                FlexibleMessageBox.Show(this, msg, caption, MessageBoxButtons.OKCancel, handler);
                break;

            case 3:
                msg += "\nClick Retry to display another version of the message box.";
                return(FlexibleMessageBox.Show(this, msg, caption, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning, handler) == DialogResult.Retry);

            case 4:
                msg += "\nWould you like to display another version of the message box?";
                return(FlexibleMessageBox.Show(this, msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                               defaultButton, handler) == DialogResult.Yes);

            case 5:
                FlexibleMessageBox.Show(msg, handler);
                break;

            case 6:
                FlexibleMessageBox.Show(msg, caption, handler);
                break;

            case 7:
                msg += "\nClick Retry to display another version of the message box.";
                return(FlexibleMessageBox.Show(msg, caption, MessageBoxButtons.RetryCancel, handler) == DialogResult.Retry);

            case 8:
                FlexibleMessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Stop, handler);
                break;

            default:
                msg += "\nWould you like to display another version of the message box?";
                return(FlexibleMessageBox.Show(msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                                               defaultButton, handler) == DialogResult.Yes);
            }
            return(false);
        }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _data.MinSize = float.Parse(MinHeightBox.Text);
                _data.MaxSize = float.Parse(MaxHeightBox.Text);

                _data.MinTail = float.Parse(MinTailBox.Text);
                _data.MaxTail = float.Parse(MaxTailBox.Text);

                if (Gender == XivGender.Female)
                {
                    _data.BustMinX = float.Parse(MinBustX.Text);
                    _data.BustMinY = float.Parse(MinBustY.Text);
                    _data.BustMinZ = float.Parse(MinBustZ.Text);

                    _data.BustMaxX = float.Parse(MaxBustX.Text);
                    _data.BustMaxY = float.Parse(MaxBustY.Text);
                    _data.BustMaxZ = float.Parse(MaxBustZ.Text);
                }
            }
            catch (Exception Ex)
            {
                FlexibleMessageBox.Show("Cannot save changes: One or more values are not valid.", "Invalid Data Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            try
            {
                ResetButton.IsEnabled  = false;
                CancelButton.IsEnabled = false;
                SaveButton.IsEnabled   = false;
                SaveButton.Content     = "Working...";

                await CMP.SaveScalingParameter(_data, XivStrings.TexTools);

                this.Close();
            } catch (Exception ex)
            {
                FlexibleMessageBox.Show("Cannot save changes:\n\nError: " + ex.Message, "Save Scaling Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);

                ResetButton.IsEnabled  = true;
                CancelButton.IsEnabled = true;
                SaveButton.IsEnabled   = true;
                SaveButton.Content     = "Save";
                return;
            }
        }
        /// <summary>
        /// Checks the dat counts in the index file
        /// </summary>
        /// <returns>Flag for problem found</returns>
        private async Task <bool> CheckIndexDatCounts()
        {
            var problemFound = false;

            var filesToCheck = new XivDataFile[]
            { XivDataFile._0A_Exd, XivDataFile._01_Bgcommon, XivDataFile._04_Chara, XivDataFile._06_Ui };

            foreach (var file in filesToCheck)
            {
                AddText($"\t{file.GetDataFileName()} Index Files", textColor);

                try
                {
                    var result = await _problemChecker.CheckIndexDatCounts(file);

                    if (result)
                    {
                        _indexDatRepairList.Add(file);
                        AddText("\t\u2716\t", "Red");
                        problemFound = true;
                    }
                    else
                    {
                        AddText("\t\u2714\t", "Green");
                    }

                    result = await _problemChecker.CheckForLargeDats(file);

                    if (result)
                    {
                        AddText($"\t\u2716\n{UIStrings.ProblemCheck_ExtraDats}\n", "Red");
                        problemFound = true;
                    }
                    else
                    {
                        AddText("\t\u2714\n", "Green");
                    }
                }
                catch (Exception ex)
                {
                    FlexibleMessageBox.Show(
                        $"{UIMessages.ProblemCheckDatIssueMessage}\n{ex.Message}", UIMessages.ProblemCheckErrorTitle,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            return(problemFound);
        }
Example #4
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string       ver       = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion;
            const string lineBreak = "\n======================================================\n";
            var          errorText = "TexTools ran into an error.\n\n" +
                                     "Please submit a bug report with the following information.\n " +
                                     lineBreak +
                                     e.ExceptionObject +
                                     lineBreak + "\n" +
                                     "Copy to clipboard?";

            if (FlexibleMessageBox.Show(errorText, "Crash Report " + ver, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
            {
                Clipboard.SetText(e.ExceptionObject.ToString());
            }
        }
Example #5
0
 private void написатьАвторуToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string[] st = new string[]
     {
         "GitHub:\t https://github.com/PasaOpasen",
         "Gmail:\t [email protected]",
         "Discord:\t Пася Опасен#3065",
         "Instagram: ofdegradation",
         "Telegram:\t @PasaOpasen",
         "Steam:\t https://steamcommunity.com/id/PasaOpasen",
         "VK:\t https://vk.com/roman_disease",
         "PornHub: https://rt.pornhub.com/users/demetrypaskal"
     };
     FlexibleMessageBox.MAX_WIDTH_FACTOR = 2;
     FlexibleMessageBox.Show(Expendator.StringArrayToString(st), "Контакты", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
        private async void Menu_Backup_Click(object sender, RoutedEventArgs e)
        {
            var result = FlexibleMessageBox.Show(UIMessages.CreateBackupsMessage, UIMessages.CreateBackupsTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                var gameDirectory   = new DirectoryInfo(Settings.Default.FFXIV_Directory);
                var backupDirectory = new DirectoryInfo(Properties.Settings.Default.Backup_Directory);
                var indexFiles      = new XivDataFile[] { XivDataFile._04_Chara, XivDataFile._06_Ui, XivDataFile._01_Bgcommon };
                var index           = new Index(gameDirectory);
                var modding         = new Modding(gameDirectory);

                if (index.IsIndexLocked(XivDataFile._0A_Exd))
                {
                    FlexibleMessageBox.Show(UIMessages.IndexLockedBackupFailedMessage, UIMessages.BackupFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                try
                {
                    // Toggle off all mods
                    await modding.ToggleAllMods(false);
                }
                catch (Exception ex)
                {
                    FlexibleMessageBox.Show(string.Format(UIMessages.BackupFailedErrorMessage, ex.Message), UIMessages.BackupFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                foreach (var xivDataFile in indexFiles)
                {
                    try
                    {
                        File.Copy($"{gameDirectory.FullName}\\{xivDataFile.GetDataFileName()}.win32.index",
                                  $"{backupDirectory}\\{xivDataFile.GetDataFileName()}.win32.index", true);
                        File.Copy($"{gameDirectory.FullName}\\{xivDataFile.GetDataFileName()}.win32.index2",
                                  $"{backupDirectory}\\{xivDataFile.GetDataFileName()}.win32.index2", true);
                    }
                    catch (Exception ex)
                    {
                        FlexibleMessageBox.Show(string.Format(UIMessages.BackupFailedErrorMessage, ex.Message), UIMessages.BackupFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                await this.ShowMessageAsync(UIMessages.BackupCompleteTitle, UIMessages.BackupCompleteMessage);
            }
        }
        /// <summary>
        /// The event handler for the advanced options button clicked
        /// </summary>
        private void AdvOptionsButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = ModelTypeComboBox.SelectedItem as ModComboBox;

            var mod = selectedItem.SelectedMod;

            var includedMod = new IncludedMods
            {
                Name     = $"{Path.GetFileNameWithoutExtension(mod.fullPath)} ({((Category)ModListTreeView.SelectedItem).Name})",
                FullPath = mod.fullPath
            };

            var itemModel = MakeItemModel(mod);

            var includedModsList = IncludedModsList.Items.Cast <IncludedMods>().ToList();
            var mdl = new Mdl(_gameDirectory, XivDataFiles.GetXivDataFile(mod.datFile));

            var xivMdl = mdl.GetMdlData(itemModel, GetRace(mod.fullPath), null, null, mod.data.originalOffset);

            var advancedImportView = new AdvancedModelImportView(xivMdl, itemModel, GetRace(mod.fullPath), true);
            var result             = advancedImportView.ShowDialog();

            if (result == true)
            {
                if (includedModsList.Any(item => item.Name.Equals(includedMod.Name)))
                {
                    if (FlexibleMessageBox.Show(
                            $"This Option already includes {includedMod.Name}  \n\n Would you like to overwrite the existing mod for this option?",
                            "Overwrite?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                        System.Windows.Forms.DialogResult.Yes)
                    {
                        _selectedModOption.Mods[mod.fullPath].ModDataBytes = advancedImportView.RawModelData;
                    }
                }
                else
                {
                    IncludedModsList.Items.Add(includedMod);
                    _selectedModOption.Mods.Add(mod.fullPath, new ModData
                    {
                        Name         = mod.name,
                        Category     = mod.category,
                        FullPath     = mod.fullPath,
                        ModDataBytes = advancedImportView.RawModelData
                    });
                }
            }
        }
Example #8
0
        /// <summary>
        /// Called when the start election button is clicked
        /// </summary>
        /// <param name="sender">
        /// autogenerated
        /// </param>
        /// <param name="e">
        /// autogenerated
        /// </param>
        private void StartEndElectionButtonClick(object sender, RoutedEventArgs e)
        {
            if (!_ui.EnoughStations())
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "You are not connected to enough stations to start the election.",
                                        "Not Enough Stations",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                return;
            }

            Boolean result = false;
            Boolean cancel = false;

            _ui._stationWindow.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(
                    delegate {
                var d   = new CheckMasterPasswordDialog(_ui, "The master password is required to start the election.");
                d.Owner = _ui._stationWindow;
                result  = (Boolean)d.ShowDialog();
                cancel  = d.IsCancel;
            }));

            if (result)
            {
                if (cancel)
                {
                    return;
                }

                if (_activeUpdateThread != null)
                {
                    _activeUpdateThread.Abort();
                }

                _ui.OverviewPage = null;
                _ui.ManagerAnnounceStartElection();
                _parent.Navigate(new ManagerOverviewPage(_parent, _ui));
            }
            else
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "Incorrect master password, please try again.", "Incorrect Master Password", MessageBoxButtons.OK);
            }
        }
Example #9
0
        /// <summary>
        /// The event handler for the custom model button clicked
        /// </summary>
        private void AddCustomModelButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = ModelTypeComboBox.SelectedItem as ModComboBox;

            var mod = selectedItem.SelectedMod;

            var includedMod = new IncludedMods
            {
                Name     = $"{Path.GetFileNameWithoutExtension(mod.fullPath)} ({((Category)ModListTreeView.SelectedItem).Name})",
                FullPath = mod.fullPath
            };

            var itemModel = MakeItemModel(mod);

            var includedModsList = IncludedModsList.Items.Cast <IncludedMods>().ToList();
            var mdl           = new Mdl(_gameDirectory, XivDataFiles.GetXivDataFile(mod.datFile));
            var xivMdl        = mdl.GetMdlData(itemModel, GetRace(mod.fullPath));
            var importResults = mdl.ImportModel(itemModel, xivMdl, new DirectoryInfo(CustomModelTextBox.Text), null, XivStrings.TexTools,
                                                true);

            //TODO: Add dialogs for import results (warning messages)

            var mdlData = mdl.MDLRawData;

            if (includedModsList.Any(item => item.Name.Equals(includedMod.Name)))
            {
                if (FlexibleMessageBox.Show(
                        $"This Option already includes {includedMod.Name}  \n\n Would you like to overwrite the existing mod for this option?",
                        "Overwrite?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                    System.Windows.Forms.DialogResult.Yes)
                {
                    _selectedModOption.Mods[mod.fullPath].ModDataBytes = mdlData;
                }
            }
            else
            {
                IncludedModsList.Items.Add(includedMod);
                _selectedModOption.Mods.Add(mod.fullPath, new ModData
                {
                    Name         = mod.name,
                    Category     = mod.category,
                    FullPath     = mod.fullPath,
                    ModDataBytes = mdlData
                });
            }
        }
Example #10
0
        private static void Main()
        {
#if DEBUG
            //Debug.GBAGameCodeScan(@"C:\Users\Kermalis\Documents\Emulation\GBA\Games");
#endif
            try
            {
                GlobalConfig.Init();
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show(ex.Message, Strings.ErrorGlobalConfig);
                return;
            }
            Application.EnableVisualStyles();
            Application.Run(MainForm.Instance);
        }
Example #11
0
        private void indexbackupDirButton_Click(object sender, RoutedEventArgs e)
        {
            var oldIndexBackupLocation      = indexBackupsDir.Text;
            FolderSelectDialog folderSelect = new FolderSelectDialog()
            {
                Title = "Select new location of Index Backup folder"
            };

            folderSelect.InitialDirectory = oldIndexBackupLocation;
            var result = folderSelect.ShowDialog();

            if (result)
            {
                Properties.Settings.Default.IndexBackups_Directory = folderSelect.FileName + "\\Index_Backups";
                Properties.Settings.Default.Save();

                if (FlexibleMessageBox.Show("Would you like to move the existing data to the new location?", "Move Data?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    try
                    {
                        Directory.Move(oldIndexBackupLocation, folderSelect.FileName);
                    }
                    catch
                    {
                        var newLoc = folderSelect.FileName + "\\Index_Backups";
                        Directory.CreateDirectory(newLoc);

                        foreach (string dirPath in Directory.GetDirectories(oldIndexBackupLocation, "*", SearchOption.AllDirectories))
                        {
                            Directory.CreateDirectory(dirPath.Replace(oldIndexBackupLocation, newLoc));
                        }

                        foreach (string newPath in Directory.GetFiles(oldIndexBackupLocation, "*.*", SearchOption.AllDirectories))
                        {
                            File.Copy(newPath, newPath.Replace(oldIndexBackupLocation, newLoc), true);
                        }

                        DeleteDirectory(oldIndexBackupLocation);
                    }
                }

                FlexibleMessageBox.Show("Location of Index Backup folder changed.\n\n" +
                                        "New Location: " + folderSelect.FileName + "\\Index_Backups", "New Directory", MessageBoxButtons.OK, MessageBoxIcon.Information);
                indexBackupsDir.Text = folderSelect.FileName + "\\Index_Backups";
            }
        }
        private async void OnlyImport()
        {
            var gameDirectory = new DirectoryInfo(Settings.Default.FFXIV_Directory);
            var index         = new Index(gameDirectory);

            if (index.IsIndexLocked(XivDataFile._0A_Exd))
            {
                FlexibleMessageBox.Show(UIMessages.IndexLockedErrorMessage, UIMessages.IndexLockedErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                var modPackDirectory = new DirectoryInfo(Settings.Default.ModPack_Directory);

                await ImportModpack(new DirectoryInfo(_startupArgs), modPackDirectory, false, true);
            }

            Application.Current.Shutdown();
        }
Example #13
0
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new frmMainWindow());
     }
     catch (Exception ex)
     {
         FlexibleMessageBox.Show(
             text: ex.FormatForMessageBox("There was an unhandled error and the program crashed. There program will exit. Here's some info about the error:"),
             caption: "Program crashed!",
             buttons: MessageBoxButtons.OK,
             icon: MessageBoxIcon.Error
             );
     }
 }
Example #14
0
        private void BtnAlterArtikel_Click(object sender, EventArgs e)
        {
            CheckFilled();

            // Save to the database
            if (AlterItemInDB())
            {
                FlexibleMessageBox.Show("Het artikel is aangepast", "Succes");
                Dispose();
            }
            else
            {
                string message = "Er is iets fout gegaan, probeer het opnieuw.\r" +
                                 "Neem contact op met de helpdesk indien dit probleem zich blijft voordoen";
                string header = "An Error Occured";
                FlexibleMessageBox.Show(message, header, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #15
0
        public ListViewModel(string selectedItem)
        {
            try
            {
                foreach (string line in File.ReadAllLines(Properties.Settings.Default.Modlist_Directory))
                {
                    JsonEntry entry = JsonConvert.DeserializeObject <JsonEntry>(line);

                    if (entry.name.Equals(selectedItem))
                    {
                        mlmList.Add(ParseEntry(entry));
                    }
                }
            }
            catch (Exception e)
            {
                FlexibleMessageBox.Show("[VM] Error Accessing .modlist File \n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 /// <summary>
 /// Applies the deformer to a model
 /// </summary>
 /// <param name="model">The model being deformed</param>
 /// <param name="itemType">The item type of the model</param>
 /// <param name="currentRace">The current model race</param>
 /// <param name="targetRace">The target race to convert the model to</param>
 private void ApplyDeformers(TTModel model, string itemType, XivRace currentRace, XivRace targetRace)
 {
     try
     {
         // Current race is already parent node
         // Direct conversion
         // [ Current > (apply deform) > Target ]
         if (currentRace.IsDirectParentOf(targetRace))
         {
             ModelModifiers.ApplyRacialDeform(model, targetRace);
         }
         // Target race is parent node of Current race
         // Convert to parent (invert deform)
         // [ Current > (apply inverse deform) > Target ]
         else if (targetRace.IsDirectParentOf(currentRace))
         {
             ModelModifiers.ApplyRacialDeform(model, currentRace, true);
         }
         // Current race is not parent of Target Race and Current race has parent
         // Make a recursive call with the current races parent race
         // [ Current > (apply inverse deform) > Current.Parent > Recursive Call ]
         else if (currentRace.GetNode().Parent != null)
         {
             ModelModifiers.ApplyRacialDeform(model, currentRace, true);
             ApplyDeformers(model, itemType, currentRace.GetNode().Parent.Race, targetRace);
         }
         // Current race has no parent
         // Make a recursive call with the target races parent race
         // [ Target > (apply deform on Target.Parent) > Target.Parent > Recursive Call ]
         else
         {
             ModelModifiers.ApplyRacialDeform(model, targetRace.GetNode().Parent.Race);
             ApplyDeformers(model, itemType, targetRace.GetNode().Parent.Race, targetRace);
         }
     }
     catch (Exception ex)
     {
         // Show a warning that deforms are missing for the target race
         // This mostly happens with Face, Hair, Tails, Ears, and Female > Male deforms
         // The model is still added but no deforms are applied
         FlexibleMessageBox.Show(string.Format(UIMessages.MissingDeforms, targetRace.GetDisplayName(), itemType, ex.Message), UIMessages.MissingDeformsTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #17
0
        /// <summary>
        /// Event handler for mod delete button
        /// </summary>
        private async void modDeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var gameDirectory = new DirectoryInfo(Properties.Settings.Default.FFXIV_Directory);
            var modding       = new Modding(gameDirectory);

            await LockUi("Deleting Mod", "Please wait...", this);

            try
            {
                if ((ModListTreeView.SelectedItem as Category).ParentCategory.Name.Equals("ModPacks"))
                {
                    if (FlexibleMessageBox.Show(
                            UIMessages.DeleteModPackMessage,
                            UIMessages.DeleteModPackTitle,
                            MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                    {
                        await modding.DeleteModPack((ModListTreeView.SelectedItem as Category).Name);

                        (DataContext as ModListViewModel).RemoveModPack();
                    }
                }
                else
                {
                    var enumerable    = ModItemList.SelectedItems as IEnumerable;
                    var selectedItems = enumerable.OfType <ModListViewModel.ModListModel>().ToArray();

                    foreach (var selectedModItem in selectedItems)
                    {
                        await modding.DeleteMod(selectedModItem.ModItem.fullPath);

                        (DataContext as ModListViewModel).RemoveItem(selectedModItem, (Category)ModListTreeView.SelectedItem);
                    }
                }
            }
            catch (Exception Ex)
            {
                FlexibleMessageBox.Show("Unable to delete Mod or Modpack.\n\nError: " + Ex.Message, "Mod Delete Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally {
                await UnlockUi(this);
            }
        }
Example #18
0
        void checkForUpdate()
        {
            try
            {
                string currentVersion = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/version").Result;
                currentVersion = currentVersion.Remove(currentVersion.Length - 1);

                if (localVersion != currentVersion)
                {
                    string       changelog    = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/changelog.txt").Result;
                    DialogResult dialogResult = FlexibleMessageBox.Show("There is a new update you have version " + localVersion + ", do you want to update?\nCHANGELOG\n" + changelog, "Version " + currentVersion + " is available", MessageBoxButtons.YesNo);
                    if (dialogResult != DialogResult.Yes)
                    {
                        return;
                    }

                    //download updated version
                    using (var fileClient = new WebClient())
                    {
                        ServicePointManager.Expect100Continue = true;
                        ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
                        fileClient.DownloadFile("https://github.com/nerdunit/androidsideloader/releases/download/v" + currentVersion + "/AndroidSideloader.exe", "AndroidSideloader v" + currentVersion + ".exe");
                    }

                    //melt
                    Process.Start(new ProcessStartInfo()
                    {
                        Arguments      = "/C choice /C Y /N /D Y /T 5 & Del \"" + Application.ExecutablePath + "\"",
                        WindowStyle    = ProcessWindowStyle.Hidden,
                        CreateNoWindow = true,
                        FileName       = "cmd.exe"
                    });

                    Process.Start(Environment.CurrentDirectory + "\\AndroidSideloader v" + currentVersion + ".exe");

                    Environment.Exit(0);
                }
            }
            catch
            {
            }
        }
        /// <summary>
        /// The event handler for the current model button clicked
        /// </summary>
        private void AddCurrentModelButton_Click(object sender, RoutedEventArgs e)
        {
            var dat = new Dat(_gameDirectory);

            var selectedItem = ModelTypeComboBox.SelectedItem as ModComboBox;

            var mod = selectedItem.SelectedMod;

            var includedMod = new IncludedMods
            {
                Name     = $"{Path.GetFileNameWithoutExtension(mod.fullPath)} ({((Category)ModListTreeView.SelectedItem).Name})",
                FullPath = mod.fullPath
            };

            var includedModsList = IncludedModsList.Items.Cast <IncludedMods>().ToList();

            if (includedModsList.Any(item => item.Name.Equals(includedMod.Name)))
            {
                if (FlexibleMessageBox.Show(
                        $"This Option already includes {includedMod.Name}  \n\n Would you like to overwrite the existing mod for this option?",
                        "Overwrite?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                    System.Windows.Forms.DialogResult.Yes)
                {
                    _selectedModOption.Mods[mod.fullPath].ModDataBytes = dat.GetRawData(mod.data.modOffset,
                                                                                        XivDataFiles.GetXivDataFile(mod.datFile), mod.data.modSize);
                }
            }
            else
            {
                IncludedModsList.Items.Add(includedMod);

                var modData = new ModData
                {
                    Name         = mod.name,
                    Category     = mod.category,
                    FullPath     = mod.fullPath,
                    ModDataBytes = dat.GetRawData(mod.data.modOffset, XivDataFiles.GetXivDataFile(mod.datFile), mod.data.modSize)
                };

                _selectedModOption.Mods.Add(mod.fullPath, modData);
            }
        }
Example #20
0
        private void generateFileButton_Click(object sender, EventArgs e)
        {
            try
            {
                updatedFile = PositionsFileGenerator.UpdatePositionsFile(positionsFile, updatesFile);
                resultsDataGrid.DataSource = updatedFile.positions;

                saveAsButton.Enabled   = true;
                dataTabs.SelectedIndex = 2;

                if (updatedFile.loadExceptions.Count > 0)
                {
                    FlexibleMessageBox.Show(updatedFile.loadExceptions.Aggregate("", (current, next) => current + "\n" + next), "There were errors generating the results.");
                }
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show(ex.Message, "Error");
            }
        }
        private void Review_ReviewAccepted(object sender, StandardModpackItemEntry e)
        {
            if (e == null)
            {
                if (_inProgressLevel == XivDependencyLevel.Root)
                {
                    // Back button pressed on an 'everything' item, return to the level confirm screen.
                    LevelSelect_LevelSelected(this, _inProgressLevel);
                    return;
                }
                else
                {
                    // Back button pressed, return to the file select screen.
                    LevelReview_ConfirmedSharedItems(this, true);
                    return;
                }
            }
            var root = e.Item.GetRootInfo();

            StandardModpackItemEntry toRemove = null;

            foreach (var entry in ViewModel.Entries)
            {
                var entryRoot = entry.Item.GetRootInfo();
                if (root == entryRoot)
                {
                    var result = FlexibleMessageBox.Show("Adding this item will overwrite your existing entry for item: " + entry.Item.Name + "\nAre you sure you wish to proceed?", "Item Overwrite Confirmation", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button1);
                    if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return;
                    }
                    toRemove = entry;
                    break;
                }
            }

            ViewModel.Entries.Remove(toRemove);
            ViewModel.Entries.Add(e);

            ShowItemSelect();
        }
Example #22
0
        private async void ToggleButton_Click(object sender, RoutedEventArgs e)
        {
            var _modding = new Modding(XivCache.GameInfo.GameDirectory);
            var path     = _root.Info.GetRootFile();
            var mod      = await _modding.TryGetModEntry(path);

            if (mod == null)
            {
                return;
            }
            var enabled = mod.enabled;

            await MainWindow.GetMainWindow().LockUi("Updating Metadata");

            try
            {
                if (enabled)
                {
                    await _modding.ToggleModStatus(path, false);

                    ToggleButton.Content = "Enable";
                }
                else
                {
                    await _modding.ToggleModStatus(path, true);

                    ToggleButton.Content = "Disable";
                }
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show("Unable to toggle mod status.\n\nError: " + ex.Message, "Mod Toggle Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                await MainWindow.GetMainWindow().UnlockUi();

                var mw = MainWindow.GetMainWindow();
                mw.ReloadItem();
            }
        }
Example #23
0
        /// <summary>
        /// Returns a list of items, as returned from the database
        /// </summary>
        /// <param name="items"> The list in which the items should return </param>
        /// <param name="ConnString"> The connection string to the DataBase </param>
        /// <returns> Returns a list of MagazijnItems </returns>
        public static List <MagazijnItems> GetMagazijnItems(List <MagazijnItems> items, string ConnString)
        {
            items.Clear();
            try
            {
                using (var conn = new NpgsqlConnection(ConnString))
                {
                    conn.Open();
                    using (var cmd = new NpgsqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandText = string.Format("SELECT voorraad.id, afdelingnaam, nummer, omschrijving, voorraad, prijs " +
                                                        "FROM voorraad INNER JOIN afdelingen ON (voorraad.afdeling = afdelingen.id) ORDER BY afdelingnaam, omschrijving;");

                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var res = new MagazijnItems()
                                {
                                    Id           = reader.GetInt32(0),
                                    Afdeling     = reader.GetString(1),
                                    Nummer       = reader.GetString(2),
                                    Omschrijving = reader.GetString(3),
                                    Voorraad     = reader.GetInt32(4),
                                    Prijs        = reader.GetDouble(5)
                                };
                                items.Add(res);
                            }
                        }
                        items = items.OrderBy(item => item.Afdeling).ToList();
                        return(items);
                    }
                }
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show(ex.Message);
                return(items);
            }
        }
Example #24
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            if (BandwithTextbox.Text.Length > 0 && BandwithTextbox.Text != "0")
            {
                if (BandwithComboBox.SelectedIndex == -1)
                {
                    FlexibleMessageBox.Show("You need to select something from the combobox");
                    return;
                }
                else
                {
                    Properties.Settings.Default.BandwithLimit = $"{BandwithTextbox.Text.Replace(" ", "")}{BandwithComboBox.Text}";
                }
            }
            else
            {
                Properties.Settings.Default.BandwithLimit = "";
            }

            Properties.Settings.Default.Save();
        }
        private async void Menu_ScanForSets_Click(object sender, RoutedEventArgs e)
        {
            var r = FlexibleMessageBox.Show("This will scan the entire FFXIV file system for new item sets.\n\nThis operation can take up to an hour.\nAre you sure you wish to proceed?.", "Set Scan Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                await LockUi("Scanning for new Item Sets", "This can take up to roughly an hour, depending on computer specs.");

                // Stop the worker, in case it was reading from the file for some reason.
                XivCache.CacheWorkerEnabled = false;

                try
                {
                    await Task.Run(XivCache.RebuildAllRoots);
                } catch (Exception ex)
                {
                    FlexibleMessageBox.Show("Item Scan Error", "An error occured while trying to scan for new item sets.\n\n" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                await UnlockUi();
            }
        }
Example #26
0
        /// <summary>
        /// Adds the model to the viewport
        /// </summary>
        /// <param name="ttModel">The model to add</param>
        /// <param name="materialDictionary">The dictionary of texture data for the model</param>
        /// <param name="item">The item associated with the model</param>
        /// <param name="race">The race of the model</param>
        public async Task AddModel(TTModel ttModel, Dictionary <int, ModelTextureData> materialDictionary, IItemModel item, XivRace race)
        {
            // Because the full model is skinned, it requires the bones to exist so we check them here
            var sklb = new Sklb(_gameDirectory);
            var skel = await sklb.CreateParsedSkelFile(ttModel.Source);

            // If we have weights, but can't find a skel, bad times.
            if (skel == null)
            {
                throw new InvalidDataException("Unable to resolve model skeleton.");
            }

            try
            {
                _fmvm.AddModelToView(ttModel, materialDictionary, item, race);
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show(ex.Message, UIMessages.ModelAddErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private async void Menu_Backup_Click(object sender, RoutedEventArgs e)
        {
            var result = FlexibleMessageBox.Show(UIMessages.CreateBackupsMessage, UIMessages.CreateBackupsTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                var gameDirectory    = new DirectoryInfo(Settings.Default.FFXIV_Directory);
                var problemChecker   = new ProblemChecker(gameDirectory);
                var backupsDirectory = new DirectoryInfo(Properties.Settings.Default.Backup_Directory);
                try
                {
                    await problemChecker.BackupIndexFiles(backupsDirectory);
                }
                catch (Exception ex)
                {
                    FlexibleMessageBox.Show(string.Format(UIMessages.BackupFailedErrorMessage, ex.Message), UIMessages.BackupFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                await this.ShowMessageAsync(UIMessages.BackupCompleteTitle, UIMessages.BackupCompleteMessage);
            }
        }
Example #28
0
        private void RunGame()
        {
            _updateWorker.CancelAsync();
            Settings.Instance.LastLaunchedWotC = false;

            // Check for WOTC only mods
            if (Settings.Mods.Active.Count(e => e.BuiltForWOTC) > 0)
            {
                if (FlexibleMessageBox.Show(this,
                                            "Are you sure you want to proceed? Please be warned that this is very likely to crash your game. Offending mods:\r\n" +
                                            String.Join("\r\n", Settings.Mods.Active.Where(e => e.BuiltForWOTC).Select(e => e.Name)),
                                            "You are trying to launch vanilla game with mods built for WOTC", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    RunVanilla();
                }
            }
            else
            {
                RunVanilla();
            }
        }
Example #29
0
        /// <summary>
        /// The station removed.
        /// </summary>
        public void StationRemoved()
        {
            FlexibleMessageBox.Show(_stationNativeWindow,
                                    "This station has been shut down by the manager",
                                    "Station Shut Down",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
            if (WaitingForManagerPage != null)
            {
                WaitingForManagerPage.Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(delegate { WaitingForManagerPage.StationRemoved(); }));
            }

            if (BallotRequestPage != null)
            {
                BallotRequestPage.Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(delegate { BallotRequestPage.StationRemoved(); }));
            }
        }
Example #30
0
        /// <summary>
        /// Called when the make manager button is clicked
        /// </summary>
        /// <param name="sender">
        /// autogenerated
        /// </param>
        /// <param name="e">
        /// autogenerated
        /// </param>
        private void MakeManagerButtonClick(object sender, RoutedEventArgs e)
        {
            Boolean result = false;
            Boolean cancel = false;

            _ui._stationWindow.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(
                    delegate {
                var d   = new CheckMasterPasswordDialog(_ui, "The master password is required to promote a check-in station to a manager.");
                d.Owner = _ui._stationWindow;
                result  = (Boolean)d.ShowDialog();
                cancel  = d.IsCancel;
            }));

            if (cancel)
            {
                return;
            }

            if (result)
            {
                if (ManagerstationGrid.SelectedItem != null &&
                    _ui.MakeManager(((StationStatus)ManagerstationGrid.SelectedItem).Address))
                {
                }
                else
                {
                    FlexibleMessageBox.Show(_ui._stationNativeWindow, "Could not connect to the specified station", "No Connection", MessageBoxButtons.OK);
                }
            }
            else
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "You have entered an incorrect master password, please try again.",
                                        "Incorrect Master Password",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Stop);
            }
        }