Exemplo n.º 1
0
 public static Dsl.DslFile LoadStoryText(string file, byte[] bytes)
 {
     if (Dsl.DslFile.IsBinaryDsl(bytes, 0))
     {
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             dataFile.LoadBinaryCode(bytes);
             return(dataFile);
         } catch {
             return(null);
         }
     }
     else
     {
         string text = Converter.FileContent2Utf8String(bytes);
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             if (dataFile.LoadFromString(text, file, LogSystem.Log))
             {
                 return(dataFile);
             }
             else
             {
                 LogSystem.Error("LoadStoryText text:{0} failed", file);
             }
         } catch (Exception ex) {
             LogSystem.Error("LoadStoryText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
         }
         return(null);
     }
 }
 public void LoadStoryCode(string code, int sceneId, string _namespace)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         Load(dataFile, sceneId, _namespace, "storycode");
     } catch {
     }
 }
Exemplo n.º 3
0
 public static Dsl.DslFile LoadStoryCode(string code)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         return(dataFile);
     } catch {
         return(null);
     }
 }
 static public int LoadBinaryCode(IntPtr l)
 {
     try {
         Dsl.DslFile   self = (Dsl.DslFile)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.Dictionary <System.String, System.String> a2;
         checkType(l, 3, out a2);
         self.LoadBinaryCode(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static Dsl.DslFile LoadStoryText(string file, byte[] bytes)
 {
     if (Dsl.DslFile.IsBinaryDsl(bytes, 0))
     {
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             dataFile.LoadBinaryCode(bytes, StoryConfigManager.ReuseKeyBuffer, StoryConfigManager.ReuseIdBuffer);
             return(dataFile);
         }
         catch (Exception ex) {
             var sb = new System.Text.StringBuilder();
             sb.AppendFormat("[LoadStory] LoadStoryText file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
             sb.AppendLine();
             Helper.LogInnerException(ex, sb);
             LogSystem.Error("{0}", sb.ToString());
         }
     }
     else
     {
         string text = Converter.FileContent2Utf8String(bytes);
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             if (dataFile.LoadFromString(text, file, LogSystem.Log))
             {
                 return(dataFile);
             }
             else
             {
                 LogSystem.Error("LoadStoryText file:{0} failed", file);
             }
         }
         catch (Exception ex) {
             var sb = new System.Text.StringBuilder();
             sb.AppendFormat("[LoadStory] LoadStoryText file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
             sb.AppendLine();
             Helper.LogInnerException(ex, sb);
             LogSystem.Error("{0}", sb.ToString());
         }
     }
     return(null);
 }
 public void LoadStoryText(string file, byte[] bytes, int sceneId, string _namespace)
 {
     if (Dsl.DslFile.IsBinaryDsl(bytes, 0))
     {
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             dataFile.LoadBinaryCode(bytes);
             Load(dataFile, sceneId, _namespace, file);
         }
         catch (Exception ex) {
             var sb = new System.Text.StringBuilder();
             sb.AppendFormat("[LoadStory] LoadStoryText file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
             sb.AppendLine();
             Helper.LogInnerException(ex, sb);
             LogSystem.Error("{0}", sb.ToString());
         }
     }
     else
     {
         try {
             string      text     = Converter.FileContent2Utf8String(bytes);
             Dsl.DslFile dataFile = new Dsl.DslFile();
             if (dataFile.LoadFromString(text, file, LogSystem.Log))
             {
                 Load(dataFile, sceneId, _namespace, file);
             }
             else
             {
                 LogSystem.Error("[LoadStory] LoadStoryText file:{0} scene:{1} failed", file, sceneId);
             }
         }
         catch (Exception ex) {
             var sb = new System.Text.StringBuilder();
             sb.AppendFormat("[LoadStory] LoadStoryText file:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
             sb.AppendLine();
             Helper.LogInnerException(ex, sb);
             LogSystem.Error("{0}", sb.ToString());
         }
     }
 }
 public void LoadStoryText(string file, byte[] bytes, int sceneId, string _namespace)
 {
     if (Dsl.DslFile.IsBinaryDsl(bytes, 0))
     {
         try {
             Dsl.DslFile dataFile = new Dsl.DslFile();
             dataFile.LoadBinaryCode(bytes);
             Load(dataFile, sceneId, _namespace, file);
         } catch (Exception ex) {
             while (null != ex.InnerException)
             {
                 ex = ex.InnerException;
             }
             LogSystem.Error("[LoadStory] LoadStoryText text:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
         }
     }
     else
     {
         try {
             string      text     = Converter.FileContent2Utf8String(bytes);
             Dsl.DslFile dataFile = new Dsl.DslFile();
             if (dataFile.LoadFromString(text, file, LogSystem.Log))
             {
                 Load(dataFile, sceneId, _namespace, file);
             }
             else
             {
                 LogSystem.Error("[LoadStory] LoadStoryText text:{0} scene:{1} failed", file, sceneId);
             }
         } catch (Exception ex) {
             while (null != ex.InnerException)
             {
                 ex = ex.InnerException;
             }
             LogSystem.Error("[LoadStory] LoadStoryText text:{0} scene:{1} Exception:{2}\n{3}", file, sceneId, ex.Message, ex.StackTrace);
         }
     }
 }
        public void LoadSkillText(int id, string text)
        {
            Dsl.DslFile dataFile = new Dsl.DslFile();
#if DEBUG
            try {
                if (dataFile.LoadFromString(text, "skill", LogSystem.Log))
                {
                    Load(id, dataFile);
                }
                else
                {
                    LogSystem.Error("LoadSkillText text:{0} failed", text);
                }
            } catch (Exception ex) {
                LogSystem.Error("LoadSkillText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
            }
#else
            try {
                dataFile.LoadBinaryCode(text, GlobalVariables.Instance.DecodeTable);
                Load(id, dataFile);
            } catch {
            }
#endif
        }
        public void LoadSkillText(int id, string text)
        {
            Dsl.DslFile dataFile = new Dsl.DslFile();
#if DEBUG
            try {
                if (dataFile.LoadFromString(text, "skill", LogSystem.Log))
                {
                    Load(id, dataFile);
                }
                else
                {
                    LogSystem.Error("LoadSkillText text:{0} failed", text);
                }
            } catch (Exception ex) {
                LogSystem.Error("LoadSkillText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
            }
#else
            try {
                dataFile.LoadBinaryCode(System.Text.Encoding.UTF8.GetBytes(text));
                Load(id, dataFile);
            } catch {
            }
#endif
        }
 public void LoadStoryCode(string code, int sceneId, string _namespace)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         Load(dataFile, sceneId, _namespace, "storycode");
     } catch {
     }
 }
 public void LoadSkillText(string text)
 {
     Dsl.DslFile dataFile = new Dsl.DslFile();
     #if DEBUG
     try {
         if (dataFile.LoadFromString(text, "skill", LogSystem.Log)) {
             Load(dataFile);
         } else {
             LogSystem.Error("LoadSkillText text:{0} failed", text);
         }
     } catch (Exception ex) {
         LogSystem.Error("LoadSkillText text:{0} Exception:{1}\n{2}", text, ex.Message, ex.StackTrace);
     }
     #else
       try {
     dataFile.LoadBinaryCode(text, GlobalVariables.Instance.DecodeTable);
     Load(dataFile);
       } catch {
       }
     #endif
 }
 public static Dsl.DslFile LoadStoryCode(string code)
 {
     try {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         dataFile.LoadBinaryCode(code, GlobalVariables.Instance.DecodeTable);
         return dataFile;
     } catch {
         return null;
     }
 }