Esempio n. 1
0
        // Step 5 - Update AppValues.js file
        private void buttonUpdateAppValues_Click(object sender, EventArgs e)
        {
            richTextBoxOutput.SelectionColor = Color.Red;
            richTextBoxOutput.AppendText("-- UPDATE AppValues.js --------------------\n\n");

            string path = System.IO.Path.Combine(environmentSettings.GetPhysicalPath(), "ProjectName");

            if (Directory.Exists(path))
            {
                path = System.IO.Path.Combine(path, "app\\values\\app.values.js");

                Utils.ReplaceInFile(path, "localhost", environmentSettings.GetServer());
                richTextBoxOutput.AppendText("CHANGED localhost TO " + environmentSettings.GetServer() + "\n");

                if (environmentSettings.Environment != "Gold")
                {
                    Utils.ReplaceInFile(path, "Authorization2", "Authorization");
                    richTextBoxOutput.AppendText("CHANGED Authorization2 TO Authorization\n");
                }

                richTextBoxOutput.AppendText("\n");

                Utils.ReplaceInFile(path, @".*environment:.*", "\t\t\t" + @"environment: '" + environmentSettings.Environment + "',");
                richTextBoxOutput.AppendText("REPLACED environment: WITH " + @"environment: " + environmentSettings.Environment + ",\n");

                Utils.ReplaceInFile(path, @".*baseUrl:.*", "\t\t\t" + @"baseUrl: ""http://" + environmentSettings.GetServer() + @"/" + environmentSettings.GetEnvPrefix().ToLower() + environmentSettings.AppVersion.ToLower() + "\",");
                richTextBoxOutput.AppendText(@"REPLACED baseUrl: ""http://localhost/projectname"" WITH " + @"baseUrl: ""http://" + environmentSettings.GetServer() + @"/" + environmentSettings.GetEnvPrefix().ToLower() + environmentSettings.AppVersion.ToLower() + "\",\n");

                richTextBoxOutput.AppendText("\n");

                Utils.ReplaceInFile(path, "value-to-remove", environmentSettings.GetClientID());
                richTextBoxOutput.AppendText("CHANGED clientID FROM value-to-remove TO " + environmentSettings.GetClientID() + "\n");

                Utils.ReplaceInFile(path, "xx.xx.xx.xx", environmentSettings.GetServer());
                richTextBoxOutput.AppendText("CHANGED FROM xx.xx.xx.xx TO " + environmentSettings.GetServer() + "\n");

                Utils.ReplaceInFile(path, "projectnameServicesDev", environmentSettings.GetEnvPrefix() + "Services" + environmentSettings.FolderVersion);
                richTextBoxOutput.AppendText("CHANGED serviceUrls FROM projectnameServicesDev TO " + environmentSettings.GetEnvPrefix() + "Services" + environmentSettings.FolderVersion + "\n");

                richTextBoxOutput.AppendText("\n");
                richTextBoxOutput.Refresh();
            }
            else
            {
                richTextBoxOutput.AppendText("Directory does NOT exist at: " + path + "\n\n");
                richTextBoxOutput.Refresh();
            }
        }
        public static void DisplayEnvironmentVariables(EnvironmentSettings environmentSettings, RichTextBox richTextBoxOutput)
        {
            richTextBoxOutput.Clear();
            richTextBoxOutput.AppendText("Environment\t" + environmentSettings.Environment + "\n");
            richTextBoxOutput.AppendText("Git Branch\t" + environmentSettings.Branch + "\n");
            richTextBoxOutput.AppendText("App Version\t" + environmentSettings.AppVersion + "\n");
            richTextBoxOutput.AppendText("Released?\t" + ((environmentSettings.IsQA() ? "N/A" : environmentSettings.Released.ToString()) + "\n"));
            richTextBoxOutput.AppendText("Enviro Prefix\t" + environmentSettings.GetEnvPrefix() + "\n");
            richTextBoxOutput.AppendText("FolderVersion\t" + environmentSettings.FolderVersion + "\n");
            richTextBoxOutput.AppendText("Server Path\t" + environmentSettings.GetServer() + "\n");
            richTextBoxOutput.AppendText("Client ID\t\t" + environmentSettings.GetClientID() + "\n\n");

            richTextBoxOutput.AppendText("Url\t\t" + @"http://" + environmentSettings.GetServer() + @"/" + environmentSettings.GetEnvPrefix().ToLower() + environmentSettings.AppVersion + "\n\n");

            richTextBoxOutput.AppendText("Physical Path\t" + environmentSettings.GetPhysicalPath() + "\n\n");
        }