37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
|
|
|
internal abstract class Index
|
|
{
|
|
|
|
private static string GetJsonContains(string result, string jsonFileFullName, FileInfo fileInfo, string fileSegmentCollection)
|
|
{
|
|
fileInfo ??= new FileInfo(jsonFileFullName);
|
|
result = result.Replace(fileSegmentCollection, nameof(Properties.IIndex.RelativePaths)).Replace("\\\\", "/");
|
|
File.WriteAllText(fileInfo.FullName, result);
|
|
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
|
return result;
|
|
}
|
|
|
|
private static string GetJsonSpecial(string result, string jsonFileFullName, FileInfo fileInfo)
|
|
{
|
|
fileInfo ??= new FileInfo(jsonFileFullName);
|
|
result = result.Replace("/u0", "\\u0");
|
|
File.WriteAllText(fileInfo.FullName, result);
|
|
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
|
return result;
|
|
}
|
|
|
|
internal static string GetJson(string jsonFileFullName, FileInfo fileInfo)
|
|
{
|
|
string result;
|
|
string fileSegment = "FileSegment";
|
|
string fileSegmentCollection = "FileSegmentCollection";
|
|
result = File.ReadAllText(jsonFileFullName).Replace("Goolgle", "Google");
|
|
if (result.Contains(fileSegment) || result.Contains(fileSegmentCollection))
|
|
result = GetJsonContains(result, jsonFileFullName, fileInfo, fileSegmentCollection);
|
|
if (result.Contains("/u0"))
|
|
result = GetJsonSpecial(result, jsonFileFullName, fileInfo);
|
|
return result;
|
|
}
|
|
|
|
} |