示例#1
0
        public static XmlSummary LoadFromFile(string Path) {
  
            try {
                string xmlString = System.IO.File.ReadAllText(Path);

                XmlSerializer serializer = new XmlSerializer(typeof(XmlSummary));


            } catch (Exception ex) {
                if (ex is System.IO.FileNotFoundException || ex is System.IO.DirectoryNotFoundException) {
                    TShockAPI.Log.ConsoleError("seconomy xml: Cannot find file or directory. Creating new one.");

                    XmlSummary newSummary = new XmlSummary();
                    newSummary.SaveXml(Path);

                } else if (ex is System.Security.SecurityException) {
                    TShockAPI.Log.ConsoleError("seconomy xml: Access denied reading file " + Path);
                } else {
                    TShockAPI.Log.ConsoleError("seconomy xml: error " + ex.ToString());
                }
            }

        }
示例#2
0
        public static XmlSummary LoadFromFile(string Path)
        {
            try {
                string xmlString = System.IO.File.ReadAllText(Path);

                XmlSerializer serializer = new XmlSerializer(typeof(XmlSummary));
            } catch (Exception ex) {
                if (ex is System.IO.FileNotFoundException || ex is System.IO.DirectoryNotFoundException)
                {
                    TShockAPI.Log.ConsoleError("seconomy xml: Cannot find file or directory. Creating new one.");

                    XmlSummary newSummary = new XmlSummary();
                    newSummary.SaveXml(Path);
                }
                else if (ex is System.Security.SecurityException)
                {
                    TShockAPI.Log.ConsoleError("seconomy xml: Access denied reading file " + Path);
                }
                else
                {
                    TShockAPI.Log.ConsoleError("seconomy xml: error " + ex.ToString());
                }
            }
        }