Beispiel #1
0
 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;
 }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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));
            }
        }
Beispiel #5
0
 public virtual bool UpdateWebsiteFiles(IExtensionContext context)
 {
     return(false);
 }
Beispiel #6
0
 public virtual void RemoveWebsiteFiles(IExtensionContext context)
 {
 }
Beispiel #7
0
 public ExtenderScope(IExtensionContext ctx) : this(ctx, new ExtenderRegistry(ctx.Extensions))
 {
 }
 public ContextExtension(IExtensionContext context)
     : base()
 {
     _context = context;
 }