Пример #1
0
        }                                       //KeyToDataContent

        public JsonStorage(string directory, string name, bool GZip, bool Encryption, SecureString Password = null)
        {
            if (Files.HasExtension(name))
            {
                name = name + extension;
            }

            Path     = Directories.Create(directory).FullName;
            this.Key = name;

            this.GZip       = GZip;
            this.Encryption = Encryption;
            this.InitializePassword(Password);


            this.Load();
        }
Пример #2
0
        public static void TryEmpty(string path)
        {
            path = Directories.GetFullPath(path);

            if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path))
            {
                return;
            }

            DirectoryInfo info = new DirectoryInfo(path);

            foreach (FileInfo file in info.GetFiles())
            {
                try
                {
                    file.Delete();
                }
                catch (Exception ex)
                {
                    Output.WriteException(ex);
                }
            }

            foreach (DirectoryInfo directory in info.GetDirectories())
            {
                Directories.TryEmpty(directory.FullName);

                try
                {
                    directory.Delete(false);
                }
                catch (Exception ex)
                {
                    Output.WriteException(ex);
                }
            }
        }