Make the text cache look in static data if can't find cache
Made persistable work on decimate and repair
This commit is contained in:
parent
6ef0df24cc
commit
7d3cce547d
4 changed files with 26 additions and 4 deletions
|
|
@ -200,12 +200,18 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public static void RetrieveText(string uriToLoad, Action<string> updateResult)
|
||||
public static void RetrieveText(string uriToLoad, Action<string> updateResult, bool checkStaticData = false)
|
||||
{
|
||||
var longHash = uriToLoad.GetLongHashCode();
|
||||
|
||||
var textFileName = ApplicationController.CacheablePath("Text", longHash.ToString() + ".txt");
|
||||
|
||||
// change to a path that makes it easy to collect up all the text we want to ship with MC
|
||||
if (checkStaticData)
|
||||
{
|
||||
textFileName = ApplicationController.CacheablePath("Text_OverRide", longHash.ToString() + ".txt");
|
||||
}
|
||||
|
||||
string fileText = null;
|
||||
if (File.Exists(textFileName))
|
||||
{
|
||||
|
|
@ -218,9 +224,20 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
}
|
||||
}
|
||||
else // check if it is in the shipping data for the application
|
||||
else // We could not find it in the cache. Check if it is in static data.
|
||||
{
|
||||
|
||||
if (File.Exists(textFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
textFileName = AggContext.StaticData.ReadAllText(Path.Combine("Text_OverRide", longHash.ToString() + ".txt"));
|
||||
fileText = File.ReadAllText(textFileName);
|
||||
updateResult?.Invoke(fileText);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue