-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hello, dear developer.
My .cfg file does not contain sections (like [section]). How i can using libary?
Error
************** Текст исключения **************
Salaros.Configuration.ConfigParserException: This key value pair is orphan, all the keys must be preceded by a section.. On the line no. #2.
at Salaros.Configuration.ConfigParser.BackupCurrentLine(ConfigSection& currentSection, ConfigLine& currentLine, Int32 lineNumber)
at Salaros.Configuration.ConfigParser.ReadKeyAndValue(ConfigSection& currentSection, ConfigLine& currentLine, String lineRaw, Int32 lineNumber, Boolean append, Boolean forceIncludeKey)
at Salaros.Configuration.ConfigParser.Read(String configContent)
at Salaros.Configuration.ConfigParser..ctor(String configFile, ConfigParserSettings settings)
at Launcher_CS.Form1.Form1_Load(Object sender, EventArgs e) in line 43
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
Code:
var configFileFromPath = new ConfigParser(@"config.cfg",
new ConfigParserSettings
{
KeyValueSeparator = " ",
MultiLineValues = MultiLineValues.QuoteDelimitedValues
});
string CsName = configFileFromPath.GetValue(null, "name"); // Error
Metadata
Metadata
Assignees
Labels
No labels