Beispiel #1
0
        public Task PersistConfiguration(Configuration configuration)
        {
            return Task.Run(() =>
            {
                using (FileStream stream = new FileStream(GetDataPath("configuration.txt"), FileMode.Create, FileAccess.Write, FileShare.None, 16 * 1024, FileOptions.WriteThrough))
                using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8))
                {
                    writer.WriteLine("DownloadPath|" + configuration.DownloadPath);

                    writer.Flush();
                    stream.Flush();
                }
            });
        }
Beispiel #2
0
        public Task<Configuration> GetConfiguration()
        {
            return Task.Run(() =>
            {
                Configuration configuration = new Configuration();

                using (FileStream stream = new FileStream(GetDataPath("configuration.txt"), FileMode.OpenOrCreate, FileAccess.Read, FileShare.None, 16 * 1024, FileOptions.None))
                using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                {
                    while (reader.EndOfStream == false)
                    {
                        string[] parts = reader.ReadLine().Split(new[] { '|' }, 2);
                        if (parts.Length == 2)
                        {
                            switch (parts[0])
                            {
                                case "DownloadPath":
                                    configuration.DownloadPath = parts[1];
                                    break;
                            }
                        }
                    }
                }

                return configuration;
            });
        }
Beispiel #3
0
 public void SetConfiguration(Configuration configuration)
 {
     this.Configuration = configuration;
     this.DownloadPath = this.Configuration.DownloadPath;
     this.Raise("DownloadPath");
 }
Beispiel #4
0
 public void SetConfiguration(Configuration configuration)
 {
     this.model.SetConfiguration(configuration);
 }
Beispiel #5
0
 private async void HandleConfiguration(Configuration configuration)
 {
     this.transfer.SetConfiguration(configuration);
     await new Facade().PersistConfiguration(configuration);
 }
Beispiel #6
0
 public void SetConfiguration(Configuration configuration)
 {
     this.Configuration = configuration;
 }