Inheritance: IDisposable
コード例 #1
0
        /// <summary>
        /// Returns a proper IniWriter depending upon the type parameter.
        /// </summary>
        private IniWriter GetIniWriter(TextWriter reader, IniFileType type)
        {
            IniWriter result = new IniWriter(reader);

            switch (type)
            {
            case IniFileType.Standard:
            case IniFileType.WindowsStyle:
                // do nothing
                break;

            case IniFileType.PythonStyle:
                result.AssignDelimiter  = ':';
                result.CommentDelimiter = '#';
                break;

            case IniFileType.SambaStyle:
            case IniFileType.MysqlStyle:
                result.AssignDelimiter  = '=';
                result.CommentDelimiter = '#';
                break;
            }

            return(result);
        }
コード例 #2
0
        /// <include file='IniDocument.xml' path='//Method[@name="SaveTextWriter"]/docs/*' />
        public void Save(TextWriter textWriter)
        {
            IniWriter  writer  = GetIniWriter(textWriter, fileType);
            IniItem    item    = null;
            IniSection section = null;

            foreach (string comment in initialComment)
            {
                writer.WriteEmpty(comment);
            }

            for (int j = 0; j < sections.Count; j++)
            {
                section = sections[j];
                writer.WriteSection(section.Name, section.Comment);
                for (int i = 0; i < section.ItemCount; i++)
                {
                    item = section.GetItem(i);
                    switch (item.Type)
                    {
                    case IniType.Key:
                        writer.WriteKey(item.Name, item.Value, item.Comment);
                        break;

                    case IniType.Empty:
                        writer.WriteEmpty(item.Comment);
                        break;
                    }
                }
            }

            writer.Close();
        }
コード例 #3
0
ファイル: IniDocument.cs プロジェクト: RavenB/gridsearch
		/// <summary>
		/// Returns a proper IniWriter depending upon the type parameter.
		/// </summary>
		private IniWriter GetIniWriter (TextWriter reader, IniFileType type)
		{
			IniWriter result = new IniWriter (reader);

			switch (type)
			{
			case IniFileType.Standard:
			case IniFileType.WindowsStyle:
				// do nothing
				break;
			case IniFileType.PythonStyle:
				result.AssignDelimiter = ':';
				result.CommentDelimiter = '#';
				break;
			case IniFileType.SambaStyle:
			case IniFileType.MysqlStyle:
				result.AssignDelimiter = '=';
				result.CommentDelimiter = '#';
				break;
			}

			return result;
		}