|
5 | 5 | using System.Windows.Forms; |
6 | 6 | using System.Diagnostics; |
7 | 7 | using System.Xml.Linq; |
8 | | -using Microsoft.Win32; |
9 | 8 | using WebClient_cs; |
10 | 9 | using FileDropAdmin_cs; |
11 | 10 | using AppConfig_cs; |
12 | 11 | using Other_cs; |
13 | 12 | using Registry_cs; |
14 | 13 |
|
15 | | - |
16 | 14 | namespace 磁贴美化小工具 |
17 | 15 | { |
18 | 16 | public partial class Form : System.Windows.Forms.Form |
@@ -459,10 +457,16 @@ private void Add_Tile_Dll() // 固定磁贴 |
459 | 457 | { |
460 | 458 | ProcessStartInfo Tile = new ProcessStartInfo |
461 | 459 | { |
462 | | - FileName = "runas.exe", |
463 | | - WindowStyle = ProcessWindowStyle.Hidden, |
464 | | - Arguments = "/trustlevel:0x20000" + '"' + Application.StartupPath + @"\syspin.dll " + @"\" + '"' + TextBox_程序路径.Text + @"\" + '"' + " 51201" + '"' |
| 460 | + //FileName = "runas.exe", |
| 461 | + FileName = Application.StartupPath + @"\syspin.dll", |
| 462 | + //WindowStyle = ProcessWindowStyle.Hidden, |
| 463 | + UseShellExecute = false, |
| 464 | + CreateNoWindow = true, |
| 465 | + Verb = "explorer", |
| 466 | + //Arguments = "/trustlevel:0x20000 " + '"' + @"\" + '"' + Application.StartupPath + @"\syspin.dll" + @"\" + '"' + " " + @"\" + '"' + TextBox_程序路径.Text + @"\" + '"' + " 51201" + '"' |
| 467 | + Arguments = '"' + TextBox_程序路径.Text + '"' + " 51201" |
465 | 468 | }; |
| 469 | + //Debug.Print(Tile.Arguments); |
466 | 470 | Process.Start(Tile); |
467 | 471 | } |
468 | 472 | else |
@@ -496,7 +500,7 @@ private void Button_查看_Click(object sender, EventArgs e) // 显示并定位 |
496 | 500 | { |
497 | 501 | if (TextBox_程序路径.Text != "" && System.IO.File.Exists(TextBox_程序路径.Text)) |
498 | 502 | { |
499 | | - _ = Process.Start("explorer.exe", "/select," + TextBox_程序路径.Text); |
| 503 | + _ = Process.Start("explorer", "/select," + TextBox_程序路径.Text); |
500 | 504 | } |
501 | 505 | } |
502 | 506 |
|
@@ -589,7 +593,7 @@ private void Check_RightClickMenu() // 检查是否添加右键菜单 |
589 | 593 |
|
590 | 594 | private void Button_查看磁贴目录_Click(object sender, EventArgs e) // 查看磁贴目录 |
591 | 595 | { |
592 | | - _ = Process.Start("explorer.exe", "/e," + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Programs)); |
| 596 | + _ = Process.Start(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Programs)); |
593 | 597 | } |
594 | 598 |
|
595 | 599 | private void Button_自动检查更新_Click(object sender, EventArgs e) // 自动检查更新 |
@@ -669,26 +673,31 @@ private void TextBox_程序路径_TextChanged(object sender, EventArgs e) // 输 |
669 | 673 | Temp_Shortcut_Path = File_cs.Shortcut.Get_Shortcut_TargetPath_Array(File_cs.File.File_Enumeration(System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonPrograms), "*.lnk", true), TextBox_程序路径.Text); |
670 | 674 | } |
671 | 675 | // 如果找到了磁贴快捷方式,就设置全局变量 快捷方式文件名、快捷方式路径 |
672 | | - if (Temp_Shortcut_Path != "") |
| 676 | + if (Temp_Shortcut_Path != null) |
673 | 677 | { |
674 | 678 | Old_Shortcut_Path = Temp_Shortcut_Path; |
675 | | - Debug.Print(Old_Shortcut_Path); |
| 679 | + //Debug.Print(Old_Shortcut_Path); |
676 | 680 | Temp_Shortcut_Name = Path.GetFileNameWithoutExtension(Temp_Shortcut_Path); |
677 | | - Debug.Print(Temp_Shortcut_Name); |
| 681 | + //Debug.Print(Temp_Shortcut_Name); |
678 | 682 | } |
679 | 683 | else |
680 | 684 | { |
681 | 685 | Old_Shortcut_Path = Temp_Shortcut_Name = ""; |
682 | 686 | } |
683 | 687 | // 如果快捷方式文件名为空,则磁贴名称设置为程序文件名 |
684 | | - if(Temp_Shortcut_Name != "") |
| 688 | + if (Temp_Shortcut_Name != "") |
685 | 689 | { |
686 | 690 | TextBox_磁贴名称.Text = Temp_Shortcut_Name; |
| 691 | + if (TextBox_磁贴名称.Text == "") |
| 692 | + { |
| 693 | + TextBox_磁贴名称.Text = Path.GetFileNameWithoutExtension(TextBox_程序路径.Text); |
| 694 | + } |
687 | 695 | } |
688 | 696 | else |
689 | 697 | { |
690 | 698 | TextBox_磁贴名称.Text = Path.GetFileNameWithoutExtension(TextBox_程序路径.Text); |
691 | 699 | } |
| 700 | + Debug.Print("333" + TextBox_磁贴名称.Text); |
692 | 701 | // 设置程序配置文件路径 |
693 | 702 | Config_Path = Path.GetDirectoryName(TextBox_程序路径.Text) + @"\" + Path.GetFileNameWithoutExtension(TextBox_程序路径.Text) + ".VisualElementsManifest.xml"; |
694 | 703 | Debug.Print(Config_Path); |
|
0 commit comments