public DeDupeFuseFileSystem(string key, SettingsData data)
        {
            this.key = key;
            dbfile   = new EncryptedTempFile("data.sqlite.enc", key);
            db       = new SQLiteDatabase(dbfile.Path);



            fs = new DeDupeFileSystem(dbfile.Path, key, true);
            foreach (KeyValuePair <string, string> kv in data.locations)
            {
                fs.AddFileSystem(new DeDupeLocalFileSystem(kv.Value, kv.Key));
            }
        }
        public static void Write(SettingsData data, string file)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SettingsData));
            string        xml        = "";

            using (var sww = new StringWriter())
            {
                using (XmlWriter writer = XmlWriter.Create(sww))
                {
                    serializer.Serialize(writer, data);
                    xml = sww.ToString();
                }
            }

            System.IO.File.WriteAllText(file, xml);
        }
Beispiel #3
0
        public SettingsData GenerateSettings()
        {
            //SettingsData data = SettingsFile.Read("settings.xml");
            SettingsData data;

            if (File.Exists("settings.xml"))
            {
                Console.Write("settings.xml file detected - are you sure you want to overwrite [y]/n? ");
                string choice = Console.ReadLine();
                if (choice.Trim() != "y" && choice.Trim() != "yes")
                {
                    return(null);
                }
                data = SettingsFile.Read("settings.xml");
            }
            Console.Write("How many iterations do you want when generating the key [10000] ? ");
            string resp = Console.ReadLine();
            int    iterations;

            if (resp.Trim() == String.Empty)
            {
                iterations = 10000;
            }
            else
            {
                iterations = Convert.ToInt32(resp.Trim());
            }

            Console.Write("How many bytes do you want the salt to be [512] ? ");
            resp = Console.ReadLine();
            int saltBytes;

            if (resp.Trim() == String.Empty)
            {
                saltBytes = 512;
            }
            else
            {
                saltBytes = Convert.ToInt32(resp.Trim());
            }

            data = new SettingsData()
            {
                iterations = iterations, salt = AESWrapper.GenerateSaltString(saltBytes)
            };
            return(data);
        }