diff --git a/ARKBreedingStats/ARKBreedingStats.csproj b/ARKBreedingStats/ARKBreedingStats.csproj index 01bac2b8..06737b52 100644 --- a/ARKBreedingStats/ARKBreedingStats.csproj +++ b/ARKBreedingStats/ARKBreedingStats.csproj @@ -888,6 +888,7 @@ Form1.cs + Designer MultiplierSetting.cs @@ -999,8 +1000,8 @@ if $(ConfigurationName) == Release ( powershell -nologo -noprofile -command "$version = (Get-Item '$(TargetPath)').VersionInfo.FileVersion; Compress-Archive -Force -Path '$(TargetDir)*' -DestinationPath """$(SolutionDir)_publish\ARK.Smart.Breeding_$version.zip""" " - if exist "%25ProgramFiles(x86)%25\Inno Setup 5\ISCC.exe" ( - "%25ProgramFiles(x86)%25\Inno Setup 5\ISCC.exe" "$(SolutionDir)setup.iss" + if exist "%25ProgramFiles(x86)%25\Inno Setup 6\ISCC.exe" ( + "%25ProgramFiles(x86)%25\Inno Setup 6\ISCC.exe" "$(SolutionDir)setup.iss" ) else ( echo Inno Setup command line compiler not found ) diff --git a/ARKBreedingStats/App.config b/ARKBreedingStats/App.config index 86a8e434..87f9b4a7 100644 --- a/ARKBreedingStats/App.config +++ b/ARKBreedingStats/App.config @@ -475,6 +475,9 @@ False + + True + diff --git a/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs b/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs index ca9bffa5..08a9ea5c 100644 --- a/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs +++ b/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs @@ -999,7 +999,7 @@ private void radioButtonBPHighStats_CheckedChanged(object sender, EventArgs e) } } - public void SetSpeciesList(List species, List creatures) + public void SetSpeciesList(IList species, List creatures) { Species previouslySelectedSpecies = listViewSpeciesBP.SelectedItems.Count > 0 ? listViewSpeciesBP.SelectedItems[0].Tag as Species : null; diff --git a/ARKBreedingStats/CreatureInfoInput.cs b/ARKBreedingStats/CreatureInfoInput.cs index 7efd639b..6fc80b82 100644 --- a/ARKBreedingStats/CreatureInfoInput.cs +++ b/ARKBreedingStats/CreatureInfoInput.cs @@ -63,6 +63,8 @@ public partial class CreatureInfoInput : UserControl /// public ParentInheritance ParentInheritance; + internal CreatureCollection.ColorExisting[] ColorAlreadyExistingInformation; + private Button[] ButtonsNamingPattern => new[] { btnGenerateUniqueName, btNamingPattern2, btNamingPattern3, btNamingPattern4, btNamingPattern5, btNamingPattern6 }; public CreatureInfoInput() @@ -579,7 +581,7 @@ private void btNamingPatternEditor_Click(object sender, EventArgs e) public void GenerateCreatureName(Creature creature, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary customReplacings, bool showDuplicateNameWarning, int namingPatternIndex) { SetCreatureData(creature); - CreatureName = NamePattern.GenerateCreatureName(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, showDuplicateNameWarning, namingPatternIndex, false); + CreatureName = NamePattern.GenerateCreatureName(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, showDuplicateNameWarning, namingPatternIndex, false, colorsExisting: ColorAlreadyExistingInformation); if (CreatureName.Length > 24) SetMessageLabelText?.Invoke("The generated name is longer than 24 characters, the name will look like this in game:\n" + CreatureName.Substring(0, 24), MessageBoxIcon.Error); } @@ -588,7 +590,7 @@ public void OpenNamePatternEditor(Creature creature, int[] speciesTopLevels, int { if (!parentListValid) ParentListRequested?.Invoke(this); - using (var pe = new PatternEditor(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings, namingPatternIndex, reloadCallback)) + using (var pe = new PatternEditor(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, ColorAlreadyExistingInformation, customReplacings, namingPatternIndex, reloadCallback)) { if (pe.ShowDialog() == DialogResult.OK) { diff --git a/ARKBreedingStats/Form1.Designer.cs b/ARKBreedingStats/Form1.Designer.cs index c79399b2..5291fb76 100644 --- a/ARKBreedingStats/Form1.Designer.cs +++ b/ARKBreedingStats/Form1.Designer.cs @@ -127,10 +127,12 @@ private void InitializeComponent() this.toolStripSeparator23 = new System.Windows.Forms.ToolStripSeparator(); this.openJsonDataFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.speciesSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.editSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.helpAboutSpeciesSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetSortingToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator(); + this.editSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.applyChangedSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpAboutSpeciesSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.onlinehelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -1232,28 +1234,16 @@ private void InitializeComponent() // speciesSortingToolStripMenuItem // this.speciesSortingToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.editSortingToolStripMenuItem, - this.helpAboutSpeciesSortingToolStripMenuItem, this.resetSortingToolStripMenuItem, - this.resetSortingToolStripMenuItem1}); + this.resetSortingToolStripMenuItem1, + this.toolStripSeparator26, + this.editSortingToolStripMenuItem, + this.applyChangedSortingToolStripMenuItem, + this.helpAboutSpeciesSortingToolStripMenuItem}); this.speciesSortingToolStripMenuItem.Name = "speciesSortingToolStripMenuItem"; this.speciesSortingToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.speciesSortingToolStripMenuItem.Text = "Species sorting"; // - // editSortingToolStripMenuItem - // - this.editSortingToolStripMenuItem.Name = "editSortingToolStripMenuItem"; - this.editSortingToolStripMenuItem.Size = new System.Drawing.Size(214, 22); - this.editSortingToolStripMenuItem.Text = "Edit sorting"; - this.editSortingToolStripMenuItem.Click += new System.EventHandler(this.editSortingToolStripMenuItem_Click); - // - // helpAboutSpeciesSortingToolStripMenuItem - // - this.helpAboutSpeciesSortingToolStripMenuItem.Name = "helpAboutSpeciesSortingToolStripMenuItem"; - this.helpAboutSpeciesSortingToolStripMenuItem.Size = new System.Drawing.Size(214, 22); - this.helpAboutSpeciesSortingToolStripMenuItem.Text = "Help about species sorting"; - this.helpAboutSpeciesSortingToolStripMenuItem.Click += new System.EventHandler(this.helpAboutSpeciesSortingToolStripMenuItem_Click); - // // resetSortingToolStripMenuItem // this.resetSortingToolStripMenuItem.Name = "resetSortingToolStripMenuItem"; @@ -1268,6 +1258,32 @@ private void InitializeComponent() this.resetSortingToolStripMenuItem1.Text = "Reset sorting"; this.resetSortingToolStripMenuItem1.Click += new System.EventHandler(this.resetSortingToolStripMenuItem1_Click); // + // toolStripSeparator26 + // + this.toolStripSeparator26.Name = "toolStripSeparator26"; + this.toolStripSeparator26.Size = new System.Drawing.Size(211, 6); + // + // editSortingToolStripMenuItem + // + this.editSortingToolStripMenuItem.Name = "editSortingToolStripMenuItem"; + this.editSortingToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.editSortingToolStripMenuItem.Text = "Edit sorting"; + this.editSortingToolStripMenuItem.Click += new System.EventHandler(this.editSortingToolStripMenuItem_Click); + // + // applyChangedSortingToolStripMenuItem + // + this.applyChangedSortingToolStripMenuItem.Name = "applyChangedSortingToolStripMenuItem"; + this.applyChangedSortingToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.applyChangedSortingToolStripMenuItem.Text = "Apply changed sorting"; + this.applyChangedSortingToolStripMenuItem.Click += new System.EventHandler(this.applyChangedSortingToolStripMenuItem_Click); + // + // helpAboutSpeciesSortingToolStripMenuItem + // + this.helpAboutSpeciesSortingToolStripMenuItem.Name = "helpAboutSpeciesSortingToolStripMenuItem"; + this.helpAboutSpeciesSortingToolStripMenuItem.Size = new System.Drawing.Size(214, 22); + this.helpAboutSpeciesSortingToolStripMenuItem.Text = "Help about species sorting"; + this.helpAboutSpeciesSortingToolStripMenuItem.Click += new System.EventHandler(this.helpAboutSpeciesSortingToolStripMenuItem_Click); + // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -2640,6 +2656,7 @@ private void InitializeComponent() this.listBoxSpeciesLib.Name = "listBoxSpeciesLib"; this.listBoxSpeciesLib.Size = new System.Drawing.Size(175, 287); this.listBoxSpeciesLib.TabIndex = 0; + this.listBoxSpeciesLib.Click += new System.EventHandler(this.listBoxSpeciesLib_Click); this.listBoxSpeciesLib.SelectedIndexChanged += new System.EventHandler(this.listBoxSpeciesLib_SelectedIndexChanged); // // tabPage3 @@ -3242,6 +3259,7 @@ private void InitializeComponent() // this.ToolStripTextBoxLibraryFilter.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.ToolStripTextBoxLibraryFilter.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; + this.ToolStripTextBoxLibraryFilter.Font = new System.Drawing.Font("Segoe UI", 9F); this.ToolStripTextBoxLibraryFilter.Name = "ToolStripTextBoxLibraryFilter"; this.ToolStripTextBoxLibraryFilter.Size = new System.Drawing.Size(200, 25); this.ToolStripTextBoxLibraryFilter.Visible = false; @@ -3816,5 +3834,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator25; private System.Windows.Forms.ToolStripMenuItem adminCommandToSpawnExactDinoDS2ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem colorDefinitionsToClipboardToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator26; + private System.Windows.Forms.ToolStripMenuItem applyChangedSortingToolStripMenuItem; } } diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 8adb0c0c..8007a7bc 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -105,10 +105,6 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, public Form1() { - var args = Environment.GetCommandLineArgs(); - if (args.Contains("cleanupUpdater")) - FileService.TryDeleteFile(Path.Combine(Path.GetTempPath(), Updater.Updater.UpdaterExe)); - // load settings of older version if possible after an upgrade if (Properties.Settings.Default.UpgradeRequired) { @@ -699,7 +695,6 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged) _hiddenLevelsCreatureTester = 0; _tt.SetToolTip(tbSpeciesGlobal, species.DescriptiveNameAndMod + "\n" + species.blueprintPath); - _tt.SetToolTip(LbBlueprintPath, "Click to copy blueprint path to clipboard."); } private void numericUpDown_Enter(object sender, EventArgs e) @@ -921,6 +916,7 @@ private void UpdateCreatureListings(Species species = null, bool keepCurrentlySe /// /// This function should be called if the creatureCollection is changed, i.e. after loading a file or adding/removing a creature. /// It updates the listed species in the treeList and in the speciesSelector. + /// Also call after the sort order of the species was changed. /// private void UpdateSpeciesLists(List creatures, bool keepCurrentlySelectedSpecies = true) { @@ -941,19 +937,19 @@ private void UpdateSpeciesLists(List creatures, bool keepCurrentlySele } // sort species according to selected order (can be modified by json/sortNames.txt) - availableSpecies = Values.V.species.Where(sn => availableSpecies.Contains(sn)).ToList(); + _speciesInLibraryOrdered = Values.V.species.Where(sn => availableSpecies.Contains(sn)).ToArray(); // add node to show all listBoxSpeciesLib.BeginUpdate(); listBoxSpeciesLib.Items.Add(Loc.S("All")); - listBoxSpeciesLib.Items.AddRange(availableSpecies.ToArray()); + listBoxSpeciesLib.Items.AddRange(_speciesInLibraryOrdered); listBoxSpeciesLib.EndUpdate(); if (selectedSpeciesLibrary != null) listBoxSpeciesLib.SelectedItem = selectedSpeciesLibrary; - breedingPlan1.SetSpeciesList(availableSpecies, creatures); - speciesSelector1.SetLibrarySpecies(availableSpecies); + breedingPlan1.SetSpeciesList(_speciesInLibraryOrdered, creatures); + speciesSelector1.SetLibrarySpecies(_speciesInLibraryOrdered); } /// @@ -2911,6 +2907,12 @@ private void CreatureInfoInput_CreatureDataRequested(CreatureInfoInput input, bo } else { + CreatureCollection.ColorExisting[] colorAlreadyExistingInformation = null; + if (Properties.Settings.Default.NamingPatterns != null + && Properties.Settings.Default.NamingPatterns[namingPatternIndex].IndexOf("#colorNew:", StringComparison.InvariantCultureIgnoreCase) != -1) + colorAlreadyExistingInformation = _creatureCollection.ColorAlreadyAvailable(cr.Species, input.RegionColors, out _); + input.ColorAlreadyExistingInformation = colorAlreadyExistingInformation; + input.GenerateCreatureName(cr, _topLevels.TryGetValue(cr.Species, out var tl) ? tl : null, _lowestLevels.TryGetValue(cr.Species, out var ll) ? ll : null, _customReplacingNamingPattern, showDuplicateNameWarning, namingPatternIndex); @@ -3572,6 +3574,19 @@ private void addRandomCreaturesToolStripMenuItem_Click(object sender, EventArgs private void resetSortingToolStripMenuItem_Click(object sender, EventArgs e) { Values.V.ResetDefaultSpeciesNameSorting(); + UpdateSpeciesLists(_creatureCollection.creatures); + } + + private void resetSortingToolStripMenuItem1_Click(object sender, EventArgs e) + { + Values.V.ResetSpeciesNameSorting(); + UpdateSpeciesLists(_creatureCollection.creatures); + } + + private void applyChangedSortingToolStripMenuItem_Click(object sender, EventArgs e) + { + Values.V.ApplySpeciesOrdering(); + UpdateSpeciesLists(_creatureCollection.creatures); } private void editSortingToolStripMenuItem_Click(object sender, EventArgs e) @@ -3584,11 +3599,6 @@ private void helpAboutSpeciesSortingToolStripMenuItem_Click(object sender, Event RepositoryInfo.OpenWikiPage("Library#order-of-the-species-in-the-library"); } - private void resetSortingToolStripMenuItem1_Click(object sender, EventArgs e) - { - Values.V.ResetSpeciesNameSorting(); - } - private void colorDefinitionsToClipboardToolStripMenuItem_Click(object sender, EventArgs e) { // copy currently loaded color definitions to the clipboard diff --git a/ARKBreedingStats/Form1.extractor.cs b/ARKBreedingStats/Form1.extractor.cs index 55218c5b..d9c98213 100644 --- a/ARKBreedingStats/Form1.extractor.cs +++ b/ARKBreedingStats/Form1.extractor.cs @@ -197,6 +197,7 @@ private void ShowSumOfChosenLevels() creatureInfoInputExtractor.ButtonEnabled = allValid; groupBoxRadarChartExtractor.Visible = allValid; creatureAnalysis1.Visible = allValid; + // update inheritance info CreatureInfoInput_CreatureDataRequested(creatureInfoInputExtractor, false, true, false, 0); } @@ -908,7 +909,7 @@ private void CopyExtractionToClipboard() tabControlMain.SelectedTab = tabPageExtractor; bool creatureAlreadyExists = ExtractValuesInExtractor(cv, exportFilePath, true); - CopyNameToClipboardIfSet(creatureAlreadyExists); + GenerateCreatureNameAndCopyNameToClipboardIfSet(creatureAlreadyExists); return creatureAlreadyExists; } @@ -917,7 +918,7 @@ private void CopyExtractionToClipboard() /// Copies the creature name to the clipboard if the conditions according to the user settings are fulfilled. /// /// - private void CopyNameToClipboardIfSet(bool creatureAlreadyExists) + private void GenerateCreatureNameAndCopyNameToClipboardIfSet(bool creatureAlreadyExists) { if (Properties.Settings.Default.applyNamePatternOnAutoImportAlways || (Properties.Settings.Default.applyNamePatternOnImportIfEmptyName @@ -947,7 +948,7 @@ private void ExtractExportedFileInExtractor(importExported.ExportedCreatureContr return; bool creatureAlreadyExists = ExtractValuesInExtractor(ecc.creatureValues, ecc.exportedFile, false); - CopyNameToClipboardIfSet(creatureAlreadyExists); + GenerateCreatureNameAndCopyNameToClipboardIfSet(creatureAlreadyExists); // gets deleted in extractLevels() _exportedCreatureControl = ecc; @@ -1119,8 +1120,14 @@ private void creatureInfoInputExtractor_Add2Library_Clicked(CreatureInfoInput se private void CreatureInfoInputColorsChanged(CreatureInfoInput input) { - if (_dontUpdateExtractorVisualData) return; - var newColorStatus = input.SetRegionColorsExisting(_creatureCollection.ColorAlreadyAvailable(speciesSelector1.SelectedSpecies, input.RegionColors, out string infoText)); + if (_dontUpdateExtractorVisualData) + { + input.ColorAlreadyExistingInformation = null; + return; + } + var colorAlreadyExisting = _creatureCollection.ColorAlreadyAvailable(speciesSelector1.SelectedSpecies, input.RegionColors, out string infoText); + var newColorStatus = input.SetRegionColorsExisting(colorAlreadyExisting); + input.ColorAlreadyExistingInformation = colorAlreadyExisting; if (input == creatureInfoInputExtractor) creatureAnalysis1.SetColorAnalysis(newColorStatus.newInSpecies ? LevelStatus.NewTopLevel : newColorStatus.newInRegion ? LevelStatus.TopLevel : LevelStatus.Neutral, infoText); diff --git a/ARKBreedingStats/Form1.l10n.cs b/ARKBreedingStats/Form1.l10n.cs index ac3475de..a9a480b9 100644 --- a/ARKBreedingStats/Form1.l10n.cs +++ b/ARKBreedingStats/Form1.l10n.cs @@ -1,7 +1,4 @@ -using ARKBreedingStats.species; -using ARKBreedingStats.values; - -namespace ARKBreedingStats +namespace ARKBreedingStats { public partial class Form1 { @@ -14,10 +11,10 @@ private void InitLocalization() /// /// Sets the localizations, i.e. translated texts in the application. /// - /// If true - private void SetLocalizations(bool init = true) + /// If the language was changed set to true to load the according strings. + private void SetLocalizations(bool initialize = true) { - if (init) + if (initialize) InitLocalization(); // menu @@ -153,6 +150,9 @@ private void SetLocalizations(bool init = true) columnHeaderColor5.Text = Loc.S("C5"); Loc.ControlText(ToolStripLabelFilter); + _tt.SetToolTip(LbBlueprintPath, "Click to copy blueprint path to clipboard."); + _tt.SetToolTip(listBoxSpeciesLib, "Ctrl + Click on a species to select / unselect as favorite.\nFavorites are sorted at the top."); + // other tabs Loc.ControlText(tabPagePedigree, "pedigree"); Loc.ControlText(tabPageTaming, "Taming"); diff --git a/ARKBreedingStats/Form1.library.cs b/ARKBreedingStats/Form1.library.cs index 6fd09369..ed5ba1b6 100644 --- a/ARKBreedingStats/Form1.library.cs +++ b/ARKBreedingStats/Form1.library.cs @@ -25,6 +25,8 @@ public partial class Form1 /// private Creature[] _creaturesPreFiltered; + private Species[] _speciesInLibraryOrdered; + /// /// Add a new creature to the library based from the data of the extractor or tester /// @@ -756,7 +758,7 @@ private void UpdateIncubationParents(CreatureCollection cc) private void ShowCreaturesInListView(IEnumerable creatures) { listViewLibrary.BeginUpdate(); - _creaturesDisplayed = _creatureListSorter.DoSort(creatures); + _creaturesDisplayed = _creatureListSorter.DoSort(creatures, orderBySpecies: Properties.Settings.Default.LibraryGroupBySpecies ? _speciesInLibraryOrdered : null); listViewLibrary.VirtualListSize = _creaturesDisplayed.Length; _libraryListViewItemCache = null; listViewLibrary.EndUpdate(); @@ -1185,7 +1187,7 @@ private void SortLibrary(int columnIndex = -1) foreach (int i in listViewLibrary.SelectedIndices) selectedCreatures.Add(_creaturesDisplayed[i]); - _creaturesDisplayed = _creatureListSorter.DoSort(_creaturesDisplayed, columnIndex); + _creaturesDisplayed = _creatureListSorter.DoSort(_creaturesDisplayed, columnIndex, Properties.Settings.Default.LibraryGroupBySpecies ? _speciesInLibraryOrdered : null); _libraryListViewItemCache = null; listViewLibrary.EndUpdate(); SelectCreaturesInLibrary(selectedCreatures); @@ -1468,6 +1470,14 @@ private IEnumerable ApplyLibraryFilterSettings(IEnumerable c return creatures; } + private void listBoxSpeciesLib_Click(object sender, EventArgs e) + { + if (!(ModifierKeys == Keys.Control && listBoxSpeciesLib.SelectedItem is Species species)) return; + + Values.V.ToggleSpeciesFavorite(species); + UpdateSpeciesLists(_creatureCollection.creatures); + } + private void listViewLibrary_KeyUp(object sender, KeyEventArgs e) { switch (e.KeyCode) diff --git a/ARKBreedingStats/Form1.resx b/ARKBreedingStats/Form1.resx index 46b32e94..c404f61a 100644 --- a/ARKBreedingStats/Form1.resx +++ b/ARKBreedingStats/Form1.resx @@ -129,7 +129,7 @@ The TE can differ 0.1% due to ingame-rounding. iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka + wQAADsEBuJFr7QAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka rICWUX5bqNy6gsMB0pq48aMy/3FjIwtmgwsNw9SMLXS4ecgEpVavqUKr5frDg7Z34H32+dzdM98dveu1 9Mi4vp/mm+f98dz7vO/383x/1rhw4eIq4luUfYnD/8J5TcdIkRcpUygucoBsCHHeFxEiZF78zMW4Y7SE CA9RRIqLHGC0hLgWkmNI4akxQuIkJPXeOoqLHGG0FuIix3AJ+T+DS0iOoCBrfXwrpZKSDa6UkLGum9eQ @@ -170,7 +170,7 @@ The TE can differ 0.1% due to ingame-rounding. iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka + wQAADsEBuJFr7QAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka rICWUX5bqNy6gsMB0pq48aMy/3FjIwtmgwsNw9SMLXS4ecgEpVavqUKr5frDg7Z34H32+dzdM98dveu1 9Mi4vp/mm+f98dz7vO/383x/1rhw4eIq4luUfYnD/8J5TcdIkRcpUygucoBsCHHeFxEiZF78zMW4Y7SE CA9RRIqLHGC0hLgWkmNI4akxQuIkJPXeOoqLHGG0FuIix3AJ+T+DS0iOoCBrfXwrpZKSDa6UkLGum9eQ @@ -245,7 +245,7 @@ It's recommended to first create a backup file of you library. iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka + wQAADsEBuJFr7QAACDpJREFUeF7tWX9slOUdf3AkVocTN/7ossVgYlznjMFNLL01GzFu8Z85M8jSKTka rICWUX5bqNy6gsMB0pq48aMy/3FjIwtmgwsNw9SMLXS4ecgEpVavqUKr5frDg7Z34H32+dzdM98dveu1 9Mi4vp/mm+f98dz7vO/383x/1rhw4eIq4luUfYnD/8J5TcdIkRcpUygucoBsCHHeFxEiZF78zMW4Y7SE CA9RRIqLHGC0hLgWkmNI4akxQuIkJPXeOoqLHGG0FuIix3AJ+T+DS0iOoCBrfXwrpZKSDa6UkLGum9eQ diff --git a/ARKBreedingStats/Loc.cs b/ARKBreedingStats/Loc.cs index 07ce1f54..4725ef27 100644 --- a/ARKBreedingStats/Loc.cs +++ b/ARKBreedingStats/Loc.cs @@ -14,9 +14,24 @@ internal static class Loc public static void LoadResourceFile() { - Thread.CurrentThread.CurrentUICulture = !string.IsNullOrEmpty(Properties.Settings.Default.language) ? - new System.Globalization.CultureInfo(Properties.Settings.Default.language) : - System.Globalization.CultureInfo.CurrentCulture; + CultureInfo culture; + if (string.IsNullOrEmpty(Properties.Settings.Default.language)) + { + culture = CultureInfo.CurrentCulture; + } + else + { + try + { + culture = new CultureInfo(Properties.Settings.Default.language); + } + catch (CultureNotFoundException) + { + culture = CultureInfo.CurrentCulture; + } + } + + Thread.CurrentThread.CurrentUICulture = culture; rm = new ResourceManager("ARKBreedingStats.local.strings", typeof(Form1).Assembly); } diff --git a/ARKBreedingStats/NamePatterns/NamePattern.cs b/ARKBreedingStats/NamePatterns/NamePattern.cs index b3086459..9c061e53 100644 --- a/ARKBreedingStats/NamePatterns/NamePattern.cs +++ b/ARKBreedingStats/NamePatterns/NamePattern.cs @@ -4,9 +4,8 @@ using System.Text.RegularExpressions; using System.Windows.Forms; using ARKBreedingStats.Library; -using ARKBreedingStats.species; using ARKBreedingStats.utils; -using ARKBreedingStats.values; +using static ARKBreedingStats.Library.CreatureCollection; namespace ARKBreedingStats.NamePatterns { @@ -20,9 +19,11 @@ public static class NamePattern /// /// Generate a creature name with the naming pattern. /// - public static string GenerateCreatureName(Creature creature, Creature[] sameSpecies, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary customReplacings, bool showDuplicateNameWarning, int namingPatternIndex, bool showTooLongWarning = true, string pattern = null, bool displayError = true, Dictionary tokenDictionary = null) + public static string GenerateCreatureName(Creature creature, Creature[] sameSpecies, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary customReplacings, + bool showDuplicateNameWarning, int namingPatternIndex, bool showTooLongWarning = true, string pattern = null, bool displayError = true, Dictionary tokenDictionary = null, + CreatureCollection.ColorExisting[] colorsExisting = null) { - var creatureNames = sameSpecies?.Where(c => c.guid != creature.guid).Select(x => x.name).ToArray() ?? new string[0]; + var creatureNames = sameSpecies?.Where(c => c.guid != creature.guid).Select(x => x.name).ToArray() ?? Array.Empty(); if (pattern == null) { if (namingPatternIndex == -1) @@ -67,7 +68,7 @@ public static string GenerateCreatureName(Creature creature, Creature[] sameSpec // first resolve keys, then functions string name = ResolveFunctions( ResolveKeysToValues(tokenDictionary, pattern.Replace("\r", string.Empty).Replace("\n", string.Empty)), - creature, customReplacings, displayError, false); + creature, customReplacings, displayError, false, colorsExisting); if (name.Contains("{n}")) { @@ -80,7 +81,7 @@ public static string GenerateCreatureName(Creature creature, Creature[] sameSpec { numberedUniqueName = ResolveFunctions( ResolveKeysToValues(tokenDictionary, name, n++), - creature, customReplacings, displayError, true); + creature, customReplacings, displayError, true, colorsExisting); // check if numberedUniqueName actually is different, else break the potentially infinite loop. E.g. it is not different if {n} is an unreached if branch or was altered with other functions if (numberedUniqueName == lastNumberedUniqueName) break; @@ -115,7 +116,7 @@ public static string GenerateCreatureName(Creature creature, Creature[] sameSpec /// If true, a MessageBox with the error will be displayed. /// If true, the {n} will be processed /// - private static string ResolveFunctions(string pattern, Creature creature, Dictionary customReplacings, bool displayError, bool processNumberField) + private static string ResolveFunctions(string pattern, Creature creature, Dictionary customReplacings, bool displayError, bool processNumberField, ColorExisting[] colorsExisting = null) { int nrFunctions = 0; int nrFunctionsAfterResolving = NrFunctions(pattern); @@ -126,7 +127,8 @@ private static string ResolveFunctions(string pattern, Creature creature, Dictio Creature = creature, CustomReplacings = customReplacings, DisplayError = displayError, - ProcessNumberField = processNumberField + ProcessNumberField = processNumberField, + ColorsExisting = colorsExisting }; // resolve nested functions while (nrFunctions != nrFunctionsAfterResolving) diff --git a/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs b/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs index 0c923d9b..2e0f024b 100644 --- a/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs +++ b/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs @@ -54,6 +54,7 @@ private static string ParametersInvalid(string specificError, string expression, {"customreplace", FunctionCustomReplace}, {"time", FunctionTime}, {"color", FunctionColor}, + {"colornew", FunctionColorNew}, {"indexof", FunctionIndexOf} }; @@ -303,6 +304,28 @@ private static string FunctionColor(Match m, NamePatternParameters p) return CreatureColors.CreatureColorName(p.Creature.colors[regionId]); } + /// + /// Returns new if the color is newInRegion in this region, returns newInSpecies if the color is new in all regions of this species, else returns string.Empty. + /// + private static string FunctionColorNew(Match m, NamePatternParameters p) + { + // parameter 1: region id (0,...,5) + if (!int.TryParse(m.Groups[2].Value, out int regionId) + || regionId < 0 || regionId > 5) return ParametersInvalid("color region id has to be a number in the range 0 - 5", m.Groups[0].Value, p.DisplayError); + + if (p.ColorsExisting == null) return string.Empty; + + switch (p.ColorsExisting[regionId]) + { + case CreatureCollection.ColorExisting.ColorExistingInOtherRegion: + return "newInRegion"; + case CreatureCollection.ColorExisting.ColorIsNew: + return "newInSpecies"; + default: + return string.Empty; + } + } + private static string FunctionIndexOf(Match m, NamePatternParameters p) { // parameter: 1: source string, 2: string to find @@ -322,5 +345,7 @@ internal struct NamePatternParameters /// The number field {n} will add the lowest possible positive integer >1 for the name to be unique. It has to be processed after all other functions. /// internal bool ProcessNumberField; + + internal CreatureCollection.ColorExisting[] ColorsExisting; } } diff --git a/ARKBreedingStats/NamePatterns/PatternEditor.cs b/ARKBreedingStats/NamePatterns/PatternEditor.cs index 44167003..9d9e057a 100644 --- a/ARKBreedingStats/NamePatterns/PatternEditor.cs +++ b/ARKBreedingStats/NamePatterns/PatternEditor.cs @@ -8,7 +8,6 @@ using System.Windows.Threading; using ARKBreedingStats.Library; using ARKBreedingStats.Properties; -using ARKBreedingStats.species; using ARKBreedingStats.Updater; using ARKBreedingStats.utils; @@ -20,6 +19,7 @@ public partial class PatternEditor : Form private readonly Creature[] _creaturesOfSameSpecies; private readonly int[] _speciesTopLevels; private readonly int[] _speciesLowestLevels; + private readonly CreatureCollection.ColorExisting[] _colorExistings; private Dictionary _customReplacings; private readonly Dictionary _tokenDictionary; private readonly Debouncer _updateNameDebouncer = new Debouncer(); @@ -38,7 +38,7 @@ public PatternEditor() InitializeComponent(); } - public PatternEditor(Creature creature, Creature[] creaturesOfSameSpecies, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary customReplacings, int namingPatternIndex, Action reloadCallback) : this() + public PatternEditor(Creature creature, Creature[] creaturesOfSameSpecies, int[] speciesTopLevels, int[] speciesLowestLevels, CreatureCollection.ColorExisting[] colorExistings, Dictionary customReplacings, int namingPatternIndex, Action reloadCallback) : this() { Utils.SetWindowRectangle(this, Settings.Default.PatternEditorFormRectangle); if (Settings.Default.PatternEditorSplitterDistance > 0) @@ -50,6 +50,7 @@ public PatternEditor(Creature creature, Creature[] creaturesOfSameSpecies, int[] _creaturesOfSameSpecies = creaturesOfSameSpecies; _speciesTopLevels = speciesTopLevels; _speciesLowestLevels = speciesLowestLevels; + _colorExistings = colorExistings; _customReplacings = customReplacings; _reloadCallback = reloadCallback; txtboxPattern.Text = Properties.Settings.Default.NamingPatterns?[namingPatternIndex] ?? string.Empty; @@ -515,6 +516,7 @@ private void InsertText(string text) {"format","{{#format: number | formatString }}\n{{#format: {hp_vb} | 000000 }}"}, {"format_int","Like #format, but supports \"x\" in the format for hexadecimal representations. {{#format_int: number | formatString }}\n{{#format_int: {{#color: 0 }} | x2 }}"}, {"color","{{#color: regionId | return color name | return value even for unused regions }}. Returns the colorId of the region. If the second parameter is not empty, the color name will be returned. Unused regions will only return a value if the third value is not empty.\n{{#color: 0 | true }}"}, + {"colorNew","{{#colorNew: regionId }}. Returns newInRegion if the region contains a color that is not yet available in that species. Returns newInSpecies if that color is not yet available in any region of that species.\n{{#colorNew: 0 }}"}, {"indexof","{{#indexof: source string | string to find }}. Returns the index of the second parameter in the first parameter. If the string is not contained, an empty string will be returned.\n{{#indexof: hello | ll }}"}, }; @@ -542,7 +544,8 @@ private void txtboxPattern_TextChanged(object sender, EventArgs e) private void DisplayPreview() { - cbPreview.Text = NamePatterns.NamePattern.GenerateCreatureName(_creature, _creaturesOfSameSpecies, _speciesTopLevels, _speciesLowestLevels, _customReplacings, false, -1, false, txtboxPattern.Text, false, _tokenDictionary); + cbPreview.Text = NamePatterns.NamePattern.GenerateCreatureName(_creature, _creaturesOfSameSpecies, _speciesTopLevels, _speciesLowestLevels, _customReplacings, + false, -1, false, txtboxPattern.Text, false, _tokenDictionary, _colorExistings); } private void TbFilterKeys_TextChanged(object sender, EventArgs e) diff --git a/ARKBreedingStats/Pedigree/PedigreeControl.Designer.cs b/ARKBreedingStats/Pedigree/PedigreeControl.Designer.cs index fa544988..42afd285 100644 --- a/ARKBreedingStats/Pedigree/PedigreeControl.Designer.cs +++ b/ARKBreedingStats/Pedigree/PedigreeControl.Designer.cs @@ -30,7 +30,6 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); this.PbRegionColors = new System.Windows.Forms.PictureBox(); this.lbPedigreeEmpty = new System.Windows.Forms.Label(); this.listViewCreatures = new System.Windows.Forms.ListView(); @@ -49,7 +48,6 @@ private void InitializeComponent() this.statSelector1 = new ARKBreedingStats.uiControls.StatSelector(); this.LbCreatureName = new System.Windows.Forms.Label(); this.nudGenerations = new ARKBreedingStats.uiControls.Nud(); - this.pedigreeCreatureHeaders = new PedigreeCreature(); ((System.ComponentModel.ISupportInitialize)(this.PbRegionColors)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -131,7 +129,6 @@ private void InitializeComponent() this.splitContainer1.Panel2.Controls.Add(this.statSelector1); this.splitContainer1.Panel2.Controls.Add(this.LbCreatureName); this.splitContainer1.Panel2.Controls.Add(this.nudGenerations); - this.splitContainer1.Panel2.Controls.Add(this.pedigreeCreatureHeaders); this.splitContainer1.Panel2.Controls.Add(this.PbRegionColors); this.splitContainer1.Size = new System.Drawing.Size(1043, 520); this.splitContainer1.SplitterDistance = 203; @@ -292,16 +289,6 @@ private void InitializeComponent() 0}); this.nudGenerations.ValueChanged += new System.EventHandler(this.nudGenerations_ValueChanged); // - // pedigreeCreatureHeaders - // - this.pedigreeCreatureHeaders.Creature = null; - this.pedigreeCreatureHeaders.Location = new System.Drawing.Point(375, 19); - this.pedigreeCreatureHeaders.Name = "pedigreeCreatureHeaders"; - this.pedigreeCreatureHeaders.OnlyLevels = false; - this.pedigreeCreatureHeaders.Size = new System.Drawing.Size(325, 35); - this.pedigreeCreatureHeaders.TabIndex = 2; - this.pedigreeCreatureHeaders.TotalLevelUnknown = false; - // // PedigreeControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -331,7 +318,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox PbRegionColors; private System.Windows.Forms.Label lbPedigreeEmpty; - private PedigreeCreature pedigreeCreatureHeaders; private System.Windows.Forms.ListView listViewCreatures; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; diff --git a/ARKBreedingStats/Pedigree/PedigreeControl.cs b/ARKBreedingStats/Pedigree/PedigreeControl.cs index 43439d4e..9b943503 100644 --- a/ARKBreedingStats/Pedigree/PedigreeControl.cs +++ b/ARKBreedingStats/Pedigree/PedigreeControl.cs @@ -49,11 +49,32 @@ public partial class PedigreeControl : UserControl private int _displayedGenerations; private int _highlightInheritanceStatIndex = -1; private int _yBottomOfPedigree; // used for descendents + private readonly PedigreeCreature _pedigreeHeader, _pedigreeHeaderMaternal, _pedigreeHeaderPaternal; public PedigreeControl() { InitializeComponent(); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); + + _pedigreeHeader = new PedigreeCreature + { + Left = PedigreeCreation.LeftMargin + PedigreeCreation.PedigreeElementWidth + PedigreeCreation.Margin, + Top = PedigreeCreation.TopMargin + }; + splitContainer1.Panel2.Controls.Add(_pedigreeHeader); + _pedigreeHeaderMaternal = new PedigreeCreature + { + Left = PedigreeCreation.LeftMargin, + Top = PedigreeCreation.TopMargin + }; + splitContainer1.Panel2.Controls.Add(_pedigreeHeaderMaternal); + _pedigreeHeaderPaternal = new PedigreeCreature + { + Left = PedigreeCreation.LeftMargin + 2 * (PedigreeCreation.PedigreeElementWidth + PedigreeCreation.Margin), + Top = PedigreeCreation.TopMargin + }; + splitContainer1.Panel2.Controls.Add(_pedigreeHeaderPaternal); + _lines = new[] { new List(), new List(), new List() }; NoCreatureSelected(); listViewCreatures.ListViewItemSorter = new ListViewColumnSorter(); @@ -242,7 +263,9 @@ private void SetViewMode(PedigreeViewMode viewMode) var classicViewMode = viewMode == PedigreeViewMode.Classic; - pedigreeCreatureHeaders.Visible = classicViewMode; + _pedigreeHeader.Visible = classicViewMode; + _pedigreeHeaderMaternal.Visible = classicViewMode; + _pedigreeHeaderPaternal.Visible = classicViewMode; nudGenerations.Visible = !classicViewMode; TbZoom.Visible = !classicViewMode; LbCreatureName.Visible = !classicViewMode; @@ -287,7 +310,9 @@ private void CreatePedigree() return; } - pedigreeCreatureHeaders.SetCustomStatNames(_selectedCreature.Species?.statNames); + _pedigreeHeader.SetCustomStatNames(_selectedCreature.Species?.statNames); + _pedigreeHeaderMaternal.SetCustomStatNames(_selectedCreature.Species?.statNames); + _pedigreeHeaderPaternal.SetCustomStatNames(_selectedCreature.Species?.statNames); statSelector1.SetStatNames(_selectedCreature.Species); lbPedigreeEmpty.Visible = false; @@ -298,7 +323,7 @@ private void CreatePedigree() if (_pedigreeViewMode == PedigreeViewMode.Classic) { PedigreeCreation.CreateDetailedView(_selectedCreature, _lines, _pedigreeControls, _enabledColorRegions); - _yBottomOfPedigree = 170; + _yBottomOfPedigree = PedigreeCreation.TopMargin + 4 * PedigreeCreation.PedigreeElementHeight; } else { @@ -316,7 +341,7 @@ private void CreatePedigree() _pedigreeControls.Add(new PedigreeCreature(_selectedCreature, _enabledColorRegions) { - Location = new Point(PedigreeCreation.LeftBorder, _yBottomOfPedigree + PedigreeCreation.Margin) + Location = new Point(PedigreeCreation.LeftMargin, _yBottomOfPedigree + PedigreeCreation.Margin) }); _yBottomOfPedigree += 50; } @@ -328,7 +353,7 @@ private void CreatePedigree() { PedigreeCreature pc = new PedigreeCreature(c, _enabledColorRegions) { - Location = new Point(PedigreeCreation.LeftBorder, yDescendants + 35 * row) + Location = new Point(PedigreeCreation.LeftMargin, yDescendants + 35 * row) }; if (c.levelsWild != null && _selectedCreature.levelsWild != null) { @@ -339,8 +364,8 @@ private void CreatePedigree() _selectedCreature.levelsWild[si] == c.levelsWild[si]) _lines[0].Add(new[] { - PedigreeCreation.LeftBorder + PedigreeCreature.XOffsetFirstStat + PedigreeCreature.HorizontalStatDistance * s, yDescendants + 35 * row + 6, - PedigreeCreation.LeftBorder + PedigreeCreature.XOffsetFirstStat + PedigreeCreature.HorizontalStatDistance * s, yDescendants + 35 * row + 15, 0, 0 + PedigreeCreation.LeftMargin + PedigreeCreature.XOffsetFirstStat + PedigreeCreature.HorizontalStatDistance * s, yDescendants + 35 * row + 6, + PedigreeCreation.LeftMargin + PedigreeCreature.XOffsetFirstStat + PedigreeCreature.HorizontalStatDistance * s, yDescendants + 35 * row + 15, 0, 0 }); } } diff --git a/ARKBreedingStats/Pedigree/PedigreeCreation.cs b/ARKBreedingStats/Pedigree/PedigreeCreation.cs index 07a1fa46..0d5756a2 100644 --- a/ARKBreedingStats/Pedigree/PedigreeCreation.cs +++ b/ARKBreedingStats/Pedigree/PedigreeCreation.cs @@ -12,8 +12,16 @@ namespace ARKBreedingStats.Pedigree /// public static class PedigreeCreation { + /// + /// Margin between pedigree elements. + /// internal const int Margin = 10; private const int MinXPosCreature = 440; + internal const int PedigreeElementWidth = 325; + internal const int PedigreeElementHeight = 40; + internal const int LeftMargin = 40; + internal const int TopMargin = 20; + private const int YCenterOfCreatureParent = TopMargin + 2 * PedigreeElementHeight + PedigreeElementHeight / 2 - 1; #region Compact View @@ -227,32 +235,29 @@ private static void CompactViewLeftAlign(List controls, List[] l #region Detailed View - internal const int LeftBorder = 40; internal static void CreateDetailedView(Creature creature, List[] lines, List pedigreeControls, bool[] enabledColorRegions) { - const int pedigreeElementWidth = 325; - const int yCenterOfCreatureParent = 79; // draw creature - CreateParentsChild(creature, lines, pedigreeControls, LeftBorder + pedigreeElementWidth + Margin, 60, enabledColorRegions, true, true); + CreateParentsChild(creature, lines, pedigreeControls, LeftMargin + PedigreeElementWidth + Margin, TopMargin + PedigreeElementHeight, enabledColorRegions, true, true); // create ancestors if (creature.Mother != null - && CreateParentsChild(creature.Mother, lines, pedigreeControls, LeftBorder, 20, enabledColorRegions)) + && CreateParentsChild(creature.Mother, lines, pedigreeControls, LeftMargin, TopMargin + PedigreeElementHeight, enabledColorRegions)) { lines[1].Add(new[] { - LeftBorder + pedigreeElementWidth, yCenterOfCreatureParent, - LeftBorder + pedigreeElementWidth + Margin, yCenterOfCreatureParent, 0 + LeftMargin + PedigreeElementWidth, YCenterOfCreatureParent, + LeftMargin + PedigreeElementWidth + Margin, YCenterOfCreatureParent - PedigreeElementHeight, 0 }); } if (creature.Father != null - && CreateParentsChild(creature.Father, lines, pedigreeControls, LeftBorder + 2 * (pedigreeElementWidth + Margin), 20, enabledColorRegions)) + && CreateParentsChild(creature.Father, lines, pedigreeControls, LeftMargin + 2 * (PedigreeElementWidth + Margin), TopMargin + PedigreeElementHeight, enabledColorRegions)) { lines[1].Add(new[] { - LeftBorder + 2 * pedigreeElementWidth + 2 * Margin, yCenterOfCreatureParent, - LeftBorder + 2 * pedigreeElementWidth + Margin, yCenterOfCreatureParent + 80, 0 + LeftMargin + 2 * PedigreeElementWidth + 2 * Margin, YCenterOfCreatureParent, + LeftMargin + 2 * PedigreeElementWidth + Margin, YCenterOfCreatureParent + PedigreeElementHeight, 0 }); } } diff --git a/ARKBreedingStats/Program.cs b/ARKBreedingStats/Program.cs index 9f0ce24f..a5c5122f 100644 --- a/ARKBreedingStats/Program.cs +++ b/ARKBreedingStats/Program.cs @@ -12,11 +12,26 @@ static class Program [STAThread] static void Main() { - AppDomain currentDomain = AppDomain.CurrentDomain; #if !DEBUG + AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += UnhandledExceptionHandler; #endif + var args = Environment.GetCommandLineArgs(); + for (int i = 1; i < args.Length; i++) + { + switch (args[i].ToLowerInvariant()) + { + case "cleanupupdater": + FileService.TryDeleteFile(Path.Combine(Path.GetTempPath(), Updater.Updater.UpdaterExe)); + break; + case "-setlanguage": + var language = args.Length > ++i ? args[i] : null; + Properties.Settings.Default.language = language; + break; + } + } + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1 diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 45281f0c..f8864e7b 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.50.3.0")] +[assembly: AssemblyFileVersion("0.50.4.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/Properties/Settings.Designer.cs b/ARKBreedingStats/Properties/Settings.Designer.cs index fec0663f..80a7eaf9 100644 --- a/ARKBreedingStats/Properties/Settings.Designer.cs +++ b/ARKBreedingStats/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace ARKBreedingStats.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -2123,5 +2123,17 @@ public bool FilterHideNonCooldowns { this["FilterHideNonCooldowns"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool LibraryGroupBySpecies { + get { + return ((bool)(this["LibraryGroupBySpecies"])); + } + set { + this["LibraryGroupBySpecies"] = value; + } + } } } diff --git a/ARKBreedingStats/Properties/Settings.settings b/ARKBreedingStats/Properties/Settings.settings index fc7e6f1b..5e79fc5f 100644 --- a/ARKBreedingStats/Properties/Settings.settings +++ b/ARKBreedingStats/Properties/Settings.settings @@ -533,5 +533,8 @@ False + + True + \ No newline at end of file diff --git a/ARKBreedingStats/SpeciesSelector.cs b/ARKBreedingStats/SpeciesSelector.cs index 3070b02c..8eeeaa1a 100644 --- a/ARKBreedingStats/SpeciesSelector.cs +++ b/ARKBreedingStats/SpeciesSelector.cs @@ -193,7 +193,7 @@ public void InitializeSpeciesImages(List species) /// Fills the species listed as appearing in the library /// /// - public void SetLibrarySpecies(List librarySpeciesList) + public void SetLibrarySpecies(IList librarySpeciesList) { lvSpeciesInLibrary.BeginUpdate(); lvSpeciesInLibrary.Items.Clear(); diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 6a7ef5d3..04a435a9 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.50.3.0" + "version": "0.50.4.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/json/values/_manifest.json b/ARKBreedingStats/json/values/_manifest.json index 1eaa7e9e..af08eddf 100644 --- a/ARKBreedingStats/json/values/_manifest.json +++ b/ARKBreedingStats/json/values/_manifest.json @@ -35,7 +35,7 @@ "mod": { "id": "1139775728", "tag": "Confuciusornis", "title": "Confuciusornis" } }, "1169020368-Trex.json": { - "version": "347.1.1657081669", + "version": "349.2.1661969243", "mod": { "id": "1169020368", "tag": "Trex", "title": "Ark Creature Rebalance (AG Reborn)" } }, "1178308359-ShadDragon.json": { @@ -72,7 +72,7 @@ "mod": { "id": "1356703358", "tag": "Primal_Fear_Noxious_Creatures", "title": "Primal Fear Noxious Creatures" } }, "1373744537-AC2.json": { - "version": "347.1.1657086858", + "version": "348.7.1660069796", "mod": { "id": "1373744537", "tag": "AC2", "title": "Additional Creatures 2: Wild Ark" } }, "1405944717-Project_Evolution.json": { @@ -96,7 +96,7 @@ "mod": { "id": "1498206270", "tag": "SmallDragon", "title": "Small Dragons!" } }, "1522327484-Additions_Pack.json": { - "version": "345.39.1654535304", + "version": "348.6.1659412407", "mod": { "id": "1522327484", "tag": "Additions_Pack", "title": "ARK Additions!" } }, "1523045986-Paranoia.json": { @@ -104,11 +104,11 @@ "mod": { "id": "1523045986", "tag": "Paranoia", "title": "Additional Creatures 2: Paranoia!" } }, "1565015734-BetterDinosTest.json": { - "version": "345.39.1653822963", + "version": "348.7.1659637030", "mod": { "id": "1565015734", "tag": "BetterDinosTest", "title": "Better Dinos" } }, "1576299694-ElementalDinos.json": { - "version": "345.3.1650281665", + "version": "348.6.1659523193", "mod": { "id": "1576299694", "tag": "ElementalDinos", "title": "Elemental Ark" } }, "1587391872-FasterFlyers.json": { @@ -235,7 +235,7 @@ "mod": { "id": "2000326197", "tag": "ExtraResources", "title": "Event Assets" } }, "2003934830-Beasts.json": { - "version": "347.1.1657246231", + "version": "348.10.1660762304", "mod": { "id": "2003934830", "tag": "Beasts", "title": "Prehistoric Beasts" } }, "2019846325-ApexMod.json": { @@ -263,7 +263,7 @@ "mod": { "id": "2135314513", "tag": "CI_Dinos", "title": "Crystal Isles Dino Addition" } }, "2447186973-ArkOmega.json": { - "version": "347.1.1657647099", + "version": "349.2.1661580009", "mod": { "id": "2447186973", "tag": "ArkOmega", "title": "Ark Omega" } }, "729352919-IndomRex.json": { @@ -283,7 +283,7 @@ "mod": { "id": "883957187", "tag": "WyvernWorld", "title": "Wyvern World" } }, "893735676-AE.json": { - "version": "347.1.1657515543", + "version": "349.2.1661548349", "mod": { "id": "893735676", "tag": "AE", "title": "Ark Eternal" } }, "895711211-ClassicFlyers.json": { diff --git a/ARKBreedingStats/library/CreatureCollection.cs b/ARKBreedingStats/library/CreatureCollection.cs index cdc58951..24ce4d04 100644 --- a/ARKBreedingStats/library/CreatureCollection.cs +++ b/ARKBreedingStats/library/CreatureCollection.cs @@ -469,7 +469,7 @@ internal void ResetExistingColors(Species species = null) internal ColorExisting[] ColorAlreadyAvailable(Species species, byte[] colorIds, out string infoText) { infoText = null; - if (string.IsNullOrEmpty(species?.blueprintPath)) return null; + if (string.IsNullOrEmpty(species?.blueprintPath) || colorIds == null) return null; var usedColorIndices = Enumerable.Range(0, Ark.ColorRegionCount).Where(i => species.EnabledColorRegions[i]).ToArray(); var usedColorCount = usedColorIndices.Length; @@ -543,7 +543,7 @@ string ColorDescription(byte colorId) return results; } - internal enum ColorExisting + public enum ColorExisting { Unknown, /// diff --git a/ARKBreedingStats/local/strings.de.resx b/ARKBreedingStats/local/strings.de.resx index c1fabc4a..123b1f85 100644 --- a/ARKBreedingStats/local/strings.de.resx +++ b/ARKBreedingStats/local/strings.de.resx @@ -1318,4 +1318,7 @@ Filter nach Farben mit c{Region}: {FarbCode} {FarbCode2}, z.B. c0: 20, c5: 3 4 5 Klicken um das Feld zu fixieren. Wenn das Feld fixiert ist, hat es einen grauen Hintergrund und wird beim Importieren einer Kreatur nicht verändert. + + Bibliothek nach Spezies gruppieren + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.fr.resx b/ARKBreedingStats/local/strings.fr.resx index 6436704b..6f8e8886 100644 --- a/ARKBreedingStats/local/strings.fr.resx +++ b/ARKBreedingStats/local/strings.fr.resx @@ -1328,4 +1328,7 @@ Filtre pour les couleurs avec c{region}: {colorValue} {colorValue2}, par exemple Maintenir la touche Ctrl enfoncée pour sélectionner un autre identifiant de couleur (bordure rouge). Maintenir Ctrl et cliquer sur aucune couleur pour le désactiver. + + Grouper la bibliothèque par espèces + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.ja.resx b/ARKBreedingStats/local/strings.ja.resx index 703cb8af..09e3f65c 100644 --- a/ARKBreedingStats/local/strings.ja.resx +++ b/ARKBreedingStats/local/strings.ja.resx @@ -1299,4 +1299,7 @@ Filter for colors with c{region}: {colorValue}, e.g. c0: 20, c5: 3 savegameインポート中 + + 種族でライブラリを切り分ける + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.pl.resx b/ARKBreedingStats/local/strings.pl.resx index b2185df9..47dcd0d3 100644 --- a/ARKBreedingStats/local/strings.pl.resx +++ b/ARKBreedingStats/local/strings.pl.resx @@ -1138,4 +1138,7 @@ Jeśli wyświetlona jest liczba z plusem, suma jest za wysoka i musisz wybrać i Usuń tymczasowe zw. + + Pogrupuj bibliotekę po gatunku + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.pt-br.resx b/ARKBreedingStats/local/strings.pt-br.resx index db4f22e1..08e555e4 100644 --- a/ARKBreedingStats/local/strings.pt-br.resx +++ b/ARKBreedingStats/local/strings.pt-br.resx @@ -1331,4 +1331,7 @@ Filtrar por cor com c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 4 Pior Possivel + + Agrupar por Especie + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.resx b/ARKBreedingStats/local/strings.resx index 9d047fe5..6182dc8d 100644 --- a/ARKBreedingStats/local/strings.resx +++ b/ARKBreedingStats/local/strings.resx @@ -1330,4 +1330,7 @@ Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 Hold Ctrl to select an alternative color id (red border). Hold Ctrl and click on No Color to unset it. + + Group library by species + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.ru.resx b/ARKBreedingStats/local/strings.ru.resx index d9eb6577..1172e304 100644 --- a/ARKBreedingStats/local/strings.ru.resx +++ b/ARKBreedingStats/local/strings.ru.resx @@ -1193,4 +1193,7 @@ Filter for colors with c{region}: {colorValue} {colorValue2}, e.g. c0: 20, c5: 3 Импорт сохраненной игры + + Сгруппировать библиотеку по видам + \ No newline at end of file diff --git a/ARKBreedingStats/local/strings.zh-tw.resx b/ARKBreedingStats/local/strings.zh-tw.resx index 8bb60684..674003f5 100644 --- a/ARKBreedingStats/local/strings.zh-tw.resx +++ b/ARKBreedingStats/local/strings.zh-tw.resx @@ -1328,4 +1328,7 @@ 最差可能 + + 按物種分類 + \ No newline at end of file diff --git a/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs b/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs index 192abe0d..1a562e6a 100644 --- a/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs +++ b/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.CbMaturationAll = new System.Windows.Forms.CheckBox(); + this.LbMaturation = new System.Windows.Forms.Label(); this.CbTagsAll = new System.Windows.Forms.CheckBox(); this.CbServersAll = new System.Windows.Forms.CheckBox(); this.CbTribesAll = new System.Windows.Forms.CheckBox(); @@ -49,13 +51,12 @@ private void InitializeComponent() this.BtColorFilter = new System.Windows.Forms.Button(); this.BtClearColorFilters = new System.Windows.Forms.Button(); this.BtClearFlagFilter = new System.Windows.Forms.Button(); + this.ClbMaturationFilters = new System.Windows.Forms.CheckedListBox(); this.panel1 = new System.Windows.Forms.Panel(); this.CbUseFilterInTopStatCalculation = new System.Windows.Forms.CheckBox(); this.BtApply = new System.Windows.Forms.Button(); this.BtCancel = new System.Windows.Forms.Button(); - this.LbMaturation = new System.Windows.Forms.Label(); - this.ClbMaturationFilters = new System.Windows.Forms.CheckedListBox(); - this.CbMaturationAll = new System.Windows.Forms.CheckBox(); + this.CbLibraryGroupSpecies = new System.Windows.Forms.CheckBox(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -121,6 +122,28 @@ private void InitializeComponent() this.tableLayoutPanel2.Size = new System.Drawing.Size(870, 408); this.tableLayoutPanel2.TabIndex = 3; // + // CbMaturationAll + // + this.CbMaturationAll.AutoSize = true; + this.CbMaturationAll.Location = new System.Drawing.Point(760, 19); + this.CbMaturationAll.Name = "CbMaturationAll"; + this.CbMaturationAll.Size = new System.Drawing.Size(36, 17); + this.CbMaturationAll.TabIndex = 21; + this.CbMaturationAll.Text = "all"; + this.CbMaturationAll.UseVisualStyleBackColor = true; + this.CbMaturationAll.CheckedChanged += new System.EventHandler(this.CbMaturationAll_CheckedChanged); + // + // LbMaturation + // + this.LbMaturation.Anchor = System.Windows.Forms.AnchorStyles.None; + this.LbMaturation.AutoSize = true; + this.LbMaturation.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LbMaturation.Location = new System.Drawing.Point(778, 3); + this.LbMaturation.Name = "LbMaturation"; + this.LbMaturation.Size = new System.Drawing.Size(67, 13); + this.LbMaturation.TabIndex = 19; + this.LbMaturation.Text = "Maturation"; + // // CbTagsAll // this.CbTagsAll.AutoSize = true; @@ -320,8 +343,19 @@ private void InitializeComponent() this.BtClearFlagFilter.UseVisualStyleBackColor = true; this.BtClearFlagFilter.Click += new System.EventHandler(this.BtClearFlagFilter_Click); // + // ClbMaturationFilters + // + this.ClbMaturationFilters.CheckOnClick = true; + this.ClbMaturationFilters.Dock = System.Windows.Forms.DockStyle.Fill; + this.ClbMaturationFilters.FormattingEnabled = true; + this.ClbMaturationFilters.Location = new System.Drawing.Point(760, 48); + this.ClbMaturationFilters.Name = "ClbMaturationFilters"; + this.ClbMaturationFilters.Size = new System.Drawing.Size(104, 354); + this.ClbMaturationFilters.TabIndex = 20; + // // panel1 // + this.panel1.Controls.Add(this.CbLibraryGroupSpecies); this.panel1.Controls.Add(this.CbUseFilterInTopStatCalculation); this.panel1.Controls.Add(this.BtApply); this.panel1.Controls.Add(this.BtCancel); @@ -365,37 +399,15 @@ private void InitializeComponent() this.BtCancel.Text = "Cancel"; this.BtCancel.UseVisualStyleBackColor = true; // - // LbMaturation - // - this.LbMaturation.Anchor = System.Windows.Forms.AnchorStyles.None; - this.LbMaturation.AutoSize = true; - this.LbMaturation.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbMaturation.Location = new System.Drawing.Point(778, 3); - this.LbMaturation.Name = "LbMaturation"; - this.LbMaturation.Size = new System.Drawing.Size(67, 13); - this.LbMaturation.TabIndex = 19; - this.LbMaturation.Text = "Maturation"; - // - // ClbMaturationFilters - // - this.ClbMaturationFilters.CheckOnClick = true; - this.ClbMaturationFilters.Dock = System.Windows.Forms.DockStyle.Fill; - this.ClbMaturationFilters.FormattingEnabled = true; - this.ClbMaturationFilters.Location = new System.Drawing.Point(760, 48); - this.ClbMaturationFilters.Name = "ClbMaturationFilters"; - this.ClbMaturationFilters.Size = new System.Drawing.Size(104, 354); - this.ClbMaturationFilters.TabIndex = 20; - // - // CbMaturationAll + // CbLibraryGroupSpecies // - this.CbMaturationAll.AutoSize = true; - this.CbMaturationAll.Location = new System.Drawing.Point(760, 19); - this.CbMaturationAll.Name = "CbMaturationAll"; - this.CbMaturationAll.Size = new System.Drawing.Size(36, 17); - this.CbMaturationAll.TabIndex = 21; - this.CbMaturationAll.Text = "all"; - this.CbMaturationAll.UseVisualStyleBackColor = true; - this.CbMaturationAll.CheckedChanged += new System.EventHandler(this.CbMaturationAll_CheckedChanged); + this.CbLibraryGroupSpecies.AutoSize = true; + this.CbLibraryGroupSpecies.Location = new System.Drawing.Point(195, 7); + this.CbLibraryGroupSpecies.Name = "CbLibraryGroupSpecies"; + this.CbLibraryGroupSpecies.Size = new System.Drawing.Size(138, 17); + this.CbLibraryGroupSpecies.TabIndex = 3; + this.CbLibraryGroupSpecies.Text = "Group library by species"; + this.CbLibraryGroupSpecies.UseVisualStyleBackColor = true; // // LibraryFilter // @@ -450,5 +462,6 @@ private void InitializeComponent() private System.Windows.Forms.Label LbMaturation; private System.Windows.Forms.CheckedListBox ClbMaturationFilters; private System.Windows.Forms.CheckBox CbMaturationAll; + private System.Windows.Forms.CheckBox CbLibraryGroupSpecies; } } \ No newline at end of file diff --git a/ARKBreedingStats/uiControls/LibraryFilter.cs b/ARKBreedingStats/uiControls/LibraryFilter.cs index d9f9b999..44d5a2dd 100644 --- a/ARKBreedingStats/uiControls/LibraryFilter.cs +++ b/ARKBreedingStats/uiControls/LibraryFilter.cs @@ -37,6 +37,7 @@ public LibraryFilter(CreatureCollection cc) : this() SetColorFilter(Properties.Settings.Default.FilterOnlyIfColorId); CbUseFilterInTopStatCalculation.Checked = Properties.Settings.Default.useFiltersInTopStatCalculation; + CbLibraryGroupSpecies.Checked = Properties.Settings.Default.LibraryGroupBySpecies; UpdateOwnerServerTagLists(); @@ -261,6 +262,7 @@ private void BtApply_Click(object sender, EventArgs e) Properties.Settings.Default.FilterHideTribes = GetCheckedStrings(ClbTribes); Properties.Settings.Default.FilterHideServers = GetCheckedStrings(ClbServers); Properties.Settings.Default.FilterHideTags = GetCheckedStrings(ClbTags); + Properties.Settings.Default.LibraryGroupBySpecies = CbLibraryGroupSpecies.Checked; var flagsOneNeeded = CreatureFlags.None; var flagsAllNeeded = CreatureFlags.None; @@ -331,6 +333,7 @@ private void Localization() LbMaturation.Text = Loc.S("Maturation"); BtClearColorFilters.Text = Loc.S("clearColorsFilters"); CbUseFilterInTopStatCalculation.Text = Loc.S("useFilterInTopStatCalculation"); + CbLibraryGroupSpecies.Text = Loc.S("groupLibraryBySpecies"); BtClearFlagFilter.Text = Loc.S("clear"); string allString = Loc.S("All"); diff --git a/ARKBreedingStats/utils/CreatureListSorter.cs b/ARKBreedingStats/utils/CreatureListSorter.cs index 91e0f7ed..4a196d6f 100644 --- a/ARKBreedingStats/utils/CreatureListSorter.cs +++ b/ARKBreedingStats/utils/CreatureListSorter.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Windows.Forms; using ARKBreedingStats.Library; +using ARKBreedingStats.species; namespace ARKBreedingStats.utils { @@ -32,7 +34,7 @@ public class CreatureListSorter /// /// Sort list by given column index. If the columnIndex is -1, use last sorting. /// - public Creature[] DoSort(IEnumerable list, int columnIndex = -1) + public Creature[] DoSort(IEnumerable list, int columnIndex = -1, Species[] orderBySpecies = null) { if (list == null) return null; @@ -52,19 +54,35 @@ public Creature[] DoSort(IEnumerable list, int columnIndex = -1) } // Perform the sort with these new sort options. - return OrderList(list).ToArray(); + return OrderList(list, orderBySpecies).ToArray(); } - private IEnumerable OrderList(IEnumerable list) + private IEnumerable OrderList(IEnumerable list, Species[] orderBySpecies = null) { - if (SortColumnIndex == -1 || SortColumnIndex >= _keySelectors.Length) - return list; + IOrderedEnumerable listOrdered; + if (orderBySpecies != null) + { + var dict = orderBySpecies.Select((s, i) => (s, i)).ToDictionary(s => s.s, s => s.i); + listOrdered = list.OrderBy(c => dict.TryGetValue(c.Species, out var i) ? i : int.MaxValue); + if (SortColumnIndex == -1 || SortColumnIndex >= _keySelectors.Length) + return listOrdered; + listOrdered = Order == SortOrder.Ascending + ? listOrdered.ThenBy(_keySelectors[SortColumnIndex]) + : listOrdered.ThenByDescending(_keySelectors[SortColumnIndex]); + } + else + { + if (SortColumnIndex == -1 || SortColumnIndex >= _keySelectors.Length) + return list; + listOrdered = Order == SortOrder.Ascending + ? list.OrderBy(_keySelectors[SortColumnIndex]) + : list.OrderByDescending(_keySelectors[SortColumnIndex]); + } - var listOrdered = Order == SortOrder.Ascending - ? list.OrderBy(_keySelectors[SortColumnIndex]) - : list.OrderByDescending(_keySelectors[SortColumnIndex]); if (_lastSortColumnIndex == -1 || _lastSortColumnIndex >= _keySelectors.Length) return listOrdered; + + // sort by second column that was selected previously return _lastOrder == SortOrder.Ascending ? listOrdered.ThenBy(_keySelectors[_lastSortColumnIndex]) : listOrdered.ThenByDescending(_keySelectors[_lastSortColumnIndex]); diff --git a/ARKBreedingStats/values/Values.cs b/ARKBreedingStats/values/Values.cs index 5c942481..c8f08fa1 100644 --- a/ARKBreedingStats/values/Values.cs +++ b/ARKBreedingStats/values/Values.cs @@ -355,7 +355,30 @@ public void OpenSpeciesNameSortingFile() Process.Start(filePath); } - private void ApplySpeciesOrdering() + /// + /// If the passed species is not yet set in the species order file an entry is added, if it's present it's removed. + /// + /// + /// If the species is a favorite now. + public void ToggleSpeciesFavorite(Species species) + { + string filePath = SpeciesNameSortFilePath; + List lines; + if (!File.Exists(filePath)) + lines = new List(); + else lines = File.ReadAllLines(filePath).ToList(); + + const string favoritePrefix = "!fav_"; + // check if species is already a favorite + var favoriteOrderEntry = species.name + "@" + favoritePrefix + species.name; + var i = lines.IndexOf(favoriteOrderEntry); + if (i != -1) lines.RemoveAt(i); + else lines.Add(favoriteOrderEntry); + File.WriteAllLines(filePath, lines); + ApplySpeciesOrdering(); + } + + internal void ApplySpeciesOrdering() { string filePath = SpeciesNameSortFilePath; @@ -370,18 +393,15 @@ private void ApplySpeciesOrdering() if (l.IndexOf("@", StringComparison.Ordinal) <= 0 || l.IndexOf("@", StringComparison.Ordinal) + 1 >= l.Length) continue; - string matchName = l.Substring(0, l.IndexOf("@", StringComparison.Ordinal)).Trim(); - string replaceName = l.Substring(l.IndexOf("@", StringComparison.Ordinal) + 1).Trim(); + string matchName = l.Substring(0, l.IndexOf("@", StringComparison.Ordinal)); + string replaceName = l.Substring(l.IndexOf("@", StringComparison.Ordinal) + 1); Regex r = new Regex(matchName); - List matchedSpecies = - _V.species.Where(s => string.IsNullOrEmpty(s.SortName) && r.IsMatch(s.name)).ToList(); + var matchedSpecies = _V.species.Where(s => r.IsMatch(s.name)).ToArray(); foreach (Species s in matchedSpecies) - { s.SortName = r.Replace(s.name, replaceName); - } } // set each sortName of species without manual sortName to its speciesName @@ -405,7 +425,7 @@ private void ApplySpeciesOrdering() private void OrderSpeciesAndApplyCustomVariants() { ApplySpeciesOrdering(); - _V.speciesNames = _V.species.Select(s => s.name).ToList(); // ordered like the user configured it + _V.speciesNames = _V.species.Select(s => s.name).ToList(); // apply custom species variants var customSpeciesVariantsFilePath = FileService.GetJsonPath(FileService.CustomSpeciesVariants); diff --git a/ArkSavegameToolkit b/ArkSavegameToolkit index 08e06920..62b3ea9f 160000 --- a/ArkSavegameToolkit +++ b/ArkSavegameToolkit @@ -1 +1 @@ -Subproject commit 08e06920690269e4af4e83be4de6fd70804a0d5c +Subproject commit 62b3ea9f9eceb943aff5c5e80cdd15afa164bce9 diff --git a/setup-debug.iss b/setup-debug.iss deleted file mode 100644 index b4011a30..00000000 --- a/setup-debug.iss +++ /dev/null @@ -1,236 +0,0 @@ -; "Inno Download Plugin" from "Third-Party Files" is required -; http://www.jrsoftware.org/is3rdparty.php -; https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/ -#include -#include - -#define AppName "ARK Smart Breeding" -#define AppPublisher "cadon & friends" -#define AppURL "https://github.com/cadon/ARKStatsExtractor" -#define AppExeName "ARK Smart Breeding.exe" -#define ReleaseDir "ARKBreedingStats\bin\Debug" -#define ReleaseDirUpdater "ASB-Updater\bin\Debug" -#define OutputDir "_publish" -#define AppVersion GetFileVersion(ReleaseDir + "\" + AppExeName) - -[Setup] -; NOTE: The value of AppId uniquely identifies this application. -; Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{8DDA440C-714D-4BE6-AD7B-F549ABB1BB02} -AppName={#AppName} -AppVersion={#AppVersion} -;AppVerName={#AppName} {#AppVersion} -AppPublisher={#AppPublisher} -AppPublisherURL={#AppURL} -AppSupportURL={#AppURL} -AppUpdatesURL={#AppURL} -DefaultDirName={pf}\{#AppName} -DefaultGroupName={#AppName} -AllowNoIcons=yes -DisableWelcomePage=no -OutputDir={#OutputDir} -OutputBaseFilename=setup-debug-ArkSmartBreeding-{#AppVersion} -Compression=lzma -SolidCompression=yes -CloseApplications=yes -UninstallDisplayIcon={app}\{#AppExeName} - -[Messages] -WelcomeLabel2=This will install [name/ver] on your computer.%n%nIf you plan to run [name] as a portable version in a shared location (i.e. not in the system's Program Files folder), we recommend to use the zip file version instead of this installer. -de.WelcomeLabel2=Dieser Assistent wird jetzt [name/ver] auf Ihrem Computer installieren.%n%nWenn Sie planen [name] als portable Version in einem gemeinsam genutzten Verzeichnis (das heißt, außerhalb des Verzeichnisses für Programme) auszuführen, empfehlen wir anstelle dieses Installationsprogramms die Zip-Datei-Version zu nutzen. - -[CustomMessages] -DotNetFrameworkNeededCaption=.NET Framework 4.8 required -de.DotNetFrameworkNeededCaption=.NET Framework 4.8 benötigt -DotNetFrameworkNeededDescription=To run {#AppName} the .NET Framework 4.8 is required. -de.DotNetFrameworkNeededDescription=Um {#AppName} auszuführen wird .NET Framework 4.8 benötigt. -DotNetFrameworkNeededSubCaption=Check the box below to download and install .NET Framework 4.8. -de.DotNetFrameworkNeededSubCaption=Markieren Sie das folgende Kästchen, um .NET Framework 4.8 herunterzuladen und zu installieren. -DotNetFrameworkInstall=Download and install .NET Framework 4.8 -de.DotNetFrameworkInstall=Herunterladen und Installation von .NET Framework 4.8 -IDP_DownloadFailed=Download of .NET Framework 4.8 failed. .NET Framework 4.8 is required to run {#AppName}. -de.IDP_DownloadFailed=Herunterladen von .NET Framework 4.8 fehlgeschlagen. .NET Framework 4.8 wird benötigt um {#AppName} auszuführen. -IDP_RetryCancel=Click 'Retry' to try downloading the files again, or click 'Cancel' to terminate setup. -de.IDP_RetryCancel=Klicken Sie 'Wiederholen', um das Herunterladen der Dateien erneut zu versuchen, oder klicken Sie auf "Abbrechen", um die Installation abzubrechen. -InstallingDotNetFramework=Installing .NET Framework 4.8. This might take a few minutes... -de.InstallingDotNetFramework=Installiere .NET Framework 4.8. Das wird eine Weile dauern ... -DotNetFrameworkFailedToLaunch=Failed to launch .NET Framework Installer with error "%1". Please fix the error then run this installer again. -de.DotNetFrameworkFailedToLaunch=Starten des .NET Framework Installer fehlgeschlagen mit Fehler "%1". Bitte den Fehler beheben und dieses Installationsprogramm erneut ausführen. -DotNetFrameworkFailed1602=.NET Framework installation was cancelled. This installation can continue, but be aware that this application may not run unless the .NET Framework installation is completed successfully. -de.DotNetFrameworkFailed1602=Die .NET Framework Installation wurde abgebrochen. Diese Installation kann fortgesetzt werden. Beachten Sie jedoch, dass diese Anwendung möglicherweise nicht ausgeführt wird, bis die .NET Framework-Installation erfolgreich abgeschlossen wurde. -DotNetFrameworkFailed1603=A fatal error occurred while installing the .NET Framework. Please fix the error, then run the installer again. -de.DotNetFrameworkFailed1603=Ein schwerwiegender Fehler trat während der Installiion des .NET Frameworks auf. Bitte den Fehler beheben und dieses Installationsprogramm erneut ausführen. -DotNetFrameworkFailed5100=Your computer does not meet the requirements of the .NET Framework. -de.DotNetFrameworkFailed5100=Ihr Computer erfüllt nicht die Voraussetzungen für das .NET Framework. -DotNetFrameworkFailedOther=The .NET Framework installer exited with an unexpected status code "%1". Please review any other messages shown by the installer to determine whether the installation completed successfully, and abort this installation and fix the problem if it did not. -de.DotNetFrameworkFailedOther=Die .NET Framework Installation endete mit dem nicht erwarteten Statuscode "%1". Überprüfen Sie alle anderen vom Installationsprogramm angezeigten Meldungen, um festzustellen, ob die Installation erfolgreich abgeschlossen wurde, und falls nicht, brechen Sie die Installation ab und beheben Sie das Problem. -DownloadImages=Download images for some of the creatures. -de.DownloadImages=Bilder für einige der Dinos herunterladen. -CreatureImages=Additional creature images -de.CreatureImages=Zusätzliche Dino-Bilder -InstallImages=Installing additionally creature images -de.InstallImages=Installiere zusätzliche Dino-Bilder - -[Languages] -Name: "en"; MessagesFile: "compiler:Default.isl" -;Name: "fr"; MessagesFile: "compiler:Languages\French.isl" -Name: "de"; MessagesFile: "compiler:Languages\German.isl" - -[Tasks] -; images download is configured in function NextButtonClick, unzipping is run as powershell command -Name: "images"; Description: "{cm:DownloadImages}"; GroupDescription: "{cm:CreatureImages}"; Flags: checkedonce -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce - -[Files] -Source: "{#ReleaseDir}\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\de\*"; DestDir: "{app}\de\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\es\*"; DestDir: "{app}\es\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\fr\*"; DestDir: "{app}\fr\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\it\*"; DestDir: "{app}\it\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\ja\*"; DestDir: "{app}\ja\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\pl\*"; DestDir: "{app}\pl\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\pt-BR\*"; DestDir: "{app}\pt-BR\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\ru\*"; DestDir: "{app}\ru\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\zh\*"; DestDir: "{app}\zh\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\json\*.json"; DestDir: "{localappdata}\{#AppName}\json\"; Flags: ignoreversion -Source: "{#ReleaseDir}\json\values\values.json"; DestDir: "{localappdata}\{#AppName}\json\values\"; Flags: ignoreversion -Source: "{#ReleaseDir}\json\values\_manifest.json"; DestDir: "{localappdata}\{#AppName}\json\values\"; Flags: ignoreversion -Source: "{#ReleaseDir}\json\ocr\*.json"; DestDir: "{localappdata}\{#AppName}\json\ocr\"; Flags: ignoreversion -Source: "{#ReleaseDirUpdater}\asb-updater.exe"; DestDir: "{app}"; Flags: ignoreversion - -[Icons] -Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}" -Name: "{group}\{cm:ProgramOnTheWeb,{#AppName}}"; Filename: "{#AppURL}" -Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}" -Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon - -[Run] -Filename: "powershell.exe"; Parameters: "-nologo -noprofile -command ""& {{ Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('{tmp}\speciesImages.zip', '{localappdata}\{#AppName}\images\speciesImages\'); }"""; Flags: runminimized; StatusMsg: "{cm:InstallImages}"; Tasks: images -Filename: "{app}\{#AppExeName}"; Flags: nowait postinstall skipifsilent unchecked; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}" - -[UninstallRun] -Filename: "taskkill"; Parameters: "/im ""{#AppExeName}"""; Flags: runhidden - -[UninstallDelete] -Type: filesandordirs; Name: "{app}\images" - -[Code] -var - requiresRestart: boolean; - DotNetPage: TInputOptionWizardPage; - InstallDotNetFramework: Boolean; - -function DotNetFrameworkIsMissing(): Boolean; -var - bSuccess: Boolean; - regVersion: Cardinal; -begin - Result := True; - - bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion); - if (True = bSuccess) and (regVersion >= 528040) then begin - Result := False; - end; -end; - -procedure InitializeWizard; -begin - DotNetPage := CreateInputOptionPage(wpSelectTasks, ExpandConstant('{cm:DotNetFrameworkNeededCaption}'), - ExpandConstant('{cm:DotNetFrameworkNeededDescription}'), ExpandConstant('{cm:DotNetFrameworkNeededSubCaption}'), False, False); - DotNetPage.Add(ExpandConstant('{cm:DotNetFrameworkInstall}')); - DotNetPage.Values[0] := True; - - //WizardForm.WelcomeLabel2.Font.Style := [fsBold]; //Bold - WizardForm.WelcomeLabel2.Font.Color := clRed; // And red colour -end; - -function ShouldSkipPage(PageID: Integer): Boolean; -begin - if (PageID = DotNetPage.ID) and not DotNetFrameworkIsMissing() then - Result := True - else - Result := False; -end; - -function NextButtonClick(CurPageID: Integer): Boolean; -begin - if (CurPageID = DotNetPage.ID) and DotNetFrameworkIsMissing() then begin - if DotNetPage.Values[0] then begin - InstallDotNetFramework := True; - idpAddFile('https://go.microsoft.com/fwlink/?LinkId=2085155', ExpandConstant('{tmp}\NetFrameworkInstaller.exe')); - idpDownloadAfter(wpReady); - end; - end; - if (CurPageID = wpSelectTasks) then begin - if IsTaskSelected('images') then - idpAddFile('https://github.com/cadon/ARKStatsExtractor/raw/master/speciesImages/speciesImages.zip', ExpandConstant('{tmp}\speciesImages.zip')); - idpDownloadAfter(wpReady); - end; - Result := True; -end; - -function InstallFramework(): String; -var - StatusText: string; - ResultCode: Integer; -begin - StatusText := WizardForm.StatusLabel.Caption; - WizardForm.StatusLabel.Caption := CustomMessage('InstallingDotNetFramework'); - WizardForm.ProgressGauge.Style := npbstMarquee; - try - if not Exec(ExpandConstant('{tmp}\NetFrameworkInstaller.exe'), '/passive /norestart /showrmui /showfinalerror', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then - begin - Result := FmtMessage(CustomMessage('DotNetFrameworkFailedToLaunch'), [SysErrorMessage(resultCode)]); - end - else - begin - // See https://msdn.microsoft.com/en-us/library/ee942965(v=vs.110).aspx#return_codes - case resultCode of - 0: begin - // Successful - end; - 1602 : begin - MsgBox(CustomMessage('DotNetFrameworkFailed1602'), mbInformation, MB_OK); - end; - 1603: begin - Result := CustomMessage('DotNetFrameworkFailed1603'); - end; - 1641: begin - requiresRestart := True; - end; - 3010: begin - requiresRestart := True; - end; - 5100: begin - Result := CustomMessage('DotNetFrameworkFailed5100'); - end; - else begin - MsgBox(FmtMessage(CustomMessage('DotNetFrameworkFailedOther'), [IntToStr(resultCode)]), mbError, MB_OK); - end; - end; - end; - finally - WizardForm.StatusLabel.Caption := StatusText; - WizardForm.ProgressGauge.Style := npbstNormal; - - DeleteFile(ExpandConstant('{tmp}\NetFrameworkInstaller.exe')); - end; -end; - -function PrepareToInstall(var NeedsRestart: Boolean): String; -begin - // 'NeedsRestart' only has an effect if we return a non-empty string, thus aborting the installation. - // If the installers indicate that they want a restart, this should be done at the end of installation. - // Therefore we set the global 'restartRequired' if a restart is needed, and return this from NeedRestart() - - if InstallDotNetFramework then - begin - Result := InstallFramework(); - end; -end; - -function NeedRestart(): Boolean; -begin - Result := requiresRestart; -end; diff --git a/setup.iss b/setup.iss index e1952e8a..eaecc7b2 100644 --- a/setup.iss +++ b/setup.iss @@ -1,9 +1,3 @@ -; "Inno Download Plugin" from "Third-Party Files" is required -; http://www.jrsoftware.org/is3rdparty.php -; https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/ -#include -#include - #define AppName "ARK Smart Breeding" #define AppPublisher "cadon & friends" #define AppURL "https://github.com/cadon/ARKStatsExtractor" @@ -11,7 +5,7 @@ #define ReleaseDir "ARKBreedingStats\bin\Release" #define ReleaseDirUpdater "ASB-Updater\bin\Release" #define OutputDir "_publish" -#define AppVersion GetFileVersion(ReleaseDir + "\" + AppExeName) +#define AppVersion GetVersionNumbersString(ReleaseDir + "\" + AppExeName) [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -19,13 +13,13 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{8DDA440C-714D-4BE6-AD7B-F549ABB1BB02} AppName={#AppName} -AppVersion={#AppVersion} -;AppVerName={#AppName} {#AppVersion} +AppVersion={#AppVersion} +AppVerName={#AppName} {#AppVersion} AppPublisher={#AppPublisher} AppPublisherURL={#AppURL} AppSupportURL={#AppURL} AppUpdatesURL={#AppURL} -DefaultDirName={pf}\{#AppName} +DefaultDirName={commonpf}\{#AppName} DefaultGroupName={#AppName} AllowNoIcons=yes DisableWelcomePage=no @@ -38,43 +32,42 @@ UninstallDisplayIcon={app}\{#AppExeName} [Messages] WelcomeLabel2=This will install [name/ver] on your computer.%n%nIf you plan to run [name] as a portable version in a shared location (i.e. not in the system's Program Files folder), we recommend to use the zip file version instead of this installer. -de.WelcomeLabel2=Dieser Assistent wird jetzt [name/ver] auf Ihrem Computer installieren.%n%nWenn Sie planen [name] als portable Version in einem gemeinsam genutzten Verzeichnis (das heißt, außerhalb des Verzeichnisses für Programme) auszuführen, empfehlen wir anstelle dieses Installationsprogramms die Zip-Datei-Version zu nutzen. +de.WelcomeLabel2=Dieser Assistent wird jetzt [name/ver] auf Ihrem Computer installieren.%n%nWenn Sie planen [name] als portable Version in einem gemeinsam genutzten Verzeichnis (das heit, auerhalb des Verzeichnisses fr Programme) auszufhren, empfehlen wir anstelle dieses Installationsprogramms die Zip-Datei-Version zu nutzen. [CustomMessages] DotNetFrameworkNeededCaption=.NET Framework 4.8 required -de.DotNetFrameworkNeededCaption=.NET Framework 4.8 benötigt +de.DotNetFrameworkNeededCaption=.NET Framework 4.8 bentigt DotNetFrameworkNeededDescription=To run {#AppName} the .NET Framework 4.8 is required. -de.DotNetFrameworkNeededDescription=Um {#AppName} auszuführen wird .NET Framework 4.8 benötigt. +de.DotNetFrameworkNeededDescription=Um {#AppName} auszufhren wird .NET Framework 4.8 bentigt. DotNetFrameworkNeededSubCaption=Check the box below to download and install .NET Framework 4.8. -de.DotNetFrameworkNeededSubCaption=Markieren Sie das folgende Kästchen, um .NET Framework 4.8 herunterzuladen und zu installieren. +de.DotNetFrameworkNeededSubCaption=Markieren Sie das folgende Kstchen, um .NET Framework 4.8 herunterzuladen und zu installieren. DotNetFrameworkInstall=Download and install .NET Framework 4.8 de.DotNetFrameworkInstall=Herunterladen und Installation von .NET Framework 4.8 IDP_DownloadFailed=Download of .NET Framework 4.8 failed. .NET Framework 4.8 is required to run {#AppName}. -de.IDP_DownloadFailed=Herunterladen von .NET Framework 4.8 fehlgeschlagen. .NET Framework 4.8 wird benötigt um {#AppName} auszuführen. +de.IDP_DownloadFailed=Herunterladen von .NET Framework 4.8 fehlgeschlagen. .NET Framework 4.8 wird bentigt um {#AppName} auszufhren. IDP_RetryCancel=Click 'Retry' to try downloading the files again, or click 'Cancel' to terminate setup. de.IDP_RetryCancel=Klicken Sie 'Wiederholen', um das Herunterladen der Dateien erneut zu versuchen, oder klicken Sie auf "Abbrechen", um die Installation abzubrechen. InstallingDotNetFramework=Installing .NET Framework 4.8. This might take a few minutes... de.InstallingDotNetFramework=Installiere .NET Framework 4.8. Das wird eine Weile dauern ... DotNetFrameworkFailedToLaunch=Failed to launch .NET Framework Installer with error "%1". Please fix the error then run this installer again. -de.DotNetFrameworkFailedToLaunch=Starten des .NET Framework Installer fehlgeschlagen mit Fehler "%1". Bitte den Fehler beheben und dieses Installationsprogramm erneut ausführen. +de.DotNetFrameworkFailedToLaunch=Starten des .NET Framework Installer fehlgeschlagen mit Fehler "%1". Bitte den Fehler beheben und dieses Installationsprogramm erneut ausfhren. DotNetFrameworkFailed1602=.NET Framework installation was cancelled. This installation can continue, but be aware that this application may not run unless the .NET Framework installation is completed successfully. -de.DotNetFrameworkFailed1602=Die .NET Framework Installation wurde abgebrochen. Diese Installation kann fortgesetzt werden. Beachten Sie jedoch, dass diese Anwendung möglicherweise nicht ausgeführt wird, bis die .NET Framework-Installation erfolgreich abgeschlossen wurde. +de.DotNetFrameworkFailed1602=Die .NET Framework Installation wurde abgebrochen. Diese Installation kann fortgesetzt werden. Beachten Sie jedoch, dass diese Anwendung mglicherweise nicht ausgefhrt wird, bis die .NET Framework-Installation erfolgreich abgeschlossen wurde. DotNetFrameworkFailed1603=A fatal error occurred while installing the .NET Framework. Please fix the error, then run the installer again. -de.DotNetFrameworkFailed1603=Ein schwerwiegender Fehler trat während der Installiion des .NET Frameworks auf. Bitte den Fehler beheben und dieses Installationsprogramm erneut ausführen. +de.DotNetFrameworkFailed1603=Ein schwerwiegender Fehler trat whrend der Installiion des .NET Frameworks auf. Bitte den Fehler beheben und dieses Installationsprogramm erneut ausfhren. DotNetFrameworkFailed5100=Your computer does not meet the requirements of the .NET Framework. -de.DotNetFrameworkFailed5100=Ihr Computer erfüllt nicht die Voraussetzungen für das .NET Framework. +de.DotNetFrameworkFailed5100=Ihr Computer erfllt nicht die Voraussetzungen fr das .NET Framework. DotNetFrameworkFailedOther=The .NET Framework installer exited with an unexpected status code "%1". Please review any other messages shown by the installer to determine whether the installation completed successfully, and abort this installation and fix the problem if it did not. -de.DotNetFrameworkFailedOther=Die .NET Framework Installation endete mit dem nicht erwarteten Statuscode "%1". Überprüfen Sie alle anderen vom Installationsprogramm angezeigten Meldungen, um festzustellen, ob die Installation erfolgreich abgeschlossen wurde, und falls nicht, brechen Sie die Installation ab und beheben Sie das Problem. -DownloadImages=Download images for some of the species (~17 MB). -de.DownloadImages=Bilder für einige der Dinos herunterladen (~17 MB). +de.DotNetFrameworkFailedOther=Die .NET Framework Installation endete mit dem nicht erwarteten Statuscode "%1". berprfen Sie alle anderen vom Installationsprogramm angezeigten Meldungen, um festzustellen, ob die Installation erfolgreich abgeschlossen wurde, und falls nicht, brechen Sie die Installation ab und beheben Sie das Problem. +DownloadImages=Download images for some of the species (~21 MB). +de.DownloadImages=Bilder fr einige der Dinos herunterladen (~21 MB). CreatureImages=Additional creature images -de.CreatureImages=Zusätzliche Dino-Bilder +de.CreatureImages=Zustzliche Dino-Bilder InstallImages=Installing additionally creature images -de.InstallImages=Installiere zusätzliche Dino-Bilder +de.InstallImages=Installiere zustzliche Dino-Bilder [Languages] Name: "en"; MessagesFile: "compiler:Default.isl" -;Name: "fr"; MessagesFile: "compiler:Languages\French.isl" Name: "de"; MessagesFile: "compiler:Languages\German.isl" [Tasks] @@ -83,21 +76,21 @@ Name: "images"; Description: "{cm:DownloadImages}"; GroupDescription: "{cm:Creat Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce [Files] -Source: "{#ReleaseDir}\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\de\*"; DestDir: "{app}\de\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\es\*"; DestDir: "{app}\es\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\fr\*"; DestDir: "{app}\fr\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\it\*"; DestDir: "{app}\it\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\ja\*"; DestDir: "{app}\ja\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\pl\*"; DestDir: "{app}\pl\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\pt-BR\*"; DestDir: "{app}\pt-BR\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\ru\*"; DestDir: "{app}\ru\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" -Source: "{#ReleaseDir}\zh\*"; DestDir: "{app}\zh\"; Flags: ignoreversion; Excludes: "*.pdb,*.xml" +Source: "{#ReleaseDir}\*"; DestDir: "{app}"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion +Source: "{#ReleaseDir}\de\*"; DestDir: "{app}\de\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\es\*"; DestDir: "{app}\es\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\fr\*"; DestDir: "{app}\fr\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\it\*"; DestDir: "{app}\it\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\ja\*"; DestDir: "{app}\ja\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\pl\*"; DestDir: "{app}\pl\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\pt-BR\*"; DestDir: "{app}\pt-BR\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\ru\*"; DestDir: "{app}\ru\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist +Source: "{#ReleaseDir}\zh\*"; DestDir: "{app}\zh\"; Excludes: "*.pdb,*.xml"; Flags: ignoreversion skipifsourcedoesntexist Source: "{#ReleaseDir}\_manifest.json"; DestDir: "{localappdata}\{#AppName}\"; Flags: ignoreversion Source: "{#ReleaseDir}\json\*.json"; DestDir: "{localappdata}\{#AppName}\json\"; Flags: ignoreversion Source: "{#ReleaseDir}\json\values\values.json"; DestDir: "{localappdata}\{#AppName}\json\values\"; Flags: ignoreversion Source: "{#ReleaseDir}\json\values\_manifest.json"; DestDir: "{localappdata}\{#AppName}\json\values\"; Flags: ignoreversion -Source: "{#ReleaseDir}\json\ocr\*.json"; DestDir: "{localappdata}\{#AppName}\json\ocr\"; Flags: ignoreversion +Source: "{#ReleaseDir}\json\ocr\*.json"; DestDir: "{localappdata}\{#AppName}\json\ocr\"; Flags: ignoreversion skipifsourcedoesntexist Source: "{#ReleaseDirUpdater}\asb-updater.exe"; DestDir: "{app}"; Flags: ignoreversion [Icons] @@ -120,7 +113,9 @@ Type: filesandordirs; Name: "{app}\images" var requiresRestart: boolean; DotNetPage: TInputOptionWizardPage; - InstallDotNetFramework: Boolean; + InstallDotNetFramework: Boolean; + downloadFiles: Boolean; + DownloadPage: TDownloadWizardPage; function DotNetFrameworkIsMissing(): Boolean; var @@ -129,6 +124,8 @@ var begin Result := True; + // determine installed .NET version via + // https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#detect-net-framework-45-and-later-versions bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion); if (True = bSuccess) and (regVersion >= 528040) then begin Result := False; @@ -142,6 +139,9 @@ begin DotNetPage.Add(ExpandConstant('{cm:DotNetFrameworkInstall}')); DotNetPage.Values[0] := True; + DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil); + DownloadPage.Clear; + //WizardForm.WelcomeLabel2.Font.Style := [fsBold]; //Bold WizardForm.WelcomeLabel2.Font.Color := clRed; // And red colour end; @@ -157,16 +157,34 @@ end; function NextButtonClick(CurPageID: Integer): Boolean; begin if (CurPageID = DotNetPage.ID) and DotNetFrameworkIsMissing() then begin - if DotNetPage.Values[0] then begin + if DotNetPage.Values[0] then begin + DownloadPage.Add('https://go.microsoft.com/fwlink/?LinkId=2085155', 'NetFrameworkInstaller.exe', ''); InstallDotNetFramework := True; - idpAddFile('https://go.microsoft.com/fwlink/?LinkId=2085155', ExpandConstant('{tmp}\NetFrameworkInstaller.exe')); - idpDownloadAfter(wpReady); + downloadFiles := True; end; end; if (CurPageID = wpSelectTasks) then begin - if IsTaskSelected('images') then - idpAddFile('https://github.com/cadon/ARKStatsExtractor/raw/master/speciesImages/speciesImages.zip', ExpandConstant('{tmp}\speciesImages.zip')); - idpDownloadAfter(wpReady); + if WizardIsTaskSelected('images') then begin + DownloadPage.Add('{#AppURL}/raw/master/speciesImages/speciesImages.zip', 'speciesImages.zip', ''); + downloadFiles := True; + end; + end; + if (CurPageID = wpReady) and downloadFiles then begin + DownloadPage.Show; + try + try + DownloadPage.Download; // This downloads the files to {tmp} + Result := True; + except + if DownloadPage.AbortedByUser then + Log('Aborted by user.') + else + SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); + Result := False; + end; + finally + DownloadPage.Hide; + end; end; Result := True; end;