Skip to content

Commit 177d3ed

Browse files
committed
Merge branch 'dev'
2 parents ec76dfe + 6ea8486 commit 177d3ed

12 files changed

+76
-55
lines changed

ARKBreedingStats/App.config

+3
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,9 @@
532532
<setting name="OverlayInfoSize" serializeAs="String">
533533
<value>400, 800</value>
534534
</setting>
535+
<setting name="CopyNameToClipboardOnImport" serializeAs="String">
536+
<value>False</value>
537+
</setting>
535538
</ARKBreedingStats.Properties.Settings>
536539
</userSettings>
537540
</configuration>

ARKBreedingStats/AsbServer/Connection.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text.RegularExpressions;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using System.Windows;
910
using System.Windows.Forms.VisualStyles;
1011
using ARKBreedingStats.importExportGun;
1112
using ARKBreedingStats.Library;
@@ -300,7 +301,7 @@ public static string CreateNewToken()
300301
// use last character as check digit
301302
// checkSum % 15, add 1 (to avoid ambiguous 0), display as hex digit (range [1-9a-f])
302303
token[tokenLength - 1] = ((checkSum % 15) + 1).ToString("x")[0];
303-
304+
304305
return new string(token);
305306
}
306307

@@ -310,5 +311,17 @@ public static string CreateNewToken()
310311
public static string TokenStringForDisplay(string token) => Properties.Settings.Default.StreamerMode ? "****" : token;
311312

312313
public static bool IsCurrentlyListening => _lastCancellationTokenSource?.IsCancellationRequested == false;
314+
315+
/// <summary>
316+
/// If the token is in the clipboard, remove it from there, when the user is not expecting it to be there.
317+
/// </summary>
318+
public static void ClearTokenFromClipboard()
319+
{
320+
var clipboardText = Clipboard.GetText();
321+
if (!string.IsNullOrEmpty(clipboardText) && clipboardText == Properties.Settings.Default.ExportServerToken)
322+
{
323+
Clipboard.SetText(string.Empty);
324+
}
325+
}
313326
}
314327
}

ARKBreedingStats/Form1.exportGun.cs

+4-9
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ private void AsbServerDataSent(ProgressReportAsbServer data)
122122

123123
var addCreature = Properties.Settings.Default.OnAutoImportAddToLibrary;
124124
var gotoLibraryTab = addCreature && Properties.Settings.Default.AutoImportGotoLibraryAfterSuccess;
125-
if (addCreature)
126-
{
127-
DetermineLevelStatusAndSoundFeedback(creature, Properties.Settings.Default.PlaySoundOnAutoImport);
128125

129-
SetNameOfImportedCreature(creature, null, out _,
126+
DetermineLevelStatusAndSoundFeedback(creature, Properties.Settings.Default.PlaySoundOnAutoImport);
127+
SetNameOfImportedCreature(creature, null, out _,
130128
_creatureCollection.creatures.FirstOrDefault(c => c.guid == creature.guid));
131129

130+
if (addCreature)
131+
{
132132
data.TaskNameGenerated?.SetResult(creature.name);
133133

134134
_creatureCollection.MergeCreatureList(new[] { creature }, true);
@@ -137,11 +137,6 @@ private void AsbServerDataSent(ProgressReportAsbServer data)
137137
else
138138
{
139139
SetCreatureValuesLevelsAndInfoToExtractor(creature);
140-
141-
if (Properties.Settings.Default.PlaySoundOnAutoImport)
142-
{
143-
SoundFeedback.BeepSignalCurrentLevelFlags(IsCreatureAlreadyInLibrary(creature.guid, creature.ArkId, out _));
144-
}
145140
}
146141

147142
if (resultText == null)

ARKBreedingStats/Form1.extractor.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,7 @@ private void CopyExtractionToClipboard()
980980
/// </summary>
981981
private bool GenerateCreatureNameAndCopyNameToClipboardIfSet(Creature alreadyExistingCreature)
982982
{
983+
var nameWasApplied = false;
983984
if (Properties.Settings.Default.applyNamePatternOnAutoImportAlways
984985
|| (Properties.Settings.Default.applyNamePatternOnImportIfEmptyName
985986
&& string.IsNullOrEmpty(creatureInfoInputExtractor.CreatureName))
@@ -988,10 +989,9 @@ private bool GenerateCreatureNameAndCopyNameToClipboardIfSet(Creature alreadyExi
988989
)
989990
{
990991
CreatureInfoInput_CreatureDataRequested(creatureInfoInputExtractor, false, false, false, 0, alreadyExistingCreature);
991-
return CopyCreatureNameToClipboardOnImportIfSetting(creatureInfoInputExtractor.CreatureName);
992+
nameWasApplied = true;
992993
}
993-
994-
return false;
994+
return CopyCreatureNameToClipboardOnImportIfSetting(creatureInfoInputExtractor.CreatureName, nameWasApplied);
995995
}
996996

997997
/// <summary>

ARKBreedingStats/Form1.importExported.cs

+15-8
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ private Creature ImportExportedAddIfPossible(string filePath)
315315
private bool SetNameOfImportedCreature(Creature creature, Creature[] creaturesOfSpeciesIn, out Creature[] creaturesOfSpecies, Creature alreadyExistingCreature, int totalCreatureCount = -1)
316316
{
317317
creaturesOfSpecies = creaturesOfSpeciesIn;
318+
var nameWasApplied = false;
318319
if (ShouldNamingPatternBeApplied(creature, alreadyExistingCreature))
319320
{
320321
// don't overwrite existing ASB creature name with empty ingame name
@@ -338,10 +339,10 @@ private bool SetNameOfImportedCreature(Creature creature, Creature[] creaturesOf
338339
alreadyExistingCreature.name = creature.name; // if alreadyExistingCreature was already updated and creature is not used anymore make sure name is not lost
339340
}
340341

341-
return CopyCreatureNameToClipboardOnImportIfSetting(creature.name);
342+
nameWasApplied = true;
342343
}
343344

344-
return false;
345+
return CopyCreatureNameToClipboardOnImportIfSetting(creature.name, nameWasApplied);
345346
}
346347

347348
/// <summary>
@@ -357,13 +358,19 @@ private bool ShouldNamingPatternBeApplied(Creature creature, Creature alreadyExi
357358
/// <summary>
358359
/// Copies name to clipboard if the according setting is enabled. Returns true if copied.
359360
/// </summary>
360-
private bool CopyCreatureNameToClipboardOnImportIfSetting(string creatureName)
361+
private bool CopyCreatureNameToClipboardOnImportIfSetting(string creatureName, bool nameWasJustApplied)
361362
{
362-
if (!Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied) return false;
363-
Clipboard.SetText(string.IsNullOrEmpty(creatureName)
364-
? "<no name>"
365-
: creatureName);
366-
return true;
363+
if (Properties.Settings.Default.CopyNameToClipboardOnImport
364+
|| (nameWasJustApplied && Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied))
365+
{
366+
Clipboard.SetText(string.IsNullOrEmpty(creatureName)
367+
? "<no name>"
368+
: creatureName);
369+
return true;
370+
}
371+
372+
AsbServer.Connection.ClearTokenFromClipboard();
373+
return false;
367374
}
368375

369376
/// <summary>

ARKBreedingStats/Properties/AssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
// Revision
3131
//
3232
[assembly: AssemblyVersion("1.0.0.0")]
33-
[assembly: AssemblyFileVersion("0.61.0.0")]
33+
[assembly: AssemblyFileVersion("0.61.1.0")]
3434
[assembly: NeutralResourcesLanguage("en")]
3535

ARKBreedingStats/Properties/Settings.Designer.cs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ARKBreedingStats/Properties/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -599,5 +599,8 @@
599599
<Setting Name="OverlayInfoSize" Type="System.Drawing.Size" Scope="User">
600600
<Value Profile="(Default)">400, 800</Value>
601601
</Setting>
602+
<Setting Name="CopyNameToClipboardOnImport" Type="System.Boolean" Scope="User">
603+
<Value Profile="(Default)">False</Value>
604+
</Setting>
602605
</Settings>
603606
</SettingsFile>

ARKBreedingStats/_manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ARK Smart Breeding": {
55
"Id": "ARK Smart Breeding",
66
"Category": "main",
7-
"version": "0.61.0.0"
7+
"version": "0.61.1.0"
88
},
99
"SpeciesColorImages": {
1010
"Id": "SpeciesColorImages",

ARKBreedingStats/settings/Settings.Designer.cs

+18-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ARKBreedingStats/settings/Settings.cs

+2
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ private void LoadSettings(CreatureCollection cc)
399399
cbApplyNamePatternOnImportOnEmptyNames.Checked = Properties.Settings.Default.applyNamePatternOnImportIfEmptyName;
400400
cbApplyNamePatternOnImportOnNewCreatures.Checked = Properties.Settings.Default.applyNamePatternOnAutoImportForNewCreatures;
401401
cbCopyPatternNameToClipboard.Checked = Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied;
402+
CbCopyNameToClipboardOnImport.Checked = Properties.Settings.Default.CopyNameToClipboardOnImport;
402403
cbAutoImportExported.Checked = Properties.Settings.Default.AutoImportExportedCreatures;
403404
CbAutoExtractAddToLibrary.Checked = Properties.Settings.Default.OnAutoImportAddToLibrary;
404405
cbPlaySoundOnAutomaticImport.Checked = Properties.Settings.Default.PlaySoundOnAutoImport;
@@ -662,6 +663,7 @@ private void SaveSettings()
662663
Properties.Settings.Default.applyNamePatternOnImportIfEmptyName = cbApplyNamePatternOnImportOnEmptyNames.Checked;
663664
Properties.Settings.Default.applyNamePatternOnAutoImportForNewCreatures = cbApplyNamePatternOnImportOnNewCreatures.Checked;
664665
Properties.Settings.Default.copyNameToClipboardOnImportWhenAutoNameApplied = cbCopyPatternNameToClipboard.Checked;
666+
Properties.Settings.Default.CopyNameToClipboardOnImport = CbCopyNameToClipboardOnImport.Checked;
665667
Properties.Settings.Default.AutoImportExportedCreatures = cbAutoImportExported.Checked;
666668
Properties.Settings.Default.OnAutoImportAddToLibrary = CbAutoExtractAddToLibrary.Checked;
667669
Properties.Settings.Default.PlaySoundOnAutoImport = cbPlaySoundOnAutomaticImport.Checked;

ARKBreedingStats/settings/Settings.resx

-27
Original file line numberDiff line numberDiff line change
@@ -136,30 +136,6 @@ If you set the according files below, you can start the process automatically fr
136136
<metadata name="aTImportFileLocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
137137
<value>17, 17</value>
138138
</metadata>
139-
<metadata name="dgvFileLocation_Change.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
140-
<value>True</value>
141-
</metadata>
142-
<metadata name="ImportWithQuickImport.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
143-
<value>True</value>
144-
</metadata>
145-
<metadata name="dgvFileLocation_Delete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
146-
<value>True</value>
147-
</metadata>
148-
<metadata name="aTImportFileLocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
149-
<value>17, 17</value>
150-
</metadata>
151-
<metadata name="dgvExportFolderChange.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
152-
<value>True</value>
153-
</metadata>
154-
<metadata name="dgvExportFolderDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
155-
<value>True</value>
156-
</metadata>
157-
<metadata name="dgvExportMakeDefault.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
158-
<value>True</value>
159-
</metadata>
160-
<metadata name="aTExportFolderLocationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
161-
<value>262, 17</value>
162-
</metadata>
163139
<metadata name="dgvExportFolderChange.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
164140
<value>True</value>
165141
</metadata>
@@ -189,9 +165,6 @@ The window-mode "Fullscreen-Windowed" should be set ingame.</value>
189165
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
190166
<value>526, 17</value>
191167
</metadata>
192-
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
193-
<value>647, 17</value>
194-
</metadata>
195168
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
196169
<value>73</value>
197170
</metadata>

0 commit comments

Comments
 (0)