mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 19:36:55 +00:00
add option about uilogs
This commit is contained in:
parent
c0430536a6
commit
0e34a20428
6 changed files with 1952 additions and 1850 deletions
61
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
61
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
|
@ -85,6 +85,7 @@
|
|||
this.txtKcpmtu = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.uilogEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.chkKeepOlderDedupl = new System.Windows.Forms.CheckBox();
|
||||
this.cbFreshrate = new System.Windows.Forms.ComboBox();
|
||||
this.lbFreshrate = new System.Windows.Forms.Label();
|
||||
|
@ -120,33 +121,32 @@
|
|||
//
|
||||
// btnClose
|
||||
//
|
||||
resources.ApplyResources(this.btnClose, "btnClose");
|
||||
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
resources.ApplyResources(this.btnClose, "btnClose");
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
resources.ApplyResources(this.tabControl1, "tabControl1");
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage6);
|
||||
this.tabControl1.Controls.Add(this.tabPage7);
|
||||
this.tabControl1.Controls.Add(this.tabPage9);
|
||||
resources.ApplyResources(this.tabControl1, "tabControl1");
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
resources.ApplyResources(this.tabPage1, "tabPage1");
|
||||
this.tabPage1.Controls.Add(this.groupBox1);
|
||||
resources.ApplyResources(this.tabPage1, "tabPage1");
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
|
||||
this.groupBox1.Controls.Add(this.label16);
|
||||
this.groupBox1.Controls.Add(this.cmblistenerType);
|
||||
|
@ -168,6 +168,7 @@
|
|||
this.groupBox1.Controls.Add(this.label5);
|
||||
this.groupBox1.Controls.Add(this.txtlocalPort);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
|
@ -184,7 +185,6 @@
|
|||
//
|
||||
// cmblistenerType
|
||||
//
|
||||
resources.ApplyResources(this.cmblistenerType, "cmblistenerType");
|
||||
this.cmblistenerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmblistenerType.FormattingEnabled = true;
|
||||
this.cmblistenerType.Items.AddRange(new object[] {
|
||||
|
@ -195,6 +195,7 @@
|
|||
resources.GetString("cmblistenerType.Items4"),
|
||||
resources.GetString("cmblistenerType.Items5"),
|
||||
resources.GetString("cmblistenerType.Items6")});
|
||||
resources.ApplyResources(this.cmblistenerType, "cmblistenerType");
|
||||
this.cmblistenerType.Name = "cmblistenerType";
|
||||
//
|
||||
// chksniffingEnabled2
|
||||
|
@ -240,12 +241,12 @@
|
|||
//
|
||||
// cmbprotocol2
|
||||
//
|
||||
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
|
||||
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbprotocol2.FormattingEnabled = true;
|
||||
this.cmbprotocol2.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbprotocol2.Items"),
|
||||
resources.GetString("cmbprotocol2.Items1")});
|
||||
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
|
||||
this.cmbprotocol2.Name = "cmbprotocol2";
|
||||
//
|
||||
// label3
|
||||
|
@ -260,8 +261,8 @@
|
|||
//
|
||||
// cmbprotocol
|
||||
//
|
||||
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
|
||||
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
|
||||
this.cmbprotocol.FormattingEnabled = true;
|
||||
this.cmbprotocol.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbprotocol.Items"),
|
||||
|
@ -287,7 +288,6 @@
|
|||
//
|
||||
// cmbloglevel
|
||||
//
|
||||
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
|
||||
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbloglevel.FormattingEnabled = true;
|
||||
this.cmbloglevel.Items.AddRange(new object[] {
|
||||
|
@ -296,6 +296,7 @@
|
|||
resources.GetString("cmbloglevel.Items2"),
|
||||
resources.GetString("cmbloglevel.Items3"),
|
||||
resources.GetString("cmbloglevel.Items4")});
|
||||
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
|
||||
this.cmbloglevel.Name = "cmbloglevel";
|
||||
//
|
||||
// label5
|
||||
|
@ -315,33 +316,33 @@
|
|||
//
|
||||
// tabPage2
|
||||
//
|
||||
resources.ApplyResources(this.tabPage2, "tabPage2");
|
||||
this.tabPage2.Controls.Add(this.groupBox2);
|
||||
resources.ApplyResources(this.tabPage2, "tabPage2");
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Controls.Add(this.tabControl2);
|
||||
this.groupBox2.Controls.Add(this.panel3);
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// tabControl2
|
||||
//
|
||||
resources.ApplyResources(this.tabControl2, "tabControl2");
|
||||
this.tabControl2.Controls.Add(this.tabPage3);
|
||||
this.tabControl2.Controls.Add(this.tabPage4);
|
||||
this.tabControl2.Controls.Add(this.tabPage5);
|
||||
this.tabControl2.Controls.Add(this.tabPage8);
|
||||
resources.ApplyResources(this.tabControl2, "tabControl2");
|
||||
this.tabControl2.Name = "tabControl2";
|
||||
this.tabControl2.SelectedIndex = 0;
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
resources.ApplyResources(this.tabPage3, "tabPage3");
|
||||
this.tabPage3.Controls.Add(this.txtUseragent);
|
||||
resources.ApplyResources(this.tabPage3, "tabPage3");
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -352,8 +353,8 @@
|
|||
//
|
||||
// tabPage4
|
||||
//
|
||||
resources.ApplyResources(this.tabPage4, "tabPage4");
|
||||
this.tabPage4.Controls.Add(this.txtUserdirect);
|
||||
resources.ApplyResources(this.tabPage4, "tabPage4");
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -364,8 +365,8 @@
|
|||
//
|
||||
// tabPage5
|
||||
//
|
||||
resources.ApplyResources(this.tabPage5, "tabPage5");
|
||||
this.tabPage5.Controls.Add(this.txtUserblock);
|
||||
resources.ApplyResources(this.tabPage5, "tabPage5");
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -376,14 +377,13 @@
|
|||
//
|
||||
// tabPage8
|
||||
//
|
||||
resources.ApplyResources(this.tabPage8, "tabPage8");
|
||||
this.tabPage8.Controls.Add(this.cmbroutingMode);
|
||||
resources.ApplyResources(this.tabPage8, "tabPage8");
|
||||
this.tabPage8.Name = "tabPage8";
|
||||
this.tabPage8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cmbroutingMode
|
||||
//
|
||||
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
|
||||
this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbroutingMode.FormattingEnabled = true;
|
||||
this.cmbroutingMode.Items.AddRange(new object[] {
|
||||
|
@ -391,15 +391,16 @@
|
|||
resources.GetString("cmbroutingMode.Items1"),
|
||||
resources.GetString("cmbroutingMode.Items2"),
|
||||
resources.GetString("cmbroutingMode.Items3")});
|
||||
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
|
||||
this.cmbroutingMode.Name = "cmbroutingMode";
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
resources.ApplyResources(this.panel3, "panel3");
|
||||
this.panel3.Controls.Add(this.linkLabelRoutingDoc);
|
||||
this.panel3.Controls.Add(this.btnSetDefRountingRule);
|
||||
this.panel3.Controls.Add(this.labRoutingTips);
|
||||
this.panel3.Controls.Add(this.cmbdomainStrategy);
|
||||
resources.ApplyResources(this.panel3, "panel3");
|
||||
this.panel3.Name = "panel3";
|
||||
//
|
||||
// linkLabelRoutingDoc
|
||||
|
@ -418,24 +419,23 @@
|
|||
//
|
||||
// labRoutingTips
|
||||
//
|
||||
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
|
||||
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
|
||||
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
|
||||
this.labRoutingTips.Name = "labRoutingTips";
|
||||
//
|
||||
// cmbdomainStrategy
|
||||
//
|
||||
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
|
||||
this.cmbdomainStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbdomainStrategy.FormattingEnabled = true;
|
||||
this.cmbdomainStrategy.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbdomainStrategy.Items"),
|
||||
resources.GetString("cmbdomainStrategy.Items1"),
|
||||
resources.GetString("cmbdomainStrategy.Items2")});
|
||||
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
|
||||
this.cmbdomainStrategy.Name = "cmbdomainStrategy";
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
resources.ApplyResources(this.tabPage6, "tabPage6");
|
||||
this.tabPage6.Controls.Add(this.chkKcpcongestion);
|
||||
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
|
||||
this.tabPage6.Controls.Add(this.label10);
|
||||
|
@ -449,6 +449,7 @@
|
|||
this.tabPage6.Controls.Add(this.label7);
|
||||
this.tabPage6.Controls.Add(this.txtKcpmtu);
|
||||
this.tabPage6.Controls.Add(this.label6);
|
||||
resources.ApplyResources(this.tabPage6, "tabPage6");
|
||||
this.tabPage6.Name = "tabPage6";
|
||||
this.tabPage6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -520,7 +521,7 @@
|
|||
//
|
||||
// tabPage7
|
||||
//
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Controls.Add(this.uilogEnabled);
|
||||
this.tabPage7.Controls.Add(this.chkKeepOlderDedupl);
|
||||
this.tabPage7.Controls.Add(this.cbFreshrate);
|
||||
this.tabPage7.Controls.Add(this.lbFreshrate);
|
||||
|
@ -529,9 +530,16 @@
|
|||
this.tabPage7.Controls.Add(this.txturlGFWList);
|
||||
this.tabPage7.Controls.Add(this.label13);
|
||||
this.tabPage7.Controls.Add(this.chkAutoRun);
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Name = "tabPage7";
|
||||
this.tabPage7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// uilogEnabled
|
||||
//
|
||||
resources.ApplyResources(this.uilogEnabled, "uilogEnabled");
|
||||
this.uilogEnabled.Name = "uilogEnabled";
|
||||
this.uilogEnabled.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkKeepOlderDedupl
|
||||
//
|
||||
resources.ApplyResources(this.chkKeepOlderDedupl, "chkKeepOlderDedupl");
|
||||
|
@ -540,9 +548,9 @@
|
|||
//
|
||||
// cbFreshrate
|
||||
//
|
||||
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
|
||||
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbFreshrate.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
|
||||
this.cbFreshrate.Name = "cbFreshrate";
|
||||
//
|
||||
// lbFreshrate
|
||||
|
@ -580,9 +588,9 @@
|
|||
//
|
||||
// tabPage9
|
||||
//
|
||||
resources.ApplyResources(this.tabPage9, "tabPage9");
|
||||
this.tabPage9.Controls.Add(this.txtuserPacRule);
|
||||
this.tabPage9.Controls.Add(this.panel4);
|
||||
resources.ApplyResources(this.tabPage9, "tabPage9");
|
||||
this.tabPage9.Name = "tabPage9";
|
||||
this.tabPage9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -593,21 +601,21 @@
|
|||
//
|
||||
// panel4
|
||||
//
|
||||
resources.ApplyResources(this.panel4, "panel4");
|
||||
this.panel4.Controls.Add(this.label4);
|
||||
resources.ApplyResources(this.panel4, "panel4");
|
||||
this.panel4.Name = "panel4";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.ForeColor = System.Drawing.Color.Brown;
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Controls.Add(this.btnClose);
|
||||
this.panel2.Controls.Add(this.btnOK);
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Name = "panel2";
|
||||
//
|
||||
// btnOK
|
||||
|
@ -734,5 +742,6 @@
|
|||
private System.Windows.Forms.CheckBox chkKeepOlderDedupl;
|
||||
private System.Windows.Forms.LinkLabel linkLabelRoutingDoc;
|
||||
private System.Windows.Forms.CheckBox chkdefAllowInsecure;
|
||||
private System.Windows.Forms.CheckBox uilogEnabled;
|
||||
}
|
||||
}
|
|
@ -71,6 +71,8 @@ namespace v2rayN.Forms
|
|||
cmblistenerType.SelectedIndex = (int)config.listenerType;
|
||||
|
||||
chkdefAllowInsecure.Checked = config.defAllowInsecure;
|
||||
|
||||
uilogEnabled.Checked = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -269,6 +271,9 @@ namespace v2rayN.Forms
|
|||
|
||||
config.defAllowInsecure = chkdefAllowInsecure.Checked;
|
||||
|
||||
Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, uilogEnabled.Checked, true);
|
||||
Global.EnableUilogs = uilogEnabled.Checked;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -171,6 +171,12 @@ namespace v2rayN
|
|||
/// Language
|
||||
/// </summary>
|
||||
public const string MyRegKeyLanguage = "CurrentLanguage";
|
||||
|
||||
/// <summary>
|
||||
/// uilogs
|
||||
/// </summary>
|
||||
public const string MyRegKeyUilogsEnabled = "UilogsEnabled";
|
||||
|
||||
/// <summary>
|
||||
/// Icon
|
||||
/// </summary>
|
||||
|
@ -246,6 +252,10 @@ namespace v2rayN
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
public static bool EnableUilogs
|
||||
{
|
||||
get;set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace v2rayN
|
|||
|
||||
if (!IsDuplicateInstance())
|
||||
{
|
||||
Global.EnableUilogs = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, true);
|
||||
|
||||
Utils.SaveLog("v2rayN start up " + Utils.GetVersion());
|
||||
|
||||
|
|
|
@ -595,6 +595,55 @@ namespace v2rayN
|
|||
regKey?.Close();
|
||||
}
|
||||
}
|
||||
public static void RegWriteValue(string path, string name, bool value,bool def)
|
||||
{
|
||||
RegistryKey regKey = null;
|
||||
try
|
||||
{
|
||||
regKey = Registry.CurrentUser.CreateSubKey(path);
|
||||
if (value == def)
|
||||
{
|
||||
regKey?.DeleteValue(name, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
regKey?.SetValue(name, value, RegistryValueKind.DWord);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
regKey?.Close();
|
||||
}
|
||||
}
|
||||
public static bool RegReadValue(string path, string name, bool def)
|
||||
{
|
||||
RegistryKey regKey = null;
|
||||
try
|
||||
{
|
||||
regKey = Registry.CurrentUser.OpenSubKey(path, false);
|
||||
var valueobj = regKey?.GetValue(name);
|
||||
var value = valueobj as int?;
|
||||
if (!value.HasValue)
|
||||
{
|
||||
return def;
|
||||
}
|
||||
else
|
||||
{
|
||||
return value.Value == 1;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
regKey?.Close();
|
||||
}
|
||||
return def;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 测速
|
||||
|
@ -826,31 +875,35 @@ namespace v2rayN
|
|||
{
|
||||
try
|
||||
{
|
||||
string path = Path.Combine(StartupPath(), "guiLogs");
|
||||
string FilePath = Path.Combine(path, DateTime.Now.ToString("yyyyMMdd") + ".txt");
|
||||
if (!Directory.Exists(path))
|
||||
if (Global.EnableUilogs)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
if (!File.Exists(FilePath))
|
||||
{
|
||||
FileStream FsCreate = new FileStream(FilePath, FileMode.Create);
|
||||
FsCreate.Close();
|
||||
FsCreate.Dispose();
|
||||
}
|
||||
FileStream FsWrite = new FileStream(FilePath, FileMode.Append, FileAccess.Write);
|
||||
StreamWriter SwWrite = new StreamWriter(FsWrite);
|
||||
string path = Path.Combine(StartupPath(), "guiLogs");
|
||||
string FilePath = Path.Combine(path, DateTime.Now.ToString("yyyyMMdd") + ".txt");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
if (!File.Exists(FilePath))
|
||||
{
|
||||
FileStream FsCreate = new FileStream(FilePath, FileMode.Create);
|
||||
FsCreate.Close();
|
||||
FsCreate.Dispose();
|
||||
}
|
||||
FileStream FsWrite = new FileStream(FilePath, FileMode.Append, FileAccess.Write);
|
||||
StreamWriter SwWrite = new StreamWriter(FsWrite);
|
||||
|
||||
string strContent = ex.ToString();
|
||||
string strContent = ex.ToString();
|
||||
|
||||
SwWrite.WriteLine(string.Format("{0}{1}[{2}]{3}", "--------------------------------", strTitle, DateTime.Now.ToString("HH:mm:ss"), "--------------------------------"));
|
||||
SwWrite.Write(strContent);
|
||||
SwWrite.WriteLine(Environment.NewLine);
|
||||
SwWrite.WriteLine(" ");
|
||||
SwWrite.Flush();
|
||||
SwWrite.Close();
|
||||
SwWrite.WriteLine(string.Format("{0}{1}[{2}]{3}", "--------------------------------", strTitle, DateTime.Now.ToString("HH:mm:ss"), "--------------------------------"));
|
||||
SwWrite.Write(strContent);
|
||||
SwWrite.WriteLine(Environment.NewLine);
|
||||
SwWrite.WriteLine(" ");
|
||||
SwWrite.Flush();
|
||||
SwWrite.Close();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue