36 lines
985 B
C#
36 lines
985 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace uploader
|
|
{
|
|
internal class LocalizationHelper
|
|
{
|
|
private const string LocalFolder = "local";
|
|
public static LocalizationBase Base;
|
|
|
|
public static string[] GetLanguages()
|
|
{
|
|
return Directory.Exists(LocalFolder) ? Directory.GetFiles(LocalFolder) : new []{ "" };
|
|
}
|
|
|
|
public static void Load(string path)
|
|
{
|
|
var context = File.ReadAllText(path);
|
|
Base = JsonConvert.DeserializeObject<LocalizationBase>(context);
|
|
}
|
|
|
|
// Used to create Json for new version
|
|
public static void Export()
|
|
{
|
|
Base = new LocalizationBase();
|
|
var serialized = JsonConvert.SerializeObject(LocalizationHelper.Base);
|
|
File.WriteAllText("export.json", serialized);
|
|
}
|
|
}
|
|
}
|