public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) { builder.Register<IRead>(ctx => { var context = new PipelineContext(ctx.Resolve<IPipelineLogger>(), process, entity); var input = new InputContext(context, new Incrementer(context)); switch (input.Connection.Provider) { case "internal": context.Debug("Registering {0} provider", input.Connection.Provider); return new DataSetEntityReader(input); case "sqlserver": if (input.Entity.ReadSize == 0) { context.Debug("Registering {0} reader", input.Connection.Provider); return new SqlInputReader(input, input.InputFields); } context.Debug("Registering {0} batch reader", input.Connection.Provider); return new SqlInputBatchReader( input, new SqlInputReader(input, input.Entity.GetPrimaryKey()) ); default: context.Warn("Registering null reader", input.Connection.Provider); return new NullEntityReader(); } }).Named<IRead>(entity.Key); }
public static void Check(string source, string expected) { var input = new InputContext(); if (input.Compile(new List<Input> { new Input("<test>", source) })) { var output = new OutputContext(input); Assert.AreEqual(expected, output.Code); } else { Assert.AreEqual(expected, input.GenerateLog()); } }
static string SqlQuery(InputContext context, string tempTable) { var keys = context.Entity.GetPrimaryKey(); var names = string.Join(",", context.InputFields.Select(f => "i.[" + f.Name + "]")); var table = context.SqlSchemaPrefix() + "[" + context.Entity.Name + "]"; var joins = string.Join(" AND ", keys.Select(f => "i.[" + f.Name + "] = k.[" + f.FieldName() + "]")); var noLock = context.Entity.NoLock ? "WITH (NOLOCK)" : string.Empty; var sql = string.Format("SELECT {0} FROM #{1} k WITH (NOLOCK) INNER JOIN {2} i {3} ON ({4})", names, tempTable, table, noLock, joins); context.Debug(sql); return sql; }
public SqlEntityMatchingFieldsReader(InputContext input) { var tempTable = input.Entity.GetExcelName(); _keys = input.Entity.GetPrimaryKey(); _input = input; _create = SqlCreateKeysTable(input, tempTable); _insert = SqlInsertTemplate(input, tempTable); _query = SqlQuery(input, tempTable); _drop = SqlDrop(input, tempTable); _rowCreator = new SqlRowCreator(input); }
public void GetTypedDataSet() { var cfg = File.ReadAllText(@"Files\PersonAndPet.xml"); var shorthand = File.ReadAllText(@"Files\Shorthand.xml"); var process = new Root(cfg, shorthand, new Cfg.Net.Validators("js", new JintParser())).Processes.First(); var personContext = new PipelineContext(new DebugLogger(), process, process.Entities.Last()); var entityInput = new InputContext(personContext, new Incrementer(personContext)); var rows = new DataSetEntityReader(entityInput).Read().ToArray(); Assert.IsInstanceOf<IEnumerable<Row>>(rows); Assert.AreEqual(3, rows.Length); var dale = rows[0]; var micheal = rows[1]; Assert.IsInstanceOf<int>(dale[FieldAt(0)]); Assert.AreEqual(1, dale[FieldAt(0)]); Assert.AreEqual("Dale", dale[FieldAt(1)]); Assert.AreEqual("Michael", micheal[FieldAt(1)]); foreach (var row in rows) { Console.WriteLine(row); } }
public static void RenderInput(Asset asset, InputContext context) { //------------------------------------ // Global //------------------------------------ Dictionary<string, string> dicSiteType = new Dictionary<string, string>(); dicSiteType.Add("Single Site", "single"); dicSiteType.Add("Site Collection", "collection"); dicSiteType.Add("Site Collection with TMF", "collection_tmf"); Dictionary<string, string> dicMobile = new Dictionary<string, string>(); dicMobile.Add("None", "no"); dicMobile.Add("Responsive", "responsive"); dicMobile.Add("Dual Output", "dual_output"); dicMobile.Add("Dedicated", "dedicated"); Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>(); dicSelectOptions.Add("Dropdown", "dropdown"); dicSelectOptions.Add("Create New", "create_new"); ShowAcquireParams sapModel = new ShowAcquireParams(); sapModel.DefaultFolder = "/System/Models/"; sapModel.ShowUpload = false; //Country data FilterParams fpCountry = new FilterParams(); fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config"); Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/"); Dictionary<string, string> dicCountries = new Dictionary<string, string>(); if (aCountryFolder.IsLoaded) { foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry)) { if (!dicCountries.Keys.Contains(aFile.Label)) { dicCountries.Add(aFile.Label, aFile.Label); } } } //Language Data FilterParams fpLanguage = new FilterParams(); fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language"); Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/"); Dictionary<string, string> dicLanguages = new Dictionary<string, string>(); if (aLanguageFolder.IsLoaded) { foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage)) { if (!dicLanguages.Keys.Contains(aFile.Label)) { dicLanguages.Add(aFile.Label, aFile.Label); } } } //CP public sites Dictionary<string, string> dicCPSites = new Dictionary<string, string>(); string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml"); if (szPublicSiteXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file"); foreach (XmlNode xNode in lsXml) { dicCPSites.Add(xNode.Attributes["name"], xNode.Value); } } //CP Training Dictionary<string, string> dicCPTraining = new Dictionary<string, string>(); string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml"); if (szTrainingXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file"); foreach (XmlNode xNode in lsXml) { dicCPTraining.Add(xNode.Attributes["name"], xNode.Value); } } //Partner Private sites Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>(); if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"])) { string szPrivateSiteXML = GetPageSource(asset.Raw["private_key"]); if (szPrivateSiteXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file"); foreach (XmlNode xNode in lsXml) { dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value); } } } //------------------------------------ // Input Form //------------------------------------ Input.StartTabbedPanel("Import Setup", "Configuration"); string szLog = GetPageSource("http://mtistage.cp-access.com/SiteBuilder/Import-Log.xml"); if (!string.IsNullOrWhiteSpace(szLog)) { Input.StartControlPanel("Log"); Input.ShowTextBox("", "log_message", szLog, height: 20, readOnly: true); Input.EndControlPanel(); } Input.StartDropDownContainer("Site Builder Type", "sitebuilder_type", new Dictionary<string, string> { { "Build Site", "site_build" }, { "Add Extension", "site_extension" } }); Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" }, { "Local", "local" } }, "public"); //----------------------------------------- // CP Public Sites //----------------------------------------- Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites); Input.NextDropDownContainer(); //----------------------------- // CP Training Sites //----------------------------- Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining); Input.NextDropDownContainer(); //----------------------------- // Partner Private Folder //----------------------------- if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"])) { Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites); Input.AddHiddenField("private_language_exist", "true"); } else { Input.AddHiddenField("private_language_exist", "false"); Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form"); Input.ShowMessage("Ask CrownPeak support how to set up a private key"); } //----------------------------- // Local File //----------------------------- Input.NextDropDownContainer(); Input.ShowAcquireDocument("Select a File", "local_file", helpMessage: "Select a local XML file"); Input.EndDropDownContainer(); //----------------------------- // Site Structure Setting //----------------------------- Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root")); Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new"); Input.ShowTextBox("New Folder", "collection_new"); Input.NextDropDownContainer(); Input.ShowSelectFolder("Select", "collection_select"); Input.EndDropDownContainer(); Input.ShowTextBox("Site Root Name", "site_root_name"); Input.ShowTextBox("Project Name", "project_name"); //----------------------------- // Add Extension //----------------------------- Input.NextDropDownContainer(); Dictionary<string, string> dicExtensionTypes = new Dictionary<string, string>(); dicExtensionTypes.Add("TMF", "ext_tmf"); dicExtensionTypes.Add("Blog", "ext_blog"); dicExtensionTypes.Add("Release management", "ext_release_management"); dicExtensionTypes.Add("Metadata Management", "ext_metadata_management"); dicExtensionTypes.Add("Deep Clone Site", "ext_deep_clone"); dicExtensionTypes.Add("Clone and Convert", "ext_clone_convert"); Input.StartDropDownContainer("Extension Type", "extension_types", dicExtensionTypes); Input.ShowSelectFolder("Project Folder", "tmf_project_folder", "/", helpMessage: "Skip if the site doesn't use any Project folder"); Input.StartControlPanel("Master Site"); Input.StartHorizontalWrapContainer(); Input.StartDropDownContainer("Country Select", "tmf_master_country_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Country", "tmf_master_country_select", dicCountries); Input.NextDropDownContainer(); Input.ShowTextBox("Country Name", "new_master_country_name", width: 30, helpMessage: "United States, England, etc"); Input.EndDropDownContainer(); Input.StartDropDownContainer("Language Select", "tmf_master_language_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Language", "tmf_master_lang_select", dicLanguages); Input.NextDropDownContainer(); Input.ShowTextBox("Language Name", "new_master_language_name", width: 30, helpMessage: "English, Spanish, etc"); Input.EndDropDownContainer(); Input.EndHorizontalWrapContainer(); Input.ShowSelectFolder("Main Site", "tmf_master_main_site", "/"); Input.ShowTextBox("Rename Main Site", "tmf_master_main_site_rename"); Input.EndControlPanel(); while (Input.NextPanel("tmf_locale_panel", displayName: "Locale List")) { Input.StartHorizontalWrapContainer(); Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Country", "tmf_country_select", dicCountries); Input.NextDropDownContainer(); Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc"); Input.EndDropDownContainer(); Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages); Input.NextDropDownContainer(); Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc"); Input.EndDropDownContainer(); Input.EndHorizontalWrapContainer(); Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc"); } Input.NextDropDownContainer(); Input.NextDropDownContainer(); Input.NextDropDownContainer(); Input.NextDropDownContainer(); Input.NextDropDownContainer(); Input.EndDropDownContainer(); Input.EndDropDownContainer(); Input.StartControlPanel("Workflow"); Dictionary<string, string> dicWorkflow = new Dictionary<string, string>(); AssetParams apWorkflow = new AssetParams(); apWorkflow.ExcludeProjectTypes = false; foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow)) { if (!dicWorkflow.Keys.Contains(aWorkflow.Label)) dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label); } //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow"); Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow); Input.EndControlPanel(); Input.NextTabbedPanel(); Input.ShowMessage("Enter private key, save and refesh the form"); Input.ShowTextBox("Private Site Key", "private_key"); Input.EndTabbedPanel(); }
public SqlInputReader(InputContext input, Field[] fields) { _input = input; _fields = fields; _rowCreator = new SqlRowCreator(input); }
public EmitInputSystem(InputContext inputContext) { this.inputContext = inputContext; keyboards = inputContext.GetGroup(InputMatcher.Keyboard); }
public static string SqlSelectInput(this InputContext c, Field[] fields, IConnectionFactory cf) { var fieldList = string.Join(",", fields.Select(f => cf.Enclose(f.Name))); var table = SqlInputName(c, cf); var filter = c.Entity.Filter.Any() ? " WHERE " + c.ResolveFilter(cf) : string.Empty; var orderBy = c.ResolveOrder(cf); if (!c.Entity.IsPageRequest()) { return($"SELECT {fieldList} FROM {SqlInputName(c, cf)} {filter} {orderBy}"); } var start = (c.Entity.Page * c.Entity.Size) - c.Entity.Size; var end = start + c.Entity.Size; switch (cf.AdoProvider) { case AdoProvider.SqlServer: if (string.IsNullOrWhiteSpace(orderBy)) { orderBy = GetRequiredOrderBy(fields, cf); } var subQuery = $@"SELECT {fieldList},ROW_NUMBER() OVER ({orderBy}) AS TflRow FROM {table} WITH (NOLOCK) {filter}"; return($"WITH p AS ({subQuery}) SELECT {fieldList} FROM p WHERE TflRow BETWEEN {start + 1} AND {end}"); case AdoProvider.SqlCe: if (string.IsNullOrWhiteSpace(orderBy)) { orderBy = GetRequiredOrderBy(fields, cf); } return($"SELECT {fieldList} FROM {table} {filter} {orderBy} OFFSET {start} ROWS FETCH NEXT {c.Entity.Size} ROWS ONLY"); case AdoProvider.Access: // todo: make sure primary key is always include in sort to avoid wierd access top n behavior, see: https://stackoverflow.com/questions/887787/access-sql-using-top-5-returning-more-than-5-results if (string.IsNullOrWhiteSpace(orderBy)) { orderBy = GetRequiredOrderBy(fields, cf); } var xFieldList = string.Join(",", fields.Select(f => "x." + cf.Enclose(f.Name))); var yFieldList = string.Join(",", fields.Select(f => "y." + cf.Enclose(f.Name))); var flippedOrderBy = orderBy.Replace(" ASC", " ^a").Replace(" DESC", " ^d").Replace(" ^a", " DESC").Replace(" ^d", " ASC"); return($@"SELECT {yFieldList} FROM ( SELECT TOP {c.Entity.Size} {xFieldList} FROM ( SELECT TOP {end} {fieldList} FROM {table} {filter} {orderBy} ) x {flippedOrderBy} ) y {orderBy}"); case AdoProvider.PostgreSql: return($"SELECT {fieldList} FROM {table} {filter} {orderBy} LIMIT {c.Entity.Size} OFFSET {start}"); case AdoProvider.MySql: case AdoProvider.SqLite: return($"SELECT {fieldList} FROM {table} {filter} {orderBy} LIMIT {start},{c.Entity.Size}"); case AdoProvider.None: return(string.Empty); default: return(string.Empty); } }
public EmitInputSystem(Contexts contexts) { _context = contexts.input; }
public ShootBulletSystem(Contexts contexts) : base(contexts.input) { _gameContext = contexts.game; _inputContext = contexts.input; }
public DelimitedFileStreamReader(InputContext context, Stream stream, IRowFactory rowFactory) { _context = context; _stream = stream; _rowFactory = rowFactory; }
public SolrInputVersionDetector(InputContext context, ISolrReadOnlyOperations <Dictionary <string, object> > solr) { _context = context; _solr = solr; }
public InternalParameterReader(InputContext input, IRowFactory rowFactory, IDictionary <string, string> parameters) : this(input, input.Entity.Fields, rowFactory, parameters) { }
private InputEntity controlPadInputEntity; //代表ControlPad 在ecs系统中的entity public EmitInputSystem(Contexts contexts, IInputService inputService) { this.context = contexts.input; this.inputService = inputService; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.MakeCurrent(); this._Renderer = new Renderer(); this._Renderer.Cache = new FileSystemRenderCache(Program.Cache["Render"]); this._Renderer.Initialize(); SystemTypeface.Create = this._Renderer.CreateSystemTypeface; this._Probe = new Probe(); this._InputContext = new InputContext(this._Probe); this._Camera = new Camera(new Point(0.0, 0.0), 1.0); this._Ambience = new OceanAmbience(Random.Default); this._World = new World(this._InputContext, new Theme()); this._MakeView(); Content testcontent = new EditorContent(); this._World.Spawn(testcontent, Point.Origin); }
public ClickPointInputSystem(Contexts contexts) { m_Context = contexts.input; m_Input = m_Context.CreateEntity(); }
public SqlInputBatchReader(InputContext input, IRead reader) { _input = input; _reader = reader; _fieldsReader = new SqlEntityMatchingFieldsReader(input); }
public PlayAudioSystem(Contexts contexts) : base(contexts.game) { _gameContext = contexts.game; _inputContext = contexts.input; }
private void MenuClick() { InputContext.CreateEntity().isMenuClick = true; }
public InputEmitterSystem(Contexts context) { _context = context.input; _inputs = _context.GetGroup(InputMatcher.Input); }
public DelimitedFileReader(InputContext context, IRowFactory rowFactory) { _context = context; _rowFactory = rowFactory; }
private void SaveClick() { InputContext.CreateEntity().isSaveClick = true; }
public FileReader(InputContext context, IRowFactory rowFactory) { _context = context; _rowFactory = rowFactory; _field = context.Entity.GetAllFields().First(f => f.Input); }
private void ResumeClick() { InputContext.CreateEntity().isResumeClick = true; }
public FileSchemaReader(Process process, InputContext context) { _process = process; _context = context; }
public ReadInput(Contexts contexts, IDataSource dataSource) { _inputContext = contexts.input; _dataSource = dataSource; }
public GameEventSystem(Contexts contexts) : base(contexts.gameEvent) { _contextGame = contexts.game; _contextInput = contexts.input; _groupUI = _contextGame.GetGroup(Matcher <GameEntity> .AllOf(GameMatcher.ActiveUI)); }
public MouseSystem(Contexts contexts) { _contexts = contexts.input; }
public ExcelReader(InputContext context, IRowFactory rowFactory) { _fileInfo = new FileInfo(context.Connection.File); _context = context; _rowFactory = rowFactory; }
public DirectoryReader(InputContext input, IRowFactory rowFactory) { _input = input; _rowFactory = rowFactory; }
public static string SqlInputName(this InputContext c, IConnectionFactory cf) { return(SchemaPrefix(c, cf) + cf.Enclose(c.Entity.Name)); }
public Sitemap_Input(Asset asset, InputContext context = null) { this.asset = asset; }
public InputCollisionSystem(Contexts contexts) : base(contexts.input) { _input = contexts.input; _game = contexts.game; }
public ProductToCategoryFileFeedWriter(InputContext inputContext) : base(inputContext) { }
public static void ExportInput(Asset asset, InputContext context) { //------------------------------------------ // Global //------------------------------------------ Dictionary<string, string> dicYesNo = new Dictionary<string, string>(); dicYesNo.Add("Yes", "yes"); dicYesNo.Add("No", "no"); Dictionary<string, string> dicExtractTypes = new Dictionary<string, string>(); dicExtractTypes.Add("System", "system"); dicExtractTypes.Add("Project", "project"); Dictionary<string, string> dicLibraryTypes = new Dictionary<string, string>(); dicLibraryTypes.Add("From Folder", "all"); dicLibraryTypes.Add("Individual files", "individual"); ShowAcquireParams sapFile = new ShowAcquireParams(); sapFile.ShowUpload = false; sapFile.DefaultFolder = "/"; //------------------------------------------ // Form Starts //------------------------------------------ Input.StartTabbedPanel("Site", "Build Pattern"); string szLog = GetPageSource("http://mtistage.cp-access.com/SiteBuilder/Export-Log.xml"); if (!string.IsNullOrWhiteSpace(szLog)) { Input.StartControlPanel("Log"); Input.ShowTextBox("", "log_message", szLog, height: 20, readOnly: true); Input.EndControlPanel(); } Input.StartDropDownContainer("Pattern Builder Type", "extract_type", dicExtractTypes, "system"); //------------------------- // System //------------------------- Input.StartHorizontalWrapContainer(); Input.ShowSelectFolder("Site Root Folder", "sys_site_root_folder", helpMessage: "Required"); Input.ShowSelectFolder("Template Folder", "sys_template_folder", helpMessage: "Required", popupMessage: "Select the main template folder that is related to the site. By leaving empty, it will skip templates"); Input.ShowSelectFolder("Model Folder", "sys_model_folder", helpMessage: "Required", popupMessage: "Select the main model folder that is related to the site. By leaving empty, it will skip models."); Input.ShowSelectFolder("Library Folder", "sys_library_folder", helpMessage: "Required", popupMessage: "Select the library folder that is related to the site. By leaving empty, it will skip library."); Input.ShowSelectFolder("Content Wrapper Template", "sys_nav_wrap_location", helpMessage: "Required", popupMessage: "Select the content wrapper template that belogs to the site"); Input.EndHorizontalWrapContainer(); Input.NextDropDownContainer(); //------------------------- // Project //------------------------- Input.StartHorizontalWrapContainer(); Input.ShowSelectFolder("Site Root Folder", "pro_site_root_folder", helpMessage: "Required"); Input.ShowSelectFolder("Project Folder", "pro_project_folder", helpMessage: "Required"); Input.ShowSelectFolder("Template Folder", "pro_template_folder", helpMessage: "Required", popupMessage: "Select the main template folder that is related to the site. By leaving empty, it will skip templates"); Input.ShowSelectFolder("Model Folder", "pro_model_folder", helpMessage: "Required", popupMessage: "Select the main model folder that is related to the site. By leaving empty, it will skip models."); Input.ShowSelectFolder("Library Folder", "pro_library_folder", helpMessage: "Required", popupMessage: "Select the library folder that is related to the site. By leaving empty, it will skip library."); Input.ShowSelectFolder("Content Wrapper Template", "pro_nav_wrap_location", helpMessage: "Optional"); Input.EndHorizontalWrapContainer(); Input.EndDropDownContainer(); //------------------------- // Include Options //------------------------- Input.ShowHeader("Include Options"); Input.ShowCheckBox("", "include_contents", "true", "Include Contents", unCheckedValue: "false", defaultChecked: true); Input.ShowCheckBox("", "include_Binaries", "true", "Include Binary Files", unCheckedValue: "false", defaultChecked: true); Input.ShowCheckBox("", "include_Wrappers", "true", "Include Attached Binaries", unCheckedValue: "false", defaultChecked: true); Input.NextTabbedPanel(); Input.ShowMessage("Select Yes and Save to start building the pattern.", MessageType.Warning); Input.ShowMessage("When the process is done, an XML (which is the pattern) and a log file will be created."); Input.ShowMessage("If you get an error message while creating the pattern, please contact to our support team."); Input.ShowDropDown("Build Pattern", "export_site_option", dicYesNo, Util.MakeList("no")); Input.EndTabbedPanel(); }
public EmitSelectHolderSystem(Contexts contexts) : base(contexts.input) { _inputContext = contexts.input; _holders = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.ChessPieceHolder)); }
public static void RenderInput_bk(Asset asset, InputContext context) { //------------------------------------ // Global //------------------------------------ Dictionary<string, string> dicSiteType = new Dictionary<string, string>(); dicSiteType.Add("Single Site", "single"); dicSiteType.Add("Site Collection", "collection"); dicSiteType.Add("Site Collection with TMF", "collection_tmf"); Dictionary<string, string> dicMobile = new Dictionary<string, string>(); dicMobile.Add("None", "no"); dicMobile.Add("Responsive", "responsive"); dicMobile.Add("Dual Output", "dual_output"); dicMobile.Add("Dedicated", "dedicated"); Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>(); dicSelectOptions.Add("Dropdown", "dropdown"); dicSelectOptions.Add("Create New", "create_new"); ShowAcquireParams sapModel = new ShowAcquireParams(); sapModel.DefaultFolder = "/System/Models/"; sapModel.ShowUpload = false; //Country data FilterParams fpCountry = new FilterParams(); fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config"); Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/"); Dictionary<string, string> dicCountries = new Dictionary<string, string>(); if (aCountryFolder.IsLoaded) { foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry)) { if (!dicCountries.Keys.Contains(aFile.Label)) { dicCountries.Add(aFile.Label, aFile.Label); } } } //Language Data FilterParams fpLanguage = new FilterParams(); fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language"); Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/"); Dictionary<string, string> dicLanguages = new Dictionary<string, string>(); if (aLanguageFolder.IsLoaded) { foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage)) { if (!dicLanguages.Keys.Contains(aFile.Label)) { dicLanguages.Add(aFile.Label, aFile.Label); } } } //CP public sites Dictionary<string, string> dicCPSites = new Dictionary<string, string>(); string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml"); if (szPublicSiteXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file"); foreach (XmlNode xNode in lsXml) { dicCPSites.Add(xNode.Attributes["name"], xNode.Value); } } //CP Training Dictionary<string, string> dicCPTraining = new Dictionary<string, string>(); string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml"); if (szTrainingXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file"); foreach (XmlNode xNode in lsXml) { dicCPTraining.Add(xNode.Attributes["name"], xNode.Value); } } //Partner Private sites Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>(); if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"])) { string szPrivateSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/partner/" + asset.Raw["private_key"] + "/site-list.xml"); if (szPrivateSiteXML.Contains("<sites>")) { List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file"); foreach (XmlNode xNode in lsXml) { dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value); } } } //------------------------------------ // Input Form //------------------------------------ Input.StartTabbedPanel("Import Setup", "Configuration"); //Input.ShowRadioButton("Technology Stacks", "language_type", new Dictionary<string, string> { { "HTML", "html" }, { "NET", "net" }, { "PHP(Coming Soon)", "" }, { "Java(Coming Soon)", "" } }, "html"); Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" } }, "public"); //----------------------------------------- // CP Public Sites //----------------------------------------- Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites); Input.ShowDropDown("Create in a separate project", "new_project", new Dictionary<string, string>() { { "Yes", "yes" }, { "No", "no" } }, Util.MakeList("yes")); //TMF Input.StartDropDownContainer("Site Type", "site_type_option", dicSiteType, "single"); //Single Site Input.ShowMessage("Creates a single site"); Input.ShowTextBox("Site Name", "single_site_name"); Input.ShowHeader("Mobile"); Input.ShowCheckBox("", "single_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false); Input.ShowHeader("Extension"); Input.StartHorizontalWrapContainer(); Input.ShowCheckBox("", "single_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "single_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "single_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.EndHorizontalWrapContainer(); Input.NextDropDownContainer(); //Site Collection Input.ShowMessage("Creates collection of sites with their own templates and models"); Input.ShowTextBox("Collection Name", "collection_name"); while (Input.NextPanel("collection_panel", displayName: "Site List")) { Input.ShowTextBox("Site Name", "collection_site_name"); Input.ShowHeader("Mobile"); Input.ShowCheckBox("", "collection_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false); Input.ShowHeader("Extension"); Input.StartHorizontalWrapContainer(); Input.ShowCheckBox("", "collection_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "collection_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "collection_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.EndHorizontalWrapContainer(); } Input.NextDropDownContainer(); //Site Collection with TMF Input.ShowMessage("Creates collection of sites with TMF. Templates are shared"); Input.ShowTextBox("Site Name", "collection_tmf_name"); Input.ShowHeader("Mobile"); Input.ShowCheckBox("", "collection_tmf_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false); Input.ShowHeader("Extension"); Input.StartHorizontalWrapContainer(); Input.ShowCheckBox("", "collection_tmf_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "collection_tmf_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.ShowCheckBox("", "collection_tmf_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false); Input.EndHorizontalWrapContainer(); while (Input.NextPanel("tmf_panel", displayName: "TMF List")) { Input.ShowCheckBox("", "master_site", "true", "Master Site", unCheckedValue: "false", defaultChecked: false); Input.StartHorizontalWrapContainer(); Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Country", "tmf_country_select", dicCountries); Input.NextDropDownContainer(); Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc"); Input.EndDropDownContainer(); Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown"); Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages); Input.NextDropDownContainer(); Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc"); Input.EndDropDownContainer(); Input.EndHorizontalWrapContainer(); Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc"); } Input.EndDropDownContainer(); Input.NextDropDownContainer(); //----------------------------- // CP Training Sites //----------------------------- Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining); Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root")); Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new"); Input.ShowTextBox("New Folder", "collection_new"); Input.NextDropDownContainer(); Input.ShowSelectFolder("Select", "collection_select"); Input.EndDropDownContainer(); Input.ShowTextBox("Site Root Name", "site_root_name"); Input.ShowTextBox("Project Name", "project_name"); Input.NextDropDownContainer(); //----------------------------- // Partner Private Folder //----------------------------- if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"])) { Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites); Input.AddHiddenField("private_language_exist", "true"); } else { Input.AddHiddenField("private_language_exist", "false"); Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form"); Input.ShowMessage("Ask CrownPeak support how to set up a private key"); } Input.EndDropDownContainer(); Input.StartControlPanel("Workflow"); Dictionary<string, string> dicWorkflow = new Dictionary<string, string>(); AssetParams apWorkflow = new AssetParams(); apWorkflow.ExcludeProjectTypes = false; foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow)) { dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label); } //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow"); Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow); Input.EndControlPanel(); /* //Mobile Input.StartDropDownContainer("Mobile", "include_mobile", dicMobile, "no"); Input.NextDropDownContainer(); //Responsive Input.ShowMessage("Responsive Mobile"); Input.NextDropDownContainer(); //Dual output Input.ShowMessage("Dual output shares one input template"); Input.NextDropDownContainer(); //Dedicated Input.ShowMessage("Dedicated mobile has separate templates and models"); Input.EndDropDownContainer(); */ //Input.NextTabbedPanel(); // Input.ShowAcquireDocument("Developer Model", "model_developer", sapModel); // Input.ShowAcquireDocument("File Model", "model_file", sapModel); // Input.ShowAcquireDocument("Folder Model", "model_folder", sapModel); // Input.ShowTextBox("Workflow Name", "workflow_name"); Input.NextTabbedPanel(); Input.ShowMessage("Enter private key, save and refesh the form"); Input.ShowTextBox("Private Site Key", "private_key"); Input.EndTabbedPanel(); }
public EmitControllerInputSystem(Contexts contexts) { _context = contexts.input; }
// Initialize context void InitializeVars() { fsm = new Diagram(); context = GetComponent<InputContext>(); fsm.SetContext(context); // Conditions if_Finished = new If_ValueOf().SetInfo("finished", context); if_Clicked = new If_Clicked(); if_TargetIsCharacter = new If_TargetIsCharacter(); if_TargetIsGround = new If_TargetIsCharacter().Invert(); // Actions do_SetGroundTarget = new Do_SetGroundTarget(); do_SetCharacterTarget = new Do_SetCharacterTarget(); do_ResetInput = new Do_ResetInput(); do_ListenInput = new Do_ListenInput(); }
public RethinkDbInitializer(InputContext input, OutputContext output, IConnectionFactory connectionFactory) { _input = input; _output = output; _factory = connectionFactory; }
private void WindowOnClosing() { Controller?.Dispose(); InputContext?.Dispose(); Gl?.Dispose(); }
private void GameViewForm_Load( object sender, EventArgs e ) { // Add a performance display Scene.Objects.Add( new PerformanceDisplay( ) ); DebugInfo.ShowFps = true; DebugInfo.ShowMemoryWorkingSet = true; DebugInfo.ShowMemoryPeakWorkingSet = true; // Load in the game viewer LoadParameters loadArgs = new LoadParameters( ); loadArgs.Properties.Add( "Users", m_Users ); m_Viewer = ( Viewer )AssetManager.Instance.Load( m_Setup.ViewerSource, loadArgs ); gameDisplay.AddViewer( m_Viewer ); // Get start points IEnumerable< PlayerStart > startPoints = Scene.Objects.GetAllOfType<PlayerStart>( ); // Setup players InputContext inputContext = new InputContext( m_Viewer ); m_Users = new CommandUser[ m_Setup.NumberOfPlayers ]; for ( int playerIndex = 0; playerIndex < m_Setup.NumberOfPlayers; ++playerIndex ) { PlayerSetup player = m_Setup.Players[ playerIndex ]; // Find the start position for this player PlayerStart playerStart = null; foreach ( PlayerStart startPoint in startPoints ) { if ( startPoint.PlayerIndex == playerIndex ) { playerStart = startPoint; break; } } if ( playerStart == null ) { throw new InvalidOperationException( "No player start available for player " + playerIndex ); } // Load game inputs m_Users[ playerIndex ] = new CommandUser( ); CommandInputTemplateMap gameInputs = ( CommandInputTemplateMap )AssetManager.Instance.Load( player.CommandSource ); gameInputs.BindToInput( inputContext, m_Users[ playerIndex ] ); // Load the player's character object character = AssetManager.Instance.Load( player.CharacterSource ); Scene.Objects.Add( ( IUnique )character ); // Place the character at the start position IPlaceable placeable = Rb.Core.Components.Parent.GetType<IPlaceable>( character ); if ( placeable != null ) { placeable.Position = playerStart.Position; } // Hack... if the viewer camera is a follow camera, force it to look at the player if ( ( m_Setup.NumberOfPlayers == 1 ) && ( m_Viewer.Camera is FollowCamera ) ) { FollowCamera camera = ( FollowCamera )m_Viewer.Camera; // Follow the player camera.Target = ( IPlaceable )character; // Add a camera controller FollowCameraControl cameraControl = new FollowCameraControl( camera, m_Users[ 0 ] ); m_Viewer.Camera.AddChild( cameraControl ); } IParent characterParent = ( IParent )character; characterParent.AddChild( new UserController( m_Users[ playerIndex ], ( IMessageHandler )character ) ); } // Start rendering the scene m_Viewer.Renderable = Scene; // Kick off the update service... (TODO: AP: Not a very good hack) IUpdateService updater = Scene.GetService< IUpdateService >( ); if ( updater != null ) { updater.Start( ); } playButton.Enabled = false; }