public void GetChromiumRegistryInfoTest()
        {
            IChromiumUpdateEngine target = ChromiumUpdateEngineFactory.CreateInstance();
            ChromiumRegistryInfo  actual;

            actual = target.GetChromiumRegistryInfo();
        }
        public void GetChromiumLatestVersionStringTest()
        {
            IChromiumUpdateEngine target = ChromiumUpdateEngineFactory.CreateInstance();;
            string actual;

            actual = target.GetChromiumLatestVersionString();
            Assert.AreNotEqual <String>(actual, String.Empty);
        }
 public void GetChromiumLatestVersionUpdateLog()
 {
     try
     {
         IChromiumUpdateEngine target = ChromiumUpdateEngineFactory.CreateInstance();
         string actual;
         actual = target.GetChromiumLatestVersionString();
         Assert.AreNotEqual <String>(actual, String.Empty);
         changelogs log = target.GetChromiumVersionChangeLogData(actual);
         Assert.IsNotNull(log);
     }
     catch
     {
         throw;
     }
 }
        public void GetChromiumVersions()
        {
            try
            {
                IChromiumUpdateEngine target = ChromiumUpdateEngineFactory.CreateInstance();

                IEnumerable <String> results = target.GetChromiumVersions();
                Assert.IsNotNull(results);
                foreach (var version in results)
                {
                    var log = target.GetChromiumVersionChangeLogData(version);
                }
            }
            catch
            {
                throw;
            }
        }
        public void DownloadChromiumTest()
        {
            try
            {
                String fileName = Path.Combine(Path.GetTempPath(), "mini_installer.exe");

                IChromiumUpdateEngine target = ChromiumUpdateEngineFactory.CreateInstance();
                string actual;
                actual = target.GetChromiumLatestVersionString();
                target.DownloadChromiumInstaller(Path.GetTempPath(), actual, false, (x) =>
                {
                    Trace.Write(String.Format("", x.ProgressPercentage));
                    Trace.Write(String.Format("", x.TotalBytesToReceive));
                    Trace.Write(String.Format("", x.BytesReceived));
                    return(true);
                }
                                                 );
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine(AppResources.ApplicationName);

                using (IChromiumUpdateEngine updateEngine = ChromiumUpdateEngineFactory.CreateInstance(new ChromiumUpdateEngineConfiguration()
                {
                    WebProxyType = ProxyType.None
                }))
                {
                    ChromiumRegistryInfo chromiumRegistryInfo = updateEngine.GetChromiumRegistryInfo();
                    String     latestVersion    = updateEngine.GetChromiumLatestVersionString();
                    changelogs releaseChangeLog = updateEngine.GetChromiumVersionChangeLogData(latestVersion);

                    Console.WriteLine(AppResources.LatestChromiumVersion, latestVersion);
                    Console.WriteLine(AppResources.CurrentInstalledChromiumVersion, chromiumRegistryInfo != null ? chromiumRegistryInfo.ToString() : AppResources.None);

                    Console.WriteLine(AppResources.DownloadingChromium, latestVersion);

                    String targetFileName = null;
                    updateEngine.DownloadChromiumInstaller(Path.GetTempPath(), latestVersion, false, (x) =>
                    {
                        if (x.FileDownloadState == FileDownloadState.Starting)
                        {
                            targetFileName = x.FileName;
                        }

                        switch (x.FileDownloadState)
                        {
                        case FileDownloadState.Starting:
                            break;

                        case FileDownloadState.Downloading:
                            DrawTextProgressBar(x.BytesReceived, x.TotalBytesToReceive);
                            break;

                        case FileDownloadState.Completed:
                            break;

                        default:
                            break;
                        }

                        return(true);
                    });

                    Console.WriteLine();
                    Console.WriteLine(AppResources.LaunchingInstaller);
                    Console.WriteLine();

                    using (ProcessLauncher processLauncher = new ProcessLauncher())
                    {
                        processLauncher.FileName = targetFileName;
                        if (!processLauncher.Start(true, TimeSpan.FromSeconds(60 * 2)))
                        {
                            Console.WriteLine(AppResources.ChildProcessFailure);
                        }
                    }

                    ChromiumRegistryInfo updatedChromiumRegistryInfo = updateEngine.GetChromiumRegistryInfo();

                    if (updatedChromiumRegistryInfo != null)
                    {
                        Console.WriteLine(updatedChromiumRegistryInfo.ToString());
                    }

                    Console.WriteLine(AppResources.Done);


                    if (releaseChangeLog != null)
                    {
                        Console.WriteLine(releaseChangeLog.ConcatenatedText);
                        Console.WriteLine();

                        releaseChangeLog.log.ForEach(x =>
                        {
                            Console.WriteLine("{0}: {1}@{2}", x.revision, x.author.Trim(), x.date);
                            Console.WriteLine("{0}", x.msg.Trim());
                        }
                                                     );
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(AppResources.Error, ex.Message);
            }
        }