add option about uilogs

This commit is contained in:
yinyue200 2020-08-19 16:04:18 +08:00
parent c0430536a6
commit 0e34a20428
6 changed files with 1952 additions and 1850 deletions

View file

@ -85,6 +85,7 @@
this.txtKcpmtu = new System.Windows.Forms.TextBox(); this.txtKcpmtu = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.tabPage7 = new System.Windows.Forms.TabPage(); this.tabPage7 = new System.Windows.Forms.TabPage();
this.uilogEnabled = new System.Windows.Forms.CheckBox();
this.chkKeepOlderDedupl = new System.Windows.Forms.CheckBox(); this.chkKeepOlderDedupl = new System.Windows.Forms.CheckBox();
this.cbFreshrate = new System.Windows.Forms.ComboBox(); this.cbFreshrate = new System.Windows.Forms.ComboBox();
this.lbFreshrate = new System.Windows.Forms.Label(); this.lbFreshrate = new System.Windows.Forms.Label();
@ -120,33 +121,32 @@
// //
// btnClose // btnClose
// //
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// tabControl1 // tabControl1
// //
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage6); this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7); this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Controls.Add(this.tabPage9); this.tabControl1.Controls.Add(this.tabPage9);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
// //
// tabPage1 // tabPage1
// //
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// groupBox1 // groupBox1
// //
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.chkdefAllowInsecure); this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
this.groupBox1.Controls.Add(this.label16); this.groupBox1.Controls.Add(this.label16);
this.groupBox1.Controls.Add(this.cmblistenerType); this.groupBox1.Controls.Add(this.cmblistenerType);
@ -168,6 +168,7 @@
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtlocalPort); this.groupBox1.Controls.Add(this.txtlocalPort);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
@ -184,7 +185,6 @@
// //
// cmblistenerType // cmblistenerType
// //
resources.ApplyResources(this.cmblistenerType, "cmblistenerType");
this.cmblistenerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmblistenerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmblistenerType.FormattingEnabled = true; this.cmblistenerType.FormattingEnabled = true;
this.cmblistenerType.Items.AddRange(new object[] { this.cmblistenerType.Items.AddRange(new object[] {
@ -195,6 +195,7 @@
resources.GetString("cmblistenerType.Items4"), resources.GetString("cmblistenerType.Items4"),
resources.GetString("cmblistenerType.Items5"), resources.GetString("cmblistenerType.Items5"),
resources.GetString("cmblistenerType.Items6")}); resources.GetString("cmblistenerType.Items6")});
resources.ApplyResources(this.cmblistenerType, "cmblistenerType");
this.cmblistenerType.Name = "cmblistenerType"; this.cmblistenerType.Name = "cmblistenerType";
// //
// chksniffingEnabled2 // chksniffingEnabled2
@ -240,12 +241,12 @@
// //
// cmbprotocol2 // cmbprotocol2
// //
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbprotocol2.FormattingEnabled = true; this.cmbprotocol2.FormattingEnabled = true;
this.cmbprotocol2.Items.AddRange(new object[] { this.cmbprotocol2.Items.AddRange(new object[] {
resources.GetString("cmbprotocol2.Items"), resources.GetString("cmbprotocol2.Items"),
resources.GetString("cmbprotocol2.Items1")}); resources.GetString("cmbprotocol2.Items1")});
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.Name = "cmbprotocol2"; this.cmbprotocol2.Name = "cmbprotocol2";
// //
// label3 // label3
@ -260,8 +261,8 @@
// //
// cmbprotocol // cmbprotocol
// //
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.FormattingEnabled = true; this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] { this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"), resources.GetString("cmbprotocol.Items"),
@ -287,7 +288,6 @@
// //
// cmbloglevel // cmbloglevel
// //
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true; this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] { this.cmbloglevel.Items.AddRange(new object[] {
@ -296,6 +296,7 @@
resources.GetString("cmbloglevel.Items2"), resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"), resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")}); resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel"; this.cmbloglevel.Name = "cmbloglevel";
// //
// label5 // label5
@ -315,33 +316,33 @@
// //
// tabPage2 // tabPage2
// //
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.groupBox2); this.tabPage2.Controls.Add(this.groupBox2);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
// groupBox2 // groupBox2
// //
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.tabControl2); this.groupBox2.Controls.Add(this.tabControl2);
this.groupBox2.Controls.Add(this.panel3); this.groupBox2.Controls.Add(this.panel3);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
// //
// tabControl2 // tabControl2
// //
resources.ApplyResources(this.tabControl2, "tabControl2");
this.tabControl2.Controls.Add(this.tabPage3); this.tabControl2.Controls.Add(this.tabPage3);
this.tabControl2.Controls.Add(this.tabPage4); this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5); this.tabControl2.Controls.Add(this.tabPage5);
this.tabControl2.Controls.Add(this.tabPage8); this.tabControl2.Controls.Add(this.tabPage8);
resources.ApplyResources(this.tabControl2, "tabControl2");
this.tabControl2.Name = "tabControl2"; this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0; this.tabControl2.SelectedIndex = 0;
// //
// tabPage3 // tabPage3
// //
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Controls.Add(this.txtUseragent); this.tabPage3.Controls.Add(this.txtUseragent);
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
@ -352,8 +353,8 @@
// //
// tabPage4 // tabPage4
// //
resources.ApplyResources(this.tabPage4, "tabPage4");
this.tabPage4.Controls.Add(this.txtUserdirect); this.tabPage4.Controls.Add(this.txtUserdirect);
resources.ApplyResources(this.tabPage4, "tabPage4");
this.tabPage4.Name = "tabPage4"; this.tabPage4.Name = "tabPage4";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
// //
@ -364,8 +365,8 @@
// //
// tabPage5 // tabPage5
// //
resources.ApplyResources(this.tabPage5, "tabPage5");
this.tabPage5.Controls.Add(this.txtUserblock); this.tabPage5.Controls.Add(this.txtUserblock);
resources.ApplyResources(this.tabPage5, "tabPage5");
this.tabPage5.Name = "tabPage5"; this.tabPage5.Name = "tabPage5";
this.tabPage5.UseVisualStyleBackColor = true; this.tabPage5.UseVisualStyleBackColor = true;
// //
@ -376,14 +377,13 @@
// //
// tabPage8 // tabPage8
// //
resources.ApplyResources(this.tabPage8, "tabPage8");
this.tabPage8.Controls.Add(this.cmbroutingMode); this.tabPage8.Controls.Add(this.cmbroutingMode);
resources.ApplyResources(this.tabPage8, "tabPage8");
this.tabPage8.Name = "tabPage8"; this.tabPage8.Name = "tabPage8";
this.tabPage8.UseVisualStyleBackColor = true; this.tabPage8.UseVisualStyleBackColor = true;
// //
// cmbroutingMode // cmbroutingMode
// //
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbroutingMode.FormattingEnabled = true; this.cmbroutingMode.FormattingEnabled = true;
this.cmbroutingMode.Items.AddRange(new object[] { this.cmbroutingMode.Items.AddRange(new object[] {
@ -391,15 +391,16 @@
resources.GetString("cmbroutingMode.Items1"), resources.GetString("cmbroutingMode.Items1"),
resources.GetString("cmbroutingMode.Items2"), resources.GetString("cmbroutingMode.Items2"),
resources.GetString("cmbroutingMode.Items3")}); resources.GetString("cmbroutingMode.Items3")});
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
this.cmbroutingMode.Name = "cmbroutingMode"; this.cmbroutingMode.Name = "cmbroutingMode";
// //
// panel3 // panel3
// //
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.linkLabelRoutingDoc); this.panel3.Controls.Add(this.linkLabelRoutingDoc);
this.panel3.Controls.Add(this.btnSetDefRountingRule); this.panel3.Controls.Add(this.btnSetDefRountingRule);
this.panel3.Controls.Add(this.labRoutingTips); this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.cmbdomainStrategy); this.panel3.Controls.Add(this.cmbdomainStrategy);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
// //
// linkLabelRoutingDoc // linkLabelRoutingDoc
@ -418,24 +419,23 @@
// //
// labRoutingTips // labRoutingTips
// //
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown; this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.Name = "labRoutingTips"; this.labRoutingTips.Name = "labRoutingTips";
// //
// cmbdomainStrategy // cmbdomainStrategy
// //
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
this.cmbdomainStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbdomainStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbdomainStrategy.FormattingEnabled = true; this.cmbdomainStrategy.FormattingEnabled = true;
this.cmbdomainStrategy.Items.AddRange(new object[] { this.cmbdomainStrategy.Items.AddRange(new object[] {
resources.GetString("cmbdomainStrategy.Items"), resources.GetString("cmbdomainStrategy.Items"),
resources.GetString("cmbdomainStrategy.Items1"), resources.GetString("cmbdomainStrategy.Items1"),
resources.GetString("cmbdomainStrategy.Items2")}); resources.GetString("cmbdomainStrategy.Items2")});
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
this.cmbdomainStrategy.Name = "cmbdomainStrategy"; this.cmbdomainStrategy.Name = "cmbdomainStrategy";
// //
// tabPage6 // tabPage6
// //
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion); this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize); this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10); this.tabPage6.Controls.Add(this.label10);
@ -449,6 +449,7 @@
this.tabPage6.Controls.Add(this.label7); this.tabPage6.Controls.Add(this.label7);
this.tabPage6.Controls.Add(this.txtKcpmtu); this.tabPage6.Controls.Add(this.txtKcpmtu);
this.tabPage6.Controls.Add(this.label6); this.tabPage6.Controls.Add(this.label6);
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Name = "tabPage6"; this.tabPage6.Name = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true; this.tabPage6.UseVisualStyleBackColor = true;
// //
@ -520,7 +521,7 @@
// //
// tabPage7 // tabPage7
// //
resources.ApplyResources(this.tabPage7, "tabPage7"); this.tabPage7.Controls.Add(this.uilogEnabled);
this.tabPage7.Controls.Add(this.chkKeepOlderDedupl); this.tabPage7.Controls.Add(this.chkKeepOlderDedupl);
this.tabPage7.Controls.Add(this.cbFreshrate); this.tabPage7.Controls.Add(this.cbFreshrate);
this.tabPage7.Controls.Add(this.lbFreshrate); this.tabPage7.Controls.Add(this.lbFreshrate);
@ -529,9 +530,16 @@
this.tabPage7.Controls.Add(this.txturlGFWList); this.tabPage7.Controls.Add(this.txturlGFWList);
this.tabPage7.Controls.Add(this.label13); this.tabPage7.Controls.Add(this.label13);
this.tabPage7.Controls.Add(this.chkAutoRun); this.tabPage7.Controls.Add(this.chkAutoRun);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7"; this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true; this.tabPage7.UseVisualStyleBackColor = true;
// //
// uilogEnabled
//
resources.ApplyResources(this.uilogEnabled, "uilogEnabled");
this.uilogEnabled.Name = "uilogEnabled";
this.uilogEnabled.UseVisualStyleBackColor = true;
//
// chkKeepOlderDedupl // chkKeepOlderDedupl
// //
resources.ApplyResources(this.chkKeepOlderDedupl, "chkKeepOlderDedupl"); resources.ApplyResources(this.chkKeepOlderDedupl, "chkKeepOlderDedupl");
@ -540,9 +548,9 @@
// //
// cbFreshrate // cbFreshrate
// //
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true; this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate"; this.cbFreshrate.Name = "cbFreshrate";
// //
// lbFreshrate // lbFreshrate
@ -580,9 +588,9 @@
// //
// tabPage9 // tabPage9
// //
resources.ApplyResources(this.tabPage9, "tabPage9");
this.tabPage9.Controls.Add(this.txtuserPacRule); this.tabPage9.Controls.Add(this.txtuserPacRule);
this.tabPage9.Controls.Add(this.panel4); this.tabPage9.Controls.Add(this.panel4);
resources.ApplyResources(this.tabPage9, "tabPage9");
this.tabPage9.Name = "tabPage9"; this.tabPage9.Name = "tabPage9";
this.tabPage9.UseVisualStyleBackColor = true; this.tabPage9.UseVisualStyleBackColor = true;
// //
@ -593,21 +601,21 @@
// //
// panel4 // panel4
// //
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Controls.Add(this.label4); this.panel4.Controls.Add(this.label4);
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Name = "panel4"; this.panel4.Name = "panel4";
// //
// label4 // label4
// //
resources.ApplyResources(this.label4, "label4");
this.label4.ForeColor = System.Drawing.Color.Brown; this.label4.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4"; this.label4.Name = "label4";
// //
// panel2 // panel2
// //
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose); this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK); this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
// //
// btnOK // btnOK
@ -734,5 +742,6 @@
private System.Windows.Forms.CheckBox chkKeepOlderDedupl; private System.Windows.Forms.CheckBox chkKeepOlderDedupl;
private System.Windows.Forms.LinkLabel linkLabelRoutingDoc; private System.Windows.Forms.LinkLabel linkLabelRoutingDoc;
private System.Windows.Forms.CheckBox chkdefAllowInsecure; private System.Windows.Forms.CheckBox chkdefAllowInsecure;
private System.Windows.Forms.CheckBox uilogEnabled;
} }
} }

View file

@ -71,6 +71,8 @@ namespace v2rayN.Forms
cmblistenerType.SelectedIndex = (int)config.listenerType; cmblistenerType.SelectedIndex = (int)config.listenerType;
chkdefAllowInsecure.Checked = config.defAllowInsecure; chkdefAllowInsecure.Checked = config.defAllowInsecure;
uilogEnabled.Checked = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, true);
} }
/// <summary> /// <summary>
@ -269,6 +271,9 @@ namespace v2rayN.Forms
config.defAllowInsecure = chkdefAllowInsecure.Checked; config.defAllowInsecure = chkdefAllowInsecure.Checked;
Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, uilogEnabled.Checked, true);
Global.EnableUilogs = uilogEnabled.Checked;
return 0; return 0;
} }

File diff suppressed because it is too large Load diff

View file

@ -171,6 +171,12 @@ namespace v2rayN
/// Language /// Language
/// </summary> /// </summary>
public const string MyRegKeyLanguage = "CurrentLanguage"; public const string MyRegKeyLanguage = "CurrentLanguage";
/// <summary>
/// uilogs
/// </summary>
public const string MyRegKeyUilogsEnabled = "UilogsEnabled";
/// <summary> /// <summary>
/// Icon /// Icon
/// </summary> /// </summary>
@ -246,6 +252,10 @@ namespace v2rayN
{ {
get; set; get; set;
} }
public static bool EnableUilogs
{
get;set;
}
#endregion #endregion

View file

@ -33,6 +33,7 @@ namespace v2rayN
if (!IsDuplicateInstance()) if (!IsDuplicateInstance())
{ {
Global.EnableUilogs = Utils.RegReadValue(Global.MyRegPath, Global.MyRegKeyUilogsEnabled, true);
Utils.SaveLog("v2rayN start up " + Utils.GetVersion()); Utils.SaveLog("v2rayN start up " + Utils.GetVersion());

View file

@ -595,6 +595,55 @@ namespace v2rayN
regKey?.Close(); 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 #endregion
#region #region
@ -826,31 +875,35 @@ namespace v2rayN
{ {
try try
{ {
string path = Path.Combine(StartupPath(), "guiLogs"); if (Global.EnableUilogs)
string FilePath = Path.Combine(path, DateTime.Now.ToString("yyyyMMdd") + ".txt");
if (!Directory.Exists(path))
{ {
Directory.CreateDirectory(path); string path = Path.Combine(StartupPath(), "guiLogs");
} string FilePath = Path.Combine(path, DateTime.Now.ToString("yyyyMMdd") + ".txt");
if (!File.Exists(FilePath)) if (!Directory.Exists(path))
{ {
FileStream FsCreate = new FileStream(FilePath, FileMode.Create); Directory.CreateDirectory(path);
FsCreate.Close(); }
FsCreate.Dispose(); if (!File.Exists(FilePath))
} {
FileStream FsWrite = new FileStream(FilePath, FileMode.Append, FileAccess.Write); FileStream FsCreate = new FileStream(FilePath, FileMode.Create);
StreamWriter SwWrite = new StreamWriter(FsWrite); 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.WriteLine(string.Format("{0}{1}[{2}]{3}", "--------------------------------", strTitle, DateTime.Now.ToString("HH:mm:ss"), "--------------------------------"));
SwWrite.Write(strContent); SwWrite.Write(strContent);
SwWrite.WriteLine(Environment.NewLine); SwWrite.WriteLine(Environment.NewLine);
SwWrite.WriteLine(" "); SwWrite.WriteLine(" ");
SwWrite.Flush(); SwWrite.Flush();
SwWrite.Close(); SwWrite.Close();
}
} }
catch { } catch { }
} }
#endregion #endregion