Beispiel #1
0
        /// <summary>
        /// Processes the framework environment variables.
        /// </summary>
        /// <param name="environmentNodes">An <see cref="XmlNodeList" /> representing framework environment variables.</param>
        /// <param name="framework">The <see cref="FrameworkInfo" /> to obtain framework-specific information from.</param>
        private EnvironmentVariableCollection ProcessFrameworkEnvironmentVariables(XmlNodeList environmentNodes, FrameworkInfo framework)
        {
            EnvironmentVariableCollection frameworkEnvironment = null;

            // initialize framework-specific environment variables
            frameworkEnvironment = new EnvironmentVariableCollection();

            foreach (XmlNode environmentNode in environmentNodes)
            {
                // skip non-nant namespace elements and special elements like comments, pis, text, etc.
                if (!(environmentNode.NodeType == XmlNodeType.Element))
                {
                    continue;
                }

                // initialize element
                EnvironmentVariable environmentVariable = new EnvironmentVariable();
                environmentVariable.Parent           = environmentVariable.Project = framework.Project;
                environmentVariable.NamespaceManager = NamespaceManager;

                // configure using xml node
                environmentVariable.Initialize(environmentNode, framework.Project.Properties,
                                               framework);

                // add to collection of environment variables
                frameworkEnvironment.Add(environmentVariable);
            }

            return(frameworkEnvironment);
        }
Beispiel #2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "LaunchGroup" /> class.
        /// </summary>
        /// <param name = "parent">The parent of this group.</param>
        /// <param name = "groups">The child groups of this group.</param>
        /// <param name = "launchers">The child launchers of this group.</param>
        public LaunchGroup(LaunchGroup parent = null,
                           IEnumerable<LaunchGroup> groups = null,
                           IEnumerable<Launcher> launchers = null)
        {
            Groups = new ObservableCollection<LaunchGroup>();
            Launchers = new ObservableCollection<Launcher>();
            EnvironmentVariables = new EnvironmentVariableCollection();
            Parent = parent;

            HasChanges = false;

            if (groups != null)
            {
                foreach (var group in groups)
                {
                    Groups.Add(group);
                }
            }

            if (launchers != null)
            {
                foreach (var launcher in launchers)
                {
                    Launchers.Add(launcher);
                }
            }
        }
Beispiel #3
0
 public PipeTransportSettings(PipeTransportSettings copy)
 {
     WorkingDirectory     = copy.WorkingDirectory;
     Program              = copy.Program;
     Arguments            = copy.Arguments.ToArray();  //make copy of array
     DebuggerPath         = copy.DebuggerPath;
     EnvironmentVariables = new EnvironmentVariableCollection(copy.EnvironmentVariables);
 }
Beispiel #4
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Launcher" /> class.
 /// </summary>
 /// <param name = "parent">The <see cref = "LaunchGroup" /> that contains this Launcher.</param>
 public Launcher(LaunchGroup parent = null)
 {
     Parent = parent;
     EnvironmentVariables = new EnvironmentVariableCollection();
     Arguments = string.Empty;
     File = string.Empty;
     Name = string.Empty;
     WorkingDirectory = string.Empty;
     HasChanges = false;
 }
		protected override void OnCopyFrom (ProjectRunConfiguration config, bool isRename)
		{
			base.OnCopyFrom (config, isRename);

			var other = (ProcessRunConfiguration)config;

			StartArguments = other.StartArguments;
			StartWorkingDirectory = other.StartWorkingDirectory;
			EnvironmentVariables = new EnvironmentVariableCollection (other.EnvironmentVariables);
			ExternalConsole = other.ExternalConsole;
			PauseConsoleOutput = other.PauseConsoleOutput;
		}
        /// <summary>
        ///   Reads the JSON representation of the object.
        /// </summary>
        /// <param name = "reader">The <see cref = "T:Newtonsoft.Json.JsonReader" /> to read from.</param>
        /// <param name = "objectType">Type of the object.</param>
        /// <param name = "existingValue">The existing value of object being read.</param>
        /// <param name = "serializer">The calling serializer.</param>
        /// <returns>
        ///   The object value.
        /// </returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            var collection = new EnvironmentVariableCollection();

            string key = null;
            while (reader.Read() && reader.TokenType != JsonToken.EndObject)
            {
                if (reader.TokenType == JsonToken.PropertyName)
                {
                    key = (string) reader.Value;
                }
                else if (reader.TokenType == JsonToken.String)
                {
                    var value = (string) reader.Value;
                    collection.Add(key, value);
                    key = null;
                }
            }

            return collection;
        }
        public void EqualityTest()
        {
            const string KEY1 = "KEY1";
            const string KEY2 = "KEY2";
            const string KEY3 = "KEY3";

            var other = new EnvironmentVariableCollection();

            Assert.AreEqual(mEnvVars, other, "Empty dictionaries should be equal");

            mEnvVars[KEY1] = KEY1;
            mEnvVars[KEY2] = KEY2;
            other[KEY1]    = KEY1;
            other[KEY2]    = KEY2;

            Assert.AreEqual(mEnvVars, other, "Dictionaries with the same key-value pairs should be equal");

            other[KEY1] = KEY2;
            Assert.AreNotEqual(mEnvVars, other, "Dictionaries with different key-value pairs should not be equal");

            other[KEY1]    = KEY1;
            mEnvVars[KEY3] = KEY3;
            Assert.AreNotEqual(mEnvVars, other, "Dictionaries with different keys should not be equal");
        }
Beispiel #8
0
        /// <summary>
        ///   Gets all the environment variables to be used when launching this application, starting
        ///   with the topmost parent and overriding values down to the launcher's settings.
        /// </summary>
        public EnvironmentVariableCollection AggregateEnvironmentVariables()
        {
            var envVars = new Stack<EnvironmentVariableCollection>();
            envVars.Push(EnvironmentVariables);

            LaunchGroup parent = mParent;

            while (parent != null)
            {
                envVars.Push(parent.EnvironmentVariables);
                parent = parent.Parent;
            }

            var aggregatedEnvVars = new EnvironmentVariableCollection(envVars.Pop());

            while (envVars.Count > 0)
            {
                aggregatedEnvVars.UpdateWith(envVars.Pop());
            }

            return aggregatedEnvVars;
        }
 private void _AssertContainsKeyAndValue(EnvironmentVariableCollection envVars, string key1, string value)
 {
 }
 public void SetUp()
 {
     mEnvVars = new EnvironmentVariableCollection();
     mCollectionChangedEvents.Clear();
     mEnvVars.CollectionChanged += _HandleCollectionChanged;
 }
 private void _AssertContainsKeyAndValue(EnvironmentVariableCollection envVars, string key1, string value)
 {
 }
 public void SetUp()
 {
     mEnvVars = new EnvironmentVariableCollection();
     mCollectionChangedEvents.Clear();
     mEnvVars.CollectionChanged += _HandleCollectionChanged;
 }
        public void EqualityTest()
        {
            const string KEY1 = "KEY1";
            const string KEY2 = "KEY2";
            const string KEY3 = "KEY3";

            var other = new EnvironmentVariableCollection();

            Assert.AreEqual(mEnvVars, other, "Empty dictionaries should be equal");

            mEnvVars[KEY1] = KEY1;
            mEnvVars[KEY2] = KEY2;
            other[KEY1] = KEY1;
            other[KEY2] = KEY2;

            Assert.AreEqual(mEnvVars, other, "Dictionaries with the same key-value pairs should be equal");

            other[KEY1] = KEY2;
            Assert.AreNotEqual(mEnvVars, other, "Dictionaries with different key-value pairs should not be equal");

            other[KEY1] = KEY1;
            mEnvVars[KEY3] = KEY3;
            Assert.AreNotEqual(mEnvVars, other, "Dictionaries with different keys should not be equal");
        }