forked from ln-dotnet/ln.json
defaultValues, Dispose fix
parent
580cf6a1d8
commit
197884e101
12
JSON.cs
12
JSON.cs
|
@ -127,9 +127,11 @@ namespace sharp.json
|
||||||
}
|
}
|
||||||
public void WriteTo(String filename,bool pretty)
|
public void WriteTo(String filename,bool pretty)
|
||||||
{
|
{
|
||||||
FileStream fs = new FileStream(filename, FileMode.Create);
|
using (FileStream fs = new FileStream(filename, FileMode.Create))
|
||||||
WriteTo(fs,pretty);
|
{
|
||||||
fs.Close();
|
WriteTo(fs, pretty);
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSON ReadFrom(string filename)
|
public static JSON ReadFrom(string filename)
|
||||||
|
@ -161,6 +163,10 @@ namespace sharp.json
|
||||||
} catch (FileNotFoundException e){
|
} catch (FileNotFoundException e){
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
if (source.Equals(""))
|
||||||
|
{
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
return parser.Parse(source);
|
return parser.Parse(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue