From 95d9356edef73a1ad5b04e62b7aef6b77697a226 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 05 九月 2024 10:13:30 +0800
Subject: [PATCH] 1

---
 TEWin/FrmWin.cs |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/TEWin/FrmWin.cs b/TEWin/FrmWin.cs
index a1250e6..7b6c236 100644
--- a/TEWin/FrmWin.cs
+++ b/TEWin/FrmWin.cs
@@ -790,9 +790,16 @@
         #region 鏂规绠$悊
         private void Save()
         {
-            //SG.Command.Execute(1003, null);
             SaveLocation();
-            this.SG.Project.Save();
+            this.SG.Command.Execute(1019, 0); // Capture Tree State
+            SG.Command.Execute(1003, 0); // this.SG.Project.Save();
+        }
+
+        private void SaveAs(string flyPath)
+        {
+            SaveLocation();
+            this.SG.Command.Execute(1019, 0); // Capture Tree State
+            this.SG.Project.SaveAs(flyPath);
         }
 
         private void OpenPrj()
@@ -821,8 +828,9 @@
                 if (this.fly.Equals(flyPath)) return;
                 if (File.Exists(flyPath)) File.Delete(flyPath);
 
-                string cmd = string.Format("mklink \"{0}\" \"{1}\"", flyPath, this.fly);
-                ExecCmd(new List<string> { cmd });
+                //string cmd = string.Format("mklink \"{0}\" \"{1}\"", flyPath, this.fly);
+                //ExecCmd(new List<string> { cmd });
+                CreateShortcut(flyPath, this.fly);
             }
             catch (Exception ex)
             {
@@ -864,6 +872,26 @@
                 return null;
             }
         }
+
+        private String GetSavePath()
+        {
+            string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+            string tePathName = ConfigurationManager.AppSettings["tePath"].Contains("SmartEarth") ? "SmartEarth" : "Skyline";
+
+            return Path.Combine(appData, tePathName, "TerraExplorer");
+        }
+
+        public static void CreateShortcut(string shortcutPath, string targetPath, string description = null, string iconLocation = null)
+        {
+            var shell = new IWshRuntimeLibrary.WshShell();
+            var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutPath + ".lnk"); // 鍒涘缓蹇嵎鏂瑰紡瀵硅薄
+            shortcut.TargetPath = targetPath; // 鎸囧畾鐩爣璺緞
+            shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath); // 璁剧疆璧峰浣嶇疆
+            shortcut.WindowStyle = 1; // 璁剧疆杩愯鏂瑰紡锛岄粯璁や负甯歌绐楀彛
+            shortcut.Description = description; // 璁剧疆澶囨敞
+            shortcut.IconLocation = string.IsNullOrWhiteSpace(iconLocation) ? targetPath : iconLocation; // 璁剧疆鍥炬爣璺緞
+            shortcut.Save(); // 淇濆瓨蹇嵎鏂瑰紡
+        }
         #endregion
     }
 }

--
Gitblit v1.9.3