Skip to content

Commit

Permalink
qqnt installer
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Sep 28, 2024
1 parent d462ca4 commit 82b52ef
Show file tree
Hide file tree
Showing 12 changed files with 1,181 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RevokeMsgPatcher.Assistant/JsonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ public App QQNT()
{
Search = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 E8 3F 3F 3F 3F"),
Replace = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 B8 01 00 00 00"),
Category = "LiteLoaderQQNT+插件列表+防撤回"
Category = "请在新窗口内安装LiteLoaderQQNT"
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions RevokeMsgPatcher/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public partial class FormMain : Form

Bag bag = null;

FormLiteLoaderQQNT formLiteLoader = null;

public void InitModifier()
{
// 从配置文件中读取配置
Expand Down Expand Up @@ -422,6 +424,7 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
else if (rbtQQNT.Checked)
{
modifier = (QQNTModifier)rbtQQNT.Tag;
ShowOrFocusFormLiteLoaderQQNT();
}

EnableAllButton(true);
Expand All @@ -432,6 +435,24 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
ga.RequestPageView($"{GetCheckedRadioButtonNameEn()}/{lblVersion.Text}/switch", "切换标签页");
}

private void ShowOrFocusFormLiteLoaderQQNT()
{
if (formLiteLoader == null || formLiteLoader.IsDisposed)
{
formLiteLoader = new FormLiteLoaderQQNT();
formLiteLoader.Show();
}
else
{
if (formLiteLoader.WindowState == FormWindowState.Minimized)
{
formLiteLoader.WindowState = FormWindowState.Normal;
}
formLiteLoader.BringToFront();
formLiteLoader.Focus();
}
}

private string GetCheckedRadioButtonNameEn()
{
if (rbtWechat.Checked)
Expand Down
162 changes: 162 additions & 0 deletions RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

175 changes: 175 additions & 0 deletions RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RevokeMsgPatcher.Model;

namespace RevokeMsgPatcher.Forms
{
public partial class FormLiteLoaderQQNT : Form
{
List<LiteLoaderRowData> data = new List<LiteLoaderRowData>();

public FormLiteLoaderQQNT()
{
InitializeComponent();
InitializeDataGridView();
}


private void InitializeDataGridView()
{
dataGridView1.RowHeadersVisible = false;
// 设置 DataGridView 的列
dataGridView1.Columns.Add(new DataGridViewLinkColumn { Name = "NameColumn", HeaderText = "名称", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells });
dataGridView1.Columns.Add(new DataGridViewLinkColumn { Name = "AuthorColumn", HeaderText = "作者", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells });
dataGridView1.Columns.Add(new DataGridViewButtonColumn { Name = "UpdateButtonColumn", HeaderText = "更新", Text = "更新", UseColumnTextForButtonValue = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells });
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { Name = "StatusColumn", HeaderText = "状态", AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells });

// 初始化数据并添加行
data = InitData();
foreach (var item in data)
{
AddRow(item);
}


// 处理单元格点击事件
dataGridView1.CellClick += DataGridView1_CellClick;
}

private List<LiteLoaderRowData> InitData()
{
var data = new List<LiteLoaderRowData>
{
new LiteLoaderRowData
{
Name = "本体 LiteLoaderQQNT",
NameLink = "https://github.com/LiteLoaderQQNT/LiteLoaderQQNT",
Author = "mo-jinran",
AuthorLink = "https://github.com/mo-jinran",
Status = "未检查",
MainBranchName = "main",
LocalPath = Path.Combine(Application.StartupPath, "LiteLoaderQQNT"),
DownloadUrl = "https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/releases/download/#{version}/LiteLoaderQQNT.zip"
},
new LiteLoaderRowData
{
Name = "补丁 DLLHijackMethod",
NameLink = "https://github.com/LiteLoaderQQNT/QQNTFileVerifyPatch/tree/DLLHijackMethod",
Author = "sysrom",
AuthorLink = "https://github.com/sysrom",
LocalPath = Path.Combine(Application.StartupPath, "Public"),
Status = "无需更新"
},
new LiteLoaderRowData
{
Name = "列表插件 LL-plugin-list-viewer",
NameLink = "https://github.com/ltxhhz/LL-plugin-list-viewer",
Author = "ltxhhz",
AuthorLink = "https://github.com/ltxhhz",
Status = "未检查",
MainBranchName = "main",
LocalPath = Path.Combine(Application.StartupPath, "LiteLoaderQQNT/plugins/list-viewer"),
DownloadUrl = "https://github.com/ltxhhz/LL-plugin-list-viewer/releases/download/v#{version}/list-viewer.zip"
},
new LiteLoaderRowData
{
Name = "防撤回插件 LiteLoaderQQNT-Anti-Recall",
NameLink = "https://github.com/xh321/LiteLoaderQQNT-Anti-Recall",
Author = "xh321",
AuthorLink = "https://github.com/xh321",
Status = "未检查",
MainBranchName = "master",
LocalPath = Path.Combine(Application.StartupPath, "LiteLoaderQQNT/plugins/qq-anti-recall"),
DownloadUrl = "https://github.com/xh321/LiteLoaderQQNT-Anti-Recall/releases/download/#{version}/qq-anti-recall.zip"
}
};

return data;
}

private void AddRow(LiteLoaderRowData rowData)
{
int rowIndex = dataGridView1.Rows.Add();
DataGridViewRow row = dataGridView1.Rows[rowIndex];
rowData.Row = row;

// 设置名称列
DataGridViewLinkCell nameCell = (DataGridViewLinkCell)row.Cells["NameColumn"];
nameCell.Value = rowData.Name;
nameCell.Tag = rowData.NameLink;

// 设置作者列
DataGridViewLinkCell authorCell = (DataGridViewLinkCell)row.Cells["AuthorColumn"];
authorCell.Value = rowData.Author;
authorCell.Tag = rowData.AuthorLink;

// 设置状态列
row.Cells["StatusColumn"].Value = rowData.Status;

// 订阅状态更新事件
rowData.StatusUpdated += (newStatus) =>
{
if (dataGridView1.InvokeRequired)
{
dataGridView1.Invoke(new Action(() => row.Cells["StatusColumn"].Value = newStatus));
}
else
{
row.Cells["StatusColumn"].Value = newStatus;
}
};

rowData.GetLocalVersionAndUpdateStatus();
}


private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
if (e.ColumnIndex == dataGridView1.Columns["UpdateButtonColumn"].Index)
{
if (data[e.RowIndex].NameLink.Contains("QQNTFileVerifyPatch"))
{
MessageBox.Show("此项无需更新!");
return;
}

data[e.RowIndex].Row.Cells["StatusColumn"].Value = "正在更新";
Task.Run(() => data[e.RowIndex].CheckAndUpdate());
}
else if (e.ColumnIndex == dataGridView1.Columns["NameColumn"].Index || e.ColumnIndex == dataGridView1.Columns["AuthorColumn"].Index)
{
string url = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag.ToString();
System.Diagnostics.Process.Start(url);
}
}
}

private void btnCheckUpdateAll_Click(object sender, EventArgs e)
{
foreach (var item in data)
{
Task.Run(() => item.CheckAndUpdate());
}
}

private void btnRestore_Click(object sender, EventArgs e)
{

}

private void btnPath_Click(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit 82b52ef

Please sign in to comment.