Set() публичный Метод

public Set ( ) : void
Результат void
Пример #1
0
        /// <summary>
        /// Loads the file not saving comments.
        /// </summary>
        private void LoadReader(IniReader reader)
        {
            reader.IgnoreComments = false;
            bool       sectionFound = false;
            IniSection section      = null;

            try {
                while (reader.Read())
                {
                    switch (reader.Type)
                    {
                    case IniType.Empty:
                        if (!sectionFound)
                        {
                            initialComment.Add(reader.Comment);
                        }
                        else
                        {
                            section.Set(reader.Comment);
                        }

                        break;

                    case IniType.Section:
                        sectionFound = true;
                        // If section already exists then overwrite it
                        if (sections[reader.Name] != null)
                        {
                            sections.Remove(reader.Name);
                        }
                        section = new IniSection(reader.Name, reader.Comment);
                        sections.Add(section);

                        break;

                    case IniType.Key:
                        if (section.GetValue(reader.Name) == null)
                        {
                            section.Set(reader.Name, reader.Value, reader.Comment);
                        }
                        break;
                    }
                }
            } catch (Exception ex) {
                throw ex;
            } finally {
                // Always close the file
                reader.Close();
            }
        }
Пример #2
0
		/// <summary>
		/// Loads the file not saving comments.
		/// </summary>
		private void LoadReader (IniReader reader)
		{
			reader.IgnoreComments = false;
			bool sectionFound = false;
			IniSection section = null;
			
			try {
				while (reader.Read ())
				{
					switch (reader.Type)
					{
					case IniType.Empty:
						if (!sectionFound) {
							initialComment.Add (reader.Comment);
						} else {
							section.Set (reader.Comment);
						}

						break;
					case IniType.Section:
						sectionFound = true;
						// If section already exists then overwrite it
						if (sections[reader.Name] != null) {
							sections.Remove (reader.Name);
						}
						section = new IniSection (reader.Name, reader.Comment);
						sections.Add (section);

						break;
					case IniType.Key:
						if (section.GetValue (reader.Name) == null) { 
							section.Set (reader.Name, reader.Value, reader.Comment); 
						} 
						break;
					}
				}
			} catch (Exception ex) {
				throw ex;
			} finally {
				// Always close the file
				reader.Close ();
			}
		}