/// <summary> /// Deserializes workflow markup into an SolutionBase object /// </summary> /// <param name="input">string workflow markup to deserialize</param> /// <param name="obj">Output SolutionBase object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string input, out SolutionBase obj, out System.Exception exception) { exception = null; obj = default(SolutionBase); try { obj = Deserialize(input); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes xml markup from file into an SolutionBase object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output SolutionBase object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out SolutionBase obj, out System.Exception exception) { exception = null; obj = default(SolutionBase); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
public static bool Deserialize(string input, out SolutionBase obj) { System.Exception exception = null; return Deserialize(input, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an SolutionBase object /// </summary> /// <param name="input">string workflow markup to deserialize</param> /// <param name="obj">Output SolutionBase object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string input, out SolutionBase obj, out System.Exception exception) { exception = null; obj = default(SolutionBase); try { obj = Deserialize(input); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool LoadFromFile(string fileName, out SolutionBase obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
/// <summary> /// Deserializes xml markup from file into an SolutionBase object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output SolutionBase object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out SolutionBase obj, out System.Exception exception) { exception = null; obj = default(SolutionBase); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } }
private void TreeScan(DirectoryInfo parentDir, BackgroundWorker curWorker) { curWorker.ReportProgress(0, parentDir.FullName); // var existDir = _projectCollection.Directory.FirstOrDefault(d => d.Name == dirName); foreach (var f in parentDir.GetFiles("*" + SolutionFileExt)) { // Если проект уже найден if (_existProjects.Contains(f.FullName.ToLower())) continue; /*var dirName = parentDir.FullName; dirName = NormalizePath(dirName); if (dirName == _rootDirPath) { } else { var relativeDir = dirName.Substring(_rootDirPath.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); // Ищем среди каталогов нужный, если он существует if (existDir != null) { } else // если родительский каталог не найдн, создаём его { var directories = relativeDir.Split(Path.DirectorySeparatorChar); var createdPath = string.Empty; ProjectCollectionDirectory lastDir = null; foreach (var directory in directories) { if (string.IsNullOrEmpty(createdPath)) createdPath = directory; else createdPath = Path.Combine(createdPath, directory); var existParentDir = _projectCollection.Directory.FirstOrDefault(d => d.Path == createdPath); if (existParentDir == null) { var newDir = new ProjectCollectionDirectory { Id = createdPath.GetHashCode(),//(ulong) ((DateTime.Now.ToBinary() % 1000000000000)), Name = directory, Path = createdPath, }; if (lastDir != null) newDir.ParentId = lastDir.Id; else newDir.ParentId = -1; _projectCollection.Directory.Add(newDir); lastDir = newDir; } else lastDir = existParentDir; } existDir = lastDir; } }*/ //Debug.Assert(existDir != null); var newSolution = new SolutionBase { CategoryId = -1,//existDir?.Id ?? Name = f.Name, FullPath = f.FullName, }; ScanFolder(newSolution, parentDir); _projectCollection.Project.Add(newSolution); _existProjects.Add(newSolution.FullPath.ToLower()); //TbTest.Text += f.FullName + Environment.NewLine; } foreach (var f in parentDir.GetFiles("*" + ProjectFileExt)) { if (_existProjects.Contains(f.FullName.ToLower())) continue; //Debug.Assert(existDir != null); var newProject = new ProjectBase { CategoryId = -1,//existDir?.Id ?? Name = f.Name, FullPath = f.FullName, }; ScanFolder(newProject, parentDir); _projectCollection.Project.Add(newProject); _existProjects.Add(newProject.FullPath.ToLower()); } foreach (var d in parentDir.GetDirectories()) { //var relativeDir = d.FullName.Substring(_rootDirPath.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); TreeScan(d, curWorker); } }
private void OnFileDrop(object sender, RoutedEventArgs e) { var dfc = (DropFileControl) sender; var fullProjectPath = dfc.DroppedFile; var ext = Path.GetExtension(fullProjectPath); var dirName = Path.GetDirectoryName(fullProjectPath); var dirInfo = new DirectoryInfo(dirName); var name = Path.GetFileNameWithoutExtension(fullProjectPath); ProjectBase newProject = null; if (ext == SolutionFileExt) { newProject = new SolutionBase(); _projectCollection.Solution.Add((SolutionBase)newProject); } else if (ext == ProjectFileExt) { newProject = new ProjectBase(); _projectCollection.Project.Add(newProject); } if (newProject == null) return; newProject.CategoryId = -1; newProject.Name = name; newProject.FullPath = fullProjectPath; ScanFolder(newProject, dirInfo); var item = new CollectionItem(newProject, _projectCollection.Tags); _collectionItems.Add(item); _existProjects.Add(newProject.FullPath.ToLower()); CreateDirInTree(_folders, newProject); RefreshView(); RefreshFolders(); }
public static bool Deserialize(string input, out SolutionBase obj) { System.Exception exception = null; return(Deserialize(input, out obj, out exception)); }
public static bool LoadFromFile(string fileName, out SolutionBase obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }