示例#1
0
        private static void InitialFileItems(List<string> allFiles)
        {
            if (allFiles == null || allFiles.Count == 0) return;

            Dictionary<string, List<FileItem>> allFileItems = new Dictionary<string, List<FileItem>>(allFiles.Count, StringComparer.OrdinalIgnoreCase);
            foreach (string file in allFiles)
            {
                int idx = file.LastIndexOf('\\');
                if (idx < 0) continue;
                string fileName = file.Substring(idx + 1);
                FileItem item = new FileItem(fileName, file);
                if (allFileItems.ContainsKey(fileName))
                {
                    allFileItems[fileName].Add(item);
                }
                else
                {
                    allFileItems.Add(fileName, new List<FileItem>() { item });
                }
            }

            foreach (var items in allFileItems.Values)
            {
                items.ForEach(FileItemContainer.AddItem);
            }
        }
示例#2
0
 public static void AddItem(FileItem item)
 {
     if (item != null) AllFileItems.Add(item);
 }
示例#3
0
 private void OpenFile(FileItem fileItem)
 {
     if (fileItem == null) return;
     if (fileItem.OpenFileLocation)
     {
         Process.Start("explorer.exe", "/select, \"" + fileItem.FullPath + "\"");
     }
     else if (fileItem.FullPath.EndsWith(".sql", StringComparison.OrdinalIgnoreCase))
     {
         Process.Start(fileItem.FullPath);
     }
     else
     {
         VSIDE.EditFile(fileItem.FullPath);
     }
 }