コード例 #1
0
        public RunSetsExecutionsHistoryPage(eExecutionHistoryLevel executionHistoryLevel, RunSetConfig runsetConfig = null)
        {
            InitializeComponent();

            mExecutionHistoryLevel = executionHistoryLevel;
            RunsetConfig           = runsetConfig;

            SetGridView();
            LoadExecutionsHistoryData();
        }
コード例 #2
0
 public RunsetOperationsPage(RunSetConfig runSetConfig)
 {
     InitializeComponent();
     mRunSetConfig = runSetConfig;
     LoadActionsGrid();
 }
コード例 #3
0
 public void Init(RunSetConfig runSetConfig)
 {
     mRunSetConfig = runSetConfig;
     SetContentAndEventsListeners();
 }
コード例 #4
0
        private bool ProcessCommandLineArgs()
        {
            // New option with one arg to config file
            // resole spaces and quotes mess in commnd arg + more user friednly to edit
            // We expect only AutoRun --> File location
            try
            {
                string[] Args = Environment.GetCommandLineArgs();

                // We xpect Autorun as arg[1]
                string[] arg1 = Args[1].Split('=');

                if (arg1[0] != "ConfigFile")
                {
                    Reporter.ToLog(eLogLevel.ERROR, "'ConfigFile' argument was not found.");
                    return(false);
                }

                string AutoRunFileName = arg1[1];

                Reporter.ToLog(eLogLevel.INFO, "Reading all arguments from the Config file placed at: '" + AutoRunFileName + "'");
                string[] lines = System.IO.File.ReadAllLines(AutoRunFileName);

                string scURL  = null;
                string scUser = null;
                string scPswd = null;

                foreach (string arg in lines)
                {
                    int    i     = arg.IndexOf('=');
                    string param = arg.Substring(0, i).Trim();
                    string value = arg.Substring(i + 1).Trim();

                    switch (param)
                    {
                    case "SourceControlType":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlType: '" + value + "'");
                        if (value.Equals("GIT"))
                        {
                            App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.GIT;
                        }
                        else if (value.Equals("SVN"))
                        {
                            App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.SVN;
                        }
                        else
                        {
                            App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.None;
                        }
                        break;

                    case "SourceControlUrl":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlUrl: '" + value + "'");
                        if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN)
                        {
                            if (!value.ToUpper().Contains("/SVN") && !value.ToUpper().Contains("/SVN/"))
                            {
                                value = value + "svn/";
                            }
                            if (!value.ToUpper().EndsWith("/"))
                            {
                                value = value + "/";
                            }
                        }
                        App.UserProfile.SourceControlURL = value;
                        scURL = value;
                        break;

                    case "SourceControlUser":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlUser: '******'");
                        if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && value == "")
                        {
                            value = "Test";
                        }
                        App.UserProfile.SourceControlUser = value;
                        scUser = value;
                        break;

                    case "SourceControlPassword":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlPassword: '******'");
                        App.UserProfile.SourceControlPass = value;
                        scPswd = value;
                        break;

                    case "PasswordEncrypted":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "PasswordEncrypted: '" + value + "'");
                        string pswd = App.UserProfile.SourceControlPass;
                        if (value == "Y")
                        {
                            pswd = EncryptionHandler.DecryptwithKey(App.UserProfile.SourceControlPass, App.ENCRYPTION_KEY);
                        }
                        if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && pswd == "")
                        {
                            pswd = "Test";
                        }
                        App.UserProfile.SourceControlPass = pswd;
                        break;

                    case "SourceControlProxyServer":
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlProxyServer: '" + value + "'");
                        if (value == "")
                        {
                            App.UserProfile.SolutionSourceControlConfigureProxy = false;
                        }
                        else
                        {
                            App.UserProfile.SolutionSourceControlConfigureProxy = true;
                        }
                        if (value != "" && !value.ToUpper().StartsWith("HTTP://"))
                        {
                            value = "http://" + value;
                        }
                        App.UserProfile.SolutionSourceControlProxyAddress = value;
                        break;

                    case "SourceControlProxyPort":
                        if (value == "")
                        {
                            App.UserProfile.SolutionSourceControlConfigureProxy = false;
                        }
                        else
                        {
                            App.UserProfile.SolutionSourceControlConfigureProxy = true;
                        }
                        Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlProxyPort: '" + value + "'");
                        App.UserProfile.SolutionSourceControlProxyPort = value;
                        break;

                    case "Solution":
                        if (scURL != null && scUser != "" && scPswd != null)
                        {
                            Reporter.ToLogAndConsole(eLogLevel.INFO, "Downloading Solution from source control");
                            if (value.IndexOf(".git") != -1)
                            {
                                App.DownloadSolution(value.Substring(0, value.IndexOf(".git") + 4));
                            }
                            else
                            {
                                App.DownloadSolution(value);
                            }
                        }
                        Reporter.ToLog(eLogLevel.INFO, "Loading the Solution: '" + value + "'");
                        try
                        {
                            if (App.SetSolution(value) == false)
                            {
                                Reporter.ToLog(eLogLevel.ERROR, "Failed to load the Solution");
                                return(false);
                            }
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToLog(eLogLevel.ERROR, "Failed to load the Solution");
                            Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}");
                            return(false);
                        }
                        break;

                    case "Env":
                        Reporter.ToLog(eLogLevel.INFO, "Selected Environment: '" + value + "'");
                        ProjEnvironment env = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>().Where(x => x.Name.ToLower().Trim() == value.ToLower().Trim()).FirstOrDefault();
                        if (env != null)
                        {
                            RunsetExecutionEnvironment = env;
                        }
                        else
                        {
                            Reporter.ToLog(eLogLevel.ERROR, "Failed to find matching Environment in the Solution");
                            return(false);
                        }
                        break;

                    case "RunSet":
                        Reporter.ToLog(eLogLevel.INFO, string.Format("Selected {0}: '{1}'", GingerDicser.GetTermResValue(eTermResKey.RunSet), value));
                        RunSetConfig runSetConfig = App.LocalRepository.GetSolutionRunSets().Where(x => x.Name.ToLower().Trim() == value.ToLower().Trim()).FirstOrDefault();
                        if (runSetConfig != null)
                        {
                            App.RunsetExecutor.RunSetConfig = runSetConfig;
                        }
                        else
                        {
                            Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed to find matching {0} in the Solution", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                            return(false);
                        }
                        break;

                    default:
                        Reporter.ToLog(eLogLevel.ERROR, "Un Known argument: '" + param + "'");
                        return(false);
                    }
                }

                if (RunSetConfig != null && RunsetExecutionEnvironment != null)
                {
                    return(true);
                }
                else
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Missing key arguments which required for execution");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Exception occurred during command line arguments processing", ex);
                return(false);
            }
        }