public static AppEngine Create(string pluginPath, ILogger logger, ReflectionManager reflectionManager, IServiceCollection services, IConfigurationRoot configuration) { logger.LogInformation("CREATING RAWCMS APPENGINE"); var appEngine = new AppEngine( logger, basedir => { var folder = basedir + pluginPath; if (Path.IsPathRooted(pluginPath)) { folder = pluginPath; } return(Path.GetFullPath(folder)); //Directory.GetDirectories(folder).FirstOrDefault(); }, reflectionManager, configuration );//Hardcoded for dev appEngine.Init(); services.AddSingleton <ILogger>(x => logger); services.AddSingleton <AppEngine>(x => appEngine); appEngine.LoadPlugins(services); return(appEngine); }
public ProvisioningTemplate GetProvisioningTemplate(string name) { Log.Info("Retrieving SP stored template: ", name); try { ReflectionManager _reflectionHelper = new ReflectionManager(); var _provider = _reflectionHelper.GetTemplateProvider(ModuleKeys.PROVISIONINGPROVIDER_KEY); if (_provider.Connector.GetType() == typeof(SharePointConnector)) { _provider.Connector.AddParameter(SharePointConnector.CLIENTCONTEXT, Authentication.GetAuthenticatedContext()); } var _pt = _provider.GetTemplate(name); return(_pt); } catch (Exception _ex) { var _message = string.Format(PCResources.TemplateProviderBase_Exception_Message, _ex.Message); Log.Error("Provisioning.Common.Data.Templates.Impl.SPSiteTemplateManager", PCResources.TemplateProviderBase_Exception_Message, _ex); throw new DataStoreException(_message, _ex); } }
/// <summary> /// Member to create a site collection /// </summary> /// <param name="siteRequest">The SiteRequest</param> /// <param name="template">The Template</param> public void CreateSiteCollection(SiteInformation siteRequest, Template template) { _siteprovisioningService.Authentication = new AppOnlyAuthenticationTenant(); _siteprovisioningService.Authentication.TenantAdminUrl = template.TenantAdminUrl; ReflectionManager rm = new ReflectionManager(); var siteUrlProvider = rm.GetSiteUrlProvider("SiteUrlProvider"); if (siteUrlProvider != null) { var newUrl = siteUrlProvider.GenerateSiteUrl(siteRequest, template); if (!String.IsNullOrEmpty(newUrl)) { Log.Info("SiteProvisioningManager.CreateSiteCollection", "Site {0} was renamed to {1}", siteRequest.Url, newUrl); SiteRequestFactory.GetInstance().GetSiteRequestManager().UpdateRequestUrl(siteRequest.Url, newUrl); siteRequest.Url = newUrl; } } _siteprovisioningService.CreateSiteCollection(siteRequest, template); if (siteRequest.EnableExternalSharing) { _siteprovisioningService.SetExternalSharing(siteRequest); } }
public AppEngine(ILogger _logger, Func <string, string> pluginPathLocator, ReflectionManager reflectionManager, IConfigurationRoot configuration) { this._logger = _logger; this.pluginFolder = pluginPathLocator.Invoke(AppContext.BaseDirectory); this.reflectionManager = reflectionManager; this.configuration = configuration; }
public override void Initialize() { base.Initialize(); var controllerType = ReflectionManager.LooseGetType(InventoryInstance.InterfaceControllerTypeName); var args = new object[] { this }; InterfaceController = DynamicTypeFactory.CreateInstance <InventoryInterfaceController>(controllerType, args); InterfaceController.Initialize(); if (Owner.TryGetComponent(out _sprite)) { foreach (var mask in InventoryInstance.SlotMasks.OrderBy(s => InventoryInstance.SlotDrawingOrder(s))) { if (mask == Slots.NONE) { continue; } _sprite.LayerMapReserveBlank(mask); } } // Component state already came in but we couldn't set anything visually because, well, we didn't initialize yet. foreach (var(slot, entity) in _slots) { _setSlot(slot, entity); } }
/// <summary> /// Creates a new instance of a 'MatchedField'. /// </summary> /// <param name="fieldName1Arg">The name of the first field.</param> /// <param name="fieldName2Arg">The name of the second field. </param> /// <param name="failedMessageArg"></param> /// <param name="parentObject"></param> /// <param name="errorProcessorArg"></param> public MatchedField(string fieldName1Arg, string fieldName2Arg, string failedMessageArg, object parentObject, ErrorHandler errorProcessorArg) { // Set Properties this.Field1Name = fieldName1Arg; this.Field2Name = fieldName2Arg; this.FailedMessage = failedMessageArg; this.ErrorProcessor = errorProcessorArg; try { // Set DataType this.DataType = ReflectionManager.ParseDataType(this.Field1Name, parentObject); } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // locals string methodName = "RequiredFieldConstructor"; string objectName = "ApplicationLogicComponent.ClientValidation.RequiredField"; // Log the exception this.ErrorProcessor.LogError(methodName, objectName, error); } } }
private void fpInterfaces_ButtonClicked(object sender, EditorNotifyEventArgs e) { DialogResult dr = openFileDialog.ShowDialog(); if (dr == DialogResult.OK) { string dllName = openFileDialog.SafeFileName; List <Type> typeList = null; typeList = ReflectionManager.GetTypesByInterfaceWithOutAbstract(dllName, InterfaceType, TypeOfType.Class); if (typeList == null || typeList.Count == 0) { return; } SetHyperLinkCellTypeCellText(fpInterfaces_Sheet1.Cells[e.Row, e.Column], dllName); IDatasAskerImplementor iDatasAskerImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as IDatasAskerImplementor; iDatasAskerImplementor.DllName = dllName; string[] types = new string[typeList.Count]; for (int i = 0; i < typeList.Count; i++) { types[i] = typeList[i].FullName; } comboBoxCellType.Items = types; fpInterfaces_Sheet1.Cells[e.Row, 1].CellType = comboBoxCellType.Clone() as FarPoint.Win.Spread.CellType.ComboBoxCellType; fpInterfaces_Sheet1.Cells[e.Row, 1].Locked = false; } }
/// <summary> /// Returns Connectors /// </summary> /// <returns></returns> private FileConnectorBase GetProvisioningConnector() { ReflectionManager _helper = new ReflectionManager(); FileConnectorBase _connectorInstance = _helper.GetProvisioningConnector(ModuleKeys.PROVISIONINGCONNECTORS_KEY); return(_connectorInstance); }
private void InitToolStripItems() { List <object> objectList = ReflectionManager.CreateInstancesByInterfaceWithOutAbstract(typeof(IReportColumnSettingToolStripItem)); iReportColumnSettingToolStripItems = new IReportColumnSettingToolStripItem[objectList.Count]; SortedList sl = new SortedList(); foreach (object obj in objectList) { IReportColumnSettingToolStripItem iReportColumnSettingToolStripItem = obj as IReportColumnSettingToolStripItem; sl.Add(iReportColumnSettingToolStripItem.SortID, iReportColumnSettingToolStripItem); } int i = 0; foreach (DictionaryEntry de in sl) { IReportColumnSettingToolStripItem iReportColumnSettingToolStripItem = de.Value as IReportColumnSettingToolStripItem; iReportColumnSettingToolStripItem.HeaderSettingFpSpreadChanged += HeaderSettingFpSpreadChanged; if (iReportColumnSettingToolStripItem is ToolStripSplitButton) { ToolStripSplitButton toolStripSplitButton = iReportColumnSettingToolStripItem as ToolStripSplitButton; toolStripSplitButton.DropDownOpened += new EventHandler(toolStripSplitButton_DropDownOpened); toolStripSplitButton.DropDownClosed += new EventHandler(toolStripSplitButton_DropDownClosed); } iReportColumnSettingToolStripItems[i] = iReportColumnSettingToolStripItem; tsMain.Items.Add(iReportColumnSettingToolStripItems[i] as ToolStripItem); i++; } CalculateSize(); }
void Awake() { if (instance != null) { Destroy(instance.gameObject); } instance = this; }
/// <summary> /// 初始化所有条件录入类型。 /// </summary> private void InitConditionInputTypes() { List <object> objectList = ReflectionManager.CreateInstancesByInterfaceWithOutAbstract(typeof(IConditionInputType)); foreach (object obj in objectList) { cmbConditionInputTypes.Items.Add(obj); } }
/// <summary> /// Builds a list of available input control types /// </summary> /// <param name="controlTypeSelect"></param> private void SetInputControlTypeDropDown(CaisisSelect controlTypeSelect) { var cicTypeList = from cic in ReflectionManager.GetMetaInputControlNames() // temp, centralize where cic.IndexOf("Eform", 0, StringComparison.OrdinalIgnoreCase) < 0 orderby cic ascending select cic; controlTypeSelect.DataSource = cicTypeList; controlTypeSelect.DataBind(); }
private void InitToolStripItems() { List <object> objectList = ReflectionManager.CreateInstancesByInterfaceWithOutAbstract(typeof(IHeaderSettingToolStripItem)); toolStripItems = new ToolStripItem[objectList.Count]; foreach (object obj in objectList) { IHeaderSettingToolStripItem iHeaderSettingToolStripItem = obj as IHeaderSettingToolStripItem; //iHeaderSettingToolStripItem.FpSpread = fpMain; toolStripItems[iHeaderSettingToolStripItem.SortID] = iHeaderSettingToolStripItem as ToolStripItem; } }
//This method gets called by the runtime.Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(opt => opt.AddDefaultPolicy(p => { p.AllowAnyHeader(); p.AllowAnyMethod(); p.AllowAnyOrigin(); })); var ass = new List <Assembly>(); var builder = services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; }); var pluginPath = Configuration.GetValue <string>("PluginPath"); logger.LogInformation($"loading plugins from {pluginPath}"); Console.WriteLine($"loading plugins from {pluginPath}"); List <Assembly> allAssembly = AssemblyHelper.GetAllAssembly(); ReflectionManager rm = new ReflectionManager(allAssembly); appEngine = AppEngine.Create( pluginPath, loggerFactory.CreateLogger <AppEngine>(), rm, services, Configuration); appEngine.InvokeConfigureServices(ass, builder, services, Configuration); foreach (var a in ass.Distinct()) { builder.AddApplicationPart(a).AddControllersAsServices(); } services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Web API", Version = "v1" }); //x.IncludeXmlComments(AppContext.BaseDirectory + "YourProject.Api.xml"); c.IgnoreObsoleteProperties(); c.IgnoreObsoleteActions(); c.DescribeAllEnumsAsStrings(); c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); c.CustomSchemaIds(t => t.FullName); }); //Invoke appEngine after service configuration appEngine.InvokePostConfigureServices(services); }
public MainWindow() { ReflectionManager.LoadAssemblies(); InitializeComponent(); foreach (var xmlType in ReflectionManager.GetXmlTypes()) { XmlTypesListBox.Items.Add(new ListBoxItem() { Content = xmlType }); } }
public static XElement Serialize(object obj) { var type = obj.GetType(); var tmpObj = Activator.CreateInstance(type); var xmlType = ReflectionManager.GetXmlType(type); var xElement = new XElement(xmlType.XType.Name); foreach (var xmlProperty in xmlType.XmlProperties) { var propVal = xmlProperty.GetValue(obj); if (xmlProperty.PropertyType.IsGenericType) { var xcel = new XElement(xmlProperty.Info.Name); if (xmlProperty.PropertyType.GetGenericTypeDefinition() == typeof(Dictionary <,>)) { foreach (var pVal in ((IDictionary)propVal).Values) { var xel = Serialize(pVal); xcel.Add(xel); } } else { foreach (var pVal in (IEnumerable)propVal) { var xel = Serialize(pVal); xcel.Add(xel); } } xElement.Add(xcel); } else if (typeof(XmlBaseType).IsAssignableFrom(xmlProperty.PropertyType)) { var xel = Serialize(propVal); xElement.Add(xel); } else { if (xmlProperty.IsRequired && (propVal != xmlProperty.GetValue(tmpObj))) { var tmp = propVal ?? "null"; xElement.Add(new XElement(xmlProperty.Info.Name, new XCData(tmp.ToString()))); } } } return(xElement); }
public void Init() { var overrides = ReflectionManager.GetAttributes <SystemOverrideAttribute>(); foreach (var attributeInfo in overrides) { var overrideAttribute = (SystemOverrideAttribute)attributeInfo.Attribute; var baseType = overrideAttribute.Type; if (_systemTypes.ContainsKey(baseType)) { throw new Exception($"There are 2 or more overrides of system {baseType.FullName}"); } _systemTypes[baseType] = attributeInfo.ClassType; } }
/// <summary> /// Creates a new instance of a property name /// </summary> /// <param name="propertyNameArg">The name of the 'Property' that is required.</param> /// <param name="failedMessageArg">The message to display when the field is missing.</param> public RequiredField(string fieldNameArg, string failedMessageArg, object parentObjectArg, bool isRequiredFolderArg) { // Set Properties this.FieldName = fieldNameArg; this.FailedMessage = failedMessageArg; this.IsRequiredFolder = isRequiredFolderArg; try { // Set DataType this.DataType = ReflectionManager.ParseDataType(this.FieldName, parentObjectArg); } catch { } }
public ProvisioningTemplate GetProvisioningTemplate(string name) { try { ReflectionManager _reflectionHelper = new ReflectionManager(); var _provider = _reflectionHelper.GetTemplateProvider(ModuleKeys.PROVISIONINGPROVIDER_KEY); var _pt = _provider.GetTemplate(name); return(_pt); } catch (Exception _ex) { var _message = string.Format(PCResources.TemplateProviderBase_Exception_Message, _ex.Message); Log.Error("Provisioning.Common.Data.Templates.Impl.XMLSiteTemplateManager", PCResources.TemplateProviderBase_Exception_Message, _ex); throw new DataStoreException(_message, _ex); } }
public XmlLocation(XmlProperty propertyInfo, bool isChildLocation = false) { if (!isChildLocation) { var locationAtts = propertyInfo.Info.GetCustomAttributes <XmlLocationAttribute>(true).ToList(); locationAtts.Add(new XmlLocationAttribute(XmlLocationType.Element | XmlLocationType.Attribute, propertyInfo.Info.Name)); locationAtts.ForEach(AddLocation); if (propertyInfo.IsAssignableTypesAllowed) { var assignableTypes = ReflectionManager.GetAssignableTypes(propertyInfo.PropertyType); assignableTypes.ForEach(AddLocation); } else { AddLocation(propertyInfo.PropertyType); } } else { var childLocationAtts = propertyInfo.Info.GetCustomAttributes <XmlChildLocationAttribute>(true).ToList(); childLocationAtts.ForEach(AddLocation); var childType = propertyInfo.PropertyType.IsGenericType ? propertyInfo.PropertyType.GetGenericArguments().Last() : (propertyInfo.PropertyType.IsArray ? propertyInfo.PropertyType.GetElementType() : propertyInfo.PropertyType); if (childType == null) { throw new TestLibsException($"Couldn't find child type for type: {propertyInfo.PropertyType}, for property: {propertyInfo}"); } if (propertyInfo.IsAssignableTypesAllowed) { var assignableTypes = ReflectionManager.GetAssignableTypes(childType); assignableTypes.ForEach(AddLocation); } else { AddLocation(childType); } } }
/// <summary> /// Member to create a sub site /// </summary> /// <param name="siteRequest">The SiteRequest</param> /// <param name="template">The Template</param> public Web CreateSubSite(SiteInformation siteRequest, Template template) { Web newWeb = null; _siteprovisioningService.Authentication = new AppOnlyAuthenticationTenant(); _siteprovisioningService.Authentication.TenantAdminUrl = template.TenantAdminUrl; ReflectionManager rm = new ReflectionManager(); var siteUrlProvider = rm.GetSiteUrlProvider("SiteUrlProvider"); if (siteUrlProvider != null) { var newUrl = siteUrlProvider.GenerateSiteUrl(siteRequest, template); if (!String.IsNullOrEmpty(newUrl)) { Log.Info("SiteProvisioningManager.CreateSiteCollection", "Site {0} was renamed to {1}", siteRequest.Url, newUrl); SiteRequestFactory.GetInstance().GetSiteRequestManager().UpdateRequestUrl(siteRequest.Url, newUrl); siteRequest.Url = newUrl; } } // Check to see if the site already exists before attempting to create it bool siteExists = _siteprovisioningService.SubSiteExists(siteRequest.Url.ToString()); if (!siteExists) { newWeb = _siteprovisioningService.CreateSubSite(siteRequest, template); } else { Log.Info("Provisioning.Common.Office365SiteProvisioningService.CreateSubSite", PCResources.SiteCreation_Creation_Starting, siteRequest.Url); Uri siteUri = new Uri(siteRequest.Url); string realm = TokenHelper.GetRealmFromTargetUrl(siteUri); string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, siteUri.Authority, realm).AccessToken; using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteRequest.Url, accessToken)) { newWeb = ctx.Web; } } return(newWeb); }
static void Main(string[] args) { ReflectionManager.LoadAssemblies(System.IO.Directory.GetCurrentDirectory()); System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US"); XElement config = XDocument.Load("Hero Centered.xml").Element("webElement"); var we = XmlParser.Parse <WebElement>(config); GetAttribute(); //XmlProperty MyAttribute = (XmlProperty)Attribute.GetCustomAttribute(, typeof(XmlProperty)); //XElement elem = Config.Element("myComplex"); //var obj = XmlParser.Parse<MyComplex>(elem); XmlLocationType tt; var config1 = Config.Element("complexClass3_2"); var obj1 = XmlParser.Parse <DataSamples.ComplexClass3>(config1); Console.Read(); }
public SiteUrlCheckRequest IsSiteUrlProviderUsed([FromBody] string value) { var _request = JsonConvert.DeserializeObject <SiteUrlCheckRequest>(value); ReflectionManager rm = new ReflectionManager(); var siteUrlProvider = rm.GetSiteUrlProvider("SiteUrlProvider"); if (siteUrlProvider != null) { _request.UsesCustomProvider = false; } else { _request.UsesCustomProvider = true; } return(_request); }
public Dictionary<string, Dictionary<string, string>> GetData(parallel_import_CarInfo Car) { Dictionary<string, Dictionary<string, string>> List = new Dictionary<string, Dictionary<string, string>>(); var CarObjectValues = new ReflectionManager().GetObjectPropertiesAndValues(Car); var config = new ConfigHandle().ConfigForConfigFilds(); string FirstSplit = "\r\n", SecondSplit = ":", ProetyName = string.Empty, Value = string.Empty; foreach (var str in config) { var Values = (CarObjectValues.ContainsKey(str.Key) ? CarObjectValues[str.Key] == "0" ? "" : CarObjectValues[str.Key] : ""); if (string.IsNullOrEmpty(Values)) { continue; } var splitValues = Values.Split(new string[] { FirstSplit }, StringSplitOptions.RemoveEmptyEntries); ;//.Replace("\r\n", ""); //内容列表 Dictionary<string, string> ConfigProprotyKeyValue = new Dictionary<string, string>(); //属性值 foreach (var content in splitValues) { var NameSplitValue = content.Split(new string[] { SecondSplit }, StringSplitOptions.RemoveEmptyEntries); //属性值 及对应的值 int m = 1; foreach (var p in NameSplitValue) { if (m == 1) { ProetyName = p; } else { Value = p; } m++; } if (!ConfigProprotyKeyValue.ContainsKey(ProetyName)) { ConfigProprotyKeyValue.Add(ProetyName, Value); } } List.Add(str.Key, ConfigProprotyKeyValue); } return List; }
private void InitWizards() { iWizardUserControlList = new SortedList(); List <object> objectList = ReflectionManager.CreateInstancesByInterface(WizardType); foreach (object obj in objectList) { IWizardUserControl iWizardUserControl = obj as IWizardUserControl; iWizardUserControl.Report = report; iWizardUserControlList.Add(iWizardUserControl.SortID, iWizardUserControl); } SuspendLayout(); foreach (DictionaryEntry de in iWizardUserControlList) { Control control = de.Value as Control; control.Dock = DockStyle.Fill; pnlCenter.Controls.Add(control); } ResumeLayout(); }
private void InitReportLayoutStyles() { List <object> objectList = ReflectionManager.CreateInstancesByBaseClass(typeof(BaseReportLayoutStyle)); reportLayoutStyleWizardElements = new ReportLayoutStyleWizardElement[objectList.Count]; foreach (object obj in objectList) { BaseReportLayoutStyle style = obj as BaseReportLayoutStyle; int sortID = style.GetStyleSortID(); ReportLayoutStyleWizardElement reportLayoutStyleWizardElement = new ReportLayoutStyleWizardElement(); reportLayoutStyleWizardElement.ReportLayoutStyle = style; reportLayoutStyleWizardElement.ReportLayoutStyleSelected += new ReportLayoutStyleSelectedHandle(reportLayoutStyleWizardElement_ReportLayoutStyleSelected); reportLayoutStyleWizardElements[sortID] = reportLayoutStyleWizardElement; } pnlReportLayoutStyles.SuspendLayout(); for (int i = 0; i < reportLayoutStyleWizardElements.Length; i++) { pnlReportLayoutStyles.Controls.Add(reportLayoutStyleWizardElements[i] as Control); } pnlReportLayoutStyles.ResumeLayout(); }
/// <summary> /// Member to create a site collection /// </summary> /// <param name="siteRequest">The SiteRequest</param> /// <param name="template">The Template</param> public void CreateSiteCollection(SiteInformation siteRequest, Template template) { _siteprovisioningService.Authentication = new AppOnlyAuthenticationTenant(); _siteprovisioningService.Authentication.TenantAdminUrl = template.TenantAdminUrl; ReflectionManager rm = new ReflectionManager(); var siteUrlProvider = rm.GetSiteUrlProvider("SiteUrlProvider"); if (siteUrlProvider != null) { var newUrl = siteUrlProvider.GenerateSiteUrl(siteRequest, template); if (!String.IsNullOrEmpty(newUrl)) { Log.Info("SiteProvisioningManager.CreateSiteCollection", "Site {0} was renamed to {1}", siteRequest.Url, newUrl); SiteRequestFactory.GetInstance().GetSiteRequestManager().UpdateRequestUrl(siteRequest.Url, newUrl); siteRequest.Url = newUrl; } } // Check to see if the site already exists before attempting to create it bool siteExists = _siteprovisioningService.SiteExists(siteRequest.Url.ToString()); if (!siteExists) { _siteprovisioningService.CreateSiteCollection(siteRequest, template); if (siteRequest.EnableExternalSharing) { _siteprovisioningService.SetExternalSharing(siteRequest); } } else { Log.Info("SiteProvisioningManager.CreateSiteCollection", "Site already exists. Moving on to next provisioning step"); } }
private void InitControls() { List <Type> iPublicInterfaceList = ReflectionManager.GetTypesByInterface(typeof(IPublicInterface), TypeOfType.Interface); List <object> iPublicInterfaceSettingList = ReflectionManager.CreateInstancesByInterface(typeof(IPublicInterfaceSettingUserControl)); foreach (Type type in iPublicInterfaceList) { foreach (IPublicInterfaceSettingUserControl iPublicInterfaceSettingUserControl in iPublicInterfaceSettingList) { if (type == iPublicInterfaceSettingUserControl.InterfaceType) { iPublicInterfaceSettingUserControl.InterfaceSetting = report.MainReportSetting.InterfaceSetting; TabPage tabPage = new TabPage(); tabPage.Text = type.Name; tabPage.Controls.Add(iPublicInterfaceSettingUserControl as Control); (iPublicInterfaceSettingUserControl as Control).Dock = DockStyle.Fill; tabPage.Tag = iPublicInterfaceSettingUserControl; tabControl.TabPages.Add(tabPage); } } } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var ass = new List <Assembly>(); var builder = services.AddMvc(); var pluginPath = Configuration.GetValue <string>("PluginPath"); List <Assembly> allAssembly = AssemblyHelper.GetAllAssembly(); ReflectionManager rm = new ReflectionManager(allAssembly); appEngine = AppEngine.Create( pluginPath, loggerFactory.CreateLogger <AppEngine>(), rm, services, Configuration); appEngine.InvokeConfigureServices(ass, builder, services, Configuration); foreach (var a in ass.Distinct()) { builder.AddApplicationPart(a).AddControllersAsServices(); } services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Web API", Version = "v1" }); //x.IncludeXmlComments(AppContext.BaseDirectory + "YourProject.Api.xml"); c.IgnoreObsoleteProperties(); c.IgnoreObsoleteActions(); c.DescribeAllEnumsAsStrings(); c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); c.CustomSchemaIds(t => t.FullName); }); //Invoke appEngine after service configuration appEngine.InvokePostConfigureServices(services); }
/// <summary> /// 加载当前模块重要的元件 /// </summary> private void LoadImportentWidgetsAndAddLocalization() { //判断脚本添加的元件组件是否符合规范 if (!ReflectionManager.GetInstance().TypeIsExtentOrEquel( currentModuleWidgetScript, "UIWidgetBase")) { //命名不规范,依旧使用基类组件 currentModuleWidgetScript = "UIFrame.UIWidgetBase"; } //遍历当前对象的所有子对象 Transform[] allChild = transform.GetComponentsInChildren <Transform>(); //遍历所有的子对象 for (int i = 0; i < allChild.Length; i++) { //遍历所有的元件尾部标记符号 for (int j = 0; j < SystemDefine.IMPORTENT_WIDGET_TOKEN.Length; j++) { //判断当前子对象的名字是否以该符号结尾 if (allChild[i].name.EndsWith(SystemDefine.IMPORTENT_WIDGET_TOKEN[j])) { //添加该脚本组件 UIWidgetBase uiWidget = allChild[i].gameObject.AddComponent( Type.GetType(currentModuleWidgetScript)) as UIWidgetBase; //赋值给脚本所在的模块 uiWidget._currentModule = this; //添加到字典 _uiWidgets.Add(allChild[i].name, uiWidget); break; } } //添加本地化组件 AddLocalizationTextComponent(allChild[i]); } }
/// <summary> /// 初始化工具栏按钮。 /// </summary> private void InitToolStripItems() { //获得所有表头设置所需的按钮。 List <object> objectList = ReflectionManager.CreateInstancesByInterfaceWithOutAbstract(typeof(IHeaderSettingToolStripItem)); toolStripItems = new ToolStripItem[objectList.Count]; #region 对按钮进行排序。 SortedList sl = new SortedList(); foreach (object obj in objectList) { IHeaderSettingToolStripItem iHeaderSettingToolStripItem = obj as IHeaderSettingToolStripItem; sl.Add(iHeaderSettingToolStripItem.SortID, iHeaderSettingToolStripItem); } int i = 0; foreach (DictionaryEntry de in sl) { IHeaderSettingToolStripItem iHeaderSettingToolStripItem = de.Value as IHeaderSettingToolStripItem; iHeaderSettingToolStripItem.FpSpread = fpMain; toolStripItems[i] = iHeaderSettingToolStripItem as ToolStripItem; i++; } #endregion }