### 2024-12-10更新

------
#### VSoft    V2.0.2412.1001
- *.[新增]拖放文件到主界面,支持直接插入到拖放的位置。
- *.[新增]新增支持设置运行次数的功能,可以快速进行多开。
- *.[新增]支持保存大小和选中的栏目和分类位置。
- *.[改进]切换栏目会记录列表滚动条位置和选中的分类。
- *.[改进]编辑添加的内置功能,将不允许修改路径。
- *.[改进]读取快捷方式时,支持自动获取图标信息。
- *.[改进]新增软件完成后,不再刷新列表,而是直接添加到列表末尾。
- *.[改进]新增软件或拖放软件后,界面直接定位到添加的列表位置。
- *.[改进]点击显示主界面时,如果存在模式窗体,则将模式窗体显示在前面。
- *.[改进]当百度翻译出错时自动重试翻译。
- *.[修复]栏目和分类进行拖放操作时,拖放出控件会残留拖放标志的BUG。
This commit is contained in:
紫林软件 2024-12-10 16:55:25 +08:00
parent 6380c8b609
commit 6f72e8e105
93 changed files with 86154 additions and 403 deletions

Binary file not shown.

72230
Bin/Debug/VSoft/RaUI.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,7 +1,9 @@
[VSoft]
hwnd=25831240
width=745
height=543
hwnd=7350280
width=802
height=626
ColumnId=1
TypeId=2
[VSoft_Test]
hwnd=657946
width=733

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,22 @@
### 2023-12-04更新
### 2024-12-10更新
------
#### VSoft V2.0.2412.1001
- *.[新增]拖放文件到主界面,支持直接插入到拖放的位置。
- *.[新增]新增支持设置运行次数的功能,可以快速进行多开。
- *.[新增]支持保存大小和选中的栏目和分类位置。
- *.[改进]切换栏目会记录列表滚动条位置和选中的分类。
- *.[改进]编辑添加的内置功能,将不允许修改路径。
- *.[改进]读取快捷方式时,支持自动获取图标信息。
- *.[改进]新增软件完成后,不再刷新列表,而是直接添加到列表末尾。
- *.[改进]新增软件或拖放软件后,界面直接定位到添加的列表位置。
- *.[改进]点击显示主界面时,如果存在模式窗体,则将模式窗体显示在前面。
- *.[改进]当百度翻译出错时自动重试翻译。
- *.[修复]栏目和分类进行拖放操作时,拖放出控件会残留拖放标志的BUG。
### 2023-12-04更新
------

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VSoftBox")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2312.0401")]
[assembly: AssemblyFileVersion("1.0.2312.0401")]
[assembly: AssemblyVersion("2.0.2412.1001")]
[assembly: AssemblyFileVersion("2.0.2412.1001")]

File diff suppressed because one or more lines are too long

View File

@ -36,6 +36,7 @@
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.of_File = new System.Windows.Forms.OpenFileDialog();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.NumRunCount = new System.Windows.Forms.NumericUpDown();
this.TxtCmdId = new ryControls.TextBoxEx2();
this.label6 = new System.Windows.Forms.Label();
this.LblCustomImg = new System.Windows.Forms.Label();
@ -43,6 +44,9 @@
this.label4 = new System.Windows.Forms.Label();
this.chromeTabControl1 = new ryControls.ChromeTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label9 = new System.Windows.Forms.Label();
this.CbbRunMode = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.hotkeyTextBox1 = new ryControls.HotkeyTextBox();
this.ChkRunAsAdmin = new System.Windows.Forms.CheckBox();
@ -59,6 +63,7 @@
this.label1 = new System.Windows.Forms.Label();
this.TxtName = new ryControls.TextBoxEx2();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NumRunCount)).BeginInit();
this.chromeTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PicImg)).BeginInit();
@ -94,12 +99,39 @@
//
this.of_File.Filter = "所有文件|*.*";
//
// NumRunCount
//
this.NumRunCount.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.NumRunCount.Location = new System.Drawing.Point(258, 168);
this.NumRunCount.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.NumRunCount.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.NumRunCount.Name = "NumRunCount";
this.NumRunCount.Size = new System.Drawing.Size(74, 26);
this.NumRunCount.TabIndex = 15;
this.NumRunCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.toolTip1.SetToolTip(this.NumRunCount, "设置执行次数,可用于多开微信。\r\n本功能对翻译和清空回收站功能无效。");
this.NumRunCount.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// TxtCmdId
//
this.TxtCmdId.BackColor = System.Drawing.Color.White;
this.TxtCmdId.EmptyText = "默认为空";
this.TxtCmdId.Location = new System.Drawing.Point(310, 35);
this.TxtCmdId.LongTime = 2000;
this.TxtCmdId.MaxLength = 999999999;
this.TxtCmdId.MaxUndoRedoSteps = 50;
this.TxtCmdId.Multiline = false;
this.TxtCmdId.Name = "TxtCmdId";
this.TxtCmdId.OnlyNumeric = false;
@ -143,8 +175,10 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtDes.BackColor = System.Drawing.Color.White;
this.TxtDes.EmptyText = "";
this.TxtDes.Location = new System.Drawing.Point(57, 65);
this.TxtDes.Location = new System.Drawing.Point(57, 62);
this.TxtDes.LongTime = 2000;
this.TxtDes.MaxLength = 999999999;
this.TxtDes.MaxUndoRedoSteps = 50;
this.TxtDes.Multiline = true;
this.TxtDes.Name = "TxtDes";
this.TxtDes.OnlyNumeric = false;
@ -153,7 +187,7 @@
this.TxtDes.SelectedText = "";
this.TxtDes.SelectionLength = 0;
this.TxtDes.SelectionStart = 0;
this.TxtDes.Size = new System.Drawing.Size(513, 80);
this.TxtDes.Size = new System.Drawing.Size(513, 87);
this.TxtDes.TabIndex = 11;
this.TxtDes.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TxtDes.ToolTip = "";
@ -191,6 +225,10 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.NumRunCount);
this.tabPage1.Controls.Add(this.label9);
this.tabPage1.Controls.Add(this.CbbRunMode);
this.tabPage1.Controls.Add(this.label8);
this.tabPage1.Controls.Add(this.label7);
this.tabPage1.Controls.Add(this.hotkeyTextBox1);
this.tabPage1.Controls.Add(this.ChkRunAsAdmin);
@ -209,6 +247,39 @@
this.tabPage1.Text = "运行";
this.tabPage1.UseVisualStyleBackColor = true;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(258, 153);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(53, 12);
this.label9.TabIndex = 14;
this.label9.Text = "执行次数";
//
// CbbRunMode
//
this.CbbRunMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CbbRunMode.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.CbbRunMode.FormattingEnabled = true;
this.CbbRunMode.Items.AddRange(new object[] {
"普通模式",
"隐藏",
"最小化",
"最大化"});
this.CbbRunMode.Location = new System.Drawing.Point(506, 23);
this.CbbRunMode.Name = "CbbRunMode";
this.CbbRunMode.Size = new System.Drawing.Size(124, 22);
this.CbbRunMode.TabIndex = 13;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(504, 8);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(53, 12);
this.label8.TabIndex = 12;
this.label8.Text = "运行方式";
//
// label7
//
this.label7.AutoSize = true;
@ -255,8 +326,10 @@
//
this.TxtStartPath.BackColor = System.Drawing.Color.White;
this.TxtStartPath.EmptyText = "留空则表示使用默认设置";
this.TxtStartPath.Location = new System.Drawing.Point(8, 103);
this.TxtStartPath.Location = new System.Drawing.Point(6, 103);
this.TxtStartPath.LongTime = 2000;
this.TxtStartPath.MaxLength = 999999999;
this.TxtStartPath.MaxUndoRedoSteps = 50;
this.TxtStartPath.Multiline = false;
this.TxtStartPath.Name = "TxtStartPath";
this.TxtStartPath.OnlyNumeric = false;
@ -265,7 +338,7 @@
this.TxtStartPath.SelectedText = "";
this.TxtStartPath.SelectionLength = 0;
this.TxtStartPath.SelectionStart = 0;
this.TxtStartPath.Size = new System.Drawing.Size(449, 22);
this.TxtStartPath.Size = new System.Drawing.Size(451, 22);
this.TxtStartPath.TabIndex = 7;
this.TxtStartPath.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TxtStartPath.ToolTip = "";
@ -285,7 +358,9 @@
this.TxtPath.BackColor = System.Drawing.Color.White;
this.TxtPath.EmptyText = "";
this.TxtPath.Location = new System.Drawing.Point(6, 23);
this.TxtPath.LongTime = 2000;
this.TxtPath.MaxLength = 999999999;
this.TxtPath.MaxUndoRedoSteps = 50;
this.TxtPath.Multiline = false;
this.TxtPath.Name = "TxtPath";
this.TxtPath.OnlyNumeric = false;
@ -324,7 +399,9 @@
this.TxtRunPram.BackColor = System.Drawing.Color.White;
this.TxtRunPram.EmptyText = "";
this.TxtRunPram.Location = new System.Drawing.Point(6, 63);
this.TxtRunPram.LongTime = 2000;
this.TxtRunPram.MaxLength = 999999999;
this.TxtRunPram.MaxUndoRedoSteps = 50;
this.TxtRunPram.Multiline = false;
this.TxtRunPram.Name = "TxtRunPram";
this.TxtRunPram.OnlyNumeric = false;
@ -393,7 +470,9 @@
this.TxtName.BackColor = System.Drawing.Color.White;
this.TxtName.EmptyText = "";
this.TxtName.Location = new System.Drawing.Point(57, 35);
this.TxtName.LongTime = 2000;
this.TxtName.MaxLength = 999999999;
this.TxtName.MaxUndoRedoSteps = 50;
this.TxtName.Multiline = false;
this.TxtName.Name = "TxtName";
this.TxtName.OnlyNumeric = false;
@ -431,6 +510,7 @@
this.Text = "添加软件";
this.Load += new System.EventHandler(this.FrmAddSoft_Load);
this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NumRunCount)).EndInit();
this.chromeTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
@ -470,5 +550,9 @@
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Label label7;
public ryControls.HotkeyTextBox hotkeyTextBox1;
private System.Windows.Forms.ComboBox CbbRunMode;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.NumericUpDown NumRunCount;
private System.Windows.Forms.Label label9;
}
}

View File

@ -1,144 +1,161 @@
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VSoft.Prams;
using VSoft.Skins;
namespace VSoft
{
public partial class FrmAddSoft : SKinForm
{
public string SQLConnStr { get; set; } = Itrycn_Db.SQLConnStr;
public FrmAddSoft()
{
InitializeComponent();
LblCustomImg.Text = "自动获取";
}
public string tableName = "Softs";
private string IconPath { get; set; } = "";
public int IsAdd { get; set; } = 1;
public int SelectId { get; set; } = -1;
public int ColumnId { get; set; } = -1;
public FrmAddSoft(string path)
{
InitializeComponent();
if (System.IO.Path.GetExtension(path).ToLower() == ".lnk")
{
var shortcut = API.ReadShortcut(path);
TxtPath.Text = shortcut.TargetPath;
TxtRunPram.Text = shortcut.Arguments;
TxtStartPath.Text = shortcut.WorkDir;
TxtDes.Text = shortcut.Description;
//ShellLink cc = new ShellLink(path);
//PicImg.Image = cc.LargeIcon.ToBitmap();
}
else
{
TxtPath.Text =RyFiles.GetRelativePath(path);
}
TxtName.Text = System.IO.Path.GetFileNameWithoutExtension(path);
}
private string orgion_IconPath = "";
public void GetInfo(int id)
{
SelectId = id;
Text = "修改软件";
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
DataSet ds = db.ReadData(tableName, id.ToString());
if (mydb.HaveData(ds))
{
DataRow reader = ds.Tables[0].Rows[0];
#region
TxtName.Text = reader["Name"].ToString();
TxtCmdId.Text = reader["CmdId"].ToString();
TxtDes.Text = reader["Des"].ToString();
TxtPath.Text = reader["Path"].ToString();
TxtRunPram.Text = reader["RunPram"].ToString();
TxtStartPath.Text = reader["StartPath"].ToString();
hotkeyTextBox1.HotKey = reader["Hotkey"].ToString();
Json json = new Json(reader["SetJson"].ToString());
ChkRunAsAdmin.Checked = json.GetJsonValue("RunAsAdmin", false);
var _IconPath = reader["IconPath"].ToString();
orgion_IconPath = _IconPath;
IconPath = _IconPath;
if (_IconPath.Length==0)
{
_IconPath = reader["Path"].ToString();
}
else
{
LblCustomImg.Text = "自定义";
}
PicImg.Image = API.GetImg(RyFiles.GetRealPath(_IconPath));
#endregion
}
}
db.Free();
}
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VSoft.Prams;
using VSoft.Skins;
namespace VSoft
{
public partial class FrmAddSoft : SKinForm
{
public string SQLConnStr { get; set; } = Itrycn_Db.SQLConnStr;
public FrmAddSoft()
{
InitializeComponent();
LblCustomImg.Text = "自动获取";
CbbRunMode.SelectedIndex = 0;
}
public string tableName = "Softs";
private string IconPath { get; set; } = "";
public int IsAdd { get; set; } = 1;
public int SelectId { get; set; } = -1;
public int ColumnId { get; set; } = -1;
public FrmAddSoft(string path)
{
InitializeComponent();
if (System.IO.Path.GetExtension(path).ToLower() == ".lnk")
{
var shortcut = API.ReadShortcut(path);
TxtPath.Text = shortcut.TargetPath;
TxtRunPram.Text = shortcut.Arguments;
TxtStartPath.Text = shortcut.WorkDir;
TxtDes.Text = shortcut.Description;
//ShellLink cc = new ShellLink(path);
//PicImg.Image = cc.LargeIcon.ToBitmap();
}
else
{
TxtPath.Text =RyFiles.GetRelativePath(path);
}
TxtName.Text = System.IO.Path.GetFileNameWithoutExtension(path);
}
private int SoftType { get; set; } = -1;
private string SoftPath { get; set; } ="";
private string orgion_IconPath = "";
public void GetInfo(int id)
{
SelectId = id;
Text = "修改软件";
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
DataSet ds = db.ReadData(tableName, id.ToString());
if (mydb.HaveData(ds))
{
DataRow reader = ds.Tables[0].Rows[0];
#region
TxtName.Text = reader["Name"].ToString();
TxtCmdId.Text = reader["CmdId"].ToString();
TxtDes.Text = reader["Des"].ToString();
SoftPath = reader["Path"].ToString();
SoftType = reader["SoftType"].ToInt();
if (SoftType == 1)//内置软件
{
TxtPath.ReadOnly = true;
TxtPath.Text = "内置启动程序";
TxtPath.ForeColor = Color.Blue;
TxtPath.Font = new Font(TxtPath.Font, FontStyle.Bold);
}
else
{
TxtPath.Text = SoftPath;
}
TxtRunPram.Text = reader["RunPram"].ToString();
TxtStartPath.Text = reader["StartPath"].ToString();
hotkeyTextBox1.HotKey = reader["Hotkey"].ToString();
Json json = new Json(reader["SetJson"].ToString());
ChkRunAsAdmin.Checked = json.GetJsonValue("RunAsAdmin", false);
CbbRunMode.SelectedIndex = json.GetJsonValue("RunMode", 0);
NumRunCount.Value = json.GetJsonValue("RunCount", 1, NumRunCount.Maximum.ToInt(), 1);
var _IconPath = reader["IconPath"].ToString();
orgion_IconPath = _IconPath;
IconPath = _IconPath;
if (_IconPath.Length==0)
{
_IconPath = reader["Path"].ToString();
}
else
{
LblCustomImg.Text = "自定义";
}
PicImg.Image = API.GetImg(RyFiles.GetRealPath(_IconPath));
#endregion
}
}
db.Free();
}
/// <summary>
/// 当前操作的id
/// </summary>
public int Op_Id { get; set; } = -1;
private void BtnOK_Click(object sender, EventArgs e)
{
if (TxtName.Text.Length == 0)
{
Msg.ShowMsg("名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (TxtCmdId.Text.Length> 0 && !TxtCmdId.Text.Replace("_","").IsEngOrNum())
{
Msg.ShowMsg("命令ID只支持英文和数字字符。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (IconPath.Length>0 && IconPath.IndexOfEx("<app>")!=0 && IconPath!=TxtPath.Text)
{
var _IconPath=RyFiles.AddFileToFolder(RyFiles.GetRealPath(IconPath), Config.Soft_Info.UserDataFolder + "\\SoftLogos", true, out var result);
if(result)
{
IconPath = RyFiles.GetRelativePath(_IconPath);
}
}
if (IconPath != orgion_IconPath)
{
if (orgion_IconPath.Length > 0 && orgion_IconPath.StartsWith("<app>\\UserDb\\SoftLogos", StringComparison.OrdinalIgnoreCase))
{
RyFiles.DeleteFile(RyFiles.GetRealPath(orgion_IconPath));
}
}
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
if (TxtCmdId.Text.Length > 0)
{
var ds = db.ReadData("select * from " + tableName + " where CmdId='" + TxtCmdId.Text + "' and id<>" + SelectId + " limit 1");
if (mydb.HaveData(ds))
{
Msg.ShowMsg("当前命令ID已经存在,请更换命令ID。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds.Dispose(); return;
}
ds.Dispose();
}
if (hotkeyTextBox1.HaveHotKey)
{
var ds_soft = db.ReadData("select * from " + tableName + " where Hotkey='" + hotkeyTextBox1.HotKey + "' and id<>" + SelectId + " limit 1");
var ds_type = db.ReadData("select * from Columns where Hotkey='" + hotkeyTextBox1.HotKey + "' limit 1");
if (mydb.HaveData(ds_soft) || ds_type.HaveData())
{
Msg.ShowMsg("当前热键已经存在,请更换热键。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds_soft.Dispose(); ds_type.Dispose(); return;
}
/// </summary>
public int Op_Id { get; set; } = -1;
private void BtnOK_Click(object sender, EventArgs e)
{
if (TxtName.Text.Length == 0)
{
Msg.ShowMsg("名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (TxtCmdId.Text.Length> 0 && !TxtCmdId.Text.Replace("_","").IsEngOrNum())
{
Msg.ShowMsg("命令ID只支持英文和数字字符。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (IconPath.Length>0 && IconPath.IndexOfEx("<app>")!=0 && IconPath!=TxtPath.Text)
{
var _IconPath=RyFiles.AddFileToFolder(RyFiles.GetRealPath(IconPath), Config.Soft_Info.UserDataFolder + "\\SoftLogos", true, out var result);
if(result)
{
IconPath = RyFiles.GetRelativePath(_IconPath);
}
}
if (IconPath != orgion_IconPath)
{
if (orgion_IconPath.Length > 0 && orgion_IconPath.StartsWith("<app>\\UserDb\\SoftLogos", StringComparison.OrdinalIgnoreCase))
{
RyFiles.DeleteFile(RyFiles.GetRealPath(orgion_IconPath));
}
}
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
if (TxtCmdId.Text.Length > 0)
{
var ds = db.ReadData("select * from " + tableName + " where CmdId='" + TxtCmdId.Text + "' and id<>" + SelectId + " limit 1");
if (mydb.HaveData(ds))
{
Msg.ShowMsg("当前命令ID已经存在,请更换命令ID。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds.Dispose(); return;
}
ds.Dispose();
}
if (hotkeyTextBox1.HaveHotKey)
{
var ds_soft = db.ReadData("select * from " + tableName + " where Hotkey='" + hotkeyTextBox1.HotKey + "' and id<>" + SelectId + " limit 1");
var ds_type = db.ReadData("select * from Columns where Hotkey='" + hotkeyTextBox1.HotKey + "' limit 1");
if (mydb.HaveData(ds_soft) || ds_type.HaveData())
{
Msg.ShowMsg("当前热键已经存在,请更换热键。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds_soft.Dispose(); ds_type.Dispose(); return;
}
else
{
if(Config.Soft_Config.IsHotKeyExistInList(hotkeyTextBox1.HotKey)>=0)
@ -146,105 +163,110 @@ namespace VSoft
Msg.ShowMsg("当前热键已经存在,请更换热键。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds_soft.Dispose(); ds_type.Dispose(); return;
}
}
ds_soft.Dispose();
ds_type.Dispose();
}
RyQuickSQL mySQL = new RyQuickSQL(tableName);
mySQL.AddField("Name", TxtName.Text);
mySQL.AddField("CmdId", TxtCmdId.Text);
mySQL.AddField("Path", TxtPath.Text);
mySQL.AddField("RunPram", TxtRunPram.Text);
mySQL.AddField("StartPath", TxtStartPath.Text);//起始路径
mySQL.AddField("IconPath", IconPath);//图标路径
Json json = new Json("");
json.Add("RunAsAdmin", ChkRunAsAdmin.Checked);
mySQL.AddField("SetJson", json.Text);//设置
}
ds_soft.Dispose();
ds_type.Dispose();
}
RyQuickSQL mySQL = new RyQuickSQL(tableName);
mySQL.AddField("Name", TxtName.Text);
mySQL.AddField("CmdId", TxtCmdId.Text);
if (SoftType == 0 || IsAdd>0)//不是内置软件
{
mySQL.AddField("Path", TxtPath.Text);
}
mySQL.AddField("RunPram", TxtRunPram.Text);
mySQL.AddField("StartPath", TxtStartPath.Text);//起始路径
mySQL.AddField("IconPath", IconPath);//图标路径
Json json = new Json("");
json.Add("RunAsAdmin", ChkRunAsAdmin.Checked);
json.Add("RunMode", CbbRunMode.SelectedIndex);
json.Add("RunCount", NumRunCount.Value.ToInt());
mySQL.AddField("SetJson", json.Text);//设置
mySQL.AddField("Des", TxtDes.Text);//备注
mySQL.AddField("Hotkey", hotkeyTextBox1.HaveHotKey?hotkeyTextBox1.HotKey:"");//快捷键
mySQL.AddField("Pinyin", ryCommon.PinYin.Convert(TxtName.Text) + "\r\n" + ryCommon.PinYin.ConvertFirstPY(TxtName.Text));
mySQL.AddField("editTime", DateTime.Now);
if (IsAdd >= 1)
{
mySQL.AddField("SoftType", 0);//0表示运行文件,1表示执行快速命令,2表示执行脚本
mySQL.AddField("ClickCount", 0);//点击量
mySQL.AddField("ColumnId",ColumnId);
mySQL.AddField("sortindex",Itrycn_Db.GetSoftCount(db, ColumnId) + 1);
mySQL.AddField("addTime", DateTime.Now);
var ds= db.ReadData(mySQL.GetInsertSQL()+";select last_insert_rowid();", mySQL);
if (ds.HaveData())
{
Op_Id = ds.GetFirstRowCellValue();
}
ds.Dispose();
}
else
{
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where id=" + SelectId, mySQL);
Op_Id = SelectId;
}
}
db.Free();
DialogResult = DialogResult.OK;
}
private void TxtPath_TextChanged2(object sender, EventArgs e)
{
if (IconPath.Length > 0)
{ return; }
var path =RyFiles.GetRealPath(TxtPath.Text);
if(System.IO.File.Exists(path))
{
PicImg.Image = API.GetImg(path,128);
}
else if (System.IO.Directory.Exists(path))
{
PicImg.Image = API.GetImg(path,64);
}
else
{
PicImg.Image = null;
}
}
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void PicImg_Click(object sender, EventArgs e)
{
ToolStripMenuItem.PerformClick();
}
private void FrmAddSoft_Load(object sender, EventArgs e)
{
}
private void BtnBrowser_Click(object sender, EventArgs e)
{
if (of_File.ShowDialog() == DialogResult.OK)
{
TxtPath.Text = of_File.FileName;
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
IconPath =RyFiles.GetRelativePath(openFileDialog1.FileName);
PicImg.Image = API.GetImg(openFileDialog1.FileName);
LblCustomImg.Text = "自定义";
}
}
private void 使ToolStripMenuItem_Click(object sender, EventArgs e)
{
IconPath = "";
PicImg.Image = API.GetImg(RyFiles.GetRealPath(TxtPath.Text));
LblCustomImg.Text = "自动获取";
}
}
}
mySQL.AddField("Hotkey", hotkeyTextBox1.HaveHotKey?hotkeyTextBox1.HotKey:"");//快捷键
mySQL.AddField("Pinyin", ryCommon.PinYin.Convert(TxtName.Text) + "\r\n" + ryCommon.PinYin.ConvertFirstPY(TxtName.Text));
mySQL.AddField("editTime", DateTime.Now);
if (IsAdd >= 1)
{
mySQL.AddField("SoftType", 0);//0表示运行文件,1表示执行快速命令,2表示执行脚本
mySQL.AddField("ClickCount", 0);//点击量
mySQL.AddField("ColumnId",ColumnId);
mySQL.AddField("sortindex",Itrycn_Db.GetSoftCount(db, ColumnId) + 1);
mySQL.AddField("addTime", DateTime.Now);
var ds= db.ReadData(mySQL.GetInsertSQL()+";select last_insert_rowid();", mySQL);
if (ds.HaveData())
{
Op_Id = ds.GetFirstRowCellValue();
}
ds.Dispose();
}
else
{
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where id=" + SelectId, mySQL);
Op_Id = SelectId;
}
}
db.Free();
DialogResult = DialogResult.OK;
}
private void TxtPath_TextChanged2(object sender, EventArgs e)
{
if (IconPath.Length > 0)
{ return; }
var path =RyFiles.GetRealPath(TxtPath.Text);
if(System.IO.File.Exists(path))
{
PicImg.Image = API.GetImg(path,128);
}
else if (System.IO.Directory.Exists(path))
{
PicImg.Image = API.GetImg(path,64);
}
else
{
PicImg.Image = null;
}
}
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void PicImg_Click(object sender, EventArgs e)
{
ToolStripMenuItem.PerformClick();
}
private void FrmAddSoft_Load(object sender, EventArgs e)
{
}
private void BtnBrowser_Click(object sender, EventArgs e)
{
if (of_File.ShowDialog() == DialogResult.OK)
{
TxtPath.Text = of_File.FileName;
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
IconPath =RyFiles.GetRelativePath(openFileDialog1.FileName);
PicImg.Image = API.GetImg(openFileDialog1.FileName);
LblCustomImg.Text = "自定义";
}
}
private void 使ToolStripMenuItem_Click(object sender, EventArgs e)
{
IconPath = "";
PicImg.Image = API.GetImg(RyFiles.GetRealPath(TxtPath.Text));
LblCustomImg.Text = "自动获取";
}
}
}

View File

@ -7,6 +7,7 @@ using System.Data;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using VSoft.Config;
using VSoft.Prams;
namespace VSoft
@ -22,7 +23,19 @@ namespace VSoft
public FrmInCMD()
{
InitializeComponent();
if(ReadOnly)
#if DY
var sub_dir = @"\SysDb\Tools\VSoft";
var ProcessPath = Application.StartupPath;
if (Application.StartupPath.EndsWith(sub_dir, StringComparison.OrdinalIgnoreCase))
{
ProcessPath = Application.StartupPath.Substring(0, Application.StartupPath.Length - sub_dir.Length);
}
if (System.IO.File.Exists(ProcessPath + "\\管理员调试.set"))
{
ReadOnly = false;
}
#endif
if (ReadOnly)
{
IconViewEx1.ContextMenuStrip = null;
TabList_Column.ContextMenuStrip = null;
@ -252,7 +265,7 @@ namespace VSoft
FrmAddColumn frm = new FrmAddColumn();
frm.TopMost = TopMost;
frm.SQLConnStr = SQLConnStr;
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
@ -285,7 +298,7 @@ namespace VSoft
frm.SQLConnStr = SQLConnStr;
frm.IsAdd = 0;
frm.GetInfo(info.Id);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
SetColumnRow(info.Id, TabList_Column.SelectedItems[0].Index);
}
@ -378,7 +391,7 @@ namespace VSoft
SQLConnStr = SQLConnStr,
TopMost=TopMost
};
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
@ -427,7 +440,7 @@ namespace VSoft
TopMost=TopMost
};
frm.GetInfo(info.Id);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
SetTypeRow(info.Id, TabList_Type.SelectedItems[0].Index);
}
@ -531,7 +544,7 @@ namespace VSoft
TopMost=TopMost
};
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
LoadDb();
}
@ -550,7 +563,7 @@ namespace VSoft
};
frm.GetInfo(info.Id);
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
SetSoftRow(info.Id, IconViewEx1.SelectedItems[0].Index);
}
@ -724,7 +737,7 @@ namespace VSoft
ColumnId = ColumnId,
SQLConnStr = SQLConnStr
};
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
LoadDb();
}
@ -1134,7 +1147,7 @@ namespace VSoft
frm.GetInfo(info.Id);
frm.Text = "复制并新增软件";
frm.SelectId = -1;
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
LoadDb();
}

View File

@ -71,6 +71,8 @@
this.IconViewEx1 = new ryControls.IconViewEx();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.TabList_Column = new ryControls.TabList();
this.BtnLeftColumn = new ryControls.ButtonEx();
this.BtnRightColumn = new ryControls.ButtonEx();
this.MenuList.SuspendLayout();
this.MenuTabColumn.SuspendLayout();
this.MenuTabType.SuspendLayout();
@ -152,7 +154,7 @@
//
this.BtnAddColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BtnAddColumn.Image = ((System.Drawing.Image)(resources.GetObject("BtnAddColumn.Image")));
this.BtnAddColumn.Location = new System.Drawing.Point(681, 36);
this.BtnAddColumn.Location = new System.Drawing.Point(714, 36);
this.BtnAddColumn.Name = "BtnAddColumn";
this.BtnAddColumn.Size = new System.Drawing.Size(27, 28);
this.BtnAddColumn.TabIndex = 3;
@ -340,6 +342,7 @@
this.TabList_Type.DragDrop += new System.Windows.Forms.DragEventHandler(this.TabList_Type_DragDrop);
this.TabList_Type.DragEnter += new System.Windows.Forms.DragEventHandler(this.TabList_Type_DragEnter);
this.TabList_Type.DragOver += new System.Windows.Forms.DragEventHandler(this.IconViewEx1_DragOver);
this.TabList_Type.DragLeave += new System.EventHandler(this.TabList_Type_DragLeave);
this.TabList_Type.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TabList_Type_KeyDown);
//
// columnHeader2
@ -354,9 +357,9 @@
this.rySearch1.ButtonRoundBackColor = System.Drawing.SystemColors.Control;
this.rySearch1.ColorGradient = true;
this.rySearch1.EmptyText = "输入名称或拼音搜索";
this.rySearch1.Location = new System.Drawing.Point(533, 36);
this.rySearch1.Location = new System.Drawing.Point(570, 36);
this.rySearch1.Name = "rySearch1";
this.rySearch1.Size = new System.Drawing.Size(142, 27);
this.rySearch1.Size = new System.Drawing.Size(138, 27);
this.rySearch1.TabIndex = 2;
this.rySearch1.OnSearch += new System.EventHandler(this.RySearch1_OnSearch);
this.rySearch1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.RySearch1_KeyDown);
@ -426,6 +429,7 @@
this.IconViewEx1.DragDrop += new System.Windows.Forms.DragEventHandler(this.IconViewEx1_DragDrop);
this.IconViewEx1.DragEnter += new System.Windows.Forms.DragEventHandler(this.IconViewEx1_DragEnter);
this.IconViewEx1.DragOver += new System.Windows.Forms.DragEventHandler(this.IconViewEx1_DragOver);
this.IconViewEx1.DragLeave += new System.EventHandler(this.IconViewEx1_DragLeave);
this.IconViewEx1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.IconViewEx1_KeyDown);
this.IconViewEx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.IconViewEx1_MouseClick);
this.IconViewEx1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.IconViewEx1_MouseDoubleClick);
@ -455,7 +459,7 @@
this.TabList_Column.SelectedEndBackColor = System.Drawing.Color.SkyBlue;
this.TabList_Column.SelectedForeColor = System.Drawing.Color.Black;
this.TabList_Column.SelectedStartBackColor = System.Drawing.Color.PowderBlue;
this.TabList_Column.Size = new System.Drawing.Size(446, 29);
this.TabList_Column.Size = new System.Drawing.Size(442, 29);
this.TabList_Column.TabIndex = 1;
this.TabList_Column.TileSize = new System.Drawing.Size(70, 30);
this.TabList_Column.UseCompatibleStateImageBehavior = false;
@ -465,8 +469,35 @@
this.TabList_Column.DragDrop += new System.Windows.Forms.DragEventHandler(this.TabList_Column_DragDrop);
this.TabList_Column.DragEnter += new System.Windows.Forms.DragEventHandler(this.TabList_Column_DragEnter);
this.TabList_Column.DragOver += new System.Windows.Forms.DragEventHandler(this.IconViewEx1_DragOver);
this.TabList_Column.DragLeave += new System.EventHandler(this.TabList_Column_DragLeave);
this.TabList_Column.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TabList_Column_KeyDown);
//
// BtnLeftColumn
//
this.BtnLeftColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BtnLeftColumn.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(20)))));
this.BtnLeftColumn.ColorGradient = true;
this.BtnLeftColumn.Location = new System.Drawing.Point(527, 37);
this.BtnLeftColumn.Name = "BtnLeftColumn";
this.BtnLeftColumn.Size = new System.Drawing.Size(20, 23);
this.BtnLeftColumn.TabIndex = 9;
this.BtnLeftColumn.Text = "←";
this.BtnLeftColumn.UseVisualStyleBackColor = true;
this.BtnLeftColumn.Click += new System.EventHandler(this.BtnLeftColumn_Click);
//
// BtnRightColumn
//
this.BtnRightColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BtnRightColumn.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(20)))));
this.BtnRightColumn.ColorGradient = true;
this.BtnRightColumn.Location = new System.Drawing.Point(548, 37);
this.BtnRightColumn.Name = "BtnRightColumn";
this.BtnRightColumn.Size = new System.Drawing.Size(20, 23);
this.BtnRightColumn.TabIndex = 10;
this.BtnRightColumn.Text = "→";
this.BtnRightColumn.UseVisualStyleBackColor = true;
this.BtnRightColumn.Click += new System.EventHandler(this.BtnRightColumn_Click);
//
// FrmVSoft
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -476,6 +507,8 @@
this.CaptionHeight = 30;
this.ClientSize = new System.Drawing.Size(745, 543);
this.ControlBoxOffset = new System.Drawing.Point(8, 8);
this.Controls.Add(this.BtnRightColumn);
this.Controls.Add(this.BtnLeftColumn);
this.Controls.Add(this.rySearch1);
this.Controls.Add(this.PnlLeft);
this.Controls.Add(this.LblSetting);
@ -667,5 +700,7 @@
private System.Windows.Forms.Label LblSetting;
private System.Windows.Forms.Panel PnlLeft;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
private ryControls.ButtonEx BtnLeftColumn;
private ryControls.ButtonEx BtnRightColumn;
}
}

View File

@ -1,4 +1,5 @@
using ryCommon;
using Newtonsoft.Json.Linq;
using ryCommon;
using ryCommonDb;
using ryControls;
using SysFuns;
@ -6,17 +7,13 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using VSoft.Config;
using VSoft.Prams;
using VSoft.Skins;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace VSoft
{
@ -176,6 +173,21 @@ namespace VSoft
private void LoadColumn()
{
TabList_Column.Items.Clear();
try
{
JArray jarr = JArray.Parse(Itrycn_Db.GetSetting("SelectedCache", ""));
for (int i = 0; i < jarr.Count; i++)
{
var item = jarr[i];
dict_cache_type[item.GetJsonValue("ColumnId", -1)] = new SelectInfo()
{
SelectedTypeId = item.GetJsonValue("SelectedTypeId", -1),
IconVisibleIndex = item.GetJsonValue("IconVisibleIndex", -1),
IconSelectedIndex = item.GetJsonValue("IconSelectedIndex", -1),
};
}
}
catch { }
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
@ -189,7 +201,7 @@ namespace VSoft
}
if(ds.Tables[0].Rows.Count==0)
{
#region ,
#region ,
RyQuickSQL mySQL = new RyQuickSQL("Columns");
mySQL.AddField("Name", "默认栏目");
mySQL.AddField("editTime", DateTime.Now);
@ -217,7 +229,7 @@ namespace VSoft
TabList_Column.Items.Add(row["Name"].ToString()).Tag = row["id"].ToInt();
}
ds2.Dispose();
#endregion
#endregion
}
ds.Dispose();
TabList_Column.EndUpdate();
@ -225,9 +237,31 @@ namespace VSoft
}
if(TabList_Column.Items.Count>0)
{
TabList_Column.Items[0].Selected = true;
ryCommon.Ini ini = new ryCommon.Ini(Soft_Info.UserDataFolder + "\\Win.dat");
var ColumnId = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "ColumnId", -1);
var TypeId = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "TypeId", -1);
if (!dict_cache_type.ContainsKey(ColumnId))
{
dict_cache_type[ColumnId] = new SelectInfo()
{
SelectedTypeId = TypeId,
};
}
for (int i = 0; i < TabList_Column.Items.Count; i++)
{
if (TabList_Column.Items[i].Tag.ToInt() == ColumnId)
{
TabList_Column.Items[i].Selected = true;
break;
}
}
if (TabList_Column.SelectedItems.Count == 0)
{
TabList_Column.Items[0].Selected = true;
}
}
}
Dictionary<int,SelectInfo> dict_cache_type=new Dictionary<int, SelectInfo>();
private void LoadTypeColumn(int id)
{
TabList_Type.Items.Clear();
@ -248,7 +282,44 @@ namespace VSoft
}
if (TabList_Type.Items.Count > 0)
{
TabList_Type.Items[0].Selected = true;
if(dict_cache_type.ContainsKey(id))
{
var cache_selected=dict_cache_type[id];
if (cache_selected.SelectedTypeId> 0)
{
for (int i = 0; i < TabList_Type.Items.Count; i++)
{
if(TabList_Type.Items[i].Tag.ToInt()== cache_selected.SelectedTypeId)
{
TabList_Type.Items[i].Selected = true;
//IconViewEx1.EnsureVisible(cache_selected.IconVisibleIndex);
if (cache_selected.IconSelectedIndex.IsInRange(0, IconViewEx1.Items.Count - 1))
{
IconViewEx1.Items[cache_selected.IconSelectedIndex].Selected = true;
IconViewEx1.Items[cache_selected.IconSelectedIndex].EnsureVisible();
}
if (cache_selected.IconVisibleIndex.IsInRange(0, IconViewEx1.Items.Count - 1))
{
IconViewEx1.Items[cache_selected.IconVisibleIndex].EnsureVisible();
//IconViewEx1.TopItem = IconViewEx1.Items[cache_selected.IconVisibleIndex];
}
break;
}
}
if(TabList_Type.SelectedItems.Count==0)
{
TabList_Type.Items[0].Selected = true;
}
}
else
{
TabList_Type.Items[0].Selected = true;
}
}
else
{
TabList_Type.Items[0].Selected = true;
}
}
}
int hot_index = 0;
@ -320,7 +391,7 @@ namespace VSoft
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow row = ds.Tables[0].Rows[i];
#region
#region
RyQuickSQL mySQL2 = new RyQuickSQL("Columns");
mySQL2.AddField("Name", "默认分类");
mySQL2.AddField("Des", "");
@ -330,7 +401,7 @@ namespace VSoft
mySQL2.AddField("addTime", DateTime.Now);
var ds_id = db.ReadData(mySQL2.GetInsertSQL() + ";select last_insert_rowid();", mySQL2);
var type_id = mydb.GetValue(ds_id);
#endregion
#endregion
RyQuickSQL mySQL3 = new RyQuickSQL("Softs");
mySQL3.AddField("ColumnId", type_id);//将直属分类修改为默认分类
db.ExecuteNonQuery(mySQL3.GetUpdateSQL()+ " where ColumnId="+ row["id"].ToInt(), mySQL3);
@ -535,11 +606,11 @@ namespace VSoft
{
case 17189: //处理消息
{
#region
#region
switch (msg.WParam.ToInt32())
{
case 100://
#region
#region
if ((int)msg.LParam.ToInt32() == 100)
{
this.Show();
@ -558,7 +629,7 @@ namespace VSoft
#endregion
break;
}
#endregion
#endregion
}
break;
default:
@ -577,7 +648,7 @@ namespace VSoft
}
LoadDb(true);
}
#region
#region
/// <summary>
/// 将栏目列表中的第几个栏目修改
/// </summary>
@ -608,7 +679,7 @@ namespace VSoft
TopMost = TopMost
};
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
@ -636,7 +707,7 @@ namespace VSoft
};
frm.GetInfo(TabList_Column.SelectedItems[0].Tag.ToInt());
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
SetColumnRow(TabList_Column.SelectedItems[0].Tag.ToInt(), TabList_Column.SelectedItems[0].Index);
}
@ -685,8 +756,8 @@ namespace VSoft
}
db.Free();
}
#endregion
#region
#endregion
#region
/// <summary>
///将分类列表中的第几个分类进行修改
/// </summary>
@ -724,7 +795,7 @@ namespace VSoft
ParentId = id
};
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
@ -771,7 +842,7 @@ namespace VSoft
};
frm.GetInfo(id);
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
SetTypeRow(id, TabList_Type.SelectedItems[0].Index);
HotkeyValue hot = new HotkeyValue(frm.hotkeyTextBox1.HotKey);
@ -844,8 +915,8 @@ namespace VSoft
}
db.Free();
}
#endregion
#region
#endregion
#region
private void SetSoftRow(int id, int index)
{
#region
@ -915,14 +986,56 @@ namespace VSoft
ColumnId = ColumnId
};
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
hot_index++;
HotkeyValue hot = new HotkeyValue(frm.hotkeyTextBox1.HotKey);
hotkey.RegHotKey(hot_index, "soft_" + frm.Op_Id, hot.Modifiers_Int, hot.KeyCode);
LoadDb();
hotkey.RegHotKey(hot_index, "soft_" + frm.Op_Id, hot.Modifiers_Int, hot.KeyCode);
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
var ds = db.ReadData("select * from Softs where id="+frm.Op_Id);
if (ds.HaveData())
{
var row=ds.GetRow(0);
SoftInfo info = new SoftInfo
{
Id = frm.Op_Id,
SoftType = row["SoftType"].ToInt(),
ColumnId = row["ColumnId"].ToInt(),
Name = row["Name"].ToString(),
Path = row["Path"].ToString(),
RunPram = row["RunPram"].ToString(),
SetJson = row["SetJson"].ToString(),
StartPath = row["StartPath"].ToString(),
IconPath = row["IconPath"].ToString()
};
string img_path;
if (info.IconPath.Length == 0)
{
img_path = info.TruePath;
}
else
{
img_path = RyFiles.GetRealPath(info.IconPath);
}
if (dictCacheImg.ContainsKey(img_path))
{
info.Image = dictCacheImg[img_path];
}
else
{
info.Image = API.GetImg(img_path, 128);
dictCacheImg.Add(img_path, info.Image);
}
AddSoft(info);
}
ds?.Dispose();
}
db.Free();
}
frm.Dispose();
this.Focus();
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
@ -936,7 +1049,7 @@ namespace VSoft
};
frm.GetInfo(info.Id);
frm.ShowInCenter(this);
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
HotkeyValue hot = new HotkeyValue(frm.hotkeyTextBox1.HotKey);
var index = hotkey.GetHotId("soft_" + frm.Op_Id);
@ -1108,9 +1221,9 @@ namespace VSoft
RunByListSelected(false);
}
}
#endregion
#endregion
#region
#region
private void IconViewEx1_ItemDrag(object sender, ItemDragEventArgs e)
{
this.DoDragDrop(e.Item, DragDropEffects.Move);
@ -1131,10 +1244,16 @@ namespace VSoft
}
private void IconViewEx1_DragDrop(object sender, DragEventArgs e)
{
Point pt;
pt = ((IconViewEx)(sender)).PointToClient(new Point(e.X, e.Y));
var to_item = IconViewEx1.GetItemAt(pt.X, pt.Y);
IconViewEx1.InsertionMark.Index = -1;
TabList_Type.InsertionMark.Index = -1;
TabList_Column.InsertionMark.Index = -1;
var filedrop = e.Data.GetData(DataFormats.FileDrop);
if (filedrop != null)
{
#region
#region
var ColumnId = 0;
if (TabList_Type.SelectedItems.Count > 0)
{
@ -1152,7 +1271,7 @@ namespace VSoft
db2.Free();
}
}
if(ColumnId<=0)
if (ColumnId <= 0)
{
Msg.ShowMsg("当前模式下不支持添加软件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
@ -1175,7 +1294,11 @@ namespace VSoft
path = shortcut.TargetPath;
pram = shortcut.Arguments;
StartPath = shortcut.WorkDir;
if(shortcut.IconLocation!= path)
if(StartPath.Trim('\\')==System.IO.Path.GetDirectoryName(path).Trim('\\'))
{
StartPath = "";
}
if (shortcut.IconLocation != path)
{
icon = shortcut.IconLocation;
}
@ -1226,31 +1349,21 @@ namespace VSoft
info.Image = API.GetImg(img_path, 128);
dictCacheImg.Add(img_path, info.Image);
}
IconViewEx1.Items.Add(info.Name).Tag = info;
InsertSoft(to_item==null?-1:to_item.Index, info);
}
ReSortSoftByList(db3);
}
db3.Free();
return;
#endregion
return;
#endregion
}
Point pt;
pt = ((IconViewEx)(sender)).PointToClient(new Point(e.X, e.Y));
var to_item = IconViewEx1.GetItemAt(pt.X, pt.Y);
IconViewEx1.InsertionMark.Index = -1;
TabList_Type.InsertionMark.Index = -1;
TabList_Column.InsertionMark.Index = -1;
if (to_item == null) { return; }
//获得拖放中的项
ListViewItem lvi = (ListViewItem)e.Data.GetData(typeof(ListViewItem));
if (lvi == null) { return; }
if (lvi.ListView!=IconViewEx1) { return; }
if (lvi.Index == to_item.Index) { return; }
IconViewEx1.BeginUpdate();
IconViewEx1.View = View.List;
IconViewEx1.Items.RemoveAt(lvi.Index);
IconViewEx1.Items.Insert(to_item.Index, lvi);
IconViewEx1.View = View.Tile;
IconViewEx1.EndUpdate();
InsertSoft(to_item.Index, lvi);
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
@ -1258,23 +1371,79 @@ namespace VSoft
}
db.Free();
}
private void AddSoft(SoftInfo soft)
{
IconViewEx1.BeginUpdate();
IconViewEx1.View = View.List;
IconViewEx1.Items.Add(soft.Name).Tag = soft;
IconViewEx1.View = View.Tile;
IconViewEx1.EndUpdate();
var rect = IconViewEx1.GetItemRect(IconViewEx1.Items.Count - 1);
if (!IconViewEx1.Bounds.Contains(rect.Location))
{
IconViewEx1.EnsureVisible(IconViewEx1.Items.Count - 1);
}
}
private void InsertSoft(int index, SoftInfo soft)
{
IconViewEx1.BeginUpdate();
IconViewEx1.View = View.List;
if (index == -1)
{
IconViewEx1.Items.Add(soft.Name).Tag = soft;
}
else
{
IconViewEx1.Items.Insert(index, soft.Name).Tag = soft;
}
IconViewEx1.View = View.Tile;
IconViewEx1.EndUpdate();
if (index == -1)
{
var rect = IconViewEx1.GetItemRect(IconViewEx1.Items.Count - 1);
if (!IconViewEx1.Bounds.Contains(rect.Location))
{
IconViewEx1.EnsureVisible(IconViewEx1.Items.Count - 1);
}
}
else
{
var rect = IconViewEx1.GetItemRect(index);
if (!IconViewEx1.Bounds.Contains(rect.Location))
{
IconViewEx1.EnsureVisible(index);
}
}
}
private void InsertSoft(int index,ListViewItem lvi)
{
IconViewEx1.BeginUpdate();
IconViewEx1.View = View.List;
IconViewEx1.Items.RemoveAt(lvi.Index);
IconViewEx1.Items.Insert(index, lvi);
IconViewEx1.View = View.Tile;
IconViewEx1.EndUpdate();
var rect = IconViewEx1.GetItemRect(index);
if (!IconViewEx1.Bounds.Contains(rect.Location))
{
IconViewEx1.EnsureVisible(index);
}
}
private void IconViewEx1_DragOver(object sender, DragEventArgs e)
{
if (sender is IconViewEx list)
{
var filedrop = e.Data.GetData(DataFormats.FileDrop);
//if (filedrop != null)
//{
// list.InsertionMark.Index = -1;
// return;
//}
var lvi = e.Data.GetData(typeof(ListViewItem));
if (filedrop != null)
{
list.InsertionMark.Index = -1;
return;
}
var lvi = e.Data.GetData(typeof(ListViewItem));
if (lvi == null)
{
list.InsertionMark.Index = -1;
return;
}
else
else if(lvi != null)
{
var lvi2 = (ListViewItem)lvi;
if (lvi2.ListView != IconViewEx1)
@ -1283,6 +1452,11 @@ namespace VSoft
return;
}
}
else
{
list.InsertionMark.Index = -1;
return;
}
var pt = list.PointToClient(new Point(e.X, e.Y));
int targetIndex = list.InsertionMark.NearestIndex(pt);
if (targetIndex > -1)
@ -1291,8 +1465,9 @@ namespace VSoft
// the right of the midpoint of the closest item and set
// the InsertionMark.AppearsAfterItem property accordingly.
Rectangle itemBounds = list.GetItemRect(targetIndex);
if (pt.X > itemBounds.Left + (itemBounds.Width / 2))
if (pt.X < list.Left + itemBounds.Width)
{
targetIndex--;
list.InsertionMark.AppearsAfterItem = true;
}
else
@ -1301,7 +1476,14 @@ namespace VSoft
}
}
list.InsertionMark.Index = targetIndex;
list.InsertionMark.Color = Color.Black; ;
list.InsertionMark.Color = Color.Black;
//list.InsertionMark.a = ListViewInsertionMarkAppearance.Largest;
//list.InsertionMark.Color = Color.Transparent;
//// 清除旧的插入标记
//list.Invalidate();
//var item = list.GetItemAt(pt.X, pt.Y);
//// 绘制新的插入标记
//DrawInsertionMark(list, list.CreateGraphics(), item, pt);
//item = list.GetItemAt(pt.X, pt.Y);
}
else if (sender is TabList list2)
@ -1317,8 +1499,8 @@ namespace VSoft
list2.InsertionMark.Color = Color.Black; ;
}
}
#endregion
#region
#endregion
#region
private void TabList_Column_DragEnter(object sender, DragEventArgs e)
{
//判定是否现在拖动的数据是LISTVIEW项
@ -1404,8 +1586,8 @@ namespace VSoft
{
this.DoDragDrop(e.Item, DragDropEffects.Move);
}
#endregion
#region
#endregion
#region
private void TabList_Type_DragEnter(object sender, DragEventArgs e)
{
//判定是否现在拖动的数据是LISTVIEW项
@ -1436,7 +1618,7 @@ namespace VSoft
ListViewItem lvi = (ListViewItem)drag_item;
if (lvi.ListView == IconViewEx1)
{
#region
#region
var info = (SoftInfo)lvi.Tag;
RyQuickSQL mySQL = new RyQuickSQL("Softs");
mySQL.AddField("ColumnId", columnid);
@ -1457,7 +1639,7 @@ namespace VSoft
ReSortSoftByList(db);
}
db.Free();
#endregion
#endregion
}
else if (lvi.ListView == TabList_Type)
{
@ -1488,15 +1670,43 @@ namespace VSoft
{
this.DoDragDrop(e.Item, DragDropEffects.Move);
}
#endregion
#endregion
private void TabList_Type_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsProcUse) { return; }
if(TabList_Type.SelectedItems.Count==0) { return; }
if (TabList_Column.SelectedItems.Count == 0) { return; }
LoadDb();
}
private int LastSelected = -1;
private void SaveSelected(int column_id,int SelectedTypeId,int IconVisibleIndex,int IconSelectedIndex)
{
if (dict_cache_type.ContainsKey(column_id))
{
var item = dict_cache_type[column_id];
item.SelectedTypeId = SelectedTypeId;
item.IconVisibleIndex = IconVisibleIndex;
item.IconSelectedIndex = IconSelectedIndex;
}
else
{
dict_cache_type[column_id] = new SelectInfo()
{
SelectedTypeId = SelectedTypeId,
IconVisibleIndex = IconVisibleIndex,
IconSelectedIndex = IconSelectedIndex
};
}
}
private void TabList_Column_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (IsProcUse) { return; }
if(LastSelected>=0)
{
var column_id = TabList_Column.Items[LastSelected].Tag.ToInt();
SaveSelected(column_id, GetCurColumnId(), IconViewEx1.GetFirstVisibleIndex(), IconViewEx1.SelectedItems.Count >= 1 ? IconViewEx1.SelectedItems[0].Index : -1);
}
LastSelected = TabList_Column.SelectedItems[0].Index;
if (TabList_Column.SelectedItems.Count > 0)
{
LoadTypeColumn(TabList_Column.SelectedItems[0].Tag.ToInt());
@ -1532,6 +1742,17 @@ namespace VSoft
this.TopMost = true;
this.Show();
this.TopMost = topmost;
var opens = Application.OpenForms;
for (int i = 0; i < opens.Count; i++)
{
if (opens[i].Modal)
{
if(opens[i].Owner==this)
{
opens[i].Show();
}
}
}
}
private void 退ToolStripMenuItem_Click(object sender, EventArgs e)
@ -1573,7 +1794,7 @@ namespace VSoft
{
frm.ShowInCenter(this);
}
if (frm.ShowDialog() == DialogResult.OK)
if (frm.ShowDialog(this) == DialogResult.OK)
{
VSoft.Config.Soft_Config.LoadSetting();
hotkey.UnHotKey(100);
@ -1601,6 +1822,25 @@ namespace VSoft
}
return;
}
SaveSelected(TabList_Column.SelectedItems[0].Tag.ToInt(), GetCurColumnId(), IconViewEx1.GetFirstVisibleIndex(), IconViewEx1.SelectedItems.Count >= 1 ? IconViewEx1.SelectedItems[0].Index : -1);
ryCommon.Ini ini = new Ini(VSoft.Config.Soft_Info.UserDataFolder + "\\Win.dat");
ini.WriteIni(VSoft.Config.Soft_Info.Soft_Id, "width", Width);
ini.WriteIni(VSoft.Config.Soft_Info.Soft_Id, "height", Height);
JArray jarr = new JArray();
foreach (var item in dict_cache_type)
{
JObject jo = new JObject
{
{ "ColumnId", item.Key },
{ "IconSelectedIndex", item.Value.IconSelectedIndex },
{ "IconVisibleIndex", item.Value.IconVisibleIndex },
{ "SelectedTypeId", item.Value.SelectedTypeId }
};
jarr.Add(jo);
}
Itrycn_Db.SetSetting("SelectedCache", jarr.ToString());
ini.WriteIni(VSoft.Config.Soft_Info.Soft_Id, "ColumnId", TabList_Column.SelectedItems[0].Tag.ToInt());
ini.WriteIni(VSoft.Config.Soft_Info.Soft_Id, "TypeId", TabList_Type.SelectedItems[0].Tag.ToInt());
}
private void TabList_Column_KeyDown(object sender, KeyEventArgs e)
@ -1700,7 +1940,7 @@ namespace VSoft
TopMost = TopMost
};
frm.ShowInCenter(this);
if (frm.ShowDialog()==DialogResult.OK)
if (frm.ShowDialog(this)==DialogResult.OK)
{
var info = frm.SelectedInfo;
RyQuickSQL mySQL = new RyQuickSQL("Softs");
@ -1708,11 +1948,13 @@ namespace VSoft
mySQL.AddField("SoftType",1);//0表示运行文件,1表示执行内置命令,2表示执行脚本
mySQL.AddField("Path",frm.SQLConnStr);
if (info.CmdId.Length > 0)
{ mySQL.AddField("RunPram","cmdid="+ info.CmdId); }
{ info.RunPram = "cmdid=" + info.CmdId; mySQL.AddField("RunPram","cmdid="+ info.CmdId); }
else
{
info.RunPram = "id=" + info.Id;
mySQL.AddField("RunPram","id="+ info.Id);
}
info.IconPath = info.IconPath.Length > 0 ? info.IconPath : info.Path;
mySQL.AddField("StartPath","");//起始路径
mySQL.AddField("IconPath", info.IconPath.Length>0? info.IconPath: info.Path);//图标路径
mySQL.AddField("SetJson","");//设置
@ -1726,8 +1968,32 @@ namespace VSoft
mySQL.AddField("ColumnId", ColumnId);
mySQL.AddField("sortindex", Itrycn_Db.GetSoftCount(db, ColumnId) + 1);
mySQL.AddField("addTime", DateTime.Now);
db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
LoadDb();
var ds_c = db.ReadData(mySQL.GetInsertSQL() + ";select last_insert_rowid();", mySQL);
if(ds_c.HaveData())
{
info.Id = ds_c.GetRow(0)[0].ToInt();
}
ds_c?.Dispose();
//LoadDb();
string img_path;
if (info.IconPath.Length == 0)
{
img_path = info.TruePath;
}
else
{
img_path = RyFiles.GetRealPath(info.IconPath);
}
if (dictCacheImg.ContainsKey(img_path))
{
info.Image = dictCacheImg[img_path];
}
else
{
info.Image = API.GetImg(img_path, 128);
dictCacheImg.Add(img_path, info.Image);
}
AddSoft(info);
}
db.Free();
}
@ -1810,11 +2076,32 @@ namespace VSoft
private void FrmVSoft_Shown(object sender, EventArgs e)
{
ryCommon.Ini ini = new ryCommon.Ini(Soft_Info.UserDataFolder + "\\Win.dat");
Width = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "width",200,2000, 745);
Height = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "height",200,2000, 543);
//var ColumnId = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "ColumnId", -1);
//var TypeId = ini.ReadIni(VSoft.Config.Soft_Info.Soft_Id, "TypeId", -1);
//for (int i = 0; i < TabList_Column.Items.Count; i++)
//{
// if (TabList_Column.Items[i].Tag.ToInt()==ColumnId)
// {
// TabList_Column.Items[i].Selected = true;
// break;
// }
//}
//for (int i = 0; i < TabList_Type.Items.Count; i++)
//{
// if (TabList_Type.Items[i].Tag.ToInt() == TypeId)
// {
// TabList_Type.Items[i].Selected = true;
// break;
// }
//}
ini.WriteIni(Soft_Info.Soft_Id, "hwnd",Handle.ToInt32());
if (prog_args!=null && prog_args.Length>=1 && prog_args[0]=="q")
{
this.Hide();
}
//IconViewEx1.SetInterval(120, 120);
}
private ListViewItem currentItem = new ListViewItem();
private void IconViewEx1_MouseMove(object sender, MouseEventArgs e)
@ -1823,7 +2110,9 @@ namespace VSoft
if (lvi != null && lvi != currentItem)
{
currentItem = lvi;
if (lvi.Text.Length > 10)
Graphics g = IconViewEx1.CreateGraphics();
var size= g.MeasureString(lvi.Text, IconViewEx1.Font);
if (size.Width > IconViewEx1.TileSize.Width-2)
{
lvTp.Show(lvi.Text, IconViewEx1, e.Location);
}
@ -1838,5 +2127,67 @@ namespace VSoft
}
currentItem = lvi;
}
private void TabList_Type_DragLeave(object sender, EventArgs e)
{
TabList_Type.InsertionMark.Index = -1;
}
private void TabList_Column_DragLeave(object sender, EventArgs e)
{
TabList_Column.InsertionMark.Index = -1;
}
private void IconViewEx1_DragLeave(object sender, EventArgs e)
{
IconViewEx1.InsertionMark.Index = -1;
}
private void BtnLeftColumn_Click(object sender, EventArgs e)
{
if (TabList_Column.Items.Count == 0) { return; }
if (TabList_Column.SelectedItems.Count == 0) { TabList_Column.Items[0].Selected = true; }
else
{
var index = TabList_Column.SelectedItems[0].Index;
if(index>1)
{
index--;
}
else
{
index = TabList_Column.Items.Count - 1;
}
TabList_Column.Items[index].Selected = true;
TabList_Column.EnsureVisible(index);
}
}
private void BtnRightColumn_Click(object sender, EventArgs e)
{
if (TabList_Column.Items.Count == 0) { return; }
if (TabList_Column.SelectedItems.Count == 0) { TabList_Column.Items[0].Selected = true; }
else
{
var index = TabList_Column.SelectedItems[0].Index;
if (index < TabList_Column.Items.Count-1)
{
index++;
}
else
{
index =0;
}
TabList_Column.Items[index].Selected = true;
TabList_Column.EnsureVisible(index);
//TabList_Column.item = TabList_Column.Items[index];
}
}
}
class SelectInfo
{
public int SelectedTypeId { get; set; } = -1;
public int IconVisibleIndex { get; set; } = -1;
public int IconSelectedIndex { get; set; } = -1;
}
}

View File

@ -124,32 +124,32 @@
<data name="以管理员方式启动ToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAYRJREFUOE+NkztPwlAUx8/gakIYWFwYHB1w8FUQCEpI1KiTYpSHQVQisviYjZsJ
k4OJMT6ILhgTFheDiongc4AP4HdgcO/xnPZWaG81/JN/Qu49v1972wJ2iUQiQWqFiqL82yO2/w4Nuann
DA3MrqMrWcDaSRB30uOGiPfcYrwVWuQr1HnIPxXFnsQxQvYDYeMd1Scf1Yt3hwGMz4UNEc9WBK4JsHfx
AJ0r1wibBAoYMizwolpR9D6OYOPCh5f7AU0kcF0AuU8JhsybCVYfhvXeD9kIbGBYEwILrJYHZYEzVZRg
WH21hRtniixwJQoSDGkSWGBu7cgrCUr57THpgTEIqReE5RpCkpqoIsSr2Dezy4KSwDVBko1fxVHpzFa4
e+FGuzozAtdDC/VMLCyduR2G2DMqk3GG6wJrhRY91GZ+K/QL83nbYXHrTZ4VmDmGZC8bwu9bISC4a6mM
/dO5/2EjhoQ/28apgs7oFfon5juDjdCgg2r9NzrEduchiN+O+WmbAvADQWOC4qBCLEQAAAAASUVORK5C
YII=
vAAADrwBlbxySQAAAXxJREFUOE+NkztPAkEQx6ewNSEUNDYUlhZY+DoQCEomUaNWilGOM4hKRBoftbEz
obIwMcYH0QZjQmNjUCGRE8UCPoDfgcL+xizskrvb8/FPJrnk5vfbm909AIcgYhgRy4hIvNizz94nBRG9
iHjJoKH5TfJoedLPwrSXmhQi9s5r5xjIVmiwpuBMjPoSpwSZOsHWOxmVABkVPz0ch0hdiAoR6y2bBdS/
fETutVuC7XoXhjQT+MkoK516HqPmVYCuD0NtkUUA2Q8JhvSbBTaeRjv1OOIgcIBhgwtssFEalgXuZEGC
Yb3mCDcvFFngSeQlGFI1CWaln/glQTG3OyFtGAMh+UqwqhNoOkGiSqBWaWBunwmKZoHGjJ+FcWlmO9y7
dCeOUusKuKSRjkelmc0wxF9ImVbb98ACc4EPEVu5nYhlZjPMP73147UWkoNMhL7uuUCtUs9KiQZns7/D
IkLCrm3zXCF37IaCU4v/g0UQ0eXwN7rsfX+Gn451t235BkFjguJS2ETKAAAAAElFTkSuQmCC
</value>
</data>
<data name="新增内置功能ToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAAIpJREFUOE/tktEGxDAQRef/v6NLly5dQpfQtSXkixJJHu661R36NC/70NJhiDnH
mImRv0SMESEELJ8F73mG9x6vacKGTS6ErbVdOudUsLiwM4s55zX5fo6jChYXjvUTUkqoteIxDCpYXLgT
BSZhKQX3vlfB4sIP4U4ci50Jb12ngsUPENcdnPsORL5USPZgYQ6cHAAAAABJRU5ErkJggg==
vAAADrwBlbxySQAAAJdJREFUOE/NkVEHxDAQhPf//44eLT1aQo/QuhLyixJJHramdOnTHHcPtyyx31iz
GZFfVIxRQwi6v3fd1lW99/paFv2UC2Br7dbOORMwLtiMYc75bLznaTIB4wJblyClpLVWfY6jCRgX3HRZ
Ayyl6ND3JmBc8CG4CbawGfDRdSZg/A+K5cw4zZlxmjPjNGfGac6M05wZ/6oOVEj2YBfdvXIAAAAASUVO
RK5CYII=
</value>
</data>
<data name="BtnAddColumn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAAPFJREFUSEvt
l7EKwjAQhrM4OCazz6m77g5Cii6+gTgquuhrJG7u6mBd6/0apIQTG0wolPzwQeld86ft5dqIIE3PfVXY
JVES1Qtt7jiHmMuKL6VP44+hD8VcWnypwuxZU6DNzqXFl9TmyJoSsrAHlxZf2bhONo6qjhgvqh4NOERz
wMU/uHGmADEvl4UazUrN7AB3MecGSonUdiNoFhcumBIyvlLjtw8umJiyPWN61F8LJhV4vfSps1s/kBoU
tEBp0wzWKPUG/LWc3JIdYQm7xdxMHelcAcrGdbJxVLVm3NoPPRlPWFOQcgvDbtrex4GbNiGeSkzyFPRt
h10AAAAASUVORK5CYII=
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAAPRJREFUSEvt
l7EKwkAMhm9xcLzMPqfuujsICbr4BuKo6KKvcenmrh2sayUqKjlbLdxZ0P7wQ2n+9uPapPSMqaLhrg3E
UyDOgDi/GN1RzklNx4MJMOnfgdqY9HU+mIDc2gM+Vr7S+WCy6LYe8GZLvNH5YGrADVjng+lHwJO8ZdF1
5eMgF79xqoFP4PRF3jOgm8GIO7KKsb5JbFvkhbHEe12IbYt8MIB80oUvOKsPXNYwsSyv1wDxUhdiWxra
SGtb4rlu+wIXPp1Pxuk2sj0ZYT3VpQr7AamgBtyAdT6Y/g9c2w89kBt4wDs44hbm5abtelx503YGSkzy
FCr2IzYAAAAASUVORK5CYII=
</value>
</data>
<metadata name="MenuTabColumn.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@ -182,37 +182,36 @@
<data name="IconViewEx1.Icon" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
7NsAAAAASUVORK5CYII=
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
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@ -68,12 +68,25 @@ namespace VSoft.Prams
TargetPath = TargetPath.Replace("C:\\Program Files (x86)\\", "C:\\Program Files\\");
}
}
string IconLocation = shortcut.IconLocation;
var iPos = IconLocation.LastIndexOf(",");
var IconIndex = 0;
if (iPos >= 0)
{
if(IconLocation.Substring(iPos+1).IsInt())
{
IconIndex = IconLocation.Substring(iPos + 1).ToInt();
IconLocation=IconLocation.Substring(0, iPos);
}
}
if (IconLocation.Length == 0) { IconLocation = TargetPath; }
return new ShortcutDescription()
{
TargetPath = TargetPath,
Arguments = shortcut.Arguments,
WorkDir = shortcut.WorkingDirectory,
IconLocation= shortcut.IconLocation,
IconLocation= IconLocation,
IconIndex= IconIndex,
Description = shortcut.Description
};
}

View File

@ -60,6 +60,12 @@ public class Json
else
{ return jo[name].ToInt(defvalue); }
}
public int GetJsonValue(string name, int min, int max, int defValue)
{
if (jo[name] == null) { return defValue; }
else
{ return jo[name].ToInt(min, max,defValue); }
}
public Int64 GetJsonValue(string name, Int64 defvalue)
{
if (jo[name] == null) { return defvalue; }

View File

@ -83,20 +83,22 @@ namespace VSoft.Prams
frm.TopMost = true;
var handle= WinAPI.User32.GetActiveWindow();
var have_owner = false;
Form owner = null;
for (int i = 0; i < Application.OpenForms.Count; i++)
{
if(Application.OpenForms[i].Handle==handle)
{
var owner = Application.OpenForms[i];
owner = Application.OpenForms[i];
frm.Location = new System.Drawing.Point(owner.Left + (owner.Width - frm.Width) / 2, owner.Top + (owner.Height - frm.Height) / 2);
have_owner = true;
break;
}
}
//WinAPI.User32.GetWindowRect(handle,out var rectangle);
//var title2= ryCommon.RyForm.GetWinText(handle);
//frm.Location = new System.Drawing.Point(rectangle.X + (rectangle.Width - frm.Width) / 2, rectangle.Y + (rectangle.Height - frm.Height) / 2);
if (!have_owner) { frm.StartPosition = FormStartPosition.CenterScreen; }
return frm.ShowDialog();
return frm.ShowDialog(owner);
}
}
}

View File

@ -102,22 +102,38 @@ namespace VSoft.Prams
}
return 0;
}
if (RunasAdmin)
Json json = new Json(SetJson);
var RunCount = json.GetJsonValue("RunCount", 1);
var run_result = 37;
for (int i = 0; i < RunCount; i++)
{
return RunProcessAsAdmin(path, parm, StartPath);
}
else
{
Json json = new Json(SetJson);
if (json.GetJsonValue("RunAsAdmin", false))
if (RunasAdmin)
{
return RunProcessAsAdmin(path, parm, StartPath);
if(RunProcessAsAdmin(path, parm, StartPath, json.GetJsonValue("RunMode", 0))==-1)
{
run_result = -1;break;
}
}
else
{
return RyFiles.RunFile(path, parm, StartPath);
if (json.GetJsonValue("RunAsAdmin", false))
{
if (RunProcessAsAdmin(path, parm, StartPath, json.GetJsonValue("RunMode", 0)) == -1)
{
run_result = -1; break;
}
}
else
{
if (RyFiles.RunFile(path, parm, StartPath, json.GetJsonValue("RunMode", 0)) < 36)
{
run_result = -1; break;
}
}
}
}
return run_result;
}
/// <summary>
/// 以管理员方式打开
@ -126,7 +142,7 @@ namespace VSoft.Prams
/// <param name="parameters"></param>
/// <param name="CurrentDirectory"></param>
/// <returns></returns>
public static int RunProcessAsAdmin(string exeName, string parameters, string CurrentDirectory)
public static int RunProcessAsAdmin(string exeName, string parameters, string CurrentDirectory,int RunMode)
{
try
{
@ -135,6 +151,22 @@ namespace VSoft.Prams
startInfo.WorkingDirectory = CurrentDirectory;
startInfo.FileName = exeName;
startInfo.Verb = "runas";
switch(RunMode)
{
case 0:
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
break;
case 1:
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
break;
case 2:
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
break;
case 3:
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
break;
}
//MLHIDE
startInfo.Arguments = parameters;
startInfo.ErrorDialog = true;

View File

@ -11,6 +11,7 @@ namespace VSoft.Prams
public string Arguments { get; set; } = "";
public string WorkDir { get; set; } = "";
public string IconLocation { get; set; } = "";
public int IconIndex { get; set; } = 0;
public string Description { get; set; } = "";
}
}

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("睿元网络")]
[assembly: AssemblyProduct("VSoft")]
[assembly: AssemblyCopyright("Copyright itrycn© 2010-2020")]
[assembly: AssemblyCopyright("Copyright itrycn© 2010-2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2312.0401")]
[assembly: AssemblyFileVersion("1.0.2312.0401")]
[assembly: AssemblyVersion("2.0.2412.1001")]
[assembly: AssemblyFileVersion("2.0.2412.1001")]

View File

@ -56,7 +56,7 @@ namespace ryControls
}
else
{
if ( last_selectIndex < this.Items.Count)
if (last_selectIndex < this.Items.Count)
{
//this.Items[last_selectIndex].Selected = true;
}

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using ryCommon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -49,6 +50,11 @@ namespace VSoft.Tools
post_data += "&sign=" + sign;
var http= web.Post("http://api.fanyi.baidu.com/api/trans/vip/translate", post_data);
JObject jo = JObject.Parse(http.Html);
if(jo.GetJsonValue("error_code",0)>0)
{
http = web.Post("http://api.fanyi.baidu.com/api/trans/vip/translate", post_data);
jo = JObject.Parse(http.Html);
}
var trans_result = jo["trans_result"];
if (trans_result != null)
{
@ -65,10 +71,15 @@ namespace VSoft.Tools
}
last_text = from_txt;
return text;
}
else
{
}
return "";
}
catch(Exception ex) { return "错误=>"+ex.Message; }
catch(Exception ex)
{ return "错误=>"+ex.Message; }
}
string last_text = "";
// 计算MD5值