private void StartAgents(Dictionary <String, Object> connectorConf) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Starting agent thread..."); try { LogEvent log = new LogEvent(delegate(Object sender, PluginLogType type, String text) { TextLog.Log("PluginStarter", "{" + ((PluginBase)sender).GetPluginId().AbsoluteUri + "}>Log1> " + type + ", " + text); }); LogEvent2 log2 = new LogEvent2(delegate(Object sender, PluginLogType type, Int64 entityId, Int64 identityId, String text, String additionalData) { #if DEBUG TextLog.Log("PluginStarter", "{" + ((PluginBase)sender).GetPluginId().AbsoluteUri + "}>Log2> Type: " + type + ", Entity Id: " + entityId + ", Identity Id: " + identityId + ", Data: " + text + additionalData); #endif logProxy.AddLog(LogKey.Plugin_Event, "Proxy", 0, "0", ((PluginBase)sender).GetPluginId().AbsoluteUri, (UserLogLevel)((Int32)type), entityId, identityId, text, additionalData); logProxy.SaveToSend("agentlog"); }); plugin.Log += log; plugin.Log2 += log2; plugin.Start(connectorConf); } catch (Exception ex) { logProxy.AddLog(LogKey.Proxy_Event, "Proxy", 0, "", plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on agent thread: " + ex.Message, ""); throw ex; } }
private void ProcessImport(Int64 resource, Int64 resource_plugin, Dictionary <String, Object> connectorConf, List <PluginConnectorBaseDeployPackageMapping> mapping) { StringBuilder importLog = new StringBuilder(); importLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Starting import thread..."); TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Starting import thread..."); Int64 count = 0; try { if (connectorConf == null) { throw new Exception("connectorConf is null"); } if (mapping == null) { throw new Exception("mapping is null"); } String id = Guid.NewGuid().ToString(); /* * JsonGeneric records = new JsonGeneric(); * records.function = "ProcessImport"; * records.fields = new String[] { "resource", "uri", "importid", "registryid", "dataname", "datavalue", "datatype" }; */ JsonGeneric records = new JsonGeneric(); records.function = "ProcessImportV2"; records.fields = new String[] { "resource_plugin", "package" }; JsonGeneric structRecords = new JsonGeneric(); structRecords.function = "ProcessStructImport"; structRecords.fields = new String[] { "resource_plugin", "package" }; String uri = plugin.GetPluginId().AbsoluteUri.ToLower(); ImportPackageUserEvent newPackage = new ImportPackageUserEvent(delegate(PluginConnectorBaseImportPackageUser pkg) { count++; records.data.Add(new String[] { resource_plugin.ToString(), JSON.SerializeToBase64(pkg) }); if (records.data.Count >= 500) { try { SaveToSend(records, resource_plugin.ToString()); records.data.Clear(); } catch { } } #if DEBUG TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "}>ProcessImport> Package generated from resource plugin " + resource_plugin.ToString() + ". ID: " + pkg.pkgId); #endif }); ImportPackageStructEvent newStructPackage = new ImportPackageStructEvent(delegate(PluginConnectorBaseImportPackageStruct pkg) { count++; structRecords.data.Add(new String[] { resource_plugin.ToString(), JSON.SerializeToBase64(pkg) }); if (structRecords.data.Count >= 500) { try { SaveToSend(structRecords, resource_plugin.ToString()); structRecords.data.Clear(); } catch { } } }); /* * RegistryEvent reg = new RegistryEvent(delegate(String importId, String registryId, String dataName, String dataValue, String dataType) * { * count++; * records.data.Add(new String[] { resource.ToString(), uri, importId, registryId, dataName, dataValue, dataType }); * * //Contabiliza a quantidade de registros para separar em vários arquivos * if (records.data.Count >= 30000) * { * //Após 30000 registros monitora a troca de registryId para salvar o arquivo * //Evitando que o mesmo registryId tenha dados em arquivos diferentes * //Isso evita problemas no servidor * * if (lastRegistryId != registryId) * { * try * { * SaveToSend(records, importId); * records.data.Clear(); * } * catch { } * } * } * * lastRegistryId = registryId; * });*/ LogEvent log = new LogEvent(delegate(Object sender, PluginLogType type, string text) { TextLog.Log("PluginStarter", "{" + ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri + "} " + type + ", " + text); }); LogEvent2 log2 = new LogEvent2(delegate(Object sender, PluginLogType type, Int64 entityId, Int64 identityId, String text, String additionalData) { logProxy.AddLog(LogKey.Plugin_Event, "Proxy", resource_plugin, resource.ToString(), ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri, (UserLogLevel)((Int32)type), entityId, identityId, text, additionalData); #if DEBUG TextLog.Log("PluginStarter", "{" + ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri + "} Type: " + type + ", Entity Id: " + entityId + ", Identity Id: " + identityId + ", Data: " + text + additionalData); #endif }); plugin.ImportPackageUser += newPackage; plugin.ImportPackageStruct += newStructPackage; plugin.Log += log; plugin.Log2 += log2; plugin.ProcessImport(resource_plugin.ToString(), id, connectorConf, mapping); plugin.ImportPackageUser -= newPackage; plugin.ImportPackageStruct -= newStructPackage; plugin.Log -= log; plugin.Log2 -= log2; newPackage = null; log = null; uri = null; //Salva os registros remanescentes if (records.data.Count > 0) { SaveToSend(records, id + "-user"); } if (structRecords.data.Count > 0) { SaveToSend(structRecords, id + "-struct"); } if (records.data.Count > 0) { SaveToSend(records, resource_plugin.ToString()); } importLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Imported " + count + " items..."); TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Imported " + count + " items..."); } catch (Exception ex) { logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on import thread: " + ex.Message, ""); importLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Erro on import thread: " + ex.Message); throw ex; } finally { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Finishing import thread"); importLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Finishing import thread..."); if (count > 0) { logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Info, 0, 0, "Import executed", importLog.ToString()); } else { #if DEBUG //Mesmo log anterior, porém para mostrar quando estiver em debug logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Info, 0, 0, "Import executed", importLog.ToString()); #endif } importLog.Clear(); importLog = null; //Salva os logs para envio logProxy.SaveToSend(resource_plugin.ToString() + "log"); } }
static void ProcessImport(Int64 resource, Dictionary <String, Object> connectorConf, Dictionary <String, String> mapping) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Starting import thread..."); try { if (connectorConf == null) { throw new Exception("connectorConf is null"); } if (mapping == null) { throw new Exception("mapping is null"); } String id = Guid.NewGuid().ToString(); JsonGeneric records = new JsonGeneric(); records.function = "ProcessImport"; records.fields = new String[] { "resource", "uri", "importid", "registryid", "dataname", "datavalue", "datatype" }; String uri = plugin.GetPluginId().AbsoluteUri.ToLower(); String lastRegistryId = ""; RegistryEvent reg = new RegistryEvent(delegate(String importId, String registryId, String dataName, String dataValue, String dataType) { records.data.Add(new String[] { resource.ToString(), uri, importId, registryId, dataName, dataValue, dataType }); //Contabiliza a quantidade de registros para separar em vários arquivos if (records.data.Count >= 2000) { //Após 2000 registros monitora a troca de registryId para salvar o arquivo //Evitando que o mesmo registryId tenha dados em arquivos diferentes //Isso evita problemas no servidor if (lastRegistryId != registryId) { try { SaveToSend(records, importId); records.data.Clear(); } catch { } } } lastRegistryId = registryId; }); LogEvent log = new LogEvent(delegate(PluginBase sender, PluginLogType type, string text) { TextLog.Log("PluginStarter", "{" + sender.GetPluginId().AbsoluteUri + "} " + type + ", " + text); }); LogEvent2 log2 = new LogEvent2(delegate(PluginBase sender, PluginLogType type, Int64 entityId, Int64 identityId, String text, String additionalData) { logProxy.AddLog("Proxy", resource.ToString(), sender.GetPluginId().AbsoluteUri, (UserLogLevel)((Int32)type), entityId, identityId, text, additionalData); }); plugin.Registry += reg; plugin.Log += log; plugin.Log2 += log2; plugin.ProcessImport(id, connectorConf, mapping); plugin.Registry -= reg; plugin.Log -= log; plugin.Log2 -= log2; reg = null; log = null; uri = null; //Salva os registros remanescentes if (records.data.Count > 0) { SaveToSend(records, id); } //Salva os logs para envio logProxy.SaveToSend(resource.ToString() + "log"); } finally { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Finishing import thread"); } }
private void ProcessDeploy(Int64 resource, Int64 resource_plugin, Dictionary <String, Object> connectorConf, List <PluginConnectorBaseDeployPackageMapping> mapping) { StringBuilder deployLog = new StringBuilder(); TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Starting deploy thread..."); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Starting deploy thread..."); JsonGeneric notify = new JsonGeneric(); notify.function = "notify"; notify.fields = new String[] { "source", "resource", "uri", "entityid", "identityid" }; JsonGeneric deleted = new JsonGeneric(); deleted.function = "deleted"; deleted.fields = new String[] { "source", "resource", "uri", "entityid", "identityid" }; JsonGeneric records = new JsonGeneric(); records.function = "ProcessImportV2"; records.fields = new String[] { "resource_plugin", "package" }; ImportPackageUserEvent newPackage = new ImportPackageUserEvent(delegate(PluginConnectorBaseImportPackageUser pkg) { records.data.Add(new String[] { resource_plugin.ToString(), JSON.SerializeToBase64(pkg) }); try { SaveToSend(records, resource_plugin.ToString()); records.data.Clear(); } catch { } deployLog.AppendLine("Package generated from resource plugin " + resource_plugin.ToString() + ". ID: " + pkg.pkgId); TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "}>ProcessDeploy> Package generated from resource plugin " + resource_plugin.ToString() + ". ID: " + pkg.pkgId); }); List <FileInfo> files = null; try { System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(plugin.GetType()); DirectoryInfo dirFrom = new DirectoryInfo(Path.Combine(basePath, "In\\" + Path.GetFileNameWithoutExtension(asm.Location) + "\\rp" + resource_plugin)); if (!dirFrom.Exists)//Diretório inexistente { deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Path not found " + dirFrom.FullName); return; } //Ordena os arquivos, do mais antigo para o mais novo sortOndate sod = new sortOndate(); files = new List <FileInfo>(); files.AddRange(dirFrom.GetFiles("*.iamdat")); files.Sort(sod); foreach (FileInfo f in files) { List <PluginConnectorBaseDeployPackage> fData = null; try { deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Loading file " + f.Name); try { fData = LoadFile(f); } catch (Exception ex) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Error reading file " + f.FullName.Replace(basePath, "") + ", " + ex.Message); logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Error reading file " + f.FullName.Replace(basePath, "") + ", " + ex.Message, ""); } if (fData == null) { continue; } if (fData.Count == 0) { throw new Exception("Package is empty"); } TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} [" + resource_plugin + "]" + fData.Count + " packages in " + f.Name); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + fData.Count + " packages in " + f.Name); LogEvent log = new LogEvent(delegate(Object sender, PluginLogType type, String text) { TextLog.Log("PluginStarter", "{" + ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri + "}>Log> " + type + ", " + text); }); LogEvent2 log2 = new LogEvent2(delegate(Object sender, PluginLogType type, Int64 entityId, Int64 identityId, String text, String additionalData) { logProxy.AddLog(LogKey.Plugin_Event, "Proxy", resource_plugin, resource.ToString(), ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri, (UserLogLevel)((Int32)type), entityId, identityId, text, additionalData); #if DEBUG TextLog.Log("PluginStarter", "{" + ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri + "}>Log2> " + (((UserLogLevel)((Int32)type)).ToString()) + " entityId = " + entityId + ", identityId = " + identityId + ", " + text + additionalData); #endif }); NotityChangeUserEvent log3 = new NotityChangeUserEvent(delegate(Object sender, Int64 entityId, Int64 identityId) { notify.data.Add(new String[] { "Proxy", resource.ToString(), ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri, entityId.ToString(), identityId.ToString() }); }); NotityChangeUserEvent log4 = new NotityChangeUserEvent(delegate(Object sender, Int64 entityId, Int64 identityId) { deleted.data.Add(new String[] { "Proxy", resource.ToString(), ((PluginConnectorBase)sender).GetPluginId().AbsoluteUri, entityId.ToString(), identityId.ToString() }); }); plugin.ImportPackageUser += newPackage; plugin.Log += log; plugin.Log2 += log2; plugin.NotityChangeUser += log3; plugin.NotityDeletedUser += log4; //Somente realiza a importação após o deploy se for o Deploy Only, ou seja, a publicação sobre demanda de um usuário estecífico Boolean doImportAfterLogin = (fData.Count <= 5); try { foreach (PluginConnectorBaseDeployPackage pkg in fData) { try { deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] EntityId = " + pkg.entityId + ", IdentityId = " + pkg.identityId + ", Pkg id: " + pkg.pkgId + ", user deleted? " + pkg.deleted); if (pkg.deleted) { plugin.ProcessDelete(resource_plugin.ToString(), pkg, connectorConf, mapping); } else { plugin.ProcessDeploy(resource_plugin.ToString(), pkg, connectorConf, mapping); if (doImportAfterLogin) { #if DEBUG TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} [" + resource_plugin + "] Doing import after deploy"); #endif plugin.ProcessImportAfterDeploy(resource_plugin.ToString(), pkg, connectorConf, mapping); #if DEBUG TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} [" + resource_plugin + "] Finihing import after deploy"); #endif } } } catch (Exception ex) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} [" + resource_plugin + "] EntityId = " + pkg.entityId + ", IdentityId = " + pkg.identityId + ", Error on ProcessDeploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : "")); logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, pkg.entityId, pkg.identityId, "error on ProcessDeploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : ""), ""); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] EntityId = " + pkg.entityId + ", IdentityId = " + pkg.identityId + ", Error on ProcessDeploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : "")); } } } finally { plugin.Log -= log; plugin.Log2 -= log2; plugin.NotityChangeUser -= log3; plugin.NotityDeletedUser -= log4; plugin.ImportPackageUser -= newPackage; log = null; log2 = null; log3 = null; log4 = null; } //Salva as notificações if (notify.data.Count > 0) { SaveToSend(notify, resource_plugin.ToString() + "notify"); } //Salva as exclusões if (deleted.data.Count > 0) { SaveToSend(deleted, resource_plugin.ToString() + "deleted"); } if (records.data.Count > 0) { SaveToSend(records, resource_plugin.ToString()); } try { f.Delete(); try { if (dirFrom.GetFiles("*.iamdat").Length == 0) { dirFrom.Delete(); } if (dirFrom.Parent.GetFiles("*.iamdat").Length == 0) { dirFrom.Parent.Delete(); } } catch { } } catch (Exception ex) { deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Error deleting file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : "")); } } catch (Exception ex) { logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on deploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : ""), ""); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Error on deploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : "")); } finally { if (fData != null) { foreach (PluginConnectorBaseDeployPackage p in fData) { p.Dispose(); } } } } files.Clear(); } catch (Exception ex) { logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on deploy thread: " + ex.Message, ""); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Erro on deploy thread: " + ex.Message); throw ex; } finally { //Salva as notificações if (notify.data.Count > 0) { SaveToSend(notify, resource_plugin.ToString() + "notify"); } TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Finishing deploy thread..."); deployLog.AppendLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] Finishing deploy thread..."); if (files != null) { files.Clear(); } files = null; logProxy.AddLog(LogKey.Proxy_Event, "Proxy", resource_plugin, resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Info, 0, 0, "Deploy executed", deployLog.ToString()); deployLog.Clear(); deployLog = null; //Salva os logs para envio logProxy.SaveToSend(resource_plugin.ToString() + "log"); newPackage = null; } }
static void ProcessDeploy(Int64 resource, Dictionary <String, Object> connectorConf, Dictionary <String, String> mapping) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Starting deploy thread..."); JsonGeneric notify = new JsonGeneric(); notify.function = "notify"; notify.fields = new String[] { "source", "resource", "uri", "entityid" }; try { System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(plugin.GetType()); DirectoryInfo dirFrom = new DirectoryInfo(Path.Combine(basePath, "In\\" + Path.GetFileNameWithoutExtension(asm.Location) + "\\" + resource)); if (!dirFrom.Exists) //Diretório inexistente { return; } //Ordena os arquivos, do mais antigo para o mais novo sortOndate sod = new sortOndate(); List <FileInfo> files = new List <FileInfo>(); files.AddRange(dirFrom.GetFiles("*.iamdat")); files.Sort(sod); foreach (FileInfo f in files) { try { List <PluginBaseDeployPackage> fData = null; try { fData = LoadFile(f); } catch (Exception ex) { TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Error reading file " + f.FullName.Replace(basePath, "") + ", " + ex.Message); logProxy.AddLog("Proxy", resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Error reading file " + f.FullName.Replace(basePath, "") + ", " + ex.Message, ""); } if (fData == null) { continue; } if (fData.Count == 0) { throw new Exception("Package is empty"); } TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} [" + resource + "]" + fData.Count + " packages in " + f.Name); LogEvent log = new LogEvent(delegate(PluginBase sender, PluginLogType type, String text) { TextLog.Log("PluginStarter", "{" + sender.GetPluginId().AbsoluteUri + "} " + type + ", " + text); }); LogEvent2 log2 = new LogEvent2(delegate(PluginBase sender, PluginLogType type, Int64 entityId, Int64 identityId, String text, String additionalData) { logProxy.AddLog("Proxy", resource.ToString(), sender.GetPluginId().AbsoluteUri, (UserLogLevel)((Int32)type), entityId, identityId, text, additionalData); }); NotityChangeUserEvent log3 = new NotityChangeUserEvent(delegate(PluginBase sender, Int64 entityId) { notify.data.Add(new String[] { "Proxy", resource.ToString(), sender.GetPluginId().AbsoluteUri, entityId.ToString() }); }); plugin.Log += log; plugin.Log2 += log2; plugin.NotityChangeUser += log3; try { foreach (PluginBaseDeployPackage pkg in fData) { try { plugin.ProcessDeploy(pkg, connectorConf, mapping); } catch (Exception ex) { logProxy.AddLog("Proxy", resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, pkg.entityId, 0, "error on ProcessDeploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : ""), ""); } } } finally { plugin.Log -= log; plugin.Log2 -= log2; plugin.NotityChangeUser -= log3; log = null; log2 = null; log3 = null; } //Salva as notificações if (notify.data.Count > 0) { SaveToSend(notify, resource.ToString() + "notify"); } //Salva os logs para envio logProxy.SaveToSend(resource.ToString() + "log"); try { f.Delete(); if (dirFrom.GetFiles("*.iamdat").Length == 0) { dirFrom.Delete(); } if (dirFrom.Parent.GetFiles("*.iamdat").Length == 0) { dirFrom.Parent.Delete(); } } catch { } } catch (Exception ex) { logProxy.AddLog("Proxy", resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on deploy thread of file " + f.FullName.Replace(basePath, "") + ", " + ex.Message + (ex.InnerException != null ? " - " + ex.InnerException.Message : ""), ""); } } files.Clear(); } catch (Exception ex) { logProxy.AddLog("Proxy", resource.ToString(), plugin.GetPluginId().AbsoluteUri, UserLogLevel.Error, 0, 0, "Erro on deploy thread: " + ex.Message, ""); throw ex; } finally { //Salva as notificações if (notify.data.Count > 0) { SaveToSend(notify, resource.ToString() + "notify"); } //Salva os logs para envio logProxy.SaveToSend(resource.ToString() + "log"); TextLog.Log("PluginStarter", "{" + plugin.GetPluginId().AbsoluteUri + "} Finishing deploy thread..."); } }