public void Execute(string[] arguments) { var follow = shouldFollow(ref arguments); string lastPublisher = null; Action <string, string> printer = (publisher, message) => { if (publisher == lastPublisher) { _dispatch(message); } else { //_dispatch("color|Whtie|"+publisher+":"); _dispatch(publisher + ":"); _dispatch(Environment.NewLine + message); } lastPublisher = publisher; }; if (arguments.Length == 1) { var matcher = new Regex( "^" + Regex.Escape(arguments[0]) .Replace("\\*", ".*") .Replace("\\?", ".") + "$"); printer = (publisher, message) => { if (!matcher.IsMatch(publisher)) { return; } _dispatch(message); }; } var client = new OutputClient(_token, printer); while (true) { client.Connect(); while (client.IsConnected) { Thread.Sleep(100); } if (!follow) { break; } Thread.Sleep(1000); } }
private void Initialize(IPictureparkClientSettings settings, HttpClient httpClient) { Outputs = new OutputClient(settings, httpClient); Contents = new ContentClient(settings, httpClient); BusinessProcesses = new BusinessProcessClient(settings, httpClient); DocumentHistory = new DocumentHistoryClient(settings, httpClient); JsonSchemas = new JsonSchemaClient(settings, httpClient); Permissions = new PermissionClient(settings, httpClient); PublicAccess = new PublicAccessClient(settings, httpClient); Shares = new ShareClient(settings, httpClient); Users = new UserClient(settings, httpClient); Schemas = new SchemaClient((BusinessProcessClient)BusinessProcesses, settings, httpClient); Transfers = new TransferClient((BusinessProcessClient)BusinessProcesses, settings, httpClient); ListItems = new ListItemClient((BusinessProcessClient)BusinessProcesses, settings, httpClient); Profile = new ProfileClient(settings, httpClient); ServiceProviders = new ServiceProviderClient(settings, httpClient); }
private void watchOutput(object state) { var instance = (WatchInstance)state; var client = new OutputClient(instance.Path, instance.Printer); while (true) { client.Connect(); while (client.IsConnected) { Thread.Sleep(100); } if (!instance.Follow) { break; } Thread.Sleep(1000); } }
private void Initialize(IPictureparkServiceSettings settings, HttpClient httpClient) { Output = new OutputClient(settings, httpClient); OutputFormat = new OutputFormatClient(settings, httpClient); BusinessProcess = new BusinessProcessClient(settings, httpClient); DocumentHistory = new DocumentHistoryClient(settings, httpClient); JsonSchema = new JsonSchemaClient(settings, httpClient); ContentPermissionSet = new ContentPermissionSetClient(settings, httpClient); SchemaPermissionSet = new SchemaPermissionSetClient(settings, httpClient); Share = new ShareClient(settings, httpClient); User = new UserClient(settings, httpClient); UserRole = new UserRoleClient(settings, httpClient); Info = new InfoClient(settings, httpClient); Schema = new SchemaClient(Info, BusinessProcess, settings, httpClient); Transfer = new TransferClient((BusinessProcessClient)BusinessProcess, settings, httpClient); ListItem = new ListItemClient((BusinessProcessClient)BusinessProcess, settings, httpClient); LiveStream = new LiveStreamClient(settings, httpClient); Content = new ContentClient((BusinessProcessClient)BusinessProcess, settings, httpClient); Profile = new ProfileClient(settings, httpClient); SchemaTransfer = new SchemaTransferClient(settings, httpClient); Channel = new ChannelClient(settings, httpClient); }
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); } }