public DynView(XElement Xml, DynView ParentView, DynViewSet ParentSet) { Author = ""; Description = ""; Version = new Version("0.0.0.0"); Title = ""; this.ParentSet = ParentSet; this.ParentView = this; this.Xml = Xml; }
private bool DiscoverViewAssembly(DynView view, out string FilePath, out string Namespace, out string ClassName) { view.Ident.Split('.'); FilePath = null; ClassName = null; Namespace = null; // Folders that could contain the assemblies var searchFolders = new string[] { ProjectBaseDir, BaseDir }; // Parts of the ident string var parts = view.Ident.Split('.'); if (parts.Count() < 1) { return(false); } string className = parts.Last(); var pathParts = parts.Take(parts.Count() - 1); string path = Path.Combine(pathParts.ToArray()); List <string> filePaths = new List <string>(); List <string> pathes = new List <string>(); filePaths.Add(Path.Combine(path, view.Ident + ".dll")); if (parts.Count() > 1) { filePaths.Add(Path.Combine(Path.Combine(parts.Take(parts.Count() - 2).ToArray()), String.Join(".", pathParts.ToArray()) + ".dll")); filePaths.Add(String.Join(".", parts.Take(parts.Count() - 1).ToArray()) + ".dll"); } foreach (string fileName in filePaths) { foreach (string folder in searchFolders) { string filePath = Path.Combine(folder, fileName); if (VerboseLoad) { Console.WriteLine("Searching for view file: {0}", filePath); } // Check if the file exists if (File.Exists(filePath)) { FilePath = filePath; ClassName = className; Namespace = Path.GetFileNameWithoutExtension(FilePath); return(true); } } } return(false); }