示例#1
0
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     #region Names
     if (reader.ReadByte() == 0)
     {
         names = null;
     }
     else
     {
         int numberOfEntries = reader.ReadInt32();
         names = new string[numberOfEntries];
         for (int i = 0; i < names.Length; i++)
         {
             if (reader.ReadByte() != 0)
             {
                 names[i] = reader.ReadString();
             }
             else
             {
                 names[i] = null;
             }
         }
     }
     #endregion
     #region ScopeName
     if (reader.ReadByte() == 0)
     {
         scopeName = null;
     }
     else
     {
         scopeName = reader.ReadString();
     }
     #endregion
     #region ScopeProperties
     if (reader.ReadByte() == 0)
     {
         scopeProperties = null;
     }
     else
     {
         scopeProperties = new BuildPropertyGroup();
         scopeProperties.CreateFromStream(reader);
     }
     #endregion
     #region ScopeToolsVersion
     if (reader.ReadByte() == 0)
     {
         scopeToolsVersion = null;
     }
     else
     {
         scopeToolsVersion = reader.ReadString();
     }
     #endregion
     cacheContentType = (CacheContentType)reader.ReadByte();
 }
示例#2
0
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     #region EnvironmentVariables
     int numberOfVariables = reader.ReadInt32();
     environmentVariables = new Hashtable(numberOfVariables);
     for (int i = 0; i < numberOfVariables; i++)
     {
         string key      = reader.ReadString();
         string variable = reader.ReadString();
         environmentVariables.Add(key, variable);
     }
     #endregion
     #region NodeLoggers
     if (reader.ReadByte() == 0)
     {
         nodeLoggers = null;
     }
     else
     {
         int numberOfLoggers = reader.ReadInt32();
         nodeLoggers = new LoggerDescription[numberOfLoggers];
         for (int i = 0; i < numberOfLoggers; i++)
         {
             LoggerDescription logger = new LoggerDescription();
             logger.CreateFromStream(reader);
             nodeLoggers[i] = logger;
         }
     }
     #endregion
     nodeId          = reader.ReadInt32();
     parentProcessId = reader.ReadInt32();
     #region ParentGlobalProperties
     if (reader.ReadByte() == 0)
     {
         parentGlobalProperties = null;
     }
     else
     {
         parentGlobalProperties = new BuildPropertyGroup();
         parentGlobalProperties.CreateFromStream(reader);
     }
     #endregion
     toolsetSearchLocations = (ToolsetDefinitionLocations)reader.ReadByte();
     parentStartupDirectory = (string)reader.ReadString();
 }
示例#3
0
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     #region EnvironmentVariables
     int numberOfVariables = reader.ReadInt32();
     environmentVariables = new Hashtable(numberOfVariables);
     for (int i = 0; i < numberOfVariables; i++)
     {
         string key = reader.ReadString();
         string variable = reader.ReadString();
         environmentVariables.Add(key, variable);
     }
     #endregion
     #region NodeLoggers
     if (reader.ReadByte() == 0)
     {
         nodeLoggers = null;
     }
     else
     {
         int numberOfLoggers = reader.ReadInt32();
         nodeLoggers = new LoggerDescription[numberOfLoggers];
         for (int i = 0; i < numberOfLoggers; i++)
         {
             LoggerDescription logger = new LoggerDescription();
             logger.CreateFromStream(reader);
             nodeLoggers[i] = logger;
         }
     }
     #endregion
     nodeId = reader.ReadInt32();
     parentProcessId = reader.ReadInt32();
     #region ParentGlobalProperties
     if (reader.ReadByte() == 0)
     {
         parentGlobalProperties = null;
     }
     else
     {
         parentGlobalProperties = new BuildPropertyGroup();
         parentGlobalProperties.CreateFromStream(reader);
     }
     #endregion
     toolsetSearchLocations = (ToolsetDefinitionLocations)reader.ReadByte();
     parentStartupDirectory = (string)reader.ReadString();
   }
示例#4
0
            public void PropertyGroupCustomSerialization()
            {
                BuildPropertyGroup pg = new BuildPropertyGroup();
                pg.SetProperty(new BuildProperty("bar", "barval", PropertyType.EnvironmentProperty));
                pg.SetProperty(new BuildProperty("baz", "bazval", PropertyType.GlobalProperty));
                pg.SetProperty(new BuildProperty("caz", "cazval", PropertyType.ImportedProperty));
                pg.SetProperty(new BuildProperty("barb", "barbout", PropertyType.OutputProperty));
                pg.SetProperty(new BuildProperty("gaz", "gazout", PropertyType.OutputProperty));
                pg.SetProperty(new BuildProperty("foo", "fooout2", PropertyType.OutputProperty));

                MemoryStream stream = new MemoryStream();
                BinaryWriter writer = new BinaryWriter(stream);
                BinaryReader reader = new BinaryReader(stream);
                try
                {
                    stream.Position = 0;
                    pg.WriteToStream(writer);
                    long streamWriteEndPosition = stream.Position;

                    stream.Position = 0;
                    BuildPropertyGroup pg2 = new BuildPropertyGroup();
                    pg2.CreateFromStream(reader);
                    long streamReadEndPosition = stream.Position;
                    Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream end positions should be equal");
                    Assert.AreEqual(6, pg.Count);
                    Assert.AreEqual("fooout2", pg2["foo"].FinalValueEscaped);
                    Assert.AreEqual("barval", pg2["bar"].FinalValueEscaped);
                    Assert.AreEqual("bazval", pg2["baz"].FinalValueEscaped);
                    Assert.AreEqual("cazval", pg2["caz"].FinalValueEscaped);
                    Assert.AreEqual("barbout", pg2["barb"].FinalValueEscaped);
                    Assert.AreEqual("gazout", pg2["gaz"].FinalValueEscaped);
                }
                finally
                {
                    reader.Close();
                    writer = null;
                    stream = null;
                }
            }
示例#5
0
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     #region Names
     if (reader.ReadByte() == 0)
     {
         names = null;
     }
     else
     {
         int numberOfEntries = reader.ReadInt32();
         names = new string[numberOfEntries];
         for (int i = 0; i < names.Length; i++)
         {
             if (reader.ReadByte() != 0)
             {
                 names[i] = reader.ReadString();
             }
             else
             {
                 names[i] = null;
             }
         }
     }
     #endregion
     #region ScopeName
     if (reader.ReadByte() == 0)
     {
         scopeName = null;
     }
     else
     {
         scopeName = reader.ReadString();
     }
     #endregion
     #region ScopeProperties
     if (reader.ReadByte() == 0)
     {
         scopeProperties = null;
     }
     else
     {
         scopeProperties = new BuildPropertyGroup();
         scopeProperties.CreateFromStream(reader);
     }
     #endregion
     #region ScopeToolsVersion
     if (reader.ReadByte() == 0)
     {
         scopeToolsVersion = null;
     }
     else
     {
         scopeToolsVersion = reader.ReadString();
     }
     #endregion
     cacheContentType = (CacheContentType)reader.ReadByte();
 }