Пример #1
0
        public static void Export()
        {
            LangJson data = new LangJson()
            {
                Langs         = LangSet.Instance.Cast <Lang>().ToArray(),
                LangViewItems = LangViewItemSet.Instance.Cast <LangViewItem>().ToArray()
            };
            string json = Global.JsonSerializer.Serialize(data);

            File.WriteAllText(ClientId.ServerLangJsonFileFullName, json);
        }
Пример #2
0
        public static string Export()
        {
            LangJson data = new LangJson()
            {
                Langs         = LangSet.Instance.Cast <Lang>().ToArray(),
                LangViewItems = LangViewItemSet.Instance.Cast <LangViewItem>().ToArray()
            };
            string json = VirtualRoot.JsonSerializer.Serialize(data);

            File.WriteAllText(AssemblyInfo.LangVersionJsonFileFullName, json);
            return(Path.GetFileName(AssemblyInfo.LangVersionJsonFileFullName));
        }
Пример #3
0
 public void Init(string rawJson)
 {
     if (!_inited)
     {
         lock (_locker) {
             if (!_inited)
             {
                 if (!string.IsNullOrEmpty(rawJson))
                 {
                     try {
                         LangJson data = Global.JsonSerializer.Deserialize <LangJson>(rawJson);
                         this.Langs         = data.Langs ?? new Lang[0];
                         this.LangViewItems = data.LangViewItems ?? new LangViewItem[0];
                         File.WriteAllText(ClientId.LocalLangJsonFileFullName, rawJson);
                     }
                     catch (Exception e) {
                         Global.Logger.ErrorDebugLine(e.Message, e);
                     }
                 }
                 _inited = true;
             }
         }
     }
 }
Пример #4
0
 public void Init(string rawJson)
 {
     if (!_inited)
     {
         lock (_locker) {
             if (!_inited)
             {
                 if (!string.IsNullOrEmpty(rawJson))
                 {
                     try {
                         LangJson data = VirtualRoot.JsonSerializer.Deserialize <LangJson>(rawJson);
                         this.Langs         = data.Langs ?? new Lang[0];
                         this.LangViewItems = data.LangViewItems ?? new LangViewItem[0];
                         ClientId.WriteLocalLangJsonFile(rawJson);
                     }
                     catch (Exception e) {
                         Logger.ErrorDebugLine(e.Message, e);
                     }
                 }
                 _inited = true;
             }
         }
     }
 }