After testing E_Distance.SaveGroupedFaceEncodings

This commit is contained in:
2022-08-07 12:29:46 -07:00
parent 2158b4cfc2
commit daf5f428b9
57 changed files with 2626 additions and 660 deletions

View File

@ -5,7 +5,7 @@ internal abstract class Storage
// ...
internal static bool WriteAllText(string path, string contents, bool compareBeforeWrite)
internal static bool WriteAllText(string path, string contents, bool updateDateWhenMatches, bool compareBeforeWrite)
{
bool result;
string text;
@ -18,9 +18,24 @@ internal abstract class Storage
else
text = File.ReadAllText(path);
result = text != contents;
if (!result && updateDateWhenMatches)
File.SetLastWriteTime(path, DateTime.Now);
}
if (result)
File.WriteAllText(path, contents);
{
if (path.Contains("()"))
File.WriteAllText(path, contents);
else if (path.Contains("{}") && !path.EndsWith(".json"))
File.WriteAllText(path, contents);
else if (path.Contains("[]") && !path.EndsWith(".json"))
File.WriteAllText(path, contents);
else if (path.Contains("{}") && path.EndsWith(".json") && contents[0] == '{')
File.WriteAllText(path, contents);
else if (path.Contains("[]") && path.EndsWith(".json") && contents[0] == '[')
File.WriteAllText(path, contents);
else
File.WriteAllText(path, contents);
}
return result;
}