コード例 #1
0
        public static T TryLoadSerializedFile <T>(string characterName)
        {
            try
            {
                string path = GetConfigDirectory();

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                string filename = GetSerializedFileName(characterName);

                if (File.Exists(Path.Combine(path, filename)))
                {
                    return(Serializator.Deserialize <T>(Path.Combine(path, filename)));
                }
            }
            catch (Exception ex)
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    System.Windows.Forms.MessageBox.Show("Failed to load or deserialize saved culture file: " + ex.Message);
                }
            }

            return(default);
コード例 #2
0
        public static T TryLoadSerializedFile <T>(string characterName)
        {
            string path = GetConfigDirectory();

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string filename = GetSerializedFileName(characterName);

            if (File.Exists(Path.Combine(path, filename)))
            {
                return(Serializator.Deserialize <T>(Path.Combine(path, filename)));
            }

            return(default);