예제 #1
0
        public ModuleHttpRequest(HttpRequest httpRequest, string moduleUrl, ModuleContext moduleContext, ControllerContext pageControllerContext)
            : base(httpRequest)
        {
            this.appRelativeCurrentExecutionFilePath = moduleUrl;
            int queryStringIndex = moduleUrl.IndexOf('?');
            if (queryStringIndex != -1)
            {
                this.appRelativeCurrentExecutionFilePath = moduleUrl.Substring(0, queryStringIndex);
                if (queryStringIndex < moduleUrl.Length - 1)
                {
                    this.queryString = new HttpValueCollection(moduleUrl.Substring(queryStringIndex + 1), true, false, Encoding.UTF8);
                }
            }
            this.absolutePath = this.appRelativeCurrentExecutionFilePath.Replace("~", "");
            url = new Uri(new Uri(httpRequest.Url.Scheme + "://" + httpRequest.Url.Authority), this.absolutePath);

            _httpMethod = httpRequest.HttpMethod;
            //To ignore the POST action by other module
            if (moduleContext != null && pageControllerContext != null)
            {
                if (httpRequest.HttpMethod.ToUpper() == "POST")
                {
                    var postModule = pageControllerContext.RequestContext.GetRequestValue(Kooboo.CMS.Sites.View.ModuleUrlContext.PostModuleParameter);
                    if (!string.IsNullOrEmpty(postModule))
                    {
                        if (postModule.ToUpper() != moduleContext.FrontEndContext.ModulePosition.PagePositionId.ToUpper())
                        {
                            _httpMethod = "GET";
                        }
                    }
                }
            }
        }
예제 #2
0
 static InvariantContext()
 {
     Instance = new InvariantContext();
     ModuleContext moduleContext = new ModuleContext(null);
     moduleContext.ShowCls = true;
     CodeContext = new CodeContext(new Scope(null), Instance, moduleContext);
 }
예제 #3
0
 public ModuleHttpContext(HttpContext httpContext, HttpRequestBase httpRequest, HttpResponseBase httpResponse, ModuleContext moduleContext)
     : base(httpContext)
 {
     this._httpRequest = httpRequest;
     this._httpResponse = httpResponse;
     this.ModuleContext = moduleContext;
 }
예제 #4
0
        public string postProcess(PageWriter writer, string xml)
        {
            bool anyModulesReplaced;
            var document = ExtractHTML.loadHTML(xml);
            do
            {
                anyModulesReplaced = false;
                var references = findModuleReferences(document).ToArray();

                foreach (var reference in references)
                {
                    var moduleName = reference.URI.LocalPath;
                    var template = resolveModuleTemplate(writer.Site, moduleName);

                    var parameters = ModuleParameters.fromReference(reference);
                    var moduleContext = new ModuleContext(writer, parameters);
                    var moduleHTML = "<root>" + template.generateHTML(moduleContext) + "</root>";
                    var moduleDocument = ExtractHTML.loadWithoutDTD(moduleHTML);
                    reference.expand(moduleDocument.DocumentElement.ChildNodes);

                    anyModulesReplaced = true;
                }

            } while (anyModulesReplaced);

            return XHTMLWriter.writeStrict(document);
        }
예제 #5
0
        /// <summary>
        /// Called only from OptimizedModuleGenerator. ModuleContext will be set later.
        /// </summary>
        internal CodeContext(Scope scope, LanguageContext languageContext)
        {
            Assert.NotNull(scope, languageContext);

            _languageContext = languageContext;
            _moduleContext = null;
            _scope = scope;
        }
예제 #6
0
        public CodeContext(Scope scope, LanguageContext languageContext, ModuleContext moduleContext)
        {
            Assert.NotNull(scope, languageContext, moduleContext);

            _languageContext = languageContext;
            _moduleContext = moduleContext;
            _scope = scope;
        }
예제 #7
0
        internal static void Initialize(IronSchemeLanguageProvider ironSchemeLanguageProvider)
        {
            lp = ironSchemeLanguageProvider;
              se = lp.GetEngine() as IronSchemeScriptEngine;

              scriptmodule = ScriptDomainManager.CurrentManager.Host.DefaultModule as ScriptModule;

              ModuleContext mc = new ModuleContext(scriptmodule);

              mc.CompilerContext = new CompilerContext(SourceUnit.CreateSnippet(se, ""));

              cc = new CodeContext(scriptmodule.Scope, se.GetLanguageContext(), mc);

              binder = new IronScheme.Actions.IronSchemeActionBinder(cc);

              Generator.initme = true;
        }
예제 #8
0
 public override RealizedType UnderlyingType(ModuleContext context) => realizedType;
예제 #9
0
        private void BindButtons(OpenContentSettings settings, RenderInfo info)
        {
            bool templateDefined = info.Template != null;
            bool settingsDefined = !string.IsNullOrEmpty(settings.Data);
            bool settingsNeeded  = false;

            if (rblUseTemplate.SelectedIndex == 0 && ddlTemplate.SelectedIndex >= 0) // existing template
            {
                //create tmp TemplateManifest
                var templateManifest = new FileUri(ddlTemplate.SelectedValue).ToTemplateManifest();
                settingsNeeded = templateManifest.SettingsNeeded();

                templateDefined = templateDefined && (!ddlTemplate.Visible || (settings.Template.Key.ToString() == ddlTemplate.SelectedValue));
                settingsDefined = settingsDefined || !settingsNeeded;
            }
            else // new template
            {
                templateDefined = false;
            }

            if (!templateDefined && !settings.FirstTimeInitialisation && ddlTemplate.Items.FindByValue(settings.TemplateKey.ToString()) == null)
            {
                lCurrentTemplate.Text     = settings.TemplateKey.ToString();
                phCurrentTemplate.Visible = true;
            }

            bSave.CssClass          = "dnnPrimaryAction";
            bSave.Enabled           = true;
            hlEditSettings.CssClass = "dnnSecondaryAction";
            hlEditContent.CssClass  = "dnnSecondaryAction";
            //if (ModuleContext.PortalSettings.UserInfo.IsSuperUser)
            hlEditSettings.Enabled = false;
            hlEditSettings.Visible = settingsNeeded && !RenderOnlySaveButton;

            if (templateDefined && ModuleContext.EditMode && settingsNeeded)
            {
                //hlTempleteExchange.NavigateUrl = ModuleContext.EditUrl("ShareTemplate");
                hlEditSettings.NavigateUrl = ModuleContext.EditUrl("EditSettings");
                //hlTempleteExchange.Visible = true;
                hlEditSettings.Enabled = true;

                //bSave.CssClass = "dnnSecondaryAction";
                //bSave.Enabled = false;
                //hlEditSettings.CssClass = "dnnPrimaryAction";
                //hlEditContent.CssClass = "dnnSecondaryAction";
            }
            hlEditContent.Visible  = !RenderOnlySaveButton;
            hlEditContent2.Visible = !RenderOnlySaveButton;
            hlEditContent.Enabled  = false;
            hlEditContent2.Enabled = false;
            if (templateDefined && settingsDefined && ModuleContext.EditMode)
            {
                hlEditContent.NavigateUrl  = ModuleContext.EditUrl("Edit");
                hlEditContent.Enabled      = true;
                hlEditContent2.NavigateUrl = ModuleContext.EditUrl("Edit");
                hlEditContent2.Enabled     = true;
                //bSave.CssClass = "dnnSecondaryAction";
                //bSave.Enabled = false;
                //hlEditSettings.CssClass = "dnnSecondaryAction";
                //hlEditContent.CssClass = "dnnPrimaryAction";

                var template = new FileUri(ddlTemplate.SelectedValue);
                var manifest = template.ToTemplateManifest();
                hlEditContent.Text = App.Services.Localizer.GetString(manifest.IsListTemplate ? "Add.Action" : "Edit.Action", ResourceFile);
                if (!string.IsNullOrEmpty(manifest.Title))
                {
                    hlEditContent.Text = hlEditContent.Text + " " + manifest.Title;
                }
            }
        }
        private async Task <IHtmlContent> ExecuteModuleController(ActionContext actionContext, ModuleContext moduleContext, ModuleAction moduleAction)
        {
            if (actionContext == null)
            {
                return(null);
            }

            ActionContext moduleActionContext = GetModuleActionContext(actionContext, moduleContext, moduleAction);

            //var invoker = _moduleInvokerProvider.CreateInvoker(moduleActionContext);
            //var result = await invoker.InvokeAction() as ViewResult;
            var result = await _actionInvoker.InvokeAction(actionContext.HttpContext, moduleAction, moduleActionContext) as ViewResult;

            IHtmlContent htmlResult = result.ExecuteResultToHTML(moduleActionContext);

            return(htmlResult);
        }
 public async Task <IActionResult> InvokeAction(HttpContext httpContext, ModuleView moduleView, ActionContext actionContext, ModuleContext moduleContext = null)
 {
     return(await InvokeAction(httpContext, moduleView.ControllerNamespace, moduleView.ControllerName, moduleView.ActionName, actionContext, moduleContext));
 }
예제 #12
0
 public AssemblyModule(string filename, ModuleContext moduleContext)
 {
     this.filename      = Utils.GetFullPath(filename);
     this.moduleContext = moduleContext;
 }
예제 #13
0
 public Module()
 {
     Context = new ModuleContext();
 }
예제 #14
0
        /// <summary>
        /// あるASTノードを対象にインタープリターを起動する。
        /// Run the interpreter on a specified AST node.
        /// Can be useful for interactive mode.
        /// </summary>
        public object Run(AstNode node, bool useShared)
        {
            if(node == null)
                throw new ArgumentNullException("node", "Can not evaluate a null node.");

            if(useShared){
                return Interpret(node, global_context.SharedContext);
            }else{
                var mod_context = new ModuleContext(new Dictionary<object, object>(), global_context);
                return Interpret(node, mod_context.GlobalContext);
            }
        }
예제 #15
0
        /// <summary>
        /// main関数をエントリーポイントとしてプログラムを実行する。
        /// Run the program with the "main" function as the entry point.
        /// </summary>
        /// <param name="args">
        /// Arguments passed into the Expresso's main function.
        /// </param>
        /// <exception cref='EvalException'>
        /// Is thrown when an error occurs while evaluating the source code.
        /// </exception>
        /// <returns>The return value of the Expresso's main function</returns>
        public object Run(List<object> args = null)
        {
            Interpreter.CurRuntime = this;
            if(MainModule == null)
                throw ExpressoOps.MakeReferenceError("Missing main module!");

            Interpret(MainModule, global_context.SharedContext);

            var main_module = global_context.GetModule("main");
            var main_func = main_module.LookupMember("main") as FunctionDeclaration;
            if(main_func == null)
                throw ExpressoOps.MakeRuntimeError("No entry point");

            if(args == null)
                args = new List<object>();

            var mod_context = new ModuleContext(main_module, global_context);
            var main_args = ExpressoOps.Slice(args, new ExpressoIntegerSequence(1, args.Count, 1));
            var call = Expression.MakeCallExpr(
                AstNode.MakeIdentifier(ObjectTypes.Function, main_func),
                new Expression[]{
                    AstNode.MakeConstant(ObjectTypes.Instance, main_module),
                    AstNode.MakeConstant(ObjectTypes.List, main_args)
                }
            );

            return Interpret(call, mod_context.GlobalContext);
        }
예제 #16
0
 public override IMethodInvokeFactory FindMethod(ModuleContext context, string methodName)
 {
     EnsureFields();
     return(realizedType.FindMethod(context, methodName));
 }
예제 #17
0
 public ModuleRequestContext(HttpContextBase httpContext, RouteData routeData, ModuleContext moduleContext)
     : base(httpContext, routeData)
 {
     this.ModuleContext = moduleContext;
 }
예제 #18
0
 public IEnumerable <StructuralError> TryImportConstants(ModuleContext context)
 {
     typeDelegate.EnsureFields();
     return(Enumerable.Empty <StructuralError>());
 }
예제 #19
0
 public object Run(Scope scope, ModuleContext moduleContext) {
     return Run(scope, moduleContext, false);
 }
예제 #20
0
 void cmdGenerateXSL_Click(object sender, EventArgs e)
 {
     SaveSettings();
     Response.Redirect(ModuleContext.EditUrl("GenerateXsl"), true);
 }
예제 #21
0
 private SemanticItem _param_inputLiteral(ModuleContext context)
 {
     return(SemanticItem.Entity(context.Input));
 }
예제 #22
0
 public Module()
 {
     Context = new ModuleContext();
 }
예제 #23
0
 public IEnumerable <StructuralError> TryDeclareTypes(ModuleContext context) =>
 Enumerable.Empty <StructuralError>();
예제 #24
0
        public object Run(Scope scope, ModuleContext moduleContext, bool tryEvaluate) {
            Contract.RequiresNotNull(scope, "scope");
            Contract.RequiresNotNull(moduleContext, "moduleContext");

            return Run(new CodeContext(scope, _languageContext, moduleContext), tryEvaluate);
        }
예제 #25
0
        private static string GetEntryUrl(HttpContext context, ModuleContext moduleContext, Entry entry)
        {
            var httpContext = new GetEntryUrlContextWrapper(context, "~/");

            var routeData = moduleContext.FrontEndContext.RouteTable.GetRouteData(httpContext);

            var requestContext = new ModuleRequestContext(httpContext, routeData, moduleContext);

            UrlHelper url = new UrlHelper(requestContext, moduleContext.FrontEndContext.RouteTable);

            return url.Action(entry.Action, entry.Controller, entry.Values);
        }
 public AssemblyFactory(IEnumerable <string> filenames)
 {
     modules    = new Dictionary <string, ModuleDef>(StringComparer.Ordinal);
     nameToPath = filenames.ToDictionary(key => Path.GetFileNameWithoutExtension(key), value => value, StringComparer.Ordinal);
     context    = new ModuleContext(this, new Resolver(this));
 }
예제 #27
0
 /// <summary>
 /// Notification sent when a ScriptCode is about to be executed within given ModuleContext.
 /// </summary>
 /// <param name="newContext"></param>
 public virtual void ModuleContextEntering(ModuleContext newContext)
 {
     // nop
 }
        private async Task <string> ExecuteModuleControllerAsString(ActionContext actionContext, ModuleContext moduleContext, ModuleAction moduleAction)
        {
            if (actionContext == null)
            {
                return(null);
            }

            ActionContext moduleActionContext = GetModuleActionContext(actionContext, moduleContext, moduleAction);

            //var invoker = _moduleInvokerProvider.CreateInvoker(moduleActionContext);
            //var result = await invoker.InvokeAction() as ViewResult;
            var result = await _actionInvoker.InvokeAction(actionContext.HttpContext, moduleAction, moduleActionContext) as ViewResult;

            string strResult = result.ExecuteResultToString(moduleActionContext);

            return(strResult);
        }
예제 #29
0
 public ModuleHttpResponse(HttpResponse httpResponse, ModuleContext moduleContext)
     : base(httpResponse)
 {
     this.moduleContext = moduleContext;
 }
예제 #30
0
        protected void bSave_Click(object sender, EventArgs e)
        {
            try
            {
                ModuleController mc = new ModuleController();
                if (rblDataSource.SelectedIndex == 0) // this module
                {
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "portalid");
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "tabid");
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "moduleid");
                }
                else if (rblDataSource.SelectedIndex == 1) // other module
                {
                    var dsModule = (new ModuleController()).GetTabModule(int.Parse(ddlDataSource.SelectedValue));
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "portalid");
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "tabid", dsModule.TabID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "moduleid", dsModule.ModuleID.ToString());
                }
                else // other portal
                {
                    var dsModule = (new ModuleController()).GetTabModule(int.Parse(ddlDataSource.SelectedValue));
                    var dsPortal = int.Parse(ddlPortals.SelectedValue);
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "portalid", dsModule.PortalID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "tabid", dsModule.TabID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "moduleid", dsModule.ModuleID.ToString());
                }
                if (rblUseTemplate.SelectedIndex == 0) // existing
                {
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", ddlTemplate.SelectedValue);
                    ModuleContext.Settings["template"] = ddlTemplate.SelectedValue;
                }
                else if (rblUseTemplate.SelectedIndex == 1) // new
                {
                    if (rblFrom.SelectedIndex == 0)         // site
                    {
                        string oldFolder = Server.MapPath(ddlTemplate.SelectedValue);
                        string template  = OpenContentUtils.CopyTemplate(ModuleContext.PortalId, oldFolder, tbTemplateName.Text);
                        mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        ModuleContext.Settings["template"] = template;
                    }
                    else if (rblFrom.SelectedIndex == 1) // web
                    {
                        //string fileName = ddlTemplate.SelectedValue;
                        //string template = OpenContentUtils.ImportFromWeb(ModuleContext.PortalId, fileName, tbTemplateName.Text);
                        //mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        //ModuleContext.Settings["template"] = template;
                        //string fileName = ddlTemplate.SelectedValue;
                        string template = GithubTemplateUtils.ImportFromGithub(ModuleContext.PortalId, ddlTemplate.SelectedItem.Text, ddlTemplate.SelectedValue, tbTemplateName.Text);
                        mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        ModuleContext.Settings["template"] = template;
                    }
                }
                mc.UpdateTabModuleSetting(ModuleContext.TabModuleId, "detailtabid", ddlDetailPage.SelectedValue);


                //don't reset settings. Sure they might be invalid, but maybe not. And you can't ever revert.
                //mc.DeleteModuleSetting(ModuleContext.ModuleId, "data");

                Settings = ModuleContext.OpenContentSettings();
                if (PageRefresh || !Settings.Template.DataNeeded())
                {
                    Response.Redirect(Globals.NavigateURL(), true);
                }
                else
                {
                    rblUseTemplate.SelectedIndex = 0;
                    phTemplateName.Visible       = rblUseTemplate.SelectedIndex == 1;
                    phFrom.Visible        = rblUseTemplate.SelectedIndex == 1;
                    rblFrom.SelectedIndex = 0;
                    BindTemplates(Settings.Template, null);
                    Renderinfo.Template = Settings.Template;
                    BindButtons(Settings, Renderinfo);
                    ActivateDetailPage();
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #31
0
	public ModuleContext module() {
		ModuleContext _localctx = new ModuleContext(Context, State);
		EnterRule(_localctx, 2, RULE_module);
		int _la;
		try {
			int _alt;
			EnterOuterAlt(_localctx, 1);
			{
			State = 290;
			switch ( Interpreter.AdaptivePredict(TokenStream,0,Context) ) {
			case 1:
				{
				State = 289; Match(WS);
				}
				break;
			}
			State = 295;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,1,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					{
					{
					State = 292; Match(NEWLINE);
					}
					} 
				}
				State = 297;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,1,Context);
			}
			State = 304;
			switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) {
			case 1:
				{
				State = 298; moduleHeader();
				State = 300;
				ErrorHandler.Sync(this);
				_alt = 1;
				do {
					switch (_alt) {
					case 1:
						{
						{
						State = 299; Match(NEWLINE);
						}
						}
						break;
					default:
						throw new NoViableAltException(this);
					}
					State = 302;
					ErrorHandler.Sync(this);
					_alt = Interpreter.AdaptivePredict(TokenStream,2,Context);
				} while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber );
				}
				break;
			}
			State = 307;
			switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) {
			case 1:
				{
				State = 306; moduleConfig();
				}
				break;
			}
			State = 312;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,5,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					{
					{
					State = 309; Match(NEWLINE);
					}
					} 
				}
				State = 314;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,5,Context);
			}
			State = 316;
			switch ( Interpreter.AdaptivePredict(TokenStream,6,Context) ) {
			case 1:
				{
				State = 315; moduleAttributes();
				}
				break;
			}
			State = 321;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,7,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					{
					{
					State = 318; Match(NEWLINE);
					}
					} 
				}
				State = 323;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,7,Context);
			}
			State = 325;
			switch ( Interpreter.AdaptivePredict(TokenStream,8,Context) ) {
			case 1:
				{
				State = 324; moduleDeclarations();
				}
				break;
			}
			State = 330;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,9,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					{
					{
					State = 327; Match(NEWLINE);
					}
					} 
				}
				State = 332;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,9,Context);
			}
			State = 334;
			_la = TokenStream.La(1);
			if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__4) | (1L << T__5) | (1L << ACCESS) | (1L << ADDRESSOF) | (1L << ALIAS) | (1L << AND) | (1L << ATTRIBUTE) | (1L << APPACTIVATE) | (1L << APPEND) | (1L << AS) | (1L << BEGIN) | (1L << BEEP) | (1L << BINARY) | (1L << BOOLEAN) | (1L << BYVAL) | (1L << BYREF) | (1L << BYTE) | (1L << CALL) | (1L << CASE) | (1L << CHDIR) | (1L << CHDRIVE) | (1L << CLASS) | (1L << CLOSE) | (1L << COLLECTION) | (1L << CONST) | (1L << DATABASE) | (1L << DATE) | (1L << DECLARE) | (1L << DEFBOOL) | (1L << DEFBYTE) | (1L << DEFDATE) | (1L << DEFDBL) | (1L << DEFDEC) | (1L << DEFCUR) | (1L << DEFINT) | (1L << DEFLNG) | (1L << DEFOBJ) | (1L << DEFSNG) | (1L << DEFSTR) | (1L << DEFVAR) | (1L << DELETESETTING) | (1L << DIM) | (1L << DO) | (1L << DOUBLE) | (1L << EACH) | (1L << ELSE) | (1L << ELSEIF) | (1L << END))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (ENUM - 64)) | (1L << (EQV - 64)) | (1L << (ERASE - 64)) | (1L << (ERROR - 64)) | (1L << (EVENT - 64)) | (1L << (EXIT_DO - 64)) | (1L << (EXIT_FOR - 64)) | (1L << (EXIT_FUNCTION - 64)) | (1L << (EXIT_PROPERTY - 64)) | (1L << (EXIT_SUB - 64)) | (1L << (FALSE - 64)) | (1L << (FILECOPY - 64)) | (1L << (FRIEND - 64)) | (1L << (FOR - 64)) | (1L << (FUNCTION - 64)) | (1L << (GET - 64)) | (1L << (GLOBAL - 64)) | (1L << (GOSUB - 64)) | (1L << (GOTO - 64)) | (1L << (IF - 64)) | (1L << (IMP - 64)) | (1L << (IMPLEMENTS - 64)) | (1L << (IN - 64)) | (1L << (INPUT - 64)) | (1L << (IS - 64)) | (1L << (INTEGER - 64)) | (1L << (KILL - 64)) | (1L << (LOAD - 64)) | (1L << (LOCK - 64)) | (1L << (LONG - 64)) | (1L << (LOOP - 64)) | (1L << (LEN - 64)) | (1L << (LET - 64)) | (1L << (LIB - 64)) | (1L << (LIKE - 64)) | (1L << (LINE_INPUT - 64)) | (1L << (LSET - 64)) | (1L << (MACRO_IF - 64)) | (1L << (ME - 64)) | (1L << (MID - 64)) | (1L << (MKDIR - 64)) | (1L << (MOD - 64)) | (1L << (NAME - 64)) | (1L << (NEXT - 64)) | (1L << (NEW - 64)) | (1L << (NOT - 64)) | (1L << (NOTHING - 64)) | (1L << (NULL - 64)) | (1L << (ON - 64)) | (1L << (ON_ERROR - 64)) | (1L << (OPEN - 64)) | (1L << (OPTIONAL - 64)) | (1L << (OR - 64)))) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & ((1L << (OUTPUT - 128)) | (1L << (PARAMARRAY - 128)) | (1L << (PRESERVE - 128)) | (1L << (PRINT - 128)) | (1L << (PRIVATE - 128)) | (1L << (PROPERTY_GET - 128)) | (1L << (PROPERTY_LET - 128)) | (1L << (PROPERTY_SET - 128)) | (1L << (PUBLIC - 128)) | (1L << (PUT - 128)) | (1L << (RANDOM - 128)) | (1L << (RANDOMIZE - 128)) | (1L << (RAISEEVENT - 128)) | (1L << (READ - 128)) | (1L << (REDIM - 128)) | (1L << (REM - 128)) | (1L << (RESET - 128)) | (1L << (RESUME - 128)) | (1L << (RETURN - 128)) | (1L << (RMDIR - 128)) | (1L << (RSET - 128)) | (1L << (SAVEPICTURE - 128)) | (1L << (SAVESETTING - 128)) | (1L << (SEEK - 128)) | (1L << (SELECT - 128)) | (1L << (SENDKEYS - 128)) | (1L << (SET - 128)) | (1L << (SETATTR - 128)) | (1L << (SHARED - 128)) | (1L << (SINGLE - 128)) | (1L << (SPC - 128)) | (1L << (STATIC - 128)) | (1L << (STEP - 128)) | (1L << (STOP - 128)) | (1L << (STRING - 128)) | (1L << (SUB - 128)) | (1L << (TAB - 128)) | (1L << (TEXT - 128)) | (1L << (THEN - 128)) | (1L << (TIME - 128)) | (1L << (TO - 128)) | (1L << (TRUE - 128)) | (1L << (TYPE - 128)) | (1L << (TYPEOF - 128)) | (1L << (UNLOAD - 128)) | (1L << (UNLOCK - 128)) | (1L << (UNTIL - 128)) | (1L << (VARIANT - 128)) | (1L << (VERSION - 128)) | (1L << (WEND - 128)) | (1L << (WHILE - 128)) | (1L << (WIDTH - 128)) | (1L << (WITH - 128)) | (1L << (WITHEVENTS - 128)) | (1L << (WRITE - 128)) | (1L << (XOR - 128)))) != 0) || _la==L_SQUARE_BRACKET || _la==IDENTIFIER) {
				{
				State = 333; moduleBody();
				}
			}

			State = 339;
			ErrorHandler.Sync(this);
			_la = TokenStream.La(1);
			while (_la==NEWLINE) {
				{
				{
				State = 336; Match(NEWLINE);
				}
				}
				State = 341;
				ErrorHandler.Sync(this);
				_la = TokenStream.La(1);
			}
			State = 343;
			_la = TokenStream.La(1);
			if (_la==WS) {
				{
				State = 342; Match(WS);
				}
			}

			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
        protected void GetExtensions()
        {
            try
            {
                string fileCheck = Localization.GetString("StoreFile", LocalResourceFile);
                string postData  = "";
                Stream oStream;
                Dictionary <string, string> settings = PortalController.Instance.GetPortalSettings(ModuleContext.PortalId);
                var    ps       = new PortalSecurity();
                string username = ps.DecryptString(settings["Store_Username"], Config.GetDecryptionkey());
                string password = ps.DecryptString(settings["Store_Password"], Config.GetDecryptionkey());
                postData = postData + "username="******"&password="******"POST";
                // Create POST data and convert it to a byte array.
                byte[] byteArray = Encoding.UTF8.GetBytes(postData);

                request.ContentType   = "application/x-www-form-urlencoded";
                request.ContentLength = byteArray.Length;

                Stream dataStream = request.GetRequestStream();
                dataStream.Write(byteArray, 0, byteArray.Length);
                dataStream.Close();

                WebResponse response = request.GetResponse();
                oStream = response.GetResponseStream();
                XmlTextReader oReader;
                XPathDocument oXMLDocument;
                oReader = new XmlTextReader((oStream));


                var dt = new DataTable();
                //instance of a datarow
                DataRow drow;
                //creating two datacolums Column1 and Column2
                var dcol1 = new DataColumn("Package", typeof(string));
                var dcol2 = new DataColumn("Filename", typeof(string));
                var dcol3 = new DataColumn("Download", typeof(string));

                var dcol4 = new DataColumn("Deploy", typeof(string));
                //adding datacolumn to datatable
                dt.Columns.Add(dcol1);
                dt.Columns.Add(dcol2);
                dt.Columns.Add(dcol3);
                dt.Columns.Add(dcol4);
                oReader.XmlResolver = null;
                try
                {
                    oXMLDocument = new XPathDocument(oReader);
                }
                catch (Exception)
                {
                    grdSnow.EmptyDataText = LocalizeString("NoData");
                    grdSnow.DataBind();
                    return;
                }

                var nav = oXMLDocument.CreateNavigator();
                var orderDetailIterator = nav.Select("orders/order/orderdetails/orderdetail");
                var i = 0;
                while (orderDetailIterator.MoveNext())
                {
                    var packageName = orderDetailIterator.Current.GetAttribute("packagename", "").Replace("'", "''").Trim();

                    var filesIterator = orderDetailIterator.Current.Select("files/file");
                    while (filesIterator.MoveNext())
                    {
                        //instance of a datarow
                        drow = dt.NewRow();
                        //add rows to datatable
                        dt.Rows.Add(drow);
                        var fileName = filesIterator.Current.GetAttribute("filename", "");
                        var fileId   = filesIterator.Current.GetAttribute("fileid", "");
                        var deploy   = filesIterator.Current.GetAttribute("deploy", "");
                        //add Column values
                        dt.Rows[i][dcol1] = packageName;
                        dt.Rows[i][dcol2] = fileName;

                        var portalSettings = PortalController.Instance.GetCurrentPortalSettings();
                        dt.Rows[i][dcol3] = "<a class='dnnPrimaryAction' href='" +
                                            Globals.NavigateURL(portalSettings.ActiveTab.TabID, Null.NullString,
                                                                "fileAction",
                                                                "download", "fileid", fileId) + "'>" +
                                            LocalizeString("download") + "</a>";


                        if (deploy == "true")
                        {
                            dt.Rows[i][dcol4] = "<a class='dnnPrimaryAction' href=" + "\"" +
                                                ModuleContext.EditUrl("fileID", fileId, "Download", "package",
                                                                      Server.UrlPathEncode(packageName)) + "\"" + ">" +
                                                LocalizeString("deploy") + "</a>";
                        }
                        else
                        {
                            dt.Rows[i][dcol4] = "N/A";
                        }
                        i = i + 1;
                    }
                }

                grdSnow.DataSource = dt;
                grdSnow.DataBind();
            }
            catch (Exception)
            {
                grdSnow.EmptyDataText = LocalizeString("NoData");
                grdSnow.DataBind();
            }
        }
 JavaCollectionClassDef(ModuleContext moduleContext, string name, Class type)
 {
     super(moduleContext, name, type);
 }
예제 #34
0
 public override Type GeneratedType(ModuleContext context) => realizedType.GeneratedType(context);
예제 #35
0
 public Module(ModuleContext context)
     : base(context)
 {
 }
예제 #36
0
 public override IFieldAccessFactory FindField(ModuleContext context, string fieldName)
 {
     EnsureFields();
     return(realizedType.FindField(context, fieldName));
 }
예제 #37
0
        public void Load(HostContext context)
        {
            _logger.LogInformation($"Find {_infos.Count} modules.");

            var moduleTypes = new List <Type>();

            // 默认程序集中的模块
            foreach (var item in AssemblyLoadContext.Default.Assemblies)
            {
                foreach (var type in item.GetTypes().Where(t => typeof(IModule).IsAssignableFrom(t) && !t.IsAbstract))
                {
                    _logger.LogInformation("Found module " + type.Name);

                    moduleTypes.Add(type);
                }
            }

            foreach (var info in _infos)
            {
                var moduleContext = new ModuleContext();
                moduleContext.Info = info;

                var loader = PluginLoader.CreateFromAssemblyFile(info.GetAssemblyFilePath(),
                                                                 // this ensures that the plugin resolves to the same version of DependencyInjection
                                                                 // and ASP.NET Core that the current app uses
                                                                 config =>
                {
                    config.DefaultContext    = _moduleLoadContext;
                    config.EnableHotReload   = true;
                    config.PreferSharedTypes = true;
                });

                loader.Reloaded += Loader_Reloaded;

                moduleContext.Loader = loader;
                moduleContext.Assemblies.Add(loader.LoadDefaultAssembly());

                foreach (var name in info.ReferencedAssemblies)
                {
                    var aasembly = loader.LoadAssemblyFromPath(Path.Combine(info.DirectoryPath, name));

                    moduleContext.Assemblies.Add(aasembly);
                }

                foreach (var item in moduleContext.Assemblies)
                {
                    foreach (var type in item.GetTypes().Where(t => typeof(IModule).IsAssignableFrom(t) && !t.IsAbstract))
                    {
                        _logger.LogInformation("Found module " + type.Name);

                        moduleTypes.Add(type);
                    }
                }

                _moduleContexts.Add(moduleContext);
            }

            moduleTypes = moduleTypes.Union(FindAllDependedTypes(moduleTypes)).ToList();

            moduleTypes = moduleTypes.SortByDependencies(x => FindDependedModuleTypes(x));

            moduleTypes.ForEach(c =>
            {
                _modules.Add((IModule)Activator.CreateInstance(c));
            });

            // 注册约定
            foreach (var module in _modules)
            {
                module.ConfigureConventions();
            }

            foreach (var item in _moduleContexts)
            {
                // 按照约定注册程序集
                foreach (var assembly in item.Assemblies)
                {
                    ConventionManager.RegisterAssembly(assembly);
                }
            }

            // 加载模块的依赖注入注册
            foreach (var startup in _modules)
            {
                startup.ConfigureServices(context);
            }
        }
예제 #38
0
 public IEnumerable <StructuralError> TryImportFunctions(ModuleContext context) =>
 Enumerable.Empty <StructuralError>();
예제 #39
0
 JavaMapClassDef(ModuleContext moduleContext, string name, Class type)
 {
     super(moduleContext, name, type);
 }
예제 #40
0
 public override void Generate(ModuleContext context)
 {
     context.Add(new ByteCode {
         opCode = ByteCode.OpCode.Push, opArg = context.vm.GetString(value)
     });
 }
예제 #41
0
 private void Cancel_Click(object sender, EventArgs e)
 {
     Response.Redirect(ModuleContext.NavigateUrl(TabId, string.Empty, false, null));
 }
예제 #42
0
 protected void cmdGenerateEmail_Click(object sender, EventArgs e)
 {
     SaveSettings();
     Response.Redirect(ModuleContext.EditUrl("tracking", "true", "GenerateXsl"), true);
 }
예제 #43
0
 public void OnInstalling(ModuleContext moduleContext, ControllerContext controllerContext)
 {
     // Add code here that will be executed when the module installing.
     // Installing UI template is defined in the module.config
     WriteText(moduleContext, "OnInstalling");
 }
        public async Task <IActionResult> InvokeAction(HttpContext httpContext, string controllerNamespace, string controllerName, string actionName, ActionContext actionContext, ModuleContext moduleContext = null)
        {
            IActionResult result = null;

            var targetController = _allControllers.FirstOrDefault(c => c.Namespace == controllerNamespace && c.Name == controllerName + ControllerTypeNameSuffix);

            if (targetController == null)
            {
                throw new Exception("Controller not found");
            }

            var targetAction = targetController.GetMethods().FirstOrDefault(m => m.Name == actionName);

            if (targetAction == null)
            {
                throw new Exception("Action not found");
            }

            var executor = _cache.GetExecutor(targetAction, targetController);

            var actionArguments = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            foreach (var param in actionContext.ActionDescriptor.Parameters)
            {
                if (actionContext.RouteData.Values.ContainsKey(param.Name))
                {
                    actionArguments.Add(param.Name, actionContext.RouteData.Values[param.Name]);
                }
            }

            var arguments = PrepareArguments(actionArguments, executor);

            var returnType = executor.MethodReturnType;

            var controllerContext = new ControllerContext(actionContext);

            //var controller1 = _controllerFactory.CreateController(controllerContext);

            //var serviceProvider = httpContext.RequestServices;

            if (!(httpContext.RequestServices.GetService(targetController.AsType()) is Controller controller))
            {
                return(null);
            }

            controller.ControllerContext = controllerContext;
            if (controller is ModuleController moduleController && moduleContext != null)
            {
                moduleController.ModuleContext = moduleContext;
            }
            //var controller = _typeActivatorCache.CreateInstance<object>(serviceProvider, targetController.AsType()); //Returns

            //foreach (var propertyActivator in _propertyActivators)
            //{
            //    propertyActivator.Activate(controllerContext, controller);
            //}

            //((Deviser.Core.Library.Controllers.DeviserController)controller).TempData = new TempDataDictionary()

            if (returnType == typeof(void))
            {
                executor.Execute(controller, arguments);
                result = new EmptyResult();
            }
            else if (returnType == typeof(Task))
            {
                await(Task) executor.Execute(controller, arguments);
                result = new EmptyResult();
            }
            else if (executor.TaskGenericType == typeof(IActionResult))
            {
                result = await(Task <IActionResult>) executor.Execute(controller, arguments);
                if (result == null)
                {
                    throw new InvalidOperationException(
                              Resources.FormatActionResult_ActionReturnValueCannotBeNull(typeof(IActionResult)));
                }
            }
            else if (executor.IsTypeAssignableFromIActionResult)
            {
                if (executor.IsMethodAsync)
                {
                    result = (IActionResult)await executor.ExecuteAsync(controller, arguments);
                }
                else
                {
                    result = (IActionResult)executor.Execute(controller, arguments);
                }

                if (result == null)
                {
                    throw new InvalidOperationException(
                              Resources.FormatActionResult_ActionReturnValueCannotBeNull(
                                  executor.TaskGenericType ?? returnType));
                }
            }
            else if (!executor.IsMethodAsync)
            {
                var resultAsObject = executor.Execute(controller, arguments);
                result = new ObjectResult(resultAsObject)
                {
                    DeclaredType = returnType,
                };
            }
            else if (executor.TaskGenericType != null)
            {
                var resultAsObject = await executor.ExecuteAsync(controller, arguments);

                result = new ObjectResult(resultAsObject)
                {
                    DeclaredType = executor.TaskGenericType,
                };
            }
            else
            {
                // This will be the case for types which have derived from Task and Task<T> or non Task types.
                throw new InvalidOperationException(Resources.FormatActionExecutor_UnexpectedTaskInstance(
                                                        executor.MethodInfo.Name,
                                                        executor.MethodInfo.DeclaringType));
            }

            ((IDisposable)controller).RegisterForDispose(httpContext);

            return(result);
        }
예제 #45
0
 public void OnIncluded(ModuleContext moduleContext)
 {
     // Add code here that will be executed when the module was included to the site.
     WriteText(moduleContext, "OnIncluded");
 }
예제 #46
0
 public void Initialize(ModuleContext ctx)
 {
 }
예제 #47
0
 public void OnReinstalling(ModuleContext moduleContext, ControllerContext controllerContext, InstallationContext installationContext)
 {
     // Add code here that will be executed when the module reinstalling.
     // To use custom UI during reinstalling, define the view location in the module.config
     WriteText(moduleContext, "OnReinstalling");
 }
예제 #48
0
        /// <summary>
        /// Friend class: LanguageContext 
        /// Shouldn't be public since the module contexts are baked into code contexts in the case the module is optimized.
        /// </summary>
        internal ModuleContext SetModuleContext(ContextId languageContextId, ModuleContext moduleContext) {
            if (languageContextId.Id >= _moduleContexts.Length) {
                Array.Resize(ref _moduleContexts, languageContextId.Id + 1);
            }

            ModuleContext original = Interlocked.CompareExchange<ModuleContext>(ref _moduleContexts[languageContextId.Id],
                moduleContext,
                null);

            return original ?? moduleContext;
        }
예제 #49
0
        private SemanticItem _param_evaluation(ModuleContext context)
        {
            var evaluation = context.GetAnswer(Question.HowToEvaluate, _body.InputHistory.Last());

            return(evaluation);
        }