private void OnInit() { if (_runMode == RunMode.Playing) { return; } if (_runtime == null) { var logger = new DefaultScriptLogger(); var pathResolver = new PathResolver(); var fileSystem = new DefaultFileSystem(logger); var asyncManager = new DefaultAsyncManager(); _tick = Environment.TickCount; _runtime = ScriptEngine.CreateRuntime(true); _runtime.AddModuleResolvers(); _runtime.extraBinding = (runtime, register) => { FSWatcher.Bind(register); }; _runtime.Initialize(new ScriptRuntimeArgs { fileSystem = fileSystem, pathResolver = pathResolver, asyncManager = asyncManager, logger = logger, byteBufferAllocator = new ByteBufferPooledAllocator(), binder = DefaultBinder.GetBinder(_prefs.reflectBinding), }); _ready = true; } }
/// <summary> /// Initialises a new instance of the JavaScriptPlugin class /// </summary> /// <param name="filename"></param> /// <param name="engine"></param> /// <param name="watcher"></param> internal JavaScriptPlugin(string filename, Engine engine, FSWatcher watcher) { // Store filename Filename = filename; JavaScriptEngine = engine; this.watcher = watcher; }
/// <summary> /// Loads plugin watchers used by this extension /// </summary> /// <param name="pluginDirectory"></param> public override void LoadPluginWatchers(string pluginDirectory) { // Register the watcher watcher = new FSWatcher(pluginDirectory, "*.lua"); Manager.RegisterPluginChangeWatcher(watcher); loader.Watcher = watcher; }
public void OnStart(object service_instance, Type service_type) { this.service_instance = service_instance; this.service_type = service_type; GetCallBacks(); #if DEBUG if (!Debugger.IsAttached) Debugger.Launch(); #endif DataPath = System.Reflection.Assembly.GetExecutingAssembly().Location; DataPath = System.IO.Path.GetDirectoryName(DataPath); pattern = new Regex("^{\"app\":\"core\",\"message\":\"Login failed.*IP:([0-9]+.[0-9]+.[0-9]+.[0-9]+).*}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); ReadSettings(); authFailures = new ConcurrentDictionary<string, int>(); if (ownCloudLogFile == null || ownCloudLogFile.Length == 0) { return; } fswatcher = new FSWatcher(ownCloudLogFile); fswatcher.OnNewLine += new FSWatcher.NewLineEventHandler(fswatcher_OnNewLine); }
public DllLoaderWatcher(string pluginDirectory) { try { Watcher = new FSWatcher(pluginDirectory, "*.dll"); if (!Interface.Oxide.Config.Options.PluginWatchers) { return; } var fileWatcher = GetFileWatcher.GetValue(Watcher) as FileSystemWatcher; var originalWatcherChanged = (FileSystemEventHandler)Delegate.CreateDelegate(typeof(FileSystemEventHandler), Watcher, GetWatcherChange); // ReSharper disable once PossibleNullReferenceException fileWatcher.Changed -= originalWatcherChanged; fileWatcher.Created -= originalWatcherChanged; fileWatcher.Deleted -= originalWatcherChanged; fileWatcher.Changed += OnFileChange; fileWatcher.Created += OnFileChange; fileWatcher.Deleted += OnFileChange; } catch (Exception ex) { Interface.Oxide.LogException("DllLoader fail to patch watcher", ex); } _changeQueue = new Dictionary <string, QueuedChange>(); _timers = Interface.Oxide.GetLibrary <Timer>(); }
/// <summary> /// Loads plugin watchers used by this extension /// </summary> /// <param name="plugindir"></param> public override void LoadPluginWatchers(string plugindir) { // Register the watcher watcher = new FSWatcher(plugindir, "*.js"); Manager.RegisterPluginChangeWatcher(watcher); loader.Watcher = watcher; }
/// <summary> /// Initialises a new instance of the PythonPlugin class /// </summary> /// <param name="filename"></param> /// <param name="engine"></param> /// <param name="watcher"></param> internal PythonPlugin(string filename, ScriptEngine engine, FSWatcher watcher) { // Store filename Filename = filename; PythonEngine = engine; this.watcher = watcher; }
/// <summary> /// Initialises a new instance of the LuaPlugin class /// </summary> /// <param name="filename"></param> internal LuaPlugin(string filename, NLua.Lua lua, FSWatcher watcher) { // Store filename Filename = filename; LuaEnvironment = lua; this.watcher = watcher; }
private static void createWatcher(SQLiteDatabase.WatchedDirInfo winfo) { FSWatcher watcher = new FSWatcher(); watcher.newWatcher(winfo.DirectoryPath, winfo.DirectoryID); FSWatchers.Add(watcher); }
void Awake() { IFileSystem fileSystem; _mConsole = new MiniConsole(scrollRect, text, 100); _rt = ScriptEngine.CreateRuntime(); var asyncManager = new DefaultAsyncManager(); var pathResolver = new PathResolver(); pathResolver.AddSearchPath("node_modules"); if (fileLoader == FileLoader.Resources) { fileSystem = new ResourcesFileSystem(_mConsole); pathResolver.AddSearchPath("dist"); // 这里的路径相对于 Unity Resources 空间 } else if (fileLoader == FileLoader.HMR) { Debug.LogWarningFormat("功能未完成"); fileSystem = new HttpFileSystem(_mConsole, baseUrl); } else { // 演示了一般文件系统的访问, 实际项目中典型的情况需要自行实现基于 AssetBundle(或 7z/zip) 的文件访问层 fileSystem = new DefaultFileSystem(_mConsole); pathResolver.AddSearchPath("Scripts/out"); // pathResolver.AddSearchPath("../Scripts/out"); // _rt.AddSearchPath("Assets/Examples/Scripts/dist"); } _rt.withStacktrace = stacktrace; if (sourceMap) { _rt.EnableSourceMap(); } _rt.AddModuleResolvers(); _rt.extraBinding = (runtime, register) => { FSWatcher.Bind(register); QuickJS.Extra.WebSocket.Bind(register); QuickJS.Extra.XMLHttpRequest.Bind(register); if (!runtime.isWorker) { var uri = new Uri(baseUrl); QuickJS.Extra.DOMCompatibleLayer.Bind(register, uri); QuickJS.Extra.NodeCompatibleLayer.Bind(register); } }; _rt.Initialize(new ScriptRuntimeArgs { fileSystem = fileSystem, pathResolver = pathResolver, asyncManager = asyncManager, logger = _mConsole, byteBufferAllocator = new ByteBufferPooledAllocator(), binder = DefaultBinder.GetBinder(useReflectBind), }); _rt.EvalMain(entryFileName); }
public override Boolean IsValidItem(Object item) { return(item switch { FSWatcher watcher => watcher.IsValid(), ListViewItem lvitem => IsValidItem(lvitem), _ => PathUtils.IsValidPath(item.ToString(), PathType, PathStatus) });
/// <summary> /// Initializes a new instance of the PythonPlugin class /// </summary> /// <param name="filename"></param> /// <param name="engine"></param> /// <param name="watcher"></param> internal PythonPlugin(string filename, ScriptEngine engine, FSWatcher watcher) { // Store filename Filename = filename; Name = Core.Utility.GetFileNameWithoutExtension(Filename); PythonEngine = engine; this.watcher = watcher; }
/// <summary> /// Initializes a new instance of the LuaPlugin class /// </summary> /// <param name="filename"></param> /// <param name="luaExt"></param> /// <param name="watcher"></param> internal LuaPlugin(string filename, LuaExtension luaExt, FSWatcher watcher) { // Store filename Filename = filename; Name = Core.Utility.GetFileNameWithoutExtension(Filename); this.luaExt = luaExt; LuaEnvironment = luaExt.LuaEnvironment; this.watcher = watcher; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bindSource(); } //启动监听 FSWatcher fsw = new FSWatcher(); }
public void OnBind(ScriptRuntime runtime, TypeRegister register) { FSWatcher.Bind(register); // QuickJS.Extra.WebSocket.Bind(register); // QuickJS.Extra.XMLHttpRequest.Bind(register); // if (!runtime.isWorker) // { // QuickJS.Extra.DOMCompatibleLayer.Bind(register); // QuickJS.Extra.NodeCompatibleLayer.Bind(register); // } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //添加新闻 string operate_name = Session[Constant.adminName].ToString(); ViewState["operate_name"] = operate_name; bindSorce(); bindNewsCol(); } FSWatcher fsw = new FSWatcher(); }
public DuplicateSearchForm() { InitializeComponent(); String path = StringUtils.BeforeFormatVariables(Globals.CurrentDownloadPath); if (String.IsNullOrEmpty(path) || !Directory.Exists(path)) { return; } FSWatcher pathObject = new FSWatcher(path, PathType.Folder, PathStatus.Exist); _pathListBox.Add(pathObject); }
public void OnBind(ScriptRuntime runtime, TypeRegister register) { runtime.AddStaticModule("static_test1", context => QuickJS.Native.JSApi.JS_NewInt32(context, 123)); runtime.AddStaticModule("static_test2", context => QuickJS.Native.JSApi.JS_NewInt32(context, 456)); FSWatcher.Bind(register); QuickJS.Extra.WebSocket.Bind(register); QuickJS.Extra.XMLHttpRequest.Bind(register); if (!runtime.isWorker) { var uri = new Uri(baseUrl); QuickJS.Extra.DOMCompatibleLayer.Bind(register, uri); QuickJS.Extra.NodeCompatibleLayer.Bind(register); } }
private ApplicationController() { // Crea le strutture necessarie alla risoluzione del problema _pendingActions = PendingActions.Instance; _mainWindow = new MainWindow(); _fsWatcher = FSWatcher.Instance; _serverWatcher = ServerWatcher.Instance; _syncThread = SynchThread.Instance; // Registriamoci agli eventi di errore _serverWatcher.OnError += _serverWatcher_Error; _syncThread.OnError += _syncThread_OnError; _fsWatcher.Error += _fsWatcher_Error; // Registriamoci agli eventi di notifica _syncThread.OnActionPerformed += _syncThread_OnActionPerformed; }
public AuthorsListForm() { InitializeComponent(); String path = StringUtils.BeforeFormatVariables(Globals.CurrentDownloadPath); if (String.IsNullOrEmpty(path) || !Directory.Exists(path)) { return; } FSWatcher pathObject = new FSWatcher(path, PathType.Folder, PathStatus.Exist) { Recursive = true }; _includePathListView.Add(pathObject); _regexListView.Add(AdditionalsAPI.DefaultDerpiBooruNamePattern); _regexListView.Add(AdditionalsAPI.DefaultDeviantArtNamePattern); }
public void OnStop() { fswatcher = null; }
public override void LoadPluginWatchers(string pluginDirectory) { this.Watcher = new FSWatcher(pluginDirectory, "*.cs"); base.Manager.RegisterPluginChangeWatcher(this.Watcher); }
/// <summary> /// Loads plugin watchers used by this extension /// </summary> /// <param name="pluginDirectory"></param> public override void LoadPluginWatchers(string pluginDirectory) { // Register the watcher Watcher = new FSWatcher(pluginDirectory, "*.cs"); Manager.RegisterPluginChangeWatcher(Watcher); }
private void InitializeLocalPublisher() { var publisher = _distributor.AvailableChannels.FirstOrDefault( c => c.Status == Status.Ok && string.IsNullOrEmpty(c.PublisherInfo.EndpointName)).PublisherInfo.Publisher; if (publisher != null && !string.IsNullOrEmpty(_rootFolder)) { _changePublisher = (ChangePublisher)publisher; _changePublisher.Initialize(_rootFolder); FSWatcher fsWatcher = new FSWatcher(_changePublisher); serviceHosts.Add(new ServiceHost(_changePublisher)); } }
/// <summary> /// Initializes a new instance of the CoffeeScriptPlugin class /// </summary> /// <param name="filename"></param> /// <param name="engine"></param> /// <param name="watcher"></param> internal CoffeeScriptPlugin(string filename, Engine engine, FSWatcher watcher) : base(filename, engine, watcher) { Name = Core.Utility.GetFileNameWithoutExtension(Filename); }