27 lines
616 B
C#
27 lines
616 B
C#
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
|
|
|
internal abstract class Storage
|
|
{
|
|
|
|
// ...
|
|
|
|
internal static bool WriteAllText(string path, string contents, bool compareBeforeWrite)
|
|
{
|
|
bool result;
|
|
string text;
|
|
if (!compareBeforeWrite)
|
|
result = true;
|
|
else
|
|
{
|
|
if (!File.Exists(path))
|
|
text = string.Empty;
|
|
else
|
|
text = File.ReadAllText(path);
|
|
result = text != contents;
|
|
}
|
|
if (result)
|
|
File.WriteAllText(path, contents);
|
|
return result;
|
|
}
|
|
|
|
} |