|
|
@ -119,16 +119,22 @@ namespace v2rayN
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
/// <param name="filePath"></param>
|
|
|
|
/// <param name="filePath"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static int ToJsonFile(Object obj, string filePath)
|
|
|
|
public static int ToJsonFile(Object obj, string filePath, bool nullValue = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
int result;
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (StreamWriter file = File.CreateText(filePath))
|
|
|
|
using (StreamWriter file = File.CreateText(filePath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//JsonSerializer serializer = new JsonSerializer();
|
|
|
|
JsonSerializer serializer;
|
|
|
|
JsonSerializer serializer = new JsonSerializer() { Formatting = Formatting.Indented };
|
|
|
|
if (nullValue)
|
|
|
|
//JsonSerializer serializer = new JsonSerializer() { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore };
|
|
|
|
{
|
|
|
|
|
|
|
|
serializer = new JsonSerializer() { Formatting = Formatting.Indented };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
serializer = new JsonSerializer() { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
serializer.Serialize(file, obj);
|
|
|
|
serializer.Serialize(file, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -800,7 +806,7 @@ namespace v2rayN
|
|
|
|
public static string GetTempPath(string filename)
|
|
|
|
public static string GetTempPath(string filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Path.Combine(GetTempPath(), filename);
|
|
|
|
return Path.Combine(GetTempPath(), filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string UnGzip(byte[] buf)
|
|
|
|
public static string UnGzip(byte[] buf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|