public XmlDocument LoadProjectXml(string path) { if (!_cachedProjectXml.Contains(path)) { XmlDocument doc = new XmlDocument(); if (!ProjectFactory.IsUrl(path)) { using (StreamReader sr = new StreamReader(path, Encoding.Default, true)) { doc.Load(sr); } } else { Uri uri = new Uri(path); if (uri.Scheme == Uri.UriSchemeFile) { using (StreamReader sr = new StreamReader(uri.LocalPath, Encoding.Default, true)) { doc.Load(sr); } } else { doc.LoadXml(WebDavClient.GetFileContentsStatic(path)); } } _cachedProjectXml[path] = doc; } return((XmlDocument)_cachedProjectXml[path]); }
private static string GetProjectFileName(string fileName) { string projectPath = null; if (ProjectFactory.IsUrl(fileName)) { // construct uri for project path Uri projectUri = new Uri(fileName); // get last segment of the uri (which should be the // project file itself) projectPath = projectUri.LocalPath; } else { projectPath = fileName; } // return filename part return(Path.GetFileName(projectPath)); }