mirror of
https://github.com/netchx/netch.git
synced 2026-03-28 18:59:46 +08:00
feat: remove v2ray config file when exit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -283,6 +284,10 @@ namespace Netch.Forms
|
||||
}
|
||||
|
||||
Configuration.Save();
|
||||
|
||||
if (File.Exists("data\\last.json"))
|
||||
File.Delete("data\\last.json");
|
||||
|
||||
State = State.Terminating;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using Netch.Controllers;
|
||||
using Netch.Models;
|
||||
using Netch.Servers.VMess.Utils;
|
||||
|
||||
namespace Netch.Servers.VLESS
|
||||
{
|
||||
@@ -15,17 +16,8 @@ namespace Netch.Servers.VLESS
|
||||
|
||||
public bool Start(Server s, Mode mode)
|
||||
{
|
||||
var server = (VLESS) s;
|
||||
|
||||
File.WriteAllText("data\\last.json", VMess.Utils.V2rayConfigUtils.GenerateClientConfig(server, mode));
|
||||
|
||||
if (StartInstanceAuto("-config ..\\data\\last.json"))
|
||||
{
|
||||
if (File.Exists("data\\last.json")) File.Delete("data\\last.json");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode));
|
||||
return StartInstanceAuto("-config ..\\data\\last.json");
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using Netch.Controllers;
|
||||
using Netch.Models;
|
||||
using Netch.Servers.VMess.Utils;
|
||||
|
||||
namespace Netch.Servers.VMess
|
||||
{
|
||||
@@ -20,15 +21,8 @@ namespace Netch.Servers.VMess
|
||||
|
||||
public bool Start(Server s, Mode mode)
|
||||
{
|
||||
File.WriteAllText("data\\last.json", Utils.V2rayConfigUtils.GenerateClientConfig(s, mode));
|
||||
|
||||
if (StartInstanceAuto("-config ..\\data\\last.json"))
|
||||
{
|
||||
if (File.Exists("data\\last.json")) File.Delete("data\\last.json");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode));
|
||||
return StartInstanceAuto("-config ..\\data\\last.json");
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
|
||||
Reference in New Issue
Block a user