Example #1
0
        public async Task <string> GetOfficeLatestVersion(string branch, OfficeEdition edition)
        {
            var ppDownload    = new ProPlusDownloader();
            var latestVersion = await ppDownload.GetLatestVersionAsync(branch, edition);

            return(latestVersion);
        }
        public async Task <string> GetLatestVersionAsync(baseURL branchUrl, OfficeEdition officeEdition)
        {
            var fileName = "v32.cab";

            if (officeEdition == OfficeEdition.Office64Bit)
            {
                fileName = "v64.cab";
            }

            var guid = Guid.NewGuid().ToString();

            var vcabFileDir = Environment.ExpandEnvironmentVariables(@"%temp%\OfficeProPlus\" + branchUrl.Branch + @"\" + guid);

            var vcabFilePath    = vcabFileDir + @"\" + fileName;
            var vcabExtFilePath = vcabFileDir + @"\ExtractedFiles\VersionDescriptor.xml";

            Directory.CreateDirectory(vcabFileDir);

            var fd = new FileDownloader();
            await fd.DownloadAsync(branchUrl.URL + @"/Office/Data/" + fileName, vcabFilePath);

            var cabExtractor = new CabExtractor(vcabFilePath);

            cabExtractor.ExtractCabFiles();

            var version = GetCabVersion(vcabExtFilePath);

            return(version);
        }
        public async Task <string> GetChannelBaseUrlAsync(string channel, OfficeEdition officeEdition)
        {
            if (_updateFiles == null)
            {
                using (var releaser = await myLock2.LockAsync())
                {
                    if (_updateFiles == null)
                    {
                        await Retry.BlockAsync(10, 1, async() => {
                            _updateFiles = await DownloadCabAsync();
                        });
                    }
                }
            }

            var selectUpdateFiles = _updateFiles.FirstOrDefault(f => f.OfficeEdition == officeEdition);

            if (selectUpdateFiles == null)
            {
                return(null);
            }

            var branchBase = selectUpdateFiles.BaseURL.FirstOrDefault(b => b.Branch.ToLower() == channel.ToLower());

            if (branchBase == null)
            {
                return(null);
            }
            return(branchBase.URL);
        }
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            try
            {
                var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                                                                                  b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
                if (modelBranch == null)
                {
                    return;
                }

                UpdateTargetVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);
            }
            catch (Exception ex)
            {
                var strError = ex.Message;
                if (strError != null)
                {
                }
            }
        }
        public async Task <string> GetLatestVersionAsync(string branch, OfficeEdition officeEdition)
        {
            if (_updateFiles == null)
            {
                using (var releaser = await myLock2.LockAsync())
                {
                    if (_updateFiles == null)
                    {
                        _updateFiles = await DownloadCabAsync();
                    }
                }
            }

            var selectUpdateFiles = _updateFiles.FirstOrDefault(f => f.OfficeEdition == officeEdition);

            if (selectUpdateFiles == null)
            {
                return(null);
            }

            var branchBaseUrl = selectUpdateFiles.BaseURL.FirstOrDefault(b => b.Branch.ToLower() == branch.ToLower());

            return(await GetLatestVersionAsync(branchBaseUrl, officeEdition));
        }
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            try
            {
                if (branch.Updated)
                {
                    return;
                }
                var ppDownload    = new ProPlusDownloader();
                var latestVersion = await ppDownload.GetLatestVersionAsync(branch.Branch.ToString(), officeEdition);

                var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                                                                                  b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
                if (modelBranch == null)
                {
                    return;
                }
                if (modelBranch.Versions.Any(v => v.Version == latestVersion))
                {
                    return;
                }
                modelBranch.Versions.Insert(0, new Build()
                {
                    Version = latestVersion
                });
                modelBranch.CurrentVersion = latestVersion;

                //ProductVersion.ItemsSource = modelBranch.Versions;
                //ProductVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);

                modelBranch.Updated = true;
            }
            catch (Exception)
            {
            }
        }
 public async Task<string> GetOfficeLatestVersion(string branch, OfficeEdition edition)
 {
     var ppDownload = new ProPlusDownloader();
     var latestVersion = await ppDownload.GetLatestVersionAsync(branch, edition);
     return latestVersion;
 }
Example #8
0
 public Task <string> GetOfficeLatestVersion(string branch, OfficeEdition edition)
 {
     throw new NotImplementedException();
 }
 public Task<string> GetOfficeLatestVersion(string branch, OfficeEdition edition)
 {
     throw new NotImplementedException();
 }
        public async Task<string> GetLatestVersionAsync(baseURL branchUrl, OfficeEdition officeEdition)
        {
            var fileName = "v32.cab";
            if (officeEdition == OfficeEdition.Office64Bit)
            {
                fileName = "v64.cab";
            }

            var guid = Guid.NewGuid().ToString();

            var vcabFileDir = Environment.ExpandEnvironmentVariables(@"%temp%\OfficeProPlus\" + branchUrl.Branch + @"\" + guid);

            var vcabFilePath = vcabFileDir + @"\" + fileName;
            var vcabExtFilePath = vcabFileDir + @"\ExtractedFiles\VersionDescriptor.xml";

            Directory.CreateDirectory(vcabFileDir);

            var fd = new FileDownloader();
            await fd.DownloadAsync(branchUrl.URL + @"/Office/Data/" + fileName, vcabFilePath);

            var cabExtractor = new CabExtractor(vcabFilePath);
            cabExtractor.ExtractCabFiles();

            var version = GetCabVersion(vcabExtFilePath);
            return version;
        }
        public async Task<string> GetLatestVersionAsync(string branch, OfficeEdition officeEdition)
        {
            if (_updateFiles == null)
            {
                using (var releaser = await myLock2.LockAsync())
                {
                    if (_updateFiles == null)
                    {
                        _updateFiles = await DownloadCabAsync();
                    }
                }
            }

            var selectUpdateFiles = _updateFiles.FirstOrDefault(f => f.OfficeEdition == officeEdition);
            if (selectUpdateFiles == null) return null;

            var branchBaseUrl = selectUpdateFiles.BaseURL.FirstOrDefault(b => b.Branch.ToLower() == branch.ToLower());
            return await GetLatestVersionAsync(branchBaseUrl, officeEdition);
        }
        public async Task<string> GetChannelBaseUrlAsync(string channel, OfficeEdition officeEdition)
        {
            if (_updateFiles == null)
            {
                using (var releaser = await myLock2.LockAsync())
                {
                    if (_updateFiles == null)
                    {
                        await Retry.BlockAsync(10, 1, async () => {
                            _updateFiles = await DownloadCabAsync();
                        });
                    }
                }
            }

            var selectUpdateFiles = _updateFiles.FirstOrDefault(f => f.OfficeEdition == officeEdition);
            if (selectUpdateFiles == null) return null;

            var branchBase = selectUpdateFiles.BaseURL.FirstOrDefault(b => b.Branch.ToLower() == channel.ToLower());
            if (branchBase == null) return null;
            return branchBase.URL;
        }
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
            if (modelBranch == null) return;

            NewVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);
        }
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            try
            {
                if (branch.Updated) return;
                var ppDownload = new ProPlusDownloader();
                var latestVersion = await ppDownload.GetLatestVersionAsync(branch.Branch.ToString(), officeEdition);

                var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                    b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
                if (modelBranch == null) return;
                if (modelBranch.Versions.Any(v => v.Version == latestVersion)) return;
                modelBranch.Versions.Insert(0, new Build() {Version = latestVersion});
                modelBranch.CurrentVersion = latestVersion;

                //ProductVersion.ItemsSource = modelBranch.Versions;
                //ProductVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);

                modelBranch.Updated = true;
            }
            catch (Exception)
            {

            }
        }
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            try
            {
                var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                    b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
                if (modelBranch == null) return;

                UpdateTargetVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);
            }
            catch (Exception ex)
            {
                var strError = ex.Message;
                if (strError != null)
                {
                    
                }
            }
        }