Ejemplo n.º 1
0
        /// <summary>
        /// Contacts the remote server and re-downloads the specific release specified in the manifest, overwriting the current data.
        /// </summary>
        /// <param name="manifest"></param>
        private void Refresh(ReleaseManifestDTO manifest)
        {
            client.CurrentDirectory = CurrentDirectory;

            //The manifest contains the version number on the server.
            //This should match the folder name, if it doesn't, an invalid operation has occurred.
            if (manifest.Version != this.releaseNumber)
            {
                throw new InvalidOperationException($"Server folder: {this.RootFolder} {this.releaseNumber} does not match version found in manifest: {manifest.Version}.");
            }


            //TODO: This code is performance-sensitive and would be a good candidate to modify to use the async/await API.
            //Sadly FTPclient does not support this yet.
            //If we fix this, we could speed it up immensely.

            List <string> files = getFileNamesRecursively("").ToList();

            var memoryFiles = from path in files
                              select
                              new InMemoryFile(ItemLocation.FromRelativeFilePath(path), client.DownloadFile(path));

            this.ContainedFiles = this.SaveFiles(manifest, memoryFiles);
        }
Ejemplo n.º 2
0
        public void FromRelativeFilePathDefaultTest()
        {
            ItemLocation l = ItemLocation.FromRelativeFilePath("");

            Assert.Inconclusive();
        }