Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions TeddyBench/TeddyMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,34 @@ public void LoadJson(bool force = false)
{
TonieInfoString = "| Download Failed";
ReportException("Downloader", e);
return;
}

if (string.IsNullOrEmpty(jsonContent))
if (!string.IsNullOrEmpty(jsonContent))
{
return;
}
bool written = false;
for (int loop = 0; loop < 5; loop++)
{
try
bool written = false;
for (int loop = 0; loop < 5; loop++)
{
File.WriteAllText("tonies.json", jsonContent);
written = true;
break;
try
{
File.WriteAllText("tonies.json", jsonContent);
written = true;
break;
}
catch (IOException e)
{
ReportException("Writing tonies.json", e);
Thread.Sleep(100);
}
}
catch (IOException e)

if (!written)
{
ReportException("Writing tonies.json", e);
Thread.Sleep(100);
TonieInfoString = "| Writing Failed - is the tonies.json accessible?";
}
}

if (!written)
{
TonieInfoString = "| Writing Failed - is the tonies.json accessible?";
}
}
else

if (string.IsNullOrEmpty(jsonContent))
{
try
{
Expand Down