Skip to content

Commit

Permalink
tweaked fileWatcher. fixed colorUpdating. Tweaked settings info.
Browse files Browse the repository at this point in the history
  • Loading branch information
cadaei committed Dec 24, 2019
1 parent 17147f8 commit 876964e
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 22 deletions.
5 changes: 5 additions & 0 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,11 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
timerGlobal.Dispose();
}

/// <summary>
/// Sets the text at the top to display infos.
/// </summary>
/// <param name="text"></param>
/// <param name="icon"></param>
private void SetMessageLabelText(string text = "", MessageBoxIcon icon = MessageBoxIcon.None)
{
lbLibrarySelectionInfo.Text = text;
Expand Down
6 changes: 5 additions & 1 deletion ARKBreedingStats/Form1.importExported.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,18 @@ private void ExportedCreatureList_CopyValuesToExtractor(importExported.ExportedC
}
}

private void ImportExportedAddIfPossible_WatcherThread(string filePath)
private void ImportExportedAddIfPossible_WatcherThread(string filePath, importExported.FileWatcherExports fwe)
{
fwe.Watching = false;
// wait a moment until the file is readable. why is this necessary? blocked by fileWatcher?
System.Threading.Thread.Sleep(200);

// moving to the archived folder can trigger another fileWatcherEvent, first check if the file is still there
if (File.Exists(filePath))
// filewatcher is on another thread, invoke ui-thread to work with ui
Invoke(new Action(delegate () { ImportExportedAddIfPossible(filePath); }));

fwe.Watching = true;
}

/// <summary>
Expand All @@ -134,6 +137,7 @@ private void ImportExportedAddIfPossible(string filePath)
|| (alreadyExists && extractor.validResults))
{
AddCreatureToCollection(true, goToLibraryTab: false);
SetMessageLabelText($"Successful {(alreadyExists ? "updated" : "added")} creature of the exported file\n" + filePath);
added = true;
}

Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.34.7.2")]
[assembly: AssemblyFileVersion("0.35.0.0")]
[assembly: NeutralResourcesLanguage("en")]

6 changes: 3 additions & 3 deletions ARKBreedingStats/importExported/FileWatcherExports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace ARKBreedingStats.importExported
class FileWatcherExports
{
private FileSystemWatcher fileWatcherExport;
public FileWatcherExports(string folderToWatch, Action<string> callbackNewFile, bool watching)
public FileWatcherExports(string folderToWatch, Action<string, FileWatcherExports> callbackNewFile, bool watching)
{
fileWatcherExport = new FileSystemWatcher()
{
Filter = "*.ini",
NotifyFilter = NotifyFilters.LastWrite
};
fileWatcherExport.Created += (sender, e) => callbackNewFile(e.FullPath);
fileWatcherExport.Changed += (sender, e) => callbackNewFile(e.FullPath);
fileWatcherExport.Created += (sender, e) => callbackNewFile(e.FullPath, this);
fileWatcherExport.Changed += (sender, e) => callbackNewFile(e.FullPath, this);
SetWatchFolder(folderToWatch, watching);
}

Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/library/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ public bool MergeCreatureList(List<Creature> creaturesToMerge, bool update = fal
old.fatherGuid = creature.fatherGuid;
old.fatherName = creature.fatherName;
}
old.colors = creature.colors;
}

if (recalculate)
Expand Down
30 changes: 21 additions & 9 deletions ARKBreedingStats/settings/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 26 additions & 8 deletions ARKBreedingStats/settings/Settings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@
It does only work with the resolutions 1920×1080 and 1680×1050, and sometimes does make mistakes.
It works with the window-mode "Fullscreen-Windowed" and sometimes does not work when multiple screens are used.</value>
</data>
<data name="label25.Text" xml:space="preserve">
<value>In ARK you can export a creature (hold use while looking at a creature, then choose "Options" - "Export" from the wheel).

The exported creatures are saved as a file. Select the folder to import these files. Usually the folder is
...\Steam\steamapps\common\ARK\ShooterGame\Saved\DinoExports\&lt;ID&gt;

The first entry is the default export folder and is used for 'Import last exported' and the Auto Import.</value>
</data>
<metadata name="dgvFileLocation_Change.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dgvFileLocation_Delete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="aTImportFileLocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dgvFileLocation_Change.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand All @@ -144,12 +161,13 @@ If you set the according files below, you can start the process automatically fr
<metadata name="aTExportFolderLocationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<data name="label25.Text" xml:space="preserve">
<value>In ARK you can export a creature (hold use while looking at a creature, then choose "Options" - "Export" from the wheel).

The exported creatures are saved as a file. Select the folder to import these files. Usually the folder is
...\Steam\steamapps\common\ARK\ShooterGame\Saved\DinoExports\&lt;ID&gt;

The first entry is the default export folder and is used for 'Import last exported' and the Auto Import.</value>
</data>
<metadata name="dgvExportFolderChange.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dgvExportFolderDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="aTExportFolderLocationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
</root>

0 comments on commit 876964e

Please sign in to comment.