Example #1
0
        // Synchronize vhds from Storage to this storage. Use filter to specify specific files to be synched.
        public void Syncronize(VhdStorage from, ICollection<String> filter = null)
        {
            // Create Filelist Diff >-----------------------------------------------------------
            ICollection<String> localVhdNames = GetVhdNames(); // cache for better performance
            ICollection<String> serverVhdNames = from.GetVhdNames();
            ICollection<String> diff = new List<String>();
            // if there is no filter, we take it all
            if (filter == null)
            {
                filter = serverVhdNames;
            }
            foreach (String fileName in serverVhdNames)
            {
                if (filter.Contains(fileName) && !localVhdNames.Contains(fileName))
                {
                    diff.Add(fileName);
                }
            }

            // Sum Up Source Filesizes (Bytes) >------------------------------------------------
            long totalBytesToReceive = 0;
            foreach (String filename in diff)
            {
                FileInfo f = new FileInfo(from.GetPathName() + @"\" + filename);
                totalBytesToReceive += f.Length;
            }
            Debug.WriteLine(Location.Name + ": Bytes for Transfer: " + totalBytesToReceive);

            foreach (String fileName in diff)
            {
                String sourceFilePath = Path.Combine(from.GetPathName(), fileName);
                String targetFilePath = Path.Combine(this.GetPathName(), fileName);
                FileSystem.CopyFile(sourceFilePath, targetFilePath, UIOption.AllDialogs);
            }
        }
Example #2
0
 public DeleterForm()
 {
     localStorage = new VhdStorage(new DirectoryInfo(Options.vhdlocalpath));
     InitializeComponent();
 }
Example #3
0
 public GamesLibrary(VhdStorage storage)
 {
     this.storage = storage;
 }
Example #4
0
 public DownloaderForm()
 {
     serverStorage = new VhdStorage(new DirectoryInfo(Options.vhdserverpath));
     localStorage = new VhdStorage(new DirectoryInfo(Options.vhdlocalpath));
     InitializeComponent();
 }