mirror of https://github.com/2dust/v2rayN
Add open the file location
parent
baef3b364b
commit
28e41dc621
|
@ -744,11 +744,11 @@ namespace v2rayN
|
||||||
return Guid.TryParse(strSrc, out Guid g);
|
return Guid.TryParse(strSrc, out Guid g);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ProcessStart(string fileName)
|
public static void ProcessStart(string fileName, string arguments = "")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(fileName) { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(fileName, arguments) { UseShellExecute = true });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -240,103 +240,103 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ImportOldGuiConfig(Config config, string fileName)
|
//public static int ImportOldGuiConfig(Config config, string fileName)
|
||||||
{
|
//{
|
||||||
var result = Utils.LoadResource(fileName);
|
// var result = Utils.LoadResource(fileName);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
// if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
// {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var configOld = JsonUtils.Deserialize<ConfigOld>(result);
|
// var configOld = JsonUtils.Deserialize<ConfigOld>(result);
|
||||||
if (configOld == null)
|
// if (configOld == null)
|
||||||
{
|
// {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var subItem = JsonUtils.Deserialize<List<SubItem>>(JsonUtils.Serialize(configOld.subItem));
|
// var subItem = JsonUtils.Deserialize<List<SubItem>>(JsonUtils.Serialize(configOld.subItem));
|
||||||
foreach (var it in subItem)
|
// foreach (var it in subItem)
|
||||||
{
|
// {
|
||||||
if (Utils.IsNullOrEmpty(it.id))
|
// if (Utils.IsNullOrEmpty(it.id))
|
||||||
{
|
// {
|
||||||
it.id = Utils.GetGUID(false);
|
// it.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(it);
|
// SQLiteHelper.Instance.Replace(it);
|
||||||
}
|
// }
|
||||||
|
|
||||||
var profileItems = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(configOld.vmess));
|
// var profileItems = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(configOld.vmess));
|
||||||
foreach (var it in profileItems)
|
// foreach (var it in profileItems)
|
||||||
{
|
// {
|
||||||
if (Utils.IsNullOrEmpty(it.indexId))
|
// if (Utils.IsNullOrEmpty(it.indexId))
|
||||||
{
|
// {
|
||||||
it.indexId = Utils.GetGUID(false);
|
// it.indexId = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(it);
|
// SQLiteHelper.Instance.Replace(it);
|
||||||
}
|
// }
|
||||||
|
|
||||||
foreach (var it in configOld.routings)
|
// foreach (var it in configOld.routings)
|
||||||
{
|
// {
|
||||||
if (it.locked)
|
// if (it.locked)
|
||||||
{
|
// {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
var routing = JsonUtils.Deserialize<RoutingItem>(JsonUtils.Serialize(it));
|
// var routing = JsonUtils.Deserialize<RoutingItem>(JsonUtils.Serialize(it));
|
||||||
foreach (var it2 in it.rules)
|
// foreach (var it2 in it.rules)
|
||||||
{
|
// {
|
||||||
it2.id = Utils.GetGUID(false);
|
// it2.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
routing.ruleNum = it.rules.Count;
|
// routing.ruleNum = it.rules.Count;
|
||||||
routing.ruleSet = JsonUtils.Serialize(it.rules, false);
|
// routing.ruleSet = JsonUtils.Serialize(it.rules, false);
|
||||||
|
|
||||||
if (Utils.IsNullOrEmpty(routing.id))
|
// if (Utils.IsNullOrEmpty(routing.id))
|
||||||
{
|
// {
|
||||||
routing.id = Utils.GetGUID(false);
|
// routing.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(routing);
|
// SQLiteHelper.Instance.Replace(routing);
|
||||||
}
|
// }
|
||||||
|
|
||||||
config = JsonUtils.Deserialize<Config>(JsonUtils.Serialize(configOld));
|
// config = JsonUtils.Deserialize<Config>(JsonUtils.Serialize(configOld));
|
||||||
|
|
||||||
if (config.coreBasicItem == null)
|
// if (config.coreBasicItem == null)
|
||||||
{
|
// {
|
||||||
config.coreBasicItem = new()
|
// config.coreBasicItem = new()
|
||||||
{
|
// {
|
||||||
logEnabled = configOld.logEnabled,
|
// logEnabled = configOld.logEnabled,
|
||||||
loglevel = configOld.loglevel,
|
// loglevel = configOld.loglevel,
|
||||||
muxEnabled = configOld.muxEnabled,
|
// muxEnabled = configOld.muxEnabled,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (config.routingBasicItem == null)
|
// if (config.routingBasicItem == null)
|
||||||
{
|
// {
|
||||||
config.routingBasicItem = new()
|
// config.routingBasicItem = new()
|
||||||
{
|
// {
|
||||||
enableRoutingAdvanced = configOld.enableRoutingAdvanced,
|
// enableRoutingAdvanced = configOld.enableRoutingAdvanced,
|
||||||
domainStrategy = configOld.domainStrategy
|
// domainStrategy = configOld.domainStrategy
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (config.guiItem == null)
|
// if (config.guiItem == null)
|
||||||
{
|
// {
|
||||||
config.guiItem = new()
|
// config.guiItem = new()
|
||||||
{
|
// {
|
||||||
enableStatistics = configOld.enableStatistics,
|
// enableStatistics = configOld.enableStatistics,
|
||||||
keepOlderDedupl = configOld.keepOlderDedupl,
|
// keepOlderDedupl = configOld.keepOlderDedupl,
|
||||||
ignoreGeoUpdateCore = configOld.ignoreGeoUpdateCore,
|
// ignoreGeoUpdateCore = configOld.ignoreGeoUpdateCore,
|
||||||
autoUpdateInterval = configOld.autoUpdateInterval,
|
// autoUpdateInterval = configOld.autoUpdateInterval,
|
||||||
checkPreReleaseUpdate = configOld.checkPreReleaseUpdate,
|
// checkPreReleaseUpdate = configOld.checkPreReleaseUpdate,
|
||||||
enableSecurityProtocolTls13 = configOld.enableSecurityProtocolTls13,
|
// enableSecurityProtocolTls13 = configOld.enableSecurityProtocolTls13,
|
||||||
trayMenuServersLimit = configOld.trayMenuServersLimit,
|
// trayMenuServersLimit = configOld.trayMenuServersLimit,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
GetDefaultServer(config);
|
// GetDefaultServer(config);
|
||||||
GetDefaultRouting(config);
|
// GetDefaultRouting(config);
|
||||||
SaveConfig(config);
|
// SaveConfig(config);
|
||||||
LoadConfig(ref config);
|
// LoadConfig(ref config);
|
||||||
|
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion ConfigHandler
|
#endregion ConfigHandler
|
||||||
|
|
||||||
|
|
|
@ -978,6 +978,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Open the storage location 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuOpenTheFileLocation {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuOpenTheFileLocation", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Option Setting 的本地化字符串。
|
/// 查找类似 Option Setting 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1216,4 +1216,7 @@
|
||||||
<data name="NeedRebootTips" xml:space="preserve">
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
<value>Successful operation. Click the settings menu to reboot the app.</value>
|
<value>Successful operation. Click the settings menu to reboot the app.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>Open the storage location</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1213,4 +1213,7 @@
|
||||||
<data name="NeedRebootTips" xml:space="preserve">
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
<value>操作成功。请点击设置菜单重启应用。</value>
|
<value>操作成功。请点击设置菜单重启应用。</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>打开存储所在的位置</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1186,4 +1186,7 @@
|
||||||
<data name="NeedRebootTips" xml:space="preserve">
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
<value>操作成功。 請點選設定選單重啟應用程式。</value>
|
<value>操作成功。 請點選設定選單重啟應用程式。</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>打開儲存所在的位置</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -143,7 +143,8 @@ namespace v2rayN.ViewModels
|
||||||
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
|
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ImportOldGuiConfigCmd { get; }
|
public ReactiveCommand<Unit, Unit> OpenTheFileLocationCmd { get; }
|
||||||
|
//public ReactiveCommand<Unit, Unit> ImportOldGuiConfigCmd { get; }
|
||||||
|
|
||||||
//CheckUpdate
|
//CheckUpdate
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||||
|
@ -503,10 +504,14 @@ namespace v2rayN.ViewModels
|
||||||
_statistics?.ClearAllServerStatistics();
|
_statistics?.ClearAllServerStatistics();
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
});
|
});
|
||||||
ImportOldGuiConfigCmd = ReactiveCommand.Create(() =>
|
OpenTheFileLocationCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
ImportOldGuiConfig();
|
Utils.ProcessStart("Explorer", $"/select,{Utils.GetConfigPath()}");
|
||||||
});
|
});
|
||||||
|
//ImportOldGuiConfigCmd = ReactiveCommand.Create(() =>
|
||||||
|
//{
|
||||||
|
// ImportOldGuiConfig();
|
||||||
|
//});
|
||||||
|
|
||||||
//CheckUpdate
|
//CheckUpdate
|
||||||
CheckUpdateNCmd = ReactiveCommand.Create(() =>
|
CheckUpdateNCmd = ReactiveCommand.Create(() =>
|
||||||
|
@ -1422,32 +1427,32 @@ namespace v2rayN.ViewModels
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ImportOldGuiConfig()
|
//private void ImportOldGuiConfig()
|
||||||
{
|
//{
|
||||||
if (UI.OpenFileDialog(out string fileName,
|
// if (UI.OpenFileDialog(out string fileName,
|
||||||
"guiNConfig|*.json|All|*.*") != true)
|
// "guiNConfig|*.json|All|*.*") != true)
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (Utils.IsNullOrEmpty(fileName))
|
// if (Utils.IsNullOrEmpty(fileName))
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var ret = ConfigHandler.ImportOldGuiConfig(_config, fileName);
|
// var ret = ConfigHandler.ImportOldGuiConfig(_config, fileName);
|
||||||
if (ret == 0)
|
// if (ret == 0)
|
||||||
{
|
// {
|
||||||
RefreshRoutingsMenu();
|
// RefreshRoutingsMenu();
|
||||||
InitSubscriptionView();
|
// InitSubscriptionView();
|
||||||
RefreshServers();
|
// RefreshServers();
|
||||||
Reload();
|
// Reload();
|
||||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
// _noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
// _noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion Setting
|
#endregion Setting
|
||||||
|
|
||||||
|
|
|
@ -191,9 +191,13 @@
|
||||||
Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
||||||
<Separator Margin="-40,5" />
|
<Separator Margin="-40,5" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
x:Name="menuOpenTheFileLocation"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="{x:Static resx:ResUI.menuOpenTheFileLocation}" />
|
||||||
|
<!--<MenuItem
|
||||||
x:Name="menuImportOldGuiConfig"
|
x:Name="menuImportOldGuiConfig"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />
|
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />-->
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|
|
@ -138,7 +138,8 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ImportOldGuiConfigCmd, v => v.menuImportOldGuiConfig).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
|
||||||
|
//this.BindCommand(ViewModel, vm => vm.ImportOldGuiConfigCmd, v => v.menuImportOldGuiConfig).DisposeWith(disposables);
|
||||||
|
|
||||||
//check update
|
//check update
|
||||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
||||||
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
||||||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
||||||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
|
<PackageReference Include="ReactiveUI.Validation" Version="4.0.6" />
|
||||||
<PackageReference Include="ReactiveUI.WPF" Version="20.0.1" />
|
<PackageReference Include="ReactiveUI.WPF" Version="20.0.1" />
|
||||||
<PackageReference Include="Splat.NLog" Version="15.0.1" />
|
<PackageReference Include="Splat.NLog" Version="15.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue