예제 #1
0
        public void Execute(string[] arguments)
        {
            var scripts = new ReactiveScriptReader(
                _keyPath,
                _pluginLocator,
                (p, m) => {},
                (m) => {})
                          .Read();
            var script = scripts.FirstOrDefault(x => x.Name.Equals(arguments[0]));

            if (script == null || arguments.Length < 1)
            {
                return;
            }
            File.Delete(script.File);
        }
        public void Execute(string[] arguments)
        {
            if (arguments.Length < 1)
            {
                return;
            }
            var scripts = new ReactiveScriptReader(
                _keyPath,
                _pluginLocator,
                (p, m) => {},
                (m) => {})
                          .Read();
            var script = scripts.FirstOrDefault(x => x.Name.Equals(arguments[0]));

            if (script == null)
            {
                return;
            }
            _dispatch(string.Format("event|'reactive-script-resume' '{0}'", script.File));
        }
예제 #3
0
        public void Execute(string[] arguments)
        {
            if (arguments.Length < 2)
            {
                return;
            }
            var scripts = new ReactiveScriptReader(
                _token,
                _pluginLocator,
                (p, m) => {},
                (m) => {})
                          .Read();
            var script = scripts.FirstOrDefault(x => x.Name.Equals(arguments[0]));

            if (script == null)
            {
                return;
            }

            var root   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var match1 = "'codemodel' 'raw-filesystem-change-filecreated' '" + script.File + "'";
            var match2 = "'codemodel' 'raw-filesystem-change-filechanged' '" + script.File + "'";

            Logger.Write("Looking for: " + match1);
            Logger.Write("Looking for: " + match2);
            var name = "rscript-" + Path.GetFileNameWithoutExtension(script.File);
            var hash = 0;

            try {
                using (var output = new OutputClient(_token, (publisher, msg) => { if (name == publisher)
                                                                                   {
                                                                                       _dispatch(msg);
                                                                                   }
                                                     }))
                {
                    output.Connect();
                    var proc = new Process();
                    proc.Query(
                        Path.Combine(root, Path.Combine("EventListener", "OpenIDE.EventListener.exe")),
                        "",
                        false,
                        _token,
                        (error, s) => {
                        if (s == match1 || s == match2)
                        {
                            var newHas = File.ReadAllText(script.File).GetHashCode();
                            if (newHas != hash)
                            {
                                hash = newHas;
                                Thread.Sleep(200);
                                _dispatch("");
                                _dispatch("Triggering reactive script:");
                                _dispatch("event|" + arguments[1]);
                            }
                        }
                    }
                        );
                }
            } catch (Exception ex) {
                Logger.Write(ex);
            }
        }