Skip to content

Commit

Permalink
reduce flicker on unknown tonies
Browse files Browse the repository at this point in the history
  • Loading branch information
g3gg0 committed Nov 28, 2021
1 parent 6bd2a13 commit 36f5e54
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions TeddyBench/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ private void AnalyzeMain()
var found = TonieInfos.Where(t => t.Hash.Where(h => h == hash).Count() > 0);
string tonieName = "[" + tag.Uid + "]" + Environment.NewLine + "(unknown: " + dumpFile.Header.AudioId.ToString("X8") + ")";

bool update = false;

if (found.Count() > 0)
{
var info = found.First();
Expand All @@ -732,6 +734,7 @@ private void AnalyzeMain()
}));
}
}
update = true;
image = hash;
}
else
Expand All @@ -744,30 +747,35 @@ private void AnalyzeMain()
tonieName = CustomTonies[hash];
tag.Info.Title = tonieName;
image = "custom";
update = true;
}
else if (dumpFile.Header.AudioId < 0x50000000)
{
tonieName = "Unnamed Teddy - " + tonieName;
tag.Info.Title = "Unnamed Teddy";
image = "custom";
update = true;
}
}

tag.Hash = hash;
tag.AudioId = dumpFile.Header.AudioId;

this.BeginInvoke(new Action(() =>
if (update)
{
entry.Value.Text = tonieName;
entry.Value.ImageKey = image;
entry.Value.ToolTipText =
"File: " + tag.FileName + Environment.NewLine +
"UID: " + tag.Uid + Environment.NewLine +
"Date: " + tag.FileInfo.CreationTime + Environment.NewLine +
"AudioID: 0x" + tag.AudioId.ToString("X8") + Environment.NewLine +
"Chapters: " + dumpFile.Header.AudioChapters.Length + Environment.NewLine;
UpdateSorting();
}));
tag.Hash = hash;
tag.AudioId = dumpFile.Header.AudioId;

this.BeginInvoke(new Action(() =>
{
entry.Value.Text = tonieName;
entry.Value.ImageKey = image;
entry.Value.ToolTipText =
"File: " + tag.FileName + Environment.NewLine +
"UID: " + tag.Uid + Environment.NewLine +
"Date: " + tag.FileInfo.CreationTime + Environment.NewLine +
"AudioID: 0x" + tag.AudioId.ToString("X8") + Environment.NewLine +
"Chapters: " + dumpFile.Header.AudioChapters.Length + Environment.NewLine;
UpdateSorting();
}));
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 36f5e54

Please sign in to comment.