private void ChangeProjectProperties()
        {
            string changeVbProperty = this.ChangeProperty.Get(this.ActivityContext);

            if (!string.IsNullOrEmpty(changeVbProperty))
            {
                this.LogBuildMessage("START - Changing Properties VBP");

                VBPProject project = new VBPProject(this.ProjectFile.Get(this.ActivityContext));
                if (project.Load())
                {
                    string[] linesProperty = changeVbProperty.Split(Separator);
                    string[] keyProperty   = new string[linesProperty.Length];
                    string[] valueProperty = new string[linesProperty.Length];
                    int      index;

                    for (index = 0; index <= linesProperty.Length - 1; index++)
                    {
                        if (linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase) != -1)
                        {
                            keyProperty[index]   = linesProperty[index].Substring(0, linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase));
                            valueProperty[index] = linesProperty[index].Substring(linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase) + 1);
                        }

                        if (!string.IsNullOrEmpty(keyProperty[index]) && !string.IsNullOrEmpty(valueProperty[index]))
                        {
                            this.LogBuildMessage(keyProperty[index] + " -> New value: " + valueProperty[index]);
                            project.SetProjectProperty(keyProperty[index], valueProperty[index], false);
                        }
                    }

                    project.Save();
                }

                this.LogBuildMessage("END - Changing Properties VBP");
            }
        }
Example #2
0
        private void ChangeProjectProperties()
        {
            string changeVbProperty = this.ChangeProperty.Get(this.ActivityContext);
            if (!string.IsNullOrEmpty(changeVbProperty))
            {
                this.LogBuildMessage("START - Changing Properties VBP");

                VBPProject project = new VBPProject(this.ProjectFile.Get(this.ActivityContext));
                if (project.Load())
                {
                    string[] linesProperty = changeVbProperty.Split(Separator);
                    string[] keyProperty = new string[linesProperty.Length];
                    string[] valueProperty = new string[linesProperty.Length];
                    int index;

                    for (index = 0; index <= linesProperty.Length - 1; index++)
                    {
                        if (linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase) != -1)
                        {
                            keyProperty[index] = linesProperty[index].Substring(0, linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase));
                            valueProperty[index] = linesProperty[index].Substring(linesProperty[index].IndexOf("=", StringComparison.OrdinalIgnoreCase) + 1);
                        }

                        if (!string.IsNullOrEmpty(keyProperty[index]) && !string.IsNullOrEmpty(valueProperty[index]))
                        {
                            this.LogBuildMessage(keyProperty[index] + " -> New value: " + valueProperty[index]);
                            project.SetProjectProperty(keyProperty[index], valueProperty[index], false);
                        }
                    }

                    project.Save();
                }

                this.LogBuildMessage("END - Changing Properties VBP");
            }
        }