public string GetKodiIP() { var ip = reader.GetString(Resx.ConfigurationSectionName, Resx.KodiIPKey); var port = reader.GetString(Resx.ConfigurationSectionName, Resx.KodiPortKey); return((ip ?? string.Empty) + ":" + (port ?? string.Empty)); }
public void TestOptionTemplateFlexible() { using (var reader = new IniReader("flexible.ini", IniOptions.Flexible)) { Assert.AreEqual("flexible value", reader.GetString("flexible")); Assert.AreEqual(10L, reader.GetInt64("int_in_string")); Assert.Null(reader.GetString("nonexistant")); Assert.True(reader.GetBool("loose_property")); } }
public void TestInvalidPropertyIdentifier() { using (var reader = new IniReader("basic.ini", IniOptions.Default)) { Assert.Multiple(() => { Assert.Throws <InvalidPropertyIdentifierException>(() => reader.GetString("too.many.arguments")); Assert.Throws <InvalidPropertyIdentifierException>(() => reader.GetString("")); }); } }
public void TestReadImplicitCastToStringAllowed( [Values] bool caseSensitive) { var options = new IniOptions( caseSensitive: caseSensitive, allowValueConversion: true); using (var reader = new IniReader("basic.ini", options)) { Assert.AreEqual("10", reader.GetString("Section.int")); } }
public void TestReadImplicitCastToStringNotAllowed( [Values] bool caseSensitive) { var options = new IniOptions( caseSensitive: caseSensitive, allowValueConversion: false); using (var reader = new IniReader("basic.ini", options)) { Assert.Throws <InvalidCastException>(() => reader.GetString("Section.int")); } }
public void TestReadString( [Values] bool caseSensitive, [Values] bool allowValueConversion, [Values] bool allowLooseProperties) { var options = new IniOptions( caseSensitive: caseSensitive, allowValueConversion: allowValueConversion, allowLooseProperties: allowLooseProperties); using (var reader = new IniReader("basic.ini", options)) { Assert.AreEqual("Hello, World!", reader.GetString("Section.string")); } }