Content list thread-safe (#31)
This commit is contained in:
parent
cbfa535d20
commit
62ae53fcec
6 changed files with 70 additions and 74 deletions
|
@ -103,7 +103,7 @@ LANG=日本語
|
||||||
405=ふつう
|
405=ふつう
|
||||||
406=わるい
|
406=わるい
|
||||||
407=グラフ
|
407=グラフ
|
||||||
408=クライアントの接触がない場合のDC選択
|
408=基本DC選択
|
||||||
409=現在アドレス
|
409=現在アドレス
|
||||||
410=グラフタイプ
|
410=グラフタイプ
|
||||||
411=線形
|
411=線形
|
||||||
|
|
|
@ -103,7 +103,7 @@ LANG=한국어(액토즈)
|
||||||
405=보통
|
405=보통
|
||||||
406=나쁨
|
406=나쁨
|
||||||
407=그래프 보기
|
407=그래프 보기
|
||||||
408=클라이언트의 접속이 없을때 사용할 DC 선택
|
408=기본으로 테스트할 DC
|
||||||
409=연결된 IP주소
|
409=연결된 IP주소
|
||||||
410=그래프 모양
|
410=그래프 모양
|
||||||
411=선형
|
411=선형
|
||||||
|
|
|
@ -103,7 +103,7 @@ LANG=한국어
|
||||||
405=보통
|
405=보통
|
||||||
406=나쁨
|
406=나쁨
|
||||||
407=그래프 보기
|
407=그래프 보기
|
||||||
408=클라이언트의 접속이 없을때 사용할 DC 선택
|
408=기본으로 테스트할 DC
|
||||||
409=현재 연결 IP
|
409=현재 연결 IP
|
||||||
410=그래프 모양
|
410=그래프 모양
|
||||||
411=선형
|
411=선형
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace DutyContent
|
||||||
{
|
{
|
||||||
class DcConfig
|
class DcConfig
|
||||||
{
|
{
|
||||||
public static int PluginTag => 15;
|
public static int PluginTag => 16;
|
||||||
public static Version PluginVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
public static Version PluginVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
|
||||||
public static bool PluginEnable { get; set; }
|
public static bool PluginEnable { get; set; }
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
* Network analyzer codes from https://github.com/Noisyfox/ACT.FFXIVPing
|
* Network analyzer codes from https://github.com/Noisyfox/ACT.FFXIVPing
|
||||||
|
|
||||||
## New test version
|
## New test version
|
||||||
[Download Release 15 ](https://github.com/kshman/DutyContent/releases/tag/15)
|
[Download Release 16 ](https://github.com/kshman/DutyContent/releases/tag/16)
|
||||||
Please try & test new pre-release version!!! 🤗
|
Please try & test new pre-release version!!! 🤗
|
||||||
|
|
||||||
|
|
134
Tab/DutyForm.cs
134
Tab/DutyForm.cs
|
@ -525,29 +525,32 @@ namespace DutyContent.Tab
|
||||||
if (withlog)
|
if (withlog)
|
||||||
WriteLog(Color.Black, key, 10001, fate.Name);
|
WriteLog(Color.Black, key, 10001, fate.Name);
|
||||||
|
|
||||||
lock (_lock_contents)
|
WorkerAct.Invoker(() =>
|
||||||
{
|
{
|
||||||
var sc = code.ToString();
|
lock (_lock_contents)
|
||||||
var i = UnsafeFindContent(sc, out int nth);
|
|
||||||
|
|
||||||
if (i == null && progress >= 0)
|
|
||||||
{
|
{
|
||||||
var li = new ThirdParty.EXListViewItem(sc);
|
var sc = code.ToString();
|
||||||
var si = new ThirdParty.EXImageListViewSubItem(_ilCategory.Images[subs], "");
|
var i = UnsafeFindContent(sc, out int nth);
|
||||||
|
|
||||||
li.SubItems.Add(si);
|
if (i == null && progress >= 0)
|
||||||
li.SubItems.Add(progress.ToString());
|
{
|
||||||
li.SubItems.Add(fate.Name);
|
var li = new ThirdParty.EXListViewItem(sc);
|
||||||
lstContents.Items.Add(li);
|
var si = new ThirdParty.EXImageListViewSubItem(_ilCategory.Images[subs], "");
|
||||||
|
|
||||||
|
li.SubItems.Add(si);
|
||||||
|
li.SubItems.Add(progress.ToString());
|
||||||
|
li.SubItems.Add(fate.Name);
|
||||||
|
lstContents.Items.Add(li);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (progress >= 0)
|
||||||
|
i.SubItems[2].Text = progress.ToString();
|
||||||
|
else if (nth >= 0)
|
||||||
|
lstContents.Items.RemoveAt(nth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
});
|
||||||
{
|
|
||||||
if (progress >= 0)
|
|
||||||
i.SubItems[2].Text = progress.ToString();
|
|
||||||
else if (nth >= 0)
|
|
||||||
lstContents.Items.RemoveAt(nth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -556,51 +559,57 @@ namespace DutyContent.Tab
|
||||||
if (withlog)
|
if (withlog)
|
||||||
WriteLog(Color.Black, 25, 10001, fate.Name);
|
WriteLog(Color.Black, 25, 10001, fate.Name);
|
||||||
|
|
||||||
lock (_lock_contents)
|
WorkerAct.Invoker(() =>
|
||||||
{
|
{
|
||||||
var sc = code.ToString();
|
lock (_lock_contents)
|
||||||
var i = UnsafeFindContent(sc, out int nth);
|
|
||||||
|
|
||||||
if (i == null && progress != null)
|
|
||||||
{
|
{
|
||||||
var li = new ThirdParty.EXListViewItem(sc);
|
var sc = code.ToString();
|
||||||
var si = new ThirdParty.EXImageListViewSubItem(_ilCategory.Images[5], "");
|
var i = UnsafeFindContent(sc, out int nth);
|
||||||
|
|
||||||
li.SubItems.Add(si);
|
if (i == null && progress != null)
|
||||||
li.SubItems.Add(progress.ToString());
|
{
|
||||||
li.SubItems.Add(fate.Name);
|
var li = new ThirdParty.EXListViewItem(sc);
|
||||||
lstContents.Items.Add(li);
|
var si = new ThirdParty.EXImageListViewSubItem(_ilCategory.Images[5], "");
|
||||||
}
|
|
||||||
else
|
li.SubItems.Add(si);
|
||||||
{
|
li.SubItems.Add(progress.ToString());
|
||||||
if (progress == null)
|
li.SubItems.Add(fate.Name);
|
||||||
lstContents.Items.RemoveAt(nth);
|
lstContents.Items.Add(li);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
i.SubItems[2].Text = progress;
|
{
|
||||||
|
if (progress == null)
|
||||||
|
lstContents.Items.RemoveAt(nth);
|
||||||
|
else
|
||||||
|
i.SubItems[2].Text = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private void UpdateTraceInstance(string insname, int count, int imageindex)
|
private void UpdateTraceInstance(string insname, int count, int imageindex)
|
||||||
{
|
{
|
||||||
lock (_lock_contents)
|
WorkerAct.Invoker(() =>
|
||||||
{
|
{
|
||||||
if (lstContents.Items.Count > 0)
|
lock (_lock_contents)
|
||||||
{
|
{
|
||||||
//lstContents.BeginUpdate();
|
if (lstContents.Items.Count > 0)
|
||||||
|
{
|
||||||
|
//lstContents.BeginUpdate();
|
||||||
|
|
||||||
var li = lstContents.Items[0];
|
var li = lstContents.Items[0];
|
||||||
|
|
||||||
var si = li.SubItems[1] as ThirdParty.EXImageListViewSubItem;
|
var si = li.SubItems[1] as ThirdParty.EXImageListViewSubItem;
|
||||||
si.MyImage = _ilCategory.Images[imageindex];
|
si.MyImage = _ilCategory.Images[imageindex];
|
||||||
|
|
||||||
li.SubItems[2].Text = count == 0 ? string.Empty : count.ToString();
|
li.SubItems[2].Text = count == 0 ? string.Empty : count.ToString();
|
||||||
li.SubItems[3].Text = insname;
|
li.SubItems[3].Text = insname;
|
||||||
|
|
||||||
//lstContents.EndUpdate();
|
//lstContents.EndUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1774,15 +1783,18 @@ namespace DutyContent.Tab
|
||||||
|
|
||||||
private void ResetContents()
|
private void ResetContents()
|
||||||
{
|
{
|
||||||
lock (_lock_contents)
|
WorkerAct.Invoker(() =>
|
||||||
{
|
{
|
||||||
lstContents.BeginUpdate();
|
lock (_lock_contents)
|
||||||
|
{
|
||||||
|
lstContents.BeginUpdate();
|
||||||
|
|
||||||
for (var i = lstContents.Items.Count - 1; i > 0; i--)
|
for (var i = lstContents.Items.Count - 1; i > 0; i--)
|
||||||
lstContents.Items.RemoveAt(1);
|
lstContents.Items.RemoveAt(1);
|
||||||
|
|
||||||
lstContents.EndUpdate();
|
lstContents.EndUpdate();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListViewItem UnsafeFindContent(string code, out int nth)
|
private ListViewItem UnsafeFindContent(string code, out int nth)
|
||||||
|
@ -1804,21 +1816,5 @@ namespace DutyContent.Tab
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveContent(string code)
|
|
||||||
{
|
|
||||||
if (lstContents.Items.Count <= 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (var i = 1; i < lstContents.Items.Count; i++)
|
|
||||||
{
|
|
||||||
var v = lstContents.Items[i];
|
|
||||||
if (v.Text.Equals(code))
|
|
||||||
{
|
|
||||||
lstContents.Items.RemoveAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue