pull/5210/head
2dust 2024-06-03 07:37:26 +08:00
parent 83b4f1e660
commit b99b30163b
3 changed files with 14 additions and 6 deletions

View File

@ -105,9 +105,12 @@ namespace v2rayN
/// <param name="filePath"></param>
/// <param name="nullValue"></param>
/// <returns></returns>
public static int ToFile(object? obj, string filePath, bool nullValue = true)
public static int ToFile(object? obj, string? filePath, bool nullValue = true)
{
int result;
if (filePath is null)
{
return -1;
}
try
{
using FileStream file = File.Create(filePath);
@ -119,14 +122,13 @@ namespace v2rayN
};
JsonSerializer.Serialize(file, obj, options);
result = 0;
return 0;
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
result = -1;
return -1;
}
return result;
}
}
}

View File

@ -25,6 +25,11 @@ namespace v2rayN.Handler
msg = ResUI.CheckServerSettings;
return -1;
}
if (node.GetNetwork() == nameof(ETransport.kcp))
{
msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
return -1;
}
msg = ResUI.InitialConfiguration;

View File

@ -38,7 +38,8 @@ namespace v2rayN.Handler
string fileName = Utils.GetConfigPath(Global.CoreConfigFileName);
if (CoreConfigHandler.GenerateClientConfig(node, fileName, out string msg, out string content) != 0)
{
ShowMsg(false, msg);
ShowMsg(false, msg);
return;
}
else
{