public EntityCollisionSystem(IScriptManager scriptManager) : base(Aspect.All(typeof(Position), typeof(CollisionBox), typeof(Script))) { _scriptManager = scriptManager; }
public EnemySystem(IScriptManager scriptManager) : base(Aspect.All(typeof(Hostile), typeof(Position), typeof(CollisionBox))) { _scriptManager = scriptManager; }
public void Initialize() { var container = TestBase.ConstructContainerForTests(); var mr = container.Resolve <IMouseRobot>(); ScriptManager = container.Resolve <IScriptManager>(); }
private void TransferToCurrentPage(Page page) { HttpRequest requestInternal = page.RequestInternal; if (requestInternal == null) { throw new InvalidOperationException(System.Web.SR.GetString("PropertyCannotBeNull", new object[] { "WebPartManager.Page.Request" })); } string currentExecutionFilePath = requestInternal.CurrentExecutionFilePath; if ((page.Form == null) || string.Equals(page.Form.Method, "post", StringComparison.OrdinalIgnoreCase)) { string clientQueryString = page.ClientQueryString; if (!string.IsNullOrEmpty(clientQueryString)) { currentExecutionFilePath = currentExecutionFilePath + "?" + clientQueryString; } } IScriptManager scriptManager = page.ScriptManager; if ((scriptManager != null) && scriptManager.IsInAsyncPostBack) { requestInternal.Response.Redirect(currentExecutionFilePath); } else { page.Server.Transfer(currentExecutionFilePath, false); } }
private void CompileAndExecute(string file, string[] args, string[] strReferenceAssembliesToAdd, IScriptManagerCallback callback) { try { //Create an AppDomain to compile and execute the code //This enables us to cancel the execution if needed executionDomain = AppDomain.CreateDomain("ExecutionDomain"); IScriptManager manager = (IScriptManager)executionDomain.CreateInstanceFromAndUnwrap(typeof(BaseApp).Assembly.Location, typeof(ScriptManager).FullName); manager.CompileAndExecuteFile(file, args, strReferenceAssembliesToAdd, this); } catch (UnsupportedLanguageExecption e) { ShowErrorMessage("UnsupportedLanguage (from resource):" + e.Extension); } catch (AppDomainUnloadedException e) { System.Diagnostics.Trace.WriteLine(e.Message); } catch (Exception e) { ShowErrorMessage(e.Message); } TerminateExecutionLoop(); }
public ShellViewModel(IHighlightingDefinition highlighting, IScriptManager scriptManager) { _highlighting = highlighting; _scriptManager = scriptManager; DisplayName = "ScriptCsPad"; StatusBar = new StatusBarViewModel(); }
protected override void Awake() { base.Awake(); this.AssertRequiredObjects(buttonsContainer, playButtonPrototype); Player = Engine.GetService <IScriptPlayer>(); ScriptManager = Engine.GetService <IScriptManager>(); }
private static void HandleEngineInitialized() { if (!(Engine.Behaviour is RuntimeBehaviour)) { return; } if (configuration is null) { configuration = ProjectConfigurationProvider.LoadOrDefault <ScriptsConfiguration>(); } if (editorResources is null) { editorResources = EditorResources.LoadOrDefault(); } if (!configuration.HotReloadScripts) { return; } scriptManager = Engine.GetService <IScriptManager>(); player = Engine.GetService <IScriptPlayer>(); stateManager = Engine.GetService <IStateManager>(); player.OnPlay += HandleStartPlaying; }
public GoogleAnalyticsFilter( IOptions <PlatoGoogleOptions> googleOptionsAccessor, IScriptManager scriptManager) { _googleOptions = googleOptionsAccessor.Value; _scriptManager = scriptManager; }
public ScriptController(EphItContext dbContext, IEphItUser ephItUser, IUserAuthorization userAuth, IScriptManager scriptManager) { _dbContext = dbContext; _ephItUser = ephItUser; _userAuth = userAuth; _scriptManager = scriptManager; }
public BarclaysLoginManager( IBrowserBot browserBot, IScriptManager scriptManager) { this.browserBot = browserBot; this.scriptManager = scriptManager; }
public LloydsLoginManager( IBrowserBot browserBot, IScriptManager scriptManager) { _browserBot = browserBot; _scriptManager = scriptManager; }
// Transfers execution to a new instance of the same page. We need to clear the form collection, // since it should not carry over to the page in the new scope (i.e. ViewState). If the form // method is GET, then we must not include the query string, since the entire form collection // is in the query string. If the form method is POST (or there is no form), then we must // include the query string, since the developer could be using the query string to drive the // logic of their page (VSWhidbey 444385 and 527117). private void TransferToCurrentPage(Page page) { HttpRequest request = page.RequestInternal; if (request == null) { throw new InvalidOperationException(SR.GetString(SR.PropertyCannotBeNull, "WebPartManager.Page.Request")); } string path = request.CurrentExecutionFilePath; if (page.Form == null || String.Equals(page.Form.Method, "post", StringComparison.OrdinalIgnoreCase)) { string queryString = page.ClientQueryString; if (!String.IsNullOrEmpty(queryString)) { path += "?" + queryString; } } IScriptManager scriptManager = page.ScriptManager; if ((scriptManager != null) && scriptManager.IsInAsyncPostBack) { request.Response.Redirect(path); } else { page.Server.Transfer(path, /* preserveForm */ false); } }
public static int GetIndex(this Command command, IScriptManager ScriptManager) { var script = ScriptManager.GetScriptFromCommand(command); var node = script.Commands.GetNodeFromValue(command); return(node.parent.IndexOf(command)); }
public DeployService(ILogger <DeployService> logger, IFeedbackChannel feedbackChannel, IScriptManager scriptManager) { _logger = logger; _feedbackChannel = feedbackChannel; _config = new DeployServiceConfiguration(); _scriptManager = scriptManager; }
public LloydsAccountManager( IBrowserBot browserBot, IScriptManager scriptManager) { this.browserBot = browserBot; this.scriptManager = scriptManager; }
public DatePickerTagHelper( IAssetManager assetManager, IScriptManager scriptManager) { _scriptManager = scriptManager; // Register JavasScript and CSS with asset manager assetManager.SetAssets(new List <AssetEnvironment> { new AssetEnvironment(TargetEnvironment.Development, new List <Asset>() { new Asset() { Url = "/css/vendors/bootstrap-datepicker.css", Type = AssetType.IncludeCss, Section = AssetSection.Header }, new Asset() { Url = "/js/vendors/bootstrap-datepicker.js", Type = AssetType.IncludeJavaScript, Section = AssetSection.Footer } }), new AssetEnvironment(TargetEnvironment.Staging, new List <Asset>() { new Asset() { Url = "/css/vendors/bootstrap-datepicker.css", Type = AssetType.IncludeCss, Section = AssetSection.Header }, new Asset() { Url = "/js/vendors/bootstrap-datepicker.js", Type = AssetType.IncludeJavaScript, Section = AssetSection.Footer } }), new AssetEnvironment(TargetEnvironment.Production, new List <Asset>() { new Asset() { Url = "/css/vendors/bootstrap-datepicker.css", Type = AssetType.IncludeCss, Section = AssetSection.Header }, new Asset() { Url = "/js/vendors/bootstrap-datepicker.js", Type = AssetType.IncludeJavaScript, Section = AssetSection.Footer } }) }); }
public HeartbeatSystem(IScriptManager scriptManager, EntityWorld world) : base(Aspect.All(typeof(Heartbeat), typeof(Script))) { _scriptManager = scriptManager; _world = world; }
public ScriptPlaylist(Script script, IScriptManager scriptManager = null) { ScriptName = script.Name; var localizationScript = scriptManager?.GetLocalizationScriptFor(script); var commands = script.ExtractCommands(localizationScript); AddRange(commands); }
/// <summary> /// Initializes a new instance of the <see cref="MigrationManager"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="scriptManager">Provides the ability to invoke scripts.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null /// or /// <paramref name="scriptManager"/> is null. /// </exception> public MigrationManager(IMigrationService service, IScriptManager scriptManager) { scriptManager.AssertNotNull(nameof(scriptManager)); service.AssertNotNull(nameof(service)); this.scriptManager = scriptManager; this.service = service; }
protected override void Awake () { base.Awake(); scriptManager = Engine.GetService<IScriptManager>(); titleScriptName = scriptManager.Configuration.TitleScript; scriptPlayer = Engine.GetService<IScriptPlayer>(); }
internal CacheManager(IEngine engine, IScriptManager scriptManager, FilePath configDllPath, FilePath configHashPath, FilePath outputScriptPath) { _engine = engine; _scriptManager = scriptManager; ConfigDllPath = configDllPath; ConfigHashPath = configHashPath; OutputScriptPath = outputScriptPath; }
private void RegisterStartupScript(string clientID) { string menuItemStyleCss = String.Empty; string menuItemHoverStyleCss = String.Empty; Style itemStyle = _menuUser.ItemStyle; if (itemStyle != null) { menuItemStyleCss = itemStyle.GetStyleAttributes(_menuUser.UrlResolver).Value; } Style itemHoverStyle = _menuUser.ItemHoverStyle; if (itemHoverStyle != null) { menuItemHoverStyleCss = itemHoverStyle.GetStyleAttributes(_menuUser.UrlResolver).Value; } string labelHoverColor = String.Empty; string labelHoverClass = String.Empty; Style labelHoverStyle = _menuUser.LabelHoverStyle; if (labelHoverStyle != null) { Color foreColor = labelHoverStyle.ForeColor; if (foreColor.IsEmpty == false) { labelHoverColor = ColorTranslator.ToHtml(foreColor); } labelHoverClass = labelHoverStyle.RegisteredCssClass; } // Using concatenation instead of String.Format for perf // (here, the compiler will build an object[] and call String.Concat only once). string script = @" <script type=""text/javascript""> var menu" + clientID + " = new WebPartMenu(document.getElementById('" + clientID + "'), document.getElementById('" + clientID + "Popup'), document.getElementById('" + clientID + @"Menu')); menu" + clientID + ".itemStyle = '" + Util.QuoteJScriptString(menuItemStyleCss) + @"'; menu" + clientID + ".itemHoverStyle = '" + Util.QuoteJScriptString(menuItemHoverStyleCss) + @"'; menu" + clientID + ".labelHoverColor = '" + labelHoverColor + @"'; menu" + clientID + ".labelHoverClassName = '" + labelHoverClass + @"'; </script> "; if (_menuUser.Page != null) { _menuUser.Page.ClientScript.RegisterStartupScript((Control)_menuUser, typeof(WebPartMenu), clientID, script, false); IScriptManager scriptManager = _menuUser.Page.ScriptManager; if ((scriptManager != null) && scriptManager.SupportsPartialRendering) { scriptManager.RegisterDispose((Control)_menuUser, "document.getElementById('" + clientID + "').__menu.Dispose();"); } } }
public ScriptEditor() { _scriptManager = IoC.Get<IScriptManager>(); ShowLineNumbers = true; TextArea.TextEntering += OnTextEntering; TextArea.TextEntered += OnTextEntered; }
public ScriptEditor() { _scriptManager = IoC.Get <IScriptManager>(); ShowLineNumbers = true; TextArea.TextEntering += OnTextEntering; TextArea.TextEntered += OnTextEntered; }
protected override void Awake() { base.Awake(); syncImage = GetComponentInChildren <Image>(); this.AssertRequiredObjects(syncImage); scriptManager = Engine.GetService <IScriptManager>(); UIComponent.interactable = false; }
protected override void Awake() { base.Awake(); scriptManager = Engine.GetService <IScriptManager>(); startScriptName = scriptManager.StartGameScriptName; titleScriptName = scriptManager.Configuration.TitleScript; titleMenu = GetComponentInParent <TitleMenu>(); scriptPlayer = Engine.GetService <IScriptPlayer>(); stateManager = Engine.GetService <IStateManager>(); Debug.Assert(titleMenu && scriptPlayer != null); }
internal void RegisterExpandoAttribute(Control control, string controlId, string attributeName, string attributeValue, bool encode) { IScriptManager scriptManager = this._owner.ScriptManager; if ((scriptManager != null) && scriptManager.SupportsPartialRendering) { scriptManager.RegisterExpandoAttribute(control, controlId, attributeName, attributeValue, encode); } else { this.RegisterExpandoAttribute(controlId, attributeName, attributeValue, encode); } }
internal void RegisterHiddenField(Control control, string hiddenFieldName, string hiddenFieldValue) { IScriptManager scriptManager = this._owner.ScriptManager; if ((scriptManager != null) && scriptManager.SupportsPartialRendering) { scriptManager.RegisterHiddenField(control, hiddenFieldName, hiddenFieldValue); } else { this.RegisterHiddenField(hiddenFieldName, hiddenFieldValue); } }
internal void RegisterOnSubmitStatement(Control control, Type type, string key, string script) { IScriptManager scriptManager = this._owner.ScriptManager; if ((scriptManager != null) && scriptManager.SupportsPartialRendering) { scriptManager.RegisterOnSubmitStatement(control, type, key, script); } else { this.RegisterOnSubmitStatement(type, key, script); } }
internal void RegisterStartupScript(Control control, Type type, string key, string script, bool addScriptTags) { IScriptManager scriptManager = this._owner.ScriptManager; if ((scriptManager != null) && scriptManager.SupportsPartialRendering) { scriptManager.RegisterStartupScript(control, type, key, script, addScriptTags); } else { this.RegisterStartupScript(type, key, script, addScriptTags); } }
public MainPresenter(IMainView view,IScriptManager sm) { _mainForm = view; _sm = sm; _mainForm.FormLoad += _mainForm_FormLoad; _mainForm.ScriptPanelActionClick += _mainForm_ScriptPanelActionClick; _mainForm.ScriptPanelCheckedChanged += _mainForm_ScriptPanelCheckedChanged; _mainForm.ScriptPanelDragDrop += _mainForm_ScriptPanelDragDrop; _mainForm.AddFileToolstripClick += _mainForm_AddFileToolstripClick; _mainForm.AddFolderToolstripClick += _mainForm_AddFolderToolstripClick; _mainForm.FormStop += _mainForm_FormClosing; StartLoop(); }
public RecordingManager(IScriptManager ScriptManager, ISettingsManager SettingsManager, ICroppingManager CroppingManager, IAssetManager AssetManager, IProfiler Profiler, IFeatureDetectorFactory FeatureDetectorFactory, IInputCallbacks InputCallbacks) { this.ScriptManager = ScriptManager; this.SettingsManager = SettingsManager; this.CroppingManager = CroppingManager; this.AssetManager = AssetManager; this.Profiler = Profiler; this.FeatureDetectorFactory = FeatureDetectorFactory; this.InputCallbacks = InputCallbacks; InputCallbacks.InputEvent += OnInputEvent; }
public MainForm(IPathResolver pathResolver, IScriptManager scriptManager, Settings settings) { m_settings = settings; m_pathResolver = pathResolver; m_scriptMgr = scriptManager; InitializeComponent(); // Window manager m_windowMgr = new WindowManager(m_pathResolver, dockPanel, m_settings); m_windowMgr.OnCaretChanged += new EventHandler<CaretChangedEventArgs>(WindowManagerOnCaretChanged); // Post component initialization openFileDialog.InitialDirectory = m_pathResolver.BaseDirectory; // Load output window m_outputContent = new OutputContentBox(); m_outputContent.Show(dockPanel, DockState.DockBottom); // Load error window m_errorContent = new ErrorContentBox(); m_errorContent.Show(dockPanel, DockState.DockBottom); m_errorContent.ErrorSelected += new EventOnErrorSelected(OnErrorSelected); // Adjust bottom panel dockPanel.DockBottomPortion = m_settings.DockBottom; dockPanel.DockRightPortion = m_settings.DockRight; dockPanel.DockLeftPortion = m_settings.DockLeft; dockPanel.DockTopPortion = m_settings.DockTop; // Attach event handlers m_scriptMgr.CompileFinished += new EventHandler(OnCompileFinished); m_scriptMgr.CompileInterrupted += new EventHandler(OnCompileInterrupted); m_scriptMgr.CompileStarting += new EventHandler(OnCompileStarting); m_scriptMgr.ScriptError += new EventHandler<ScriptErrorEventArgs>(OnScriptError); m_scriptMgr.ScriptOutput += new EventHandler<ScriptOutputEventArgs>(OnScriptOutput); m_scriptMgr.ScriptEngineRestarted += new EventHandler(OnScriptEngineRestarted); m_scriptMgr.ScriptEngineRestarting += new EventHandler(OnScriptEngineRestarting); // Disable Windows-XP default theme; use system colours ToolStripProfessionalRenderer renderer = new ToolStripProfessionalRenderer(); renderer.ColorTable.UseSystemColors = true; renderer.RoundedEdges = true; ToolStripManager.Renderer = renderer; }
public GameManager( EntityWorld world, SpriteBatch spriteBatch, IGraphicsManager graphicsManager, ISystemLoader systemLoader, IScreenManager screenManager, IScreenFactory screenFactory, IInputManager inputManager, ICameraManager cameraManager, IScriptManager scriptManager ) { _world = world; _spriteBatch = spriteBatch; _graphicsManager = graphicsManager; _systemLoader = systemLoader; _screenManager = screenManager; _screenFactory = screenFactory; _inputManager = inputManager; _cameraManager = cameraManager; _scriptManager = scriptManager; }
public ScriptManagerController(IScriptManager scriptManager) { _scriptManager = scriptManager; }
internal static string GetWebResourceUrl(Type type, string resourceName, bool htmlEncoded, IScriptManager scriptManager) { Assembly assemblyFromType = GetAssemblyFromType(type); if (assemblyFromType == typeof(AssemblyResourceLoader).Assembly) { if (string.Equals(resourceName, "WebForms.js", StringComparison.Ordinal)) { if (!_webFormsScriptChecked) { _webFormsScriptLocation = GetDiskResourcePath(resourceName); _webFormsScriptChecked = true; } if (_webFormsScriptLocation != null) { return _webFormsScriptLocation.VirtualPathString; } } else if (string.Equals(resourceName, "WebUIValidation.js", StringComparison.Ordinal)) { if (!_webUIValidationScriptChecked) { _webUIValidationScriptLocation = GetDiskResourcePath(resourceName); _webUIValidationScriptChecked = true; } if (_webUIValidationScriptLocation != null) { return _webUIValidationScriptLocation.VirtualPathString; } } else if (string.Equals(resourceName, "SmartNav.htm", StringComparison.Ordinal)) { if (!_smartNavPageChecked) { _smartNavPageLocation = GetDiskResourcePath(resourceName); _smartNavPageChecked = true; } if (_smartNavPageLocation != null) { return _smartNavPageLocation.VirtualPathString; } } else if (string.Equals(resourceName, "SmartNav.js", StringComparison.Ordinal)) { if (!_smartNavScriptChecked) { _smartNavScriptLocation = GetDiskResourcePath(resourceName); _smartNavScriptChecked = true; } if (_smartNavScriptLocation != null) { return _smartNavScriptLocation.VirtualPathString; } } } return GetWebResourceUrlInternal(assemblyFromType, resourceName, htmlEncoded, false, scriptManager); }
internal static string GetWebResourceUrlInternal(Assembly assembly, string resourceName, bool htmlEncoded, bool forSubstitution, IScriptManager scriptManager) { bool isSecureConnection; EnsureHandlerExistenceChecked(); if (!_handlerExists) { throw new InvalidOperationException(System.Web.SR.GetString("AssemblyResourceLoader_HandlerNotRegistered")); } Assembly resourceAssembly = assembly; string str = resourceName; bool enableCdn = false; bool debuggingEnabled = false; if (scriptManager != null) { enableCdn = scriptManager.EnableCdn; debuggingEnabled = scriptManager.IsDebuggingEnabled; isSecureConnection = scriptManager.IsSecureConnection; } else { isSecureConnection = ((HttpContext.Current != null) && (HttpContext.Current.Request != null)) && HttpContext.Current.Request.IsSecureConnection; } int num = CreateWebResourceUrlCacheKey(assembly, resourceName, htmlEncoded, forSubstitution, enableCdn, debuggingEnabled, isSecureConnection); string s = (string) _urlCache[num]; if (s == null) { IScriptResourceDefinition definition = null; if (ClientScriptManager._scriptResourceMapping != null) { definition = ClientScriptManager._scriptResourceMapping.GetDefinition(resourceName, assembly); if (definition != null) { if (!string.IsNullOrEmpty(definition.ResourceName)) { str = definition.ResourceName; } if (definition.ResourceAssembly != null) { resourceAssembly = definition.ResourceAssembly; } } } string debugPath = null; if (definition != null) { if (enableCdn) { if (debuggingEnabled) { debugPath = isSecureConnection ? definition.CdnDebugPathSecureConnection : definition.CdnDebugPath; if (string.IsNullOrEmpty(debugPath)) { debugPath = definition.DebugPath; if (string.IsNullOrEmpty(debugPath)) { if (!isSecureConnection || string.IsNullOrEmpty(definition.CdnDebugPath)) { debugPath = GetCdnPath(str, resourceAssembly, isSecureConnection); } if (string.IsNullOrEmpty(debugPath)) { debugPath = definition.Path; } } } } else { debugPath = isSecureConnection ? definition.CdnPathSecureConnection : definition.CdnPath; if (string.IsNullOrEmpty(debugPath)) { if (!isSecureConnection || string.IsNullOrEmpty(definition.CdnPath)) { debugPath = GetCdnPath(str, resourceAssembly, isSecureConnection); } if (string.IsNullOrEmpty(debugPath)) { debugPath = definition.Path; } } } } else if (debuggingEnabled) { debugPath = definition.DebugPath; if (string.IsNullOrEmpty(debugPath)) { debugPath = definition.Path; } } else { debugPath = definition.Path; } } else if (enableCdn) { debugPath = GetCdnPath(str, resourceAssembly, isSecureConnection); } if (!string.IsNullOrEmpty(debugPath)) { if (UrlPath.IsAppRelativePath(debugPath)) { if (_applicationRootPath == null) { s = VirtualPathUtility.ToAbsolute(debugPath); } else { s = VirtualPathUtility.ToAbsolute(debugPath, _applicationRootPath); } } else { s = debugPath; } if (htmlEncoded) { s = HttpUtility.HtmlEncode(s); } } else { string str4; Pair assemblyInfo = GetAssemblyInfo(resourceAssembly); AssemblyName first = (AssemblyName) assemblyInfo.First; long second = (long) assemblyInfo.Second; string str5 = first.Version.ToString(); if (resourceAssembly.GlobalAssemblyCache) { if (resourceAssembly == HttpContext.SystemWebAssembly) { str4 = "s"; } else { StringBuilder builder = new StringBuilder(); builder.Append('f'); builder.Append(first.Name); builder.Append(','); builder.Append(str5); builder.Append(','); if (first.CultureInfo != null) { builder.Append(first.CultureInfo.ToString()); } builder.Append(','); byte[] publicKeyToken = first.GetPublicKeyToken(); for (int i = 0; i < publicKeyToken.Length; i++) { builder.Append(publicKeyToken[i].ToString("x2", CultureInfo.InvariantCulture)); } str4 = builder.ToString(); } } else { str4 = "p" + first.Name; } s = FormatWebResourceUrl(str4, str, second, htmlEncoded); if (!forSubstitution && (HttpRuntime.AppDomainAppVirtualPathString != null)) { s = UrlPath.Combine(HttpRuntime.AppDomainAppVirtualPathString, s); } } _urlCache[num] = s; } return s; }
internal static string GetWebResourceUrl(Page owner, Type type, string resourceName, bool htmlEncoded, IScriptManager scriptManager) { if (type == null) { throw new ArgumentNullException("type"); } if (string.IsNullOrEmpty(resourceName)) { throw new ArgumentNullException("resourceName"); } if ((owner == null) || !owner.DesignMode) { return AssemblyResourceLoader.GetWebResourceUrl(type, resourceName, htmlEncoded, scriptManager); } ISite site = owner.Site; if (site != null) { IResourceUrlGenerator service = site.GetService(typeof(IResourceUrlGenerator)) as IResourceUrlGenerator; if (service != null) { return service.GetResourceUrl(type, resourceName); } } return resourceName; }
/// <devdoc> /// Gets a URL resource reference to a client-side resource /// </devdoc> internal static string GetWebResourceUrl(Type type, string resourceName, bool htmlEncoded, IScriptManager scriptManager, bool enableCdn) { Assembly assembly = GetAssemblyFromType(type); Debug.Assert(assembly != null, "Type.Assembly should never be null."); // If the resource request is for System.Web.dll and more specifically // it is for a file that we shipped in v1.x, we have to check if a // customized copy of the file exists. See notes at the top of the file // regarding this. if (assembly == typeof(AssemblyResourceLoader).Assembly) { if (String.Equals(resourceName, "WebForms.js", StringComparison.Ordinal)) { if (!_webFormsScriptChecked) { _webFormsScriptLocation = GetDiskResourcePath(resourceName); _webFormsScriptChecked = true; } if (_webFormsScriptLocation != null) { return _webFormsScriptLocation.VirtualPathString; } } else if (String.Equals(resourceName, "WebUIValidation.js", StringComparison.Ordinal)) { if (!_webUIValidationScriptChecked) { _webUIValidationScriptLocation = GetDiskResourcePath(resourceName); _webUIValidationScriptChecked = true; } if (_webUIValidationScriptLocation != null) { return _webUIValidationScriptLocation.VirtualPathString; } } else if (String.Equals(resourceName, "SmartNav.htm", StringComparison.Ordinal)) { if (!_smartNavPageChecked) { _smartNavPageLocation = GetDiskResourcePath(resourceName); _smartNavPageChecked = true; } if (_smartNavPageLocation != null) { return _smartNavPageLocation.VirtualPathString; } } else if (String.Equals(resourceName, "SmartNav.js", StringComparison.Ordinal)) { if (!_smartNavScriptChecked) { _smartNavScriptLocation = GetDiskResourcePath(resourceName); _smartNavScriptChecked = true; } if (_smartNavScriptLocation != null) { return _smartNavScriptLocation.VirtualPathString; } } } return GetWebResourceUrlInternal(assembly, resourceName, htmlEncoded, false, scriptManager, enableCdn); }
internal static string GetWebResourceUrl(Page owner, Type type, string resourceName, bool htmlEncoded, IScriptManager scriptManager, bool enableCdn) { if (type == null) { throw new ArgumentNullException("type"); } if (String.IsNullOrEmpty(resourceName)) { throw new ArgumentNullException("resourceName"); } if (owner != null && owner.DesignMode) { ISite site = ((IComponent)owner).Site; if (site != null) { IResourceUrlGenerator urlGenerator = site.GetService(typeof(IResourceUrlGenerator)) as IResourceUrlGenerator; if (urlGenerator != null) { return urlGenerator.GetResourceUrl(type, resourceName); } } return resourceName; } else { return AssemblyResourceLoader.GetWebResourceUrl(type, resourceName, htmlEncoded, scriptManager, enableCdn: enableCdn); } }
internal static string GetWebResourceUrl(Page owner, Type type, string resourceName, bool htmlEncoded, IScriptManager scriptManager) { bool enableCdn = scriptManager != null && scriptManager.EnableCdn; return GetWebResourceUrl(owner, type, resourceName, htmlEncoded, scriptManager, enableCdn); }
internal static string GetWebResourceUrlInternal(Assembly assembly, string resourceName, bool htmlEncoded, bool forSubstitution, IScriptManager scriptManager) { bool enableCdn = (scriptManager != null && scriptManager.EnableCdn); return GetWebResourceUrlInternal(assembly, resourceName, htmlEncoded, forSubstitution, scriptManager, enableCdn: enableCdn); }
internal static string GetWebResourceUrlInternal(Assembly assembly, string resourceName, bool htmlEncoded, bool forSubstitution, IScriptManager scriptManager, bool enableCdn) { // When this url is being inserted as a substitution in another resource, // it should just be "WebResource.axd?d=..." since the resource is already coming // from the app root (i.e. no need for a full absolute /app/WebResource.axd). // Otherwise we must return a path that is absolute (starts with '/') or // a full absolute uri (http://..) as in the case of a CDN Path. EnsureHandlerExistenceChecked(); if (!_handlerExists) { throw new InvalidOperationException(SR.GetString(SR.AssemblyResourceLoader_HandlerNotRegistered)); } Assembly effectiveAssembly = assembly; string effectiveResourceName = resourceName; bool debuggingEnabled = false; bool secureConnection; if (scriptManager != null) { debuggingEnabled = scriptManager.IsDebuggingEnabled; secureConnection = scriptManager.IsSecureConnection; } else { secureConnection = ((HttpContext.Current != null) && (HttpContext.Current.Request != null) && HttpContext.Current.Request.IsSecureConnection); debuggingEnabled = (HttpContext.Current != null) && HttpContext.Current.IsDebuggingEnabled; } int urlCacheKey = CreateWebResourceUrlCacheKey(assembly, resourceName, htmlEncoded, forSubstitution, enableCdn, debuggingEnabled, secureConnection); string url = (string)_urlCache[urlCacheKey]; if (url == null) { IScriptResourceDefinition definition = null; if (ClientScriptManager._scriptResourceMapping != null) { definition = ClientScriptManager._scriptResourceMapping.GetDefinition(resourceName, assembly); if (definition != null) { if (!String.IsNullOrEmpty(definition.ResourceName)) { effectiveResourceName = definition.ResourceName; } if (definition.ResourceAssembly != null) { effectiveAssembly = definition.ResourceAssembly; } } } string path = null; // if a resource mapping exists, take it's settings into consideration // it might supply a path or a cdnpath. if (definition != null) { if (enableCdn) { // Winner is first path defined, falling back on the effectiveResourceName/Assembly // Debug Mode : d.CdnDebugPath, d.DebugPath, *wra.CdnPath, d.Path // Release Mode: d.CdnPath , *wra.CdnPath, d.Path // * the WebResourceAttribute corresponding to the resource defined in the definition, not the // the original resource. // Also, if the definition has a CdnPath but it cannot be converted to a secure one during https, // the WRA's CdnPath is not considered. if (debuggingEnabled) { path = secureConnection ? definition.CdnDebugPathSecureConnection : definition.CdnDebugPath; if (String.IsNullOrEmpty(path)) { path = definition.DebugPath; if (String.IsNullOrEmpty(path)) { // Get CDN Path from the redirected resource name/assembly, not the original one, // but not if this is a secure connection and the only reason we didn't use the definition // cdn path is because it doesnt support secure connections. if (!secureConnection || String.IsNullOrEmpty(definition.CdnDebugPath)) { path = GetCdnPath(effectiveResourceName, effectiveAssembly, secureConnection); } if (String.IsNullOrEmpty(path)) { path = definition.Path; } } } } else { path = secureConnection ? definition.CdnPathSecureConnection : definition.CdnPath; if (String.IsNullOrEmpty(path)) { // Get CDN Path from the redirected resource name/assembly, not the original one // but not if this is a secure connection and the only reason we didn't use the definition // cdn path is because it doesnt support secure connections. if (!secureConnection || String.IsNullOrEmpty(definition.CdnPath)) { path = GetCdnPath(effectiveResourceName, effectiveAssembly, secureConnection); } if (String.IsNullOrEmpty(path)) { path = definition.Path; } } } } // cdn else { // Winner is first path defined, falling back on the effectiveResourceName/Assembly // Debug Mode : d.DebugPath, d.Path // Release Mode: d.Path if (debuggingEnabled) { path = definition.DebugPath; if (String.IsNullOrEmpty(path)) { path = definition.Path; } } else { path = definition.Path; } } } // does not have definition else if (enableCdn) { path = GetCdnPath(effectiveResourceName, effectiveAssembly, secureConnection); } if (!String.IsNullOrEmpty(path)) { // assembly based resource has been overridden by a path, // whether that be a CDN Path or a definition.Path or DebugPath. // We must return a path that is absolute (starts with '/') or // a full absolute uri (http://..) as in the case of a CDN Path. // An overridden Path that is not a CDN Path is required to be absolute // or app relative. if (UrlPath.IsAppRelativePath(path)) { // expand ~/. If it is rooted (/) or an absolute uri, no conversion needed if (_applicationRootPath == null) { url = VirtualPathUtility.ToAbsolute(path); } else { url = VirtualPathUtility.ToAbsolute(path, _applicationRootPath); } } else { // must be a full uri or already rooted. url = path; } if (htmlEncoded) { url = HttpUtility.HtmlEncode(url); } } else { string urlAssemblyName; Pair assemblyInfo = GetAssemblyInfo(effectiveAssembly); AssemblyName assemblyName = (AssemblyName)assemblyInfo.First; long assemblyDate = (long)assemblyInfo.Second; string assemblyVersion = assemblyName.Version.ToString(); if (effectiveAssembly.GlobalAssemblyCache) { // If the assembly is in the GAC, we need to store a full name to load the assembly later if (effectiveAssembly == HttpContext.SystemWebAssembly) { urlAssemblyName = "s"; } else { // Pack the necessary values into a more compact format than FullName StringBuilder builder = new StringBuilder(); builder.Append('f'); builder.Append(assemblyName.Name); builder.Append(','); builder.Append(assemblyVersion); builder.Append(','); if (assemblyName.CultureInfo != null) { builder.Append(assemblyName.CultureInfo.ToString()); } builder.Append(','); byte[] token = assemblyName.GetPublicKeyToken(); for (int i = 0; i < token.Length; i++) { builder.Append(token[i].ToString("x2", CultureInfo.InvariantCulture)); } urlAssemblyName = builder.ToString(); } } else { // Otherwise, we can just use a partial name urlAssemblyName = "p" + assemblyName.Name; } url = FormatWebResourceUrl(urlAssemblyName, effectiveResourceName, assemblyDate, htmlEncoded); if (!forSubstitution && (HttpRuntime.AppDomainAppVirtualPathString != null)) { // When this url is being inserted as a substitution in another resource, // it should just be "WebResource.axd?d=..." since the resource is already coming // from the app root (i.e. no need for a full absolute /app/WebResource.axd). url = UrlPath.Combine(HttpRuntime.AppDomainAppVirtualPathString, url); } } _urlCache[urlCacheKey] = url; } return url; }