示例#1
0
        private void urlShortcutToDesktop(string linkName, string linkUrl)
        {
            string deskDir = FileHelper.GetRootPath() + @"\" + SelectedFolder.Replace('|', '\\');

            using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url"))
            {
                writer.WriteLine("[InternetShortcut]");
                writer.WriteLine("URL=" + linkUrl);
                writer.Flush();
            }
        }
示例#2
0
        public bool SaveNewItem()
        {
            string folderName = SelectedFolder;

            string[] aplitedFolder = new string[0];
            if ((folderName.IndexOf(WidgetName) + WidgetName.Length + 1) < folderName.Length)
            {
                aplitedFolder = folderName.Substring(folderName.IndexOf(WidgetName) + WidgetName.Length + 1).Split('|');
            }
            string hiricalFolder = "";

            foreach (string index in aplitedFolder)
            {
                hiricalFolder += ConstValue.XMLFolderNS;
            }
            XmlDocument  xd = new XmlDocument();
            StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + ConstValue.XMLFileName, System.Text.Encoding.GetEncoding("utf-8"));

            xd.Load(sr);
            XmlNode currentNode;

            if (hiricalFolder != "")
            {
                currentNode = xd.SelectSingleNode("/Brienz" + ConstValue.XMLFolderNS + ConstValue.XMLFolderNS + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + WidgetName + "']" + hiricalFolder + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + aplitedFolder[aplitedFolder.Length - 1] + "']");
            }
            else
            {
                currentNode = xd.SelectSingleNode("/Brienz" + ConstValue.XMLFolderNS + ConstValue.XMLFolderNS + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + WidgetName + "']" + "[@" + ConstValue.XMLFileAttribute_FolderName + "='" + WidgetName + "']");
            }
            bool result = false;

            switch (SeletedTab)
            {
            case "Link":


                XmlDocument DomainDoc = new XmlDocument();
                urlShortcutToDesktop(LinkTab_Name, LinkTab_URL);
                result = true;
                break;

            case "File":
                if (IsCheckWord)
                {
                    string     deskDir = FileHelper.GetRootPath() + @"\" + SelectedFolder.Replace('|', '\\') + @"\" + FileName + ".doc";
                    FileStream fs      = File.Create(deskDir);
                    fs.Close();
                    Process.Start(deskDir);
                }
                else if (IsCheckExcel)
                {
                    string     deskDir = FileHelper.GetRootPath() + @"\" + SelectedFolder.Replace('|', '\\') + @"\" + FileName + ".xls";
                    FileStream fs      = File.Create(deskDir);
                    fs.Close();
                    Process.Start(deskDir);
                }
                else if (IsCheckTxt)
                {
                    string     deskDir = FileHelper.GetRootPath() + @"\" + SelectedFolder.Replace('|', '\\') + @"\" + FileName + ".txt";
                    FileStream fs      = File.Create(deskDir);
                    fs.Close();
                    Process.Start(deskDir);
                }
                else if (IsCheckZip)
                {
                }
                result = true;
                break;

            case "GOGO":
                result = true;
                break;
            }
            return(result);
        }