コード例 #1
0
        void LoadExistingVersions()
        {
            foreach (string versionFolderPath in Directory.EnumerateDirectories(_folder))
            {
                if (!Int32.TryParse(Path.GetFileName(versionFolderPath), out int version))
                {
                    // Ignore non-version folders
                    continue;
                }

                string packagePath = Path.Combine(versionFolderPath, ZipFileName);
                _versions[version] = new FunctionVersion(_appManager, packagePath);
            }
        }
コード例 #2
0
        public async Task CreateNewVersion(Stream zipContent)
        {
            int newVersion = GetNewVersion();

            string versionFolder = Path.Combine(_folder, newVersion.ToString());

            Directory.CreateDirectory(versionFolder);
            string packagePath = Path.Combine(versionFolder, ZipFileName);

            using (Stream zip = File.Create(packagePath))
            {
                await zipContent.CopyToAsync(zip);
            }

            _versions[newVersion] = new FunctionVersion(_appManager, packagePath);
        }