diff --git a/ARKBreedingStats/App.config b/ARKBreedingStats/App.config index 179ae62f..0cb1d070 100644 --- a/ARKBreedingStats/App.config +++ b/ARKBreedingStats/App.config @@ -532,6 +532,9 @@ 400, 800 + + False + diff --git a/ARKBreedingStats/AsbServer/Connection.cs b/ARKBreedingStats/AsbServer/Connection.cs index f1dc0891..f551ab23 100644 --- a/ARKBreedingStats/AsbServer/Connection.cs +++ b/ARKBreedingStats/AsbServer/Connection.cs @@ -6,6 +6,7 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using System.Windows; using System.Windows.Forms.VisualStyles; using ARKBreedingStats.importExportGun; using ARKBreedingStats.Library; @@ -300,7 +301,7 @@ public static string CreateNewToken() // use last character as check digit // checkSum % 15, add 1 (to avoid ambiguous 0), display as hex digit (range [1-9a-f]) token[tokenLength - 1] = ((checkSum % 15) + 1).ToString("x")[0]; - + return new string(token); } @@ -310,5 +311,17 @@ public static string CreateNewToken() public static string TokenStringForDisplay(string token) => Properties.Settings.Default.StreamerMode ? "****" : token; public static bool IsCurrentlyListening => _lastCancellationTokenSource?.IsCancellationRequested == false; + + /// + /// If the token is in the clipboard, remove it from there, when the user is not expecting it to be there. + /// + public static void ClearTokenFromClipboard() + { + var clipboardText = Clipboard.GetText(); + if (!string.IsNullOrEmpty(clipboardText) && clipboardText == Properties.Settings.Default.ExportServerToken) + { + Clipboard.SetText(string.Empty); + } + } } } diff --git a/ARKBreedingStats/Form1.exportGun.cs b/ARKBreedingStats/Form1.exportGun.cs index 69727ca4..43fa0fbb 100644 --- a/ARKBreedingStats/Form1.exportGun.cs +++ b/ARKBreedingStats/Form1.exportGun.cs @@ -122,13 +122,13 @@ private void AsbServerDataSent(ProgressReportAsbServer data) var addCreature = Properties.Settings.Default.OnAutoImportAddToLibrary; var gotoLibraryTab = addCreature && Properties.Settings.Default.AutoImportGotoLibraryAfterSuccess; - if (addCreature) - { - DetermineLevelStatusAndSoundFeedback(creature, Properties.Settings.Default.PlaySoundOnAutoImport); - SetNameOfImportedCreature(creature, null, out _, + DetermineLevelStatusAndSoundFeedback(creature, Properties.Settings.Default.PlaySoundOnAutoImport); + SetNameOfImportedCreature(creature, null, out _, _creatureCollection.creatures.FirstOrDefault(c => c.guid == creature.guid)); + if (addCreature) + { data.TaskNameGenerated?.SetResult(creature.name); _creatureCollection.MergeCreatureList(new[] { creature }, true); @@ -137,11 +137,6 @@ private void AsbServerDataSent(ProgressReportAsbServer data) else { SetCreatureValuesLevelsAndInfoToExtractor(creature); - - if (Properties.Settings.Default.PlaySoundOnAutoImport) - { - SoundFeedback.BeepSignalCurrentLevelFlags(IsCreatureAlreadyInLibrary(creature.guid, creature.ArkId, out _)); - } } if (resultText == null) diff --git a/ARKBreedingStats/Form1.extractor.cs b/ARKBreedingStats/Form1.extractor.cs index 96c36b49..a13f2c43 100644 --- a/ARKBreedingStats/Form1.extractor.cs +++ b/ARKBreedingStats/Form1.extractor.cs @@ -980,6 +980,7 @@ private void CopyExtractionToClipboard() /// private bool GenerateCreatureNameAndCopyNameToClipboardIfSet(Creature alreadyExistingCreature) { + var nameWasApplied = false; if (Properties.Settings.Default.applyNamePatternOnAutoImportAlways || (Properties.Settings.Default.applyNamePatternOnImportIfEmptyName && string.IsNullOrEmpty(creatureInfoInputExtractor.CreatureName)) @@ -988,10 +989,9 @@ private bool GenerateCreatureNameAndCopyNameToClipboardIfSet(Creature alreadyExi ) { CreatureInfoInput_CreatureDataRequested(creatureInfoInputExtractor, false, false, false, 0, alreadyExistingCreature); - return CopyCreatureNameToClipboardOnImportIfSetting(creatureInfoInputExtractor.CreatureName); + nameWasApplied = true; } - - return false; + return CopyCreatureNameToClipboardOnImportIfSetting(creatureInfoInputExtractor.CreatureName, nameWasApplied); } /// diff --git a/ARKBreedingStats/Form1.importExported.cs b/ARKBreedingStats/Form1.importExported.cs index c63be529..1a4fbb2e 100644 --- a/ARKBreedingStats/Form1.importExported.cs +++ b/ARKBreedingStats/Form1.importExported.cs @@ -315,6 +315,7 @@ private Creature ImportExportedAddIfPossible(string filePath) private bool SetNameOfImportedCreature(Creature creature, Creature[] creaturesOfSpeciesIn, out Creature[] creaturesOfSpecies, Creature alreadyExistingCreature, int totalCreatureCount = -1) { creaturesOfSpecies = creaturesOfSpeciesIn; + var nameWasApplied = false; if (ShouldNamingPatternBeApplied(creature, alreadyExistingCreature)) { // don't overwrite existing ASB creature name with empty ingame name @@ -338,10 +339,10 @@ private bool SetNameOfImportedCreature(Creature creature, Creature[] creaturesOf alreadyExistingCreature.name = creature.name; // if alreadyExistingCreature was already updated and creature is not used anymore make sure name is not lost } - return CopyCreatureNameToClipboardOnImportIfSetting(creature.name); + nameWasApplied = true; } - return false; + return CopyCreatureNameToClipboardOnImportIfSetting(creature.name, nameWasApplied); } /// @@ -357,13 +358,19 @@ private bool ShouldNamingPatternBeApplied(Creature creature, Creature alreadyExi /// /// Copies name to clipboard if the according setting is enabled. Returns true if copied. /// - private bool CopyCreatureNameToClipboardOnImportIfSetting(string creatureName) + private bool CopyCreatureNameToClipboardOnImportIfSetting(string creatureName, bool nameWasJustApplied) { - if (!Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied) return false; - Clipboard.SetText(string.IsNullOrEmpty(creatureName) - ? "" - : creatureName); - return true; + if (Properties.Settings.Default.CopyNameToClipboardOnImport + || (nameWasJustApplied && Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied)) + { + Clipboard.SetText(string.IsNullOrEmpty(creatureName) + ? "" + : creatureName); + return true; + } + + AsbServer.Connection.ClearTokenFromClipboard(); + return false; } /// diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index da125186..73ee5dec 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.61.0.0")] +[assembly: AssemblyFileVersion("0.61.1.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/Properties/Settings.Designer.cs b/ARKBreedingStats/Properties/Settings.Designer.cs index cee2d107..8f55f315 100644 --- a/ARKBreedingStats/Properties/Settings.Designer.cs +++ b/ARKBreedingStats/Properties/Settings.Designer.cs @@ -2385,5 +2385,17 @@ public string ManualSaveGameImportFolder { this["OverlayInfoSize"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool CopyNameToClipboardOnImport { + get { + return ((bool)(this["CopyNameToClipboardOnImport"])); + } + set { + this["CopyNameToClipboardOnImport"] = value; + } + } } } diff --git a/ARKBreedingStats/Properties/Settings.settings b/ARKBreedingStats/Properties/Settings.settings index b2dc04ee..395d7ba6 100644 --- a/ARKBreedingStats/Properties/Settings.settings +++ b/ARKBreedingStats/Properties/Settings.settings @@ -599,5 +599,8 @@ 400, 800 + + False + \ No newline at end of file diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 7b758e9d..d3cb9044 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.61.0.0" + "version": "0.61.1.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/settings/Settings.Designer.cs b/ARKBreedingStats/settings/Settings.Designer.cs index 31ff8ef4..1907c539 100644 --- a/ARKBreedingStats/settings/Settings.Designer.cs +++ b/ARKBreedingStats/settings/Settings.Designer.cs @@ -372,6 +372,7 @@ private void InitializeComponent() this.panel1 = new System.Windows.Forms.Panel(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.CbCopyNameToClipboardOnImport = new System.Windows.Forms.CheckBox(); this.groupBoxMultiplier.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrain)).BeginInit(); @@ -3661,6 +3662,7 @@ private void InitializeComponent() // // groupBox21 // + this.groupBox21.Controls.Add(this.CbCopyNameToClipboardOnImport); this.groupBox21.Controls.Add(this.CbApplyNamingPatternOnImportAlways); this.groupBox21.Controls.Add(this.cbApplyNamePatternOnImportOnNewCreatures); this.groupBox21.Controls.Add(this.label41); @@ -3668,7 +3670,7 @@ private void InitializeComponent() this.groupBox21.Controls.Add(this.cbApplyNamePatternOnImportOnEmptyNames); this.groupBox21.Location = new System.Drawing.Point(6, 508); this.groupBox21.Name = "groupBox21"; - this.groupBox21.Size = new System.Drawing.Size(318, 162); + this.groupBox21.Size = new System.Drawing.Size(318, 178); this.groupBox21.TabIndex = 5; this.groupBox21.TabStop = false; this.groupBox21.Text = "Auto naming on import"; @@ -3952,7 +3954,7 @@ private void InitializeComponent() this.customSCCustom.Location = new System.Drawing.Point(6, 139); this.customSCCustom.Name = "customSCCustom"; this.customSCCustom.Size = new System.Drawing.Size(401, 23); - this.customSCCustom.SoundFile = ""; + this.customSCCustom.SoundFile = null; this.customSCCustom.TabIndex = 4; // // customSCWakeup @@ -3960,7 +3962,7 @@ private void InitializeComponent() this.customSCWakeup.Location = new System.Drawing.Point(6, 81); this.customSCWakeup.Name = "customSCWakeup"; this.customSCWakeup.Size = new System.Drawing.Size(401, 23); - this.customSCWakeup.SoundFile = null; + this.customSCWakeup.SoundFile = ""; this.customSCWakeup.TabIndex = 2; // // customSCBirth @@ -3968,7 +3970,7 @@ private void InitializeComponent() this.customSCBirth.Location = new System.Drawing.Point(6, 110); this.customSCBirth.Name = "customSCBirth"; this.customSCBirth.Size = new System.Drawing.Size(401, 23); - this.customSCBirth.SoundFile = null; + this.customSCBirth.SoundFile = ""; this.customSCBirth.TabIndex = 3; // // customSCStarving @@ -3976,7 +3978,7 @@ private void InitializeComponent() this.customSCStarving.Location = new System.Drawing.Point(6, 52); this.customSCStarving.Name = "customSCStarving"; this.customSCStarving.Size = new System.Drawing.Size(401, 23); - this.customSCStarving.SoundFile = ""; + this.customSCStarving.SoundFile = null; this.customSCStarving.TabIndex = 1; // // label20 @@ -4793,6 +4795,16 @@ private void InitializeComponent() this.panel1.Size = new System.Drawing.Size(758, 30); this.panel1.TabIndex = 12; // + // CbCopyNameToClipboardOnImport + // + this.CbCopyNameToClipboardOnImport.AutoSize = true; + this.CbCopyNameToClipboardOnImport.Location = new System.Drawing.Point(6, 147); + this.CbCopyNameToClipboardOnImport.Name = "CbCopyNameToClipboardOnImport"; + this.CbCopyNameToClipboardOnImport.Size = new System.Drawing.Size(218, 17); + this.CbCopyNameToClipboardOnImport.TabIndex = 5; + this.CbCopyNameToClipboardOnImport.Text = "Always copy name to clipboard on import"; + this.CbCopyNameToClipboardOnImport.UseVisualStyleBackColor = true; + // // Settings // this.AcceptButton = this.buttonOK; @@ -5310,5 +5322,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label15; private uiControls.Nud nudOverlayInfoHeight; private uiControls.Nud nudOverlayInfoWidth; + private System.Windows.Forms.CheckBox CbCopyNameToClipboardOnImport; } } \ No newline at end of file diff --git a/ARKBreedingStats/settings/Settings.cs b/ARKBreedingStats/settings/Settings.cs index f65134d7..c06fdcf6 100644 --- a/ARKBreedingStats/settings/Settings.cs +++ b/ARKBreedingStats/settings/Settings.cs @@ -399,6 +399,7 @@ private void LoadSettings(CreatureCollection cc) cbApplyNamePatternOnImportOnEmptyNames.Checked = Properties.Settings.Default.applyNamePatternOnImportIfEmptyName; cbApplyNamePatternOnImportOnNewCreatures.Checked = Properties.Settings.Default.applyNamePatternOnAutoImportForNewCreatures; cbCopyPatternNameToClipboard.Checked = Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied; + CbCopyNameToClipboardOnImport.Checked = Properties.Settings.Default.CopyNameToClipboardOnImport; cbAutoImportExported.Checked = Properties.Settings.Default.AutoImportExportedCreatures; CbAutoExtractAddToLibrary.Checked = Properties.Settings.Default.OnAutoImportAddToLibrary; cbPlaySoundOnAutomaticImport.Checked = Properties.Settings.Default.PlaySoundOnAutoImport; @@ -662,6 +663,7 @@ private void SaveSettings() Properties.Settings.Default.applyNamePatternOnImportIfEmptyName = cbApplyNamePatternOnImportOnEmptyNames.Checked; Properties.Settings.Default.applyNamePatternOnAutoImportForNewCreatures = cbApplyNamePatternOnImportOnNewCreatures.Checked; Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied = cbCopyPatternNameToClipboard.Checked; + Properties.Settings.Default.CopyNameToClipboardOnImport = CbCopyNameToClipboardOnImport.Checked; Properties.Settings.Default.AutoImportExportedCreatures = cbAutoImportExported.Checked; Properties.Settings.Default.OnAutoImportAddToLibrary = CbAutoExtractAddToLibrary.Checked; Properties.Settings.Default.PlaySoundOnAutoImport = cbPlaySoundOnAutomaticImport.Checked; diff --git a/ARKBreedingStats/settings/Settings.resx b/ARKBreedingStats/settings/Settings.resx index 4a29f8fc..9bd029ab 100644 --- a/ARKBreedingStats/settings/Settings.resx +++ b/ARKBreedingStats/settings/Settings.resx @@ -136,30 +136,6 @@ If you set the according files below, you can start the process automatically fr 17, 17 - - True - - - True - - - True - - - 17, 17 - - - True - - - True - - - True - - - 262, 17 - True @@ -189,9 +165,6 @@ The window-mode "Fullscreen-Windowed" should be set ingame. 526, 17 - - 647, 17 - 73