/// <summary>
        ///     Writes the ini data to a stream.
        /// </summary>
        /// <param name="writer">A write stream where the ini data will be stored</param>
        /// <param name="iniData">An <see cref="IniData"/> instance.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="writer"/> is <c>null</c>.
        /// </exception>
        public void WriteData(StreamWriter writer, IniData iniData)
        {
            if (writer == null)
                throw new ArgumentNullException("reader");

            writer.Write(iniData.ToString());
        }
Beispiel #2
0
        public void CreateIniFileProgramatically()
        {
			var iniData = new IniData();
			iniData.Global.AddKey("UseSeparateRepositoryForAssets", true.ToString());
			
			iniData.Sections.AddSection("MainRepository");
			iniData["MainRepository"]["Type"] = "git";
			iniData["MainRepository"]["RelativePath"] = ".";
			
			Assert.That(iniData["MainRepository"].ContainsKey("Type"));
			Assert.That(iniData["MainRepository"].ContainsKey("RelativePath"));
			
			iniData.Sections.AddSection("AssetsRepository");
			iniData["AssetsRepository"]["Type"] = "svn";
			iniData["AssetsRepository"]["RelativePath"] = "./Assets";
			
			Assert.That(iniData["AssetsRepository"].ContainsKey("Type"));
			Assert.That(iniData["AssetsRepository"].ContainsKey("RelativePath"));
			
			Console.WriteLine(iniData.ToString());
        }
        /// <summary>
        ///     Writes the ini data to a stream.
        /// </summary>
        /// <param name="writer">A write stream where the ini data will be stored</param>
        /// <param name="iniData">An <see cref="IniData"/> instance.</param>
        /// <param name="formatter">Formaterr instance that controls how the ini data is transformed to a string</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="writer"/> is <c>null</c>.
        /// </exception>
        public void WriteData(StreamWriter writer, IniData iniData, IIniDataFormatter formatter)
        {
            if (formatter == null)
                throw new ArgumentNullException("formatter");
            if (iniData == null)
                throw new ArgumentNullException("iniData");
            if (writer == null)
                throw new ArgumentNullException("writer");

            writer.Write(iniData.ToString(formatter));
        }
Beispiel #4
0
 /// <summary>
 /// Creates a string from the INI data.
 /// </summary>
 /// <param name="iniData">An <see cref="IniData"/> instance.</param>
 /// <returns>
 /// A formatted string with the contents of the
 /// <see cref="IniData"/> instance object.
 /// </returns>
 public string WriteString(IniData iniData)
 {
     return iniData.ToString();
 }