コード例 #1
0
        /// <summary>
        ///		Loads a string from the set path.
        /// </summary>
        public static void Load(string name, out string data)
        {
            string path = Path.ChangeExtension(Path.Combine(savePath, name), Extention);

            if (File.Exists(path))
            {
                data = File.ReadAllText(path);
                if (EncryptData)
                {
                    FileEncryption.Decrypt(ref data);
                }
            }
            else
            {
                data = null;
            }
        }
コード例 #2
0
        /// <summary>
        ///		Saves the provided byte[] to the set path.
        /// </summary>
        public static FileInfo Save(byte[] data, string name)
        {
            if (!Directory.Exists(savePath))
            {
                Directory.CreateDirectory(savePath);
            }

            if (EncryptData)
            {
                FileEncryption.Encrypt(ref data);
            }
            string path = Path.Combine(savePath, name);

            path = Path.ChangeExtension(path, Extention);
            File.WriteAllBytes(path, data);

            LoggingUtilities.LogFormat("Saved at: {0}", path);

            return(new FileInfo(path));
        }