protected override void WatcherChanged(object sender, FileSystemEventArgs e)
        {
            var path      = e.FullPath;
            var extension = Path.GetExtension(e.FullPath);

            if (extension == ScriptEngines.ScriptExtension)
            {
                if (e.FullPath.StartsWith(ScriptEngines.AppScriptDomain.BaseDirectory, System.StringComparison.CurrentCultureIgnoreCase))
                {
                    //AppScript 剔除
                    return;
                }

                var index = path.LastIndexOf('.');
                path = path.Substring(0, index);
            }

            ScriptAssembly assembly;

            if (e.ChangeType == WatcherChangeTypes.Renamed)
            {
                ScriptAssemblies.TryRemove(path, out assembly);
            }
            else if (ScriptAssemblies.TryGetValue(path, out assembly))
            {
                assembly.Reset();
            }
        }
예제 #2
0
        protected override void WatcherChanged(object sender, FileSystemEventArgs e)
        {
            ScriptAssembly assembly;

            if (e.ChangeType == WatcherChangeTypes.Renamed)
            {
                ScriptAssemblies.TryRemove(e.FullPath, out assembly);
            }
            else if (ScriptAssemblies.TryGetValue(e.FullPath, out assembly))
            {
                assembly.Reset();
            }
        }
예제 #3
0
        public void BeforePluginsLoaded(IAppHost appHost)
        {
            if (ScriptContext == null)
            {
                ScriptContext = appHost.AssertPlugin <SharpPagesFeature>();
            }

            if (!ScriptContext.ScriptLanguages.Contains(ScriptLisp.Language))
            {
                ScriptContext.ScriptLanguages.Add(ScriptLisp.Language);
            }
            if (AllowScriptingOfAllTypes != null)
            {
                ScriptContext.AllowScriptingOfAllTypes = AllowScriptingOfAllTypes.Value;
            }

            if (!ScriptMethods.IsEmpty())
            {
                ScriptContext.ScriptMethods.AddRange(ScriptMethods);
            }
            if (!ScriptBlocks.IsEmpty())
            {
                ScriptContext.ScriptBlocks.AddRange(ScriptBlocks);
            }
            if (!ScanTypes.IsEmpty())
            {
                ScriptContext.ScanTypes.AddRange(ScanTypes);
            }
            if (!ScanAssemblies.IsEmpty())
            {
                ScriptContext.ScanAssemblies.AddRange(ScanAssemblies);
            }

            if (!ScriptAssemblies.IsEmpty())
            {
                ScriptContext.ScriptAssemblies.AddRange(ScriptAssemblies);
            }
            if (!ScriptTypes.IsEmpty())
            {
                ScriptContext.ScriptTypes.AddRange(ScriptTypes);
            }
            if (!ScriptNamespaces.IsEmpty())
            {
                ScriptContext.ScriptNamespaces.AddRange(ScriptNamespaces);
            }
        }