コード例 #1
0
 private void runAllConfigurationsItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     if (!AskQuestion("Run all configurations?"))
     {
         return;
     }
     try
     {
         navBarControl.Enabled = false;
         Program.PreRunTask();
         var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory);
         listConfigurations.StatusChanged += OnStatusChanged;
         var configList        = listConfigurations.Execute();
         var runConfigsCommand = new RunAllConfigurations();
         runConfigsCommand.StatusChanged += OnStatusChanged;
         runConfigsCommand.Execute(configList, false);
         Program.PreRunTask();
     }
     catch (Exception ex)
     {
         Log.Error(string.Format("Failed to run configurations.{0}{1}", Environment.NewLine, ex.Message), ex);
         XtraMessageBox.Show(string.Format("Failed to run configurations.{0}{1}", Environment.NewLine, ex.Message), "Error");
     }
     finally
     {
         navBarControl.Enabled = true;
         SplashManager.CloseSplashScreen();
     }
 }
コード例 #2
0
        private static void RunAll(bool compress, bool channelsMap, bool gzip)
        {
            PreRunTask();
            var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory);
            var configList         = listConfigurations.Execute();
            var runConfigsCommand  = new RunAllConfigurations();

            runConfigsCommand.Execute(configList, true);
            if (compress)
            {
                foreach (var file in Locations.OutputDirectory.GetFiles("*.xml"))
                {
                    if (!gzip)
                    {
                        using (ZipFile zip = new ZipFile())
                        {
                            var zipFileName = Path.Combine(Locations.OutputDirectory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".zip");
                            zip.AddFile(file.FullName, "");
                            zip.Save(zipFileName);
                        }
                    }
                    else
                    {
                        GZip(file.FullName, true);
                    }
                }
            }
            if (channelsMap)
            {
                var map = new ChannelMap();
                map.Configurations = configList;
                var mapFileName = Path.Combine(Locations.OutputDirectory.FullName, Settings.Default.ChannelsXmlFileName);
                map.SaveToFile(mapFileName);
            }
            PostRunTask();
        }