Skip to content

Commit

Permalink
v1.4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nobody committed Sep 13, 2020
2 parents b00a942 + 13d4a20 commit 9618c15
Show file tree
Hide file tree
Showing 27 changed files with 355 additions and 370 deletions.
27 changes: 11 additions & 16 deletions Plugins/Luna/Controllers/FormEditorCtrl/ButtonCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ internal sealed class ButtonCtrl
private readonly FormEditor formEditor;
VgcApis.WinForms.FormSearch formSearch = null;

VgcApis.UserControls.RepaintController rtboxFreezer;
VgcApis.Libs.Sys.QueueLogger qLogger = new VgcApis.Libs.Sys.QueueLogger();

Scintilla editor = null;
Expand Down Expand Up @@ -101,7 +100,6 @@ public void Run(
BindEvents();
ReloadScriptName();

rtboxFreezer = new VgcApis.UserControls.RepaintController(rtboxOutput);
logUpdater.Run();

/*
Expand Down Expand Up @@ -365,31 +363,28 @@ void ShowFormSearch()
void Log(string content) => qLogger.Log(content);

long updateOutputTimeStamp = 0;
VgcApis.Libs.Tasks.Bar bar = new VgcApis.Libs.Tasks.Bar();

void UpdateOutput()
{
if (!bar.Install())
{
return;
}

var timestamp = qLogger.GetTimestamp();
if (updateOutputTimeStamp == timestamp)
{
bar.Remove();
return;
}

VgcApis.Misc.UI.InvokeThen(
var logs = qLogger.GetLogAsString(true);
updateOutputTimeStamp = timestamp;

VgcApis.Misc.UI.Invoke(
() =>
{
rtboxFreezer.DisableRepaintEvent();
rtboxOutput.Text = qLogger.GetLogAsString(true);
VgcApis.Misc.UI.ScrollToBottom(rtboxOutput);
rtboxFreezer.EnableRepaintEvent();
updateOutputTimeStamp = timestamp;
}, () => bar.Remove());
if (rtboxOutput == null || rtboxOutput.IsDisposed)
{
return;
}

VgcApis.Misc.UI.UpdateRichTextBox(rtboxOutput, logs);
});
}

void GotoLine()
Expand Down
2 changes: 2 additions & 0 deletions Plugins/Luna/Models/Apis/Components/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public string Replace(string text, string oldStr, string newStr) =>

public string GetSubscriptionConfig() => vgcSettings.GetSubscriptionConfig();

public void SetSubscriptionConfig(string cfgStr) => vgcSettings.SetSubscriptionConfig(cfgStr);

public long GetTimeoutValue() => VgcApis.Models.Consts.Core.SpeedtestTimeout;

public void RefreshFormMain() => vgcServer.RequireFormMainReload();
Expand Down
49 changes: 38 additions & 11 deletions Plugins/Pacman/Controllers/FormMainCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ void BindDragDropEvent()
{
// update title
control.SetTitle(bean.title);
control.SetStatus(bean.status);
return;
}
}

beanUI = new Views.UserControls.BeanUI(bean);
beanUI = new Views.UserControls.BeanUI();
flyContent.Controls.Add(beanUI);
beanUI.Reload(bean);
}

if (beanUI == null && a.Data.GetDataPresent(typeof(Views.UserControls.BeanUI)))
Expand Down Expand Up @@ -277,35 +279,60 @@ void PullSelectedServerFromMainWindow()
if (found != null)
{
found.title = states.GetTitle();
found.status = states.GetStatus();
continue;
}
curList.Add(new Models.Data.Bean
{
title = states.GetTitle(),
uid = serverCtrl.GetCoreStates().GetUid(),
status = states.GetStatus(),
});
}
this.beanList = curList;
RefreshFlyContent();
}

void DoHouseKeeping(int exp)
{
flyContent.SuspendLayout();
var ctrls = flyContent.Controls.OfType<Views.UserControls.BeanUI>().ToList();
var cur = ctrls.Count;
for (int i = cur - 1; i >= exp; i++)
{
flyContent.Controls.Remove(ctrls[i]);
}

var beans = new List<Views.UserControls.BeanUI>();
for (int i = cur; i < exp; i++)
{
beans.Add(new Views.UserControls.BeanUI());
}
flyContent.Controls.AddRange(beans.ToArray());
flyContent.ResumeLayout();
}

void RefreshFlyContent()
{
flyContent.Controls.Clear();
if (beanList == null)
var clone = beanList?.ToList();

DoHouseKeeping(clone?.Count ?? 0);

if (clone == null)
{
return;
}

var beans = beanList
.OrderBy(b => b.index)
.Select(el => new Views.UserControls.BeanUI(el))
.ToArray();

flyContent.SuspendLayout();
flyContent.Controls.AddRange(beans);
flyContent.ResumeLayout();
var ctrls = flyContent.Controls.OfType<Views.UserControls.BeanUI>().ToList();
if (ctrls.Count != clone.Count)
{
return;
}

for (int i = 0; i < ctrls.Count; i++)
{
ctrls[i].Reload(clone[i]);
}
}

void PackageListSelectedIndexChanged()
Expand Down
36 changes: 27 additions & 9 deletions Plugins/Pacman/Views/UserControls/BeanUI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Data;
using System.Windows.Forms;

namespace Pacman.Views.UserControls
Expand All @@ -8,19 +7,32 @@ public partial class BeanUI : UserControl
{
Models.Data.Bean bean;

public BeanUI(Models.Data.Bean bean)
public BeanUI()
{
this.bean = bean ?? throw new NoNullAllowedException("Bean must not null.");
InitializeComponent();
}

private void BeanUI_Load(object sender, EventArgs e)
private void BeanUI_Load(object sender, EventArgs e) { }

#region private methods
void UpdateLabels()
{
lbTitle.Text = bean.title;
lbStatus.Text = bean.status;
chkTitle.Checked = bean.isSelected;
VgcApis.Misc.UI.Invoke(() =>
{
var p = this.Parent;
if (p == null || p.IsDisposed)
{
return;
}

lbTitle.Text = bean.title;
lbStatus.Text = bean.status;
chkTitle.Checked = bean.isSelected;
});
}

#endregion

#region properties
public bool isSelected
{
Expand All @@ -35,7 +47,13 @@ public double index
}
#endregion

#region public event
#region public methods
public void Reload(Models.Data.Bean bean)
{
this.bean = bean;
UpdateLabels();
}

public void InvertSelection()
{
chkTitle.Checked = !chkTitle.Checked;
Expand Down Expand Up @@ -72,7 +90,7 @@ public Models.Data.Bean GetBean()
}
#endregion

#region UI
#region UI events
private void BeanUI_MouseDown(object sender, MouseEventArgs e)
{
DoDragDrop(this, DragDropEffects.Move);
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Require .net framework 4.5+.
### 演示 Demo
![Demo v1.4.3.5 GIF](https://vrnobody.github.io/V2RayGCon/images/forms/demo_basics_v1.4.3.5.gif)

### 杀毒软件报毒说明
最近(2020年9月)Microsoft Defender(MD)又开始对这个软件报病毒。这段时间我逐步删模块排查是哪个功能引起报毒,但是直到删光所有插件MD还是报病毒。我都怀疑这个软件是不是有幸上了微软的“实体清单”,老是被针对。考虑到微软和苹果一样,都是遵纪守法的“好”公司,每次发布都提交误报申请也不是办法。所以报毒这个问题我也无能为力。

### 引用按字母排序 Credits (in alphabetical order)
[2dust/v2rayN](https://github.com/2dust/v2rayN) vmess分享链接及订阅格式
[Ahmad45123/AutoCompleteMenu-ScintillaNET](https://github.com/Ahmad45123/AutoCompleteMenu-ScintillaNET) 自动补全
Expand Down
10 changes: 4 additions & 6 deletions V2RayGCon/Controllers/FormOptionComponent/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class Subscription : OptionComponentController
readonly Services.Servers servers;
readonly Services.ShareLinkMgr slinkMgr;

string oldOptions;

VgcApis.Libs.Tasks.LazyGuy lazyCounter;

public Subscription(
Expand Down Expand Up @@ -71,10 +69,11 @@ public override void Cleanup()
public override bool SaveOptions()
{
string curOptions = GetCurOptions();
string oldOptions = setting.GetSubscriptionConfig();

if (curOptions != oldOptions)
{
setting.SaveSubscriptionItems(curOptions);
setting.SetSubscriptionConfig(curOptions);
oldOptions = curOptions;
return true;
}
Expand All @@ -83,13 +82,14 @@ public override bool SaveOptions()

public override bool IsOptionsChanged()
{
var oldOptions = setting.GetSubscriptionConfig();
return GetCurOptions() != oldOptions;
}

public void Merge(string rawSetting)
{
var mergedSettings = MergeIntoCurSubsItems(rawSetting);
setting.SaveSubscriptionItems(mergedSettings);
setting.SetSubscriptionConfig(mergedSettings);
Misc.UI.ClearFlowLayoutPanel(this.flyPanel);
InitPanel();
}
Expand Down Expand Up @@ -260,8 +260,6 @@ void InitPanel()
var subItemList = setting.GetSubscriptionItems();
chkSubsIsAutoPatch.Checked = setting.isAutoPatchSubsInfo;

this.oldOptions = JsonConvert.SerializeObject(subItemList);

if (subItemList.Count <= 0)
{
subItemList.Add(new Models.Datas.SubscriptionItem());
Expand Down
11 changes: 7 additions & 4 deletions V2RayGCon/Libs/Nets/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed class Downloader
public event EventHandler<VgcApis.Models.Datas.IntEvent> OnProgress;

string _packageName;
string _version = @"v4.23.4";
string _version = @"v4.27.0";
string _source = VgcApis.Models.Consts.Core.GetSourceUrlByIndex(0);
string _sha256sum = null;
readonly object waitForDigest = new object();
Expand Down Expand Up @@ -174,17 +174,20 @@ void NotifyDownloadResults(bool status)
void UpdateCore()
{
var servers = Services.Servers.Instance;
var pluginServ = Services.PluginsServer.Instance;

pluginServ.StopAllPlugins();
// var pluginServ = Services.PluginsServer.Instance;
// pluginServ.StopAllPlugins();

VgcApis.Misc.Utils.Sleep(1000);

var activeServerList = servers.GetRunningServers();
servers.StopAllServersThen(() =>
{
var status = UnzipPackage();
NotifyDownloadResults(status);
pluginServ.RestartAllPlugins();

// pluginServ.RestartAllPlugins();

if (activeServerList.Count > 0)
{
servers.RestartServersThen(activeServerList);
Expand Down
46 changes: 0 additions & 46 deletions V2RayGCon/Libs/Sys/DllLoader.cs

This file was deleted.

2 changes: 2 additions & 0 deletions V2RayGCon/Libs/Sys/SafeNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ internal static class SafeNativeMethods
#endregion

#region ui


[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);

Expand Down
Loading

0 comments on commit 9618c15

Please sign in to comment.