public Resource CreateResource(string rescPath) { if(rescPath.StartsWith("http://")) { UrlResource urlresc = new UrlResource(); urlresc.ResourceName = rescPath; urlresc.ResourceType = "URL"; urlresc.ResourcePath = rescPath; return urlresc; } else if (File.Exists(rescPath)) { FileResource fileresc = new FileResource(); fileresc.ResourceName = rescPath.Substring(rescPath.LastIndexOf('\\')+1); fileresc.ResourceType = "File"; fileresc.ResourcePath = rescPath; return fileresc; } else { return new Resource(rescPath,"OtherType",rescPath); } }