コード例 #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
ファイル: XmlSummary.cs プロジェクト: loganizer405/ShopSystem
        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());
                }
            }
        }