예제 #1
0
        private FileInfo GetExternalFile(string relFilePath)
        {
            if (string.IsNullOrEmpty(relFilePath))
            {
                MessageBox.Show(
                    string.Format("No external file is referenced in {0}.", _controlLocationName)
                    , Resources.ExternalNodeReference_ExternalFileNotFoundTitle, MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return(null);
            }
            FileInfo fi = EnvironmentFileHandler.GetFile();

            if (fi != null)
            {
                FileInfo extFile = new FileInfo(Path.Combine(fi.DirectoryName, relFilePath));
                if (extFile.Exists)
                {
                    return(extFile);
                }
                MessageBox.Show(
                    string.Format("The external file {1} referenced in {0} does not exist.", _controlLocationName,
                                  extFile.FullName)
                    , Resources.ExternalNodeReference_ExternalFileNotFoundTitle, MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }

            return(null);
        }
 public Editor()
 {
     _envFh = new EnvironmentFileHandler(this);
     _envFh.FileOperationCompleted += EnvFh_FileOperationCompleted;
     InitializeComponent();
     string[] args = Environment.GetCommandLineArgs();
     try
     {
         if (args.Length > 1)
         {
             FileInfo fi = new FileInfo(args[1]);
             SetDefault();
             _envFh.Load(fi.FullName);
         }
         else
         {
             _envFh.Clean();
             NewFile();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public static List <KeyValuePair <string, string> > GetVariables()
        {
            List <KeyValuePair <string, string> > vars = new List <KeyValuePair <string, string> >();

            if (_dgRowsSingelton != null)
            {
                foreach (DataGridViewRow row in _dgRowsSingelton)
                {
                    if (!row.DataGridView.Enabled)
                    {
                        return(vars);
                    }
                    if (row.IsNewRow)
                    {
                        continue;
                    }
                    object name  = row.Cells["VariableName"].Value;
                    object value = row.Cells["VariableValue"].Value;

                    if (!string.IsNullOrEmpty(row.Cells["VariableName"].ErrorText) ||
                        !string.IsNullOrEmpty(row.Cells["VariableValue"].ErrorText))
                    {
                        EnvironmentFileHandler.AddNotification(
                            "The variables datagrid has still invalid or missing values.");
                    }

                    if (name != null && value != null)
                    {
                        vars.Add(new KeyValuePair <string, string>(name.ToString(), value.ToString()));
                    }
                }
                vars.Sort((x, y) => String.Compare(x.Key, y.Key, StringComparison.Ordinal));
            }
            return(vars);
        }
 private void NewFile()
 {
     if (_envFh.Load(null))
     {
         SetDefault();
         EnvironmentFileHandler.MakeSingletonDirty();
     }
 }
 private void SaveVariable_Click(object sender, EventArgs e)
 {
     if (dataGrid_Variables.CurrentRow != null)
     {
         dataGrid_Variables.CurrentRow.Cells["VariableValue"].Value = _editVarDialog.Variable;
     }
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void DeleteRowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     dataGrid_Variables.Rows.Remove(dataGrid_Variables.CurrentRow);
     if (dataGrid_Variables.Rows.Count == 0)
     {
         dataGrid_Variables.Rows.Add();
     }
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #7
0
 private void Node_Changed(object sender, EventArgs e)
 {
     textBox_ExtNodeFile.Enabled  = radioButton_ExtNode.Checked;
     button_ExtNodeBrowse.Enabled = radioButton_ExtNode.Checked;
     comboBox_ExtNodeId.Enabled   = radioButton_ExtNode.Checked;
     textBox_IntNodeId.Enabled    = radioButton_IntNode.Checked;
     EnvironmentFileHandler.MakeSingletonDirty();
     NodeReferenceHasChanged.Invoke(sender, e);
 }
예제 #8
0
        private void CheckBox_Action_CheckedChanged(object sender, EventArgs e)
        {
            bool enabled = ((CheckBox)sender).Checked;

            checkBox_Action_deploy.Enabled  = enabled;
            checkBox_Action_force.Enabled   = enabled;
            checkBox_Action_retract.Enabled = enabled;
            checkBox_Action_update.Enabled  = enabled;
            EnvironmentFileHandler.MakeSingletonDirty();
        }
        private void CheckBox_Warmup_CheckedChanged(object sender, EventArgs e)
        {
            bool enabled = (sender as CheckBox).Checked;

            checkBox_Action_AllSites.Enabled   = enabled;
            checkBox_Action_AllWebApps.Enabled = enabled;
            checkBox_Action_CustomUrl.Enabled  = enabled;
            checkBox_Action_deploy.Enabled     = enabled;
            checkBox_Action_update.Enabled     = enabled;
            EnvironmentFileHandler.MakeSingletonDirty();
        }
 private void ComboBox_SPVersion_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox_SPVersion.Items.Count > 0 && comboBox_SPVersion.SelectedIndex != -1)
     {
         checkBox_AllowTrustedBin.Enabled =
             new Version(((KeyValuePair <string, string>)comboBox_SPVersion.SelectedItem).Key).Major == 15;
         checkBox_AllowCASPolicies.Enabled =
             new Version(((KeyValuePair <string, string>)comboBox_SPVersion.SelectedItem).Key).Major == 14;
     }
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #11
0
        private void CheckBox_RecycleAppPool_CheckedChanged(object sender, EventArgs e)
        {
            bool enabled = ((CheckBox)sender).Checked;

            checkBox_Action_deploy.Enabled        = enabled;
            checkBox_Action_retract.Enabled       = enabled;
            checkBox_Action_update.Enabled        = enabled;
            radioButton_Action_AllAppPool.Enabled = enabled;
            radioButton_Action_SPAppPool.Enabled  = enabled;
            EnvironmentFileHandler.MakeSingletonDirty();
        }
        private void checkBox_Action_CheckedChanged(object sender, EventArgs e)
        {
            bool enabled = (sender as CheckBox).Checked;

            checkBox_Action_deploy.Enabled  = enabled;
            checkBox_Action_force.Enabled   = enabled;
            checkBox_Action_retract.Enabled = enabled;
            checkBox_Action_update.Enabled  = enabled;
            textbox_ActionName.Enabled      = enabled;
            textbox_ActionName_val.Validate();
            EnvironmentFileHandler.MakeSingletonDirty();
        }
 public string GetValidatedValue()
 {
     Validate();
     if (!IsValid)
     {
         EnvironmentFileHandler.AddNotification(string.Format("The {0} has still invalid or missing values.",
                                                              SaveErrorFieldDesc));
         return("");
         //throw new InvalidExpressionException(string.Format("The {0} has still invalid or missing values.",
         //                                                   SaveErrorFieldDesc));
     }
     return(_controlToValidate.Text.Trim());
 }
예제 #14
0
        private void BrowseButton_Click(object sender, EventArgs e)
        {
            if (EnvironmentFileHandler.IsSingletonNew)
            {
                MessageBox.Show(
                    Resources.ExternalNodeReference_FileUnsavedWarningText,
                    Resources.ExternalNodeReference_FileUnsavedWarningTitle, MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }
            FileInfo fi = EnvironmentFileHandler.GetFile();

            if (fi != null)
            {
                openFileDialog.InitialDirectory = fi.DirectoryName;
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        FileInfo extFile = new FileInfo(openFileDialog.FileName);
                        if (extFile.FullName.Equals(fi.FullName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            MessageBox.Show(
                                Resources.ExternalNodeReference_SelfReferenceMessage,
                                Resources.ExternalNodeReference_BrowseErrorTitle, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                            return;
                        }
                        string relPath = fi.RelativePathTo(extFile);
                        //Model.SPSD file = EnvironmentFileHandler.LoadFile(openFileDialog.FileName);
                        //if (file != null)
                        //{
                        if (LoadExternalNodeIds(relPath))
                        {
                            textBox_ExtNodeFile.Text = relPath;
                            EnvironmentFileHandler.MakeSingletonDirty();
                        }
                        //}
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(
                            ex.Message,
                            Resources.ExternalNodeReference_BrowseErrorTitle, MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                        return;
                    }
                }
            }
        }
        internal Dictionary <string, object>[] GetRows()
        {
            ArrayList list = new ArrayList();

            if (dataGrid_Solutions.Enabled)
            {
                foreach (DataGridViewRow dgRow in dataGrid_Solutions.Rows)
                {
                    if (dgRow.IsNewRow)
                    {
                        continue;
                    }
                    Dictionary <string, object> row   = new Dictionary <string, object>();
                    DataGridViewCellCollection  cells = dgRow.Cells;
                    if (!string.IsNullOrEmpty(cells["SolutionName"].ErrorText) ||
                        !string.IsNullOrEmpty(cells["SolutionType"].ErrorText) ||
                        !string.IsNullOrEmpty(cells["SolutionUrls"].ErrorText))
                    {
                        EnvironmentFileHandler.AddNotification(
                            string.Format("The {0} has still invalid or missing values.", Tag));
                    }

                    row.Add("SolutionName", cells["SolutionName"].Value);

                    if (dataGrid_Solutions.Columns["SolutionForce"].Visible)
                    {
                        row.Add("SolutionForce", cells["SolutionForce"].Value);
                    }
                    if (dataGrid_Solutions.Columns["SolutionOverwrite"].Visible)
                    {
                        row.Add("SolutionOverwrite", cells["SolutionOverwrite"].Value);
                    }
                    row.Add("SolutionUrls", cells["SolutionUrls"].Value != null ? cells["SolutionUrls"].Value.ToString().Trim() : string.Empty);
                    row.Add("SolutionType", cells["SolutionType"].Value);
                    list.Add(row);
                }
            }
            return(list.Cast <Dictionary <string, object> >().ToArray <Dictionary <string, object> >());
        }
예제 #16
0
 private void RadioButton_WaitAfterDeployment_CheckedChanged(object sender, EventArgs e)
 {
     textBox_WaitAfterDeploy.Enabled = radioButton_WaitAfterDeployment.Checked;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #17
0
 private void CheckBox_RunOnMultipleServersInFarm_CheckedChanged(object sender, EventArgs e)
 {
     comboBox_RunOnMultipleServersInFarm.Enabled = checkBox_RunOnMultipleServersInFarm.Checked;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #18
0
 private void CheckBox_OverwriteExistingSolutions_CheckedChanged(object sender, EventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #19
0
 private void RadioButton_AllSolutions_CheckedChanged(object sender, EventArgs e)
 {
     checkBox_ForceSolutionDeployment.Enabled    = radioButton_allSolutions.Checked;
     checkBox_OverwriteExistingSolutions.Enabled = radioButton_allSolutions.Checked;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void dataGrid_Solutions_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     SetAvailabilityOfUrlField(e.RowIndex);
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void DataGrid_Variables_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void TextBox_Warmup_CustomUrls_EnabledChanged(object sender, EventArgs e)
 {
     button_Warmup_EditCustom.Enabled = textBox_Warmup_customUrls.Enabled;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void CheckBox_Warmup_CustomUrl_Changed(object sender, EventArgs e)
 {
     textBox_Warmup_customUrls.Enabled = checkBox_Action_CustomUrl.Enabled && checkBox_Action_CustomUrl.Checked;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void TextBox_Warmup_CustomUrls_TextChanged(object sender, EventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void ComboBox_SPLicense_SelectedIndexChanged(object sender, EventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void textbox_ActionName_TextChanged(object sender, EventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void SaveUrls_Click(object sender, EventArgs e)
 {
     textBox_Warmup_customUrls.Text = urlEditDialog.Urls;
     EnvironmentFileHandler.MakeSingletonDirty();
 }
예제 #28
0
 private void CheckBox_CheckedChanged(object sender, EventArgs e)
 {
     EnvironmentFileHandler.MakeSingletonDirty();
 }
 private void SaveUrls_Click(object sender, EventArgs e)
 {
     dataGrid_Solutions.CurrentRow.Cells["SolutionUrls"].Value = urlEditDialog.Urls;
     EnvironmentFileHandler.MakeSingletonDirty();
 }