/// <summary> /// Constructor. /// </summary> /// <param name="topicsPath">The path to the topics seed documents.</param> /// <param name="processUriDelegate">A delegate to process downloaded URIs.</param> public ACrawlerWin(string topicsPath, ProcessURI processUriDelegate) { InitializeComponent(); this.MainFolder = topicsPath; this.processUriDelegate = processUriDelegate; // Make sure the main folder exists Directory.CreateDirectory(this.MainFolder); threadProgressText.Text = " "; }
private static ProcessSchema CreateProcessSchema(string label, ProcessURI uri) { return new ProcessSchema { Label = label, URI = uri, Visible = true }; }
private ProcessSchema GetQueryMethod() { string label = CoreSection.Current.GetLocalizationString(EntityType, ProcessBehavior.Query.ToString()); FilterAttribute[] attributes = (FilterAttribute[]) EntityType.GetCustomAttributes(typeof (FilterAttribute), false); QueryArgument argument = new QueryArgument(); if (attributes.Length == 1) argument = (QueryArgument) ProcessArgument.Parse(ProcessBehavior.Query, attributes[0].Expression); ProcessURI uri = new ProcessURI(CoreSection.GetTypeName(EntityType), ProcessBehavior.Query, argument); return CreateProcessSchema(label, uri); }
private List<ProcessSchema> GetMethods(BindingFlags flags) { MethodInfo[] methods = GetPreparedMethods(flags); List<ProcessSchema> elements = new List<ProcessSchema>(); foreach (MethodInfo methodInfo in methods) { if (ContainsMethod(elements, methodInfo)) continue; MethodInfo[] foundMethods = FindMethodsByName(methods, methodInfo.Name); for (int i = 0; i < foundMethods.Length; i++) { MethodInfo foundMethod = foundMethods[i]; ExecutionArgument argument = new ExecutionArgument(new List<object>(new[] {foundMethod.Name, i.ToString()})); ProcessURI uri = new ProcessURI(CoreSection.GetTypeName(EntityType), ProcessBehavior.Exec, argument); ProcessSchema schema = CreateProcessSchema(GetMethodLabel(foundMethod, i), uri); ParameterInfo[] parameters = foundMethod.GetParameters(); if (parameters.Length == 1) { ParameterInfo parameter = parameters[0]; if (ComplexDomain.IsGenericEntityCollection(parameter.ParameterType) && ComplexDomain.GetEntityTypeFromCollection(parameter.ParameterType) == EntityType) schema.Type = ProcessSchemaType.ForEntityCollectionOnly; else if (CoreSection.Current.IsEntity(parameter.ParameterType) && parameter.ParameterType == EntityType) schema.Type = ProcessSchemaType.ForEntityOnly; } else schema.Type = ProcessSchemaType.Normal; elements.Add(schema); } } return elements; }
private List<ProcessSchema> GetConstructorMethods() { ConstructorInfo[] ctors = EntityType.GetConstructors(); List<ProcessSchema> elements = new List<ProcessSchema>(); for (int i = 0; i < ctors.Length; i++) { ConstructorInfo ctor = ctors[i]; if (ctor.GetParameters().Length > 0) { string label = CoreSection.Current.GetLocalizationString(EntityType, ProcessBehavior.New.ToString(), i.ToString()); if (label.Equals((ProcessBehavior.New + Domain.TypeSeparator + i))) label = ProcessBehavior.New.ToString(); ProcessURI uri = new ProcessURI(CoreSection.GetTypeName(EntityType), ProcessBehavior.New, i.ToString()); elements.Add(CreateProcessSchema(label, uri)); } } return elements; }
public ProcessSchema(string label, ProcessURI uri) { Label = label; URI = uri; }