public DataRow AddResource(Resource resource) { DataRow newRow = Resources.NewRow(); string uri = resource.Uri.ToString(); newRow ["Uri"] = uri; newRow ["Title"] = resource.Title; newRow ["FilesystemLocation"] = resource.FilesystemLocation; Resources.Rows.Add(newRow); UriToResources.Add(uri, newRow); return(newRow); }
public Resource GetResource(string uri) { DataRow resourceRow = null; if (!UriToResources.TryGetValue(uri, out resourceRow)) { return(null); } return(new Resource() { Uri = new Uri(resourceRow["Uri"] as string), Title = resourceRow["Title"] as string, FilesystemLocation = resourceRow["FilesystemLocation"] as string }); }