コード例 #1
0
        public void Parse(InstallSection installSection, InstallData expected)
        {
            var parser = new InstallSectionParser();
            var actual = parser.Parse(installSection);

            actual.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering());
        }
コード例 #2
0
        public void Merge(InstallSection installSection, InstallData defaults, InstallData[] parentInstalls, InstallData expected)
        {
            var parser = new InstallSectionParser();
            var merger = new InstallSectionMerger();

            var currentConfigInstallData = parser.Parse(installSection, defaults?.CurrentConfigurationInstallFiles);
            var actual = merger.Merge(currentConfigInstallData, defaults, parentInstalls);

            actual.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering());
        }
コード例 #3
0
ファイル: GUI.cs プロジェクト: FOGProject/fog-client
        private bool UpdateSection(Label label, MetroProgressSpinner spinner, InstallSection section)
        {
            label.ForeColor = System.Drawing.Color.Black;

            spinner.Invoke((MethodInvoker)(() =>
            {
                spinner.Value = 20;
            }));

            var success = false;

            try
            {
                switch (section)
                {
                case InstallSection.Prepare:
                    success = Helper.Instance.PrepareFiles();
                    break;

                case InstallSection.Install:
                    success = Helper.Instance.Install("0", "0",
                                                      addressTxtBox.Text, webRootTxtBox.Text, "FOG",
                                                      (logSwitch.Checked) ? "1" : "0", null);
                    break;

                case InstallSection.Configure:
                    success = Configure();
                    break;

                case InstallSection.Secure:
                    success = InstallCerts();
                    break;
                }
            }
            catch (Exception ex)
            {
                logBox.Invoke((MethodInvoker)(() =>
                {
                    logBox.AppendText(ex.Message);
                }));
                success = false;
            }


            spinner.Invoke((MethodInvoker)(() =>
            {
                spinner.Value = 100;
                spinner.ForeColor = (success) ? Color.ForestGreen : Color.Crimson;
            }));

            return(success);
        }
コード例 #4
0
        public InstallData Parse(InstallSection configSection, List <string> currentConfigurationInstallFilesFromDefault = null)
        {
            var externalModules = configSection.Install
                                  .Where(line => line.StartsWith(ModulePrefix))
                                  .Select(line => line.Substring(ModulePrefix.Length))
                                  .ToList();

            var nugets = configSection.Install
                         .Where(line => line.StartsWith(NugetPrefix))
                         .Select(line => line.Substring(NugetPrefix.Length))
                         .ToList();

            var installFiles = configSection.Install
                               .Where(IsBuildFileName)
                               .Distinct()
                               .ToList();

            var artifacts = installFiles
                            .Concat(configSection.Artifacts)
                            .Where(IsBuildFileName)
                            .Distinct()
                            .ToList();

            // currentConfigurationInstallFiles are inherited from 'default' section ¯\_(ツ)_/¯
            var currentConfigurationInstallFiles = (currentConfigurationInstallFilesFromDefault ?? Enumerable.Empty <string>())
                                                   .Concat(artifacts)
                                                   .ToList();

            var installData = new InstallData
            {
                InstallFiles = installFiles,
                CurrentConfigurationInstallFiles = currentConfigurationInstallFiles,
                Artifacts       = artifacts,
                ExternalModules = externalModules,
                NuGetPackages   = nugets
            };

            return(installData);
        }
コード例 #5
0
        public InstallData Parse(object installSection, object artifactsSection, List <string> currentConfigurationInstallFilesFromDefault = null)
        {
            var sections = new InstallSection(installSection, artifactsSection);

            return(Parse(sections, currentConfigurationInstallFilesFromDefault));
        }
コード例 #6
0
ファイル: GUI.cs プロジェクト: FOGProject/fog-client
        private bool UpdateSection(Label label, MetroProgressSpinner spinner, InstallSection section)
        {
            label.ForeColor = System.Drawing.Color.Black;

            spinner.Invoke((MethodInvoker)(() =>
            {
                spinner.Value = 20;
            }));

            var success = false;
            try
            {
                switch (section)
                {
                    case InstallSection.Prepare:
                        success = Helper.Instance.PrepareFiles();
                        break;
                    case InstallSection.Install:
                        success = Helper.Instance.Install("0", "0",
                            addressTxtBox.Text, webRootTxtBox.Text, "FOG",
                            (logSwitch.Checked) ? "1" : "0");
                        break;
                    case InstallSection.Configure:
                        success = Configure();
                        break;
                    case InstallSection.Secure:
                        success = InstallCerts();
                        break;
                }
            }
            catch (Exception ex)
            {
                logBox.Invoke((MethodInvoker)(() =>
                {
                    logBox.AppendText(ex.Message);
                }));
                success = false;
            }

            spinner.Invoke((MethodInvoker)(() =>
            {
                spinner.Value = 100;
                spinner.ForeColor = (success) ? Color.ForestGreen : Color.Crimson;
            }));

            return success;
        }