public ExtenderScope(IExtensionContext ctx, ExtenderRegistry newScope) { this.ctx = ctx; this.originalExtensions = this.ctx.Extensions; // If we don't actually have a new scope, then this is a no-op. this.ctx.Extensions = newScope ?? this.originalExtensions; }
protected virtual bool CopyToolsFileToWebsiteBinDirectory([NotNull] IExtensionContext context, [NotNull] string fileName) { var toolsDirectory = context.Configuration.GetToolsDirectory(); var websiteDirectory = context.Configuration.GetWebsiteDirectory(); var sourceFileName = PathHelper.Combine(toolsDirectory, fileName); var targetFileName = PathHelper.Combine(PathHelper.Combine(websiteDirectory, "bin"), Path.GetFileName(fileName)); return(context.FileSystem.CopyIfNewer(sourceFileName, targetFileName)); }
public void Initialize(IExtensionContext context) { IsHookEnabled = true; Context = context; Context.CurrentProjectVersion.GeometryManager.GeometricObjectEntered += OnObjectEntered; Context.ProjectEventSource.ProjectOpened += OnProjectOpened; Context.UIService.AddPromptCommand(new CommandInputItem( new PromptDelegateCommand("HOOKS OFF", () => IsHookEnabled = false, () => IsHookEnabled, "-HOOKS OFF", "Switch OFF the automatic execution of custom \"hook\" scripts after creating new geometric objects."), null)); Context.UIService.AddPromptCommand(new CommandInputItem( new PromptDelegateCommand("HOOKS ON", () => IsHookEnabled = true, () => !IsHookEnabled, "-HOOKS ON", "Switch ON the automatic execution of custom \"hook\" scripts after creating new geometric objects."), null)); PopulateCustomCommands(); }
protected virtual void RemoveWebsiteAssembly([NotNull] IExtensionContext context, [NotNull] string assemblyFileName) { var fileName = Path.Combine(context.Configuration.GetWebsiteDirectory(), "bin\\" + assemblyFileName); if (!context.FileSystem.FileExists(fileName)) { return; } try { context.FileSystem.DeleteFile(fileName); context.Trace.TraceInformation(Texts.Removed__ + PathHelper.UnmapPath(context.Configuration.GetWebsiteDirectory(), fileName)); } catch { context.Trace.TraceInformation(Texts.Failed_to_remove__ + PathHelper.UnmapPath(context.Configuration.GetWebsiteDirectory(), fileName)); } }
public virtual bool UpdateWebsiteFiles(IExtensionContext context) { return(false); }
public virtual void RemoveWebsiteFiles(IExtensionContext context) { }
public ExtenderScope(IExtensionContext ctx) : this(ctx, new ExtenderRegistry(ctx.Extensions)) { }
public ContextExtension(IExtensionContext context) : base() { _context = context; }