Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Feb 21, 2022
2 parents 0ca5a85 + b765055 commit d186dc9
Show file tree
Hide file tree
Showing 34 changed files with 1,966 additions and 166 deletions.
4 changes: 4 additions & 0 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@
<None Include="Resources\failure.wav" />
<None Include="Resources\newtopstat.wav" />
<None Include="Resources\indifferent.wav" />
<None Include="json\variantsDefaultUnselected.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="_manifest.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>_manifest.json</LastGenOutput>
Expand All @@ -658,6 +661,7 @@
<SubType>Designer</SubType>
<LastGenOutput>strings.ja.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="local\strings.pt-br.resx" />
<EmbeddedResource Include="local\strings.ru.resx" />
<EmbeddedResource Include="local\strings.pl.resx" />
<EmbeddedResource Include="ocr\PatternMatching\RecognitionTrainingForm.resx">
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/AboutBox1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
* Chinese by MicheaBoab
* Russian by SoulSuspect
* Polish by alex4401
* Japanese by maririyuzu";
* Japanese by maririyuzu
* Portuguese Brazilian by llbranco";
}
}
6 changes: 6 additions & 0 deletions ARKBreedingStats/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@
<setting name="BreedingPlanDontSuggestOverLimitOffspring" serializeAs="String">
<value>False</value>
</setting>
<setting name="PlayerListSortColumn" serializeAs="String">
<value>0</value>
</setting>
<setting name="PlayerListSortAsc" serializeAs="String">
<value>False</value>
</setting>
</ARKBreedingStats.Properties.Settings>
</userSettings>
</configuration>
3 changes: 2 additions & 1 deletion ARKBreedingStats/FileSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void SavingStarts()
public void SavingEnds()
{
_lastUpdated = DateTime.Now;
_fileWatcher.EnableRaisingEvents = true;
if (!string.IsNullOrEmpty(_currentFile))
_fileWatcher.EnableRaisingEvents = true;
}

private void UpdateProperties()
Expand Down
35 changes: 20 additions & 15 deletions ARKBreedingStats/Form1.Designer.cs

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

4 changes: 3 additions & 1 deletion ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ private void Form1_Load(object sender, EventArgs e)
// Load column-widths, display-indices and sort-order of the listViewLibrary
LoadListViewSettings(listViewLibrary, "columnWidths", "libraryColumnDisplayIndices", "listViewSortCol",
"listViewSortAsc");
LoadListViewSettings(tribesControl1.ListViewPlayers, "PlayerListColumnWidths", "PlayerListColumnDisplayIndices", "PlayerListSortColumn", "PlayerListSortAsc");

// load stat weights
double[][] custWd = Properties.Settings.Default.customStatWeights;
Expand Down Expand Up @@ -1198,7 +1199,7 @@ private static void LoadListViewSettings(ListView lv, string widthName, string i
lv.Columns[colIndicesOrdered[c].columnIndex].DisplayIndex = colIndicesOrdered[c].displayIndex;
}

// load listViewLibSorting
// load listViewSorting
if (!string.IsNullOrEmpty(sortColName) && !string.IsNullOrEmpty(sortAscName) && lv.ListViewItemSorter is ListViewColumnSorter lvcs)
{
lvcs.SortColumn = (int)Properties.Settings.Default[sortColName];
Expand All @@ -1224,6 +1225,7 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
SaveListViewSettings(timerList1.ListViewTimers, "TCLVColumnWidths", "TCLVColumnDisplayIndices", "TCLVSortCol", "TCLVSortAsc");
SaveListViewSettings(pedigree1.ListViewCreatures, "PedigreeListViewColumnWidths");
Properties.Settings.Default.PedigreeWidthLeftColum = pedigree1.LeftColumnWidth;
SaveListViewSettings(tribesControl1.ListViewPlayers, "PlayerListColumnWidths", "PlayerListColumnDisplayIndices", "PlayerListSortColumn", "PlayerListSortAsc");

// Save column-widths, display-indices and sort-order of the listViewLibrary
SaveListViewSettings(listViewLibrary, "columnWidths", "libraryColumnDisplayIndices", "listViewSortCol",
Expand Down
15 changes: 9 additions & 6 deletions ARKBreedingStats/Form1.importSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using ARKBreedingStats.uiControls;
using ARKBreedingStats.utils;

namespace ARKBreedingStats
Expand Down Expand Up @@ -87,6 +88,8 @@ private async Task<string> RunSavegameImport(ATImportFileLocation atImportFileLo
await ImportSavegame.ImportCollectionFromSavegame(_creatureCollection, workingCopyFilePath,
atImportFileLocation.ServerName);

FileService.TryDeleteFile(workingCopyFilePath);

UpdateParents(_creatureCollection.creatures);

foreach (var creature in _creatureCollection.creatures)
Expand Down Expand Up @@ -115,7 +118,7 @@ await ImportSavegame.ImportCollectionFromSavegame(_creatureCollection, workingCo
}
catch (Exception ex)
{
MessageBoxes.ExceptionMessageBox(ex, "An error occurred while importing.", "Save file import error");
MessageBoxes.ExceptionMessageBox(ex, $"An error occurred while importing the file {atImportFileLocation.FileLocation}.", "Save file import error");
return string.Empty;
}
finally
Expand Down Expand Up @@ -164,7 +167,7 @@ private async Task<string> CopyFtpFileAsync(Uri ftpUri, string serverName, strin

try
{
progressDialog.StatusText = $"Authenticating";
progressDialog.StatusText = $"Authenticating on server {serverName}";
if (!progressDialog.Visible)
progressDialog.Show(this);

Expand All @@ -175,7 +178,7 @@ private async Task<string> CopyFtpFileAsync(Uri ftpUri, string serverName, strin
// Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'.
await client.ConnectAsync(token: cancellationTokenSource.Token);

progressDialog.StatusText = $"Finding most recent file";
progressDialog.StatusText = "Finding most recent file";
await Task.Yield();

var ftpPath = ftpUri.AbsolutePath;
Expand Down Expand Up @@ -220,21 +223,21 @@ private async Task<string> CopyFtpFileAsync(Uri ftpUri, string serverName, strin
}
catch (OperationCanceledException)
{
client?.Dispose();
client.Dispose();
return null;
}
catch (Exception ex)
{
if (progressDialog.IsDisposed)
{
client?.Dispose();
client.Dispose();
return null;
}
progressDialog.StatusText = $"Unexpected error: {ex.Message}";
}
finally
{
client?.Dispose();
client.Dispose();
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions ARKBreedingStats/ImportSavegame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public static async Task ImportCollectionFromSavegame(CreatureCollection creatur
var importUnclaimedBabies = Properties.Settings.Default.SaveFileImportUnclaimedBabies;

IEnumerable<GameObject> tamedCreatureObjects = gameObjectContainer
.Where(o => o.IsCreature() && o.IsTamed() && (importUnclaimedBabies || !o.IsUnclaimedBaby()) && !ignoreClasses.Contains(o.ClassString));
.Where(o => o.IsCreature()
&& o.IsTamed()
&& (importUnclaimedBabies || (o.IsCryo && Properties.Settings.Default.SaveImportCryo) || !o.IsUnclaimedBaby())
&& !ignoreClasses.Contains(o.ClassString));

if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.ImportTribeNameFilter))
{
Expand Down Expand Up @@ -90,12 +93,14 @@ private static (GameObjectContainer, float) ReadSavegameFile(string fileName)
using (ArkArchive archive = new ArkArchive(stream))
{
arkSavegame.ReadBinary(archive, ReadingOptions.Create()
.WithDataFiles(false)
.WithEmbeddedData(false)
.WithDataFilesObjectMap(false)
.WithObjectFilter(Properties.Settings.Default.SaveImportCryo ? new Predicate<GameObject>(PredicateCreaturesAndCryopods) : new Predicate<GameObject>(PredicateCreatures))
.WithCryopodCreatures(Properties.Settings.Default.SaveImportCryo)
.WithBuildComponentTree(true));
.WithDataFiles(false)
.WithEmbeddedData(false)
.WithDataFilesObjectMap(false)
.WithObjectFilter(Properties.Settings.Default.SaveImportCryo
? new Predicate<GameObject>(PredicateCreaturesAndCryopods)
: new Predicate<GameObject>(PredicateCreatures))
.WithCryopodCreatures(Properties.Settings.Default.SaveImportCryo)
.WithBuildComponentTree(true));
}

if (!arkSavegame.HibernationEntries.Any())
Expand Down
2 changes: 2 additions & 0 deletions ARKBreedingStats/NamePatterns/NamePatternFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ private static string FunctionSubString(Match m, NamePatternParameters p)
substringLength += textLength - pos;

if (substringLength <= 0) return string.Empty;
if (pos + substringLength > textLength)
substringLength = textLength - pos;

return text.Substring(pos, substringLength);
}
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static void UnhandledExceptionHandler(object sender, UnhandledExceptionE
+ (e.InnerException != null ? "\n\nInner Exception:\n" + e.InnerException.Message : string.Empty)
;

CustomMessageBox.Show(message, "Unhandled Exception in ARK Smart Breeding", "OK", icon: MessageBoxIcon.Error,
CustomMessageBox.Show(message, "Unhandled Exception", "OK", icon: MessageBoxIcon.Error,
showCopyToClipboard: 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.49.1.0")]
[assembly: AssemblyFileVersion("0.49.2.0")]
[assembly: NeutralResourcesLanguage("en")]

46 changes: 46 additions & 0 deletions ARKBreedingStats/Properties/Settings.Designer.cs

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

12 changes: 12 additions & 0 deletions ARKBreedingStats/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,17 @@
<Setting Name="BreedingPlanDontSuggestOverLimitOffspring" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="PlayerListSortColumn" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="PlayerListSortAsc" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="PlayerListColumnWidths" Type="System.Int32[]" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="PlayerListColumnDisplayIndices" Type="System.Int32[]" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
Loading

0 comments on commit d186dc9

Please sign in to comment.