fix Import old config

pull/3301/head
2dust 2023-02-10 21:02:29 +08:00
parent 3a740118f0
commit a359a508ae
1 changed files with 33 additions and 9 deletions

View File

@ -44,7 +44,6 @@ namespace v2rayN.Handler
{ {
config = new Config config = new Config
{ {
}; };
} }
if (config.coreBasicItem == null) if (config.coreBasicItem == null)
@ -312,20 +311,45 @@ namespace v2rayN.Handler
} }
config = Utils.FromJson<Config>(Utils.ToJson(configOld)); config = Utils.FromJson<Config>(Utils.ToJson(configOld));
if (config.tunModeItem == null)
if (config.coreBasicItem == null)
{ {
config.tunModeItem = new TunModeItem config.coreBasicItem = new()
{ {
enableTun = false, logEnabled = configOld.logEnabled,
showWindow = true, loglevel = configOld.loglevel,
mtu = 9000, muxEnabled = configOld.muxEnabled,
};
}
if (config.routingBasicItem == null)
{
config.routingBasicItem = new()
{
enableRoutingAdvanced = configOld.enableRoutingAdvanced,
domainStrategy = configOld.domainStrategy
};
}
if (config.guiItem == null)
{
config.guiItem = new()
{
enableStatistics = configOld.enableStatistics,
statisticsFreshRate = configOld.statisticsFreshRate,
keepOlderDedupl = configOld.keepOlderDedupl,
ignoreGeoUpdateCore = configOld.ignoreGeoUpdateCore,
autoUpdateInterval = configOld.autoUpdateInterval,
checkPreReleaseUpdate = configOld.checkPreReleaseUpdate,
enableSecurityProtocolTls13 = configOld.enableSecurityProtocolTls13,
trayMenuServersLimit = configOld.trayMenuServersLimit,
}; };
} }
GetDefaultServer(ref config); GetDefaultServer(ref config);
GetDefaultRouting(ref config); GetDefaultRouting(ref config);
SaveConfig(ref config); SaveConfig(ref config);
LazyConfig.Instance.SetConfig(ref config); LoadConfig(ref config);
return 0; return 0;
} }