//--- Methods --- private XDoc BuildBugLink(RemoteIssue bug, XDoc doc) { RemoteStatus status = null; if (!string.IsNullOrEmpty(bug.status)) { _statuses.TryGetValue(bug.status, out status); } bool strikeThrough = status != null && Array.Exists <string>(STRIKE_THROUGH_STATUSES, delegate(string s) { return(StringUtil.EqualsInvariantIgnoreCase(status.name.ToLowerInvariant(), s)); }); string title = string.Format("{0} (Reporter: {1} Assigned To: {2})", bug.summary, bug.reporter, bug.assignee); doc.Start("a").Attr("href", _uri.At("browse").At(bug.key)).Attr("title", title); if (strikeThrough) { doc.Start("del").Value(bug.key).End(); } else { doc.Value(bug.key); } doc.End(); return(doc); }
/// <summary> /// Creates an instance of the IssueStatus based on a remote entity. /// </summary> public IssueStatus(RemoteStatus remoteStatus) : base(remoteStatus) { StatusCategory = remoteStatus.statusCategory != null ? new IssueStatusCategory(remoteStatus.statusCategory) : null; }
Atlassian.Jira.Jira jira; // This is the object that interfaces with the atlassian.net-sdk library. public JiraConnection(string url, string userName, string password, Converter <string, string> settings) { Log.Verbose("Creating a new connection"); _rootUrl = url.TrimEnd('\\', '/'); int offset = _rootUrl.LastIndexOf("/rpc/soap/jirasoapservice-v2"); if (offset > 0) { _rootUrl = _rootUrl.Substring(0, offset); } Log.Info("Root Url: {0}", _rootUrl); _settings = settings; _knownUsers = new Dictionary <string, JiraUser>(StringComparer.OrdinalIgnoreCase); _lookupUsers = StringComparer.OrdinalIgnoreCase.Equals(settings("resolveUserNames"), "true"); Log.Info("LookUp Users: {0}", _lookupUsers); LoadUsers(); _statuses = new Dictionary <string, JiraStatus>(StringComparer.Ordinal); _userName = userName; _password = password; Log.Verbose("Creating a new internal Soap Service"); _service = new JiraSoapServiceService(); Log.Verbose("Service Created"); // _service.Url = _rootUrl + "/rpc/soap/jirasoapservice-v2"; _service.UseDefaultCredentials = true; if (!String.IsNullOrEmpty(settings("jira:proxyurl"))) { System.Net.ICredentials proxyAuth = System.Net.CredentialCache.DefaultCredentials; UriBuilder proxyuri = new UriBuilder(settings("jira:proxyurl")); if (!String.IsNullOrEmpty(proxyuri.UserName)) { proxyAuth = new System.Net.NetworkCredential(proxyuri.UserName, proxyuri.Password); proxyuri.Password = proxyuri.UserName = String.Empty; } _service.Proxy = new System.Net.WebProxy(proxyuri.Uri); _service.Proxy.Credentials = proxyAuth; } _token = null; Log.Verbose("Connecting..."); Connect(); Log.Verbose("Connection Successfull"); _currentUser = GetUser(_userName); Log.Verbose("Getting Statuses"); // foreach (RemoteStatus rs in _service.getStatuses(_token)) foreach (IssueStatus status in jira.GetIssueStatuses()) {// Convert IssueStatus to RemoteStatus RemoteStatus rs = new RemoteStatus { id = status.Id, name = status.Name }; _statuses[rs.id] = new JiraStatus(rs); } Log.Verbose("JiraConnection(): _statuses.Count = {0}", _statuses.Count); Log.Verbose("Finished creating a new connection"); }
public static string RemoteSend(string value) { if (string.IsNullOrEmpty(remote_url)) { remote_url = "tcp://remoting.cn95161.com:8086/EgRServer"; } string dns = EagleString.egString.Between2String(remote_url, "tcp://", ":"); try { if (System.Net.Dns.GetHostAddresses(dns).Length <= 0) { throw new Exception("DNS RESOLVE ERROR!"); } } catch { remote_url = "tcp://61.152.93.177:8086/EgRServer"; } string ret = ""; if (rc.isConnected) { status = RemoteStatus.CONNECTED; try { ret = rc.InvokeRemoting(value); } catch (Exception ex) { EagleString.EagleFileIO.LogWrite("RemoteSend Exception1:" + ex.Message); status = RemoteStatus.DISCONNECT; } } else { try { rc.strRURL = remote_url; if (!rc.isConnected) { throw new Exception("连不上!"); } return(RemoteSend(value)); } catch (Exception ex) { EagleString.EagleFileIO.LogWrite("RemoteSend Exception2:" + ex.Message); status = RemoteStatus.DISCONNECT; } } return(ret); }
public void GetsFine() { // Setup var localRepo = Substitute.For <ILocalRepository>(); var gitExecutor = Substitute.For <IGitExecuter>(); gitExecutor.FetchAsync(localRepo, true).Returns("\n" + " 88ff88ff88..ff88ff88ff dev -> origin/dev\n" + " 865e139..431f7e9 dev -> origin/dev\n" + " 140942d..434368d fix/DPDL-1546/noMoRPC -> origin/fix/DPDL-1546/noMoRPC\n" + " = [up to date] master -> origin/master\n" + " = [up to date] test/DPDL-1571/stringResGlitch -> origin/test/DPDL-1571/stringResGlitch\n" + "\n"); var status = new RemoteStatus(gitExecutor); // Act var result = status.GetAsync(localRepo).Result; // Verify } /* End of Function - GetsFine */
/// <summary> /// Reads the registry modules. /// </summary> /// <param name="registryKey">The registry key.</param> /// <param name="result">The result.</param> /// <returns>Dictionary{System.StringSystem.String}.</returns> public Dictionary <string, string> ReadRegistryModules(string registryKey, out RemoteStatus result) { bool retVal = true; string source = string.Empty; Dictionary <string, string> remoteRegList = new Dictionary <string, string>(); result = RemoteStatus.Error; foreach (string machine in new List <string>(RemoteList.Keys)) { CDFMonitor.LogOutputHandler("ReadRegistry: processing machine:" + machine + " state:" + RemoteList[machine].ToString()); WMI wmi; if (Ping(machine) && (wmi = new WMI(machine, @"\\{0}\ROOT\DEFAULT", _creds)) != null && wmi.Status && ((remoteRegList = wmi.ReadRegistryModules(registryKey)).Count > 0) ) { if (remoteRegList.Count > 0) { RemoteList[machine] = RemoteStatus.Success; result = RemoteStatus.Success; } else { RemoteList[machine] = RemoteStatus.Error; } } else { CDFMonitor.LogOutputHandler("Fail:Check: unsuccessful."); RemoteList[machine] = RemoteStatus.Error; } // Right now this function only for one machine so break break; } CDFMonitor.LogOutputHandler("DEBUG:Check: exit:" + retVal); return(remoteRegList); }
static void Thread_Check_Remoting_Server() { while (true) { if (status == RemoteStatus.DISCONNECT) { try { rc.strRURL = remote_url; if (rc.isConnected) { status = RemoteStatus.CONNECTED; } } catch { } } System.Threading.Thread.Sleep(10 * 60 * 1000); } }
/// <summary> /// Gathers this instance. /// </summary> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> public bool Gather() { bool retVal = true; string source = string.Empty; string destination = string.Empty; if (!FileManager.CheckPath(_path, true)) { return(false); } int i = 0; do { i++; foreach (string machine in new List <string>(RemoteList.Keys)) { if (RemoteList[machine] == RemoteStatus.Gathered) { CDFMonitor.LogOutputHandler(string.Format("Gather: skipping machine {0} because of cached state: {1}", machine, RemoteList[machine])); continue; } CDFMonitor.LogOutputHandler("Gather: processing machine:" + machine + " state:" + RemoteList[machine].ToString()); WMIServicesManager wmi; source = "\\\\" + machine + "\\admin$\\cdfmonitor"; destination = _path + "\\" + machine; int pid = 0; RemoteStatus rs = RemoteStatus.Unknown; if (Ping(machine) && (wmi = new WMIServicesManager(machine, _creds)) != null && wmi.Status && (wmi.IsServiceInstalled(Resources.ServiceName) == WMIServicesManager.ReturnValue.True && ((rs = CheckServiceState(wmi)) != RemoteStatus.Started || wmi.StopService(Resources.ServiceName) == WMIServicesManager.ReturnValue.Success)) | (FileManager.CheckPath(source, false) && (pid = wmi.RunProcess(wmi.GetSYSTEMROOT() + "\\cdfmonitor\\cdfmonitor.exe /zip")) != 0 && wmi.CheckProcess(_processName, pid, true) == 0 && FileManager.CopyFiles(FileManager.GetFiles(source, "*.zip", SearchOption.TopDirectoryOnly), destination, true) && (FileManager.DeleteFiles(FileManager.GetFiles(source, "*.zip", SearchOption.TopDirectoryOnly), true) == FileManager.Results.Success) && (rs != RemoteStatus.Started || wmi.StartService(Resources.ServiceName) == WMIServicesManager.ReturnValue.Success))) { RemoteList[machine] = RemoteStatus.Gathered; } else { CDFMonitor.LogOutputHandler("Fail:Gather: unsuccessful."); RemoteList[machine] = RemoteStatus.Error; retVal = false; } if (!CheckProgress(false, machine, i, destination)) { return(retVal); } } }while ((RemoteList.Count(v => v.Value == RemoteStatus.Gathered) != RemoteList.Count) && CheckProgress(true, string.Empty, i)); return(retVal); }
/// <summary> /// Checks remote machine for existence of utility. Returns true if successful. /// </summary> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> public bool Check() { bool retVal = true; string source = string.Empty; int i = 0; do { i++; foreach (string machine in new List <string>(RemoteList.Keys)) { if (RemoteList[machine] != RemoteStatus.Unknown && RemoteList[machine] != RemoteStatus.Error) { CDFMonitor.LogOutputHandler(string.Format("Check: skipping machine {0} because of cached state: {1}", machine, RemoteList[machine])); continue; } source = "\\\\" + machine + "\\admin$\\cdfmonitor"; CDFMonitor.LogOutputHandler("Check: processing machine:" + machine + " state:" + RemoteList[machine].ToString()); WMIServicesManager wmi; RemoteStatus rs = RemoteStatus.Error; if (Ping(machine) && (wmi = new WMIServicesManager(machine, _creds)) != null && wmi.Status ) { if (wmi.IsServiceInstalled(Resources.ServiceName) == WMIServicesManager.ReturnValue.False) { rs = RemoteStatus.UnDeployed; } else { wmi.ShowProperties(Resources.ServiceName); rs = CheckServiceState(wmi); } RemoteList[machine] = rs; } else { CDFMonitor.LogOutputHandler("Fail:Check: unsuccessful."); RemoteList[machine] = RemoteStatus.Error; retVal = false; } if (!CheckProgress(false, machine, i)) { return(retVal); } } }while ((RemoteList.Count(v => (v.Value == RemoteStatus.Unknown | v.Value == RemoteStatus.Error)) != 0) && CheckProgress(true, string.Empty, i)); CDFMonitor.LogOutputHandler("Check: exit:" + retVal); return(retVal); }
/// <summary> /// Creates an instance of the IssueStatus based on a remote entity. /// </summary> public IssueStatus(RemoteStatus remoteEntity) : base(remoteEntity) { }
private XDoc BuildBugListHTMLTable(RemoteIssue[] issues) { XDoc ret = new XDoc("div").Attr("class", "DW-table Jira-table table"); ret.Start("table").Attr("border", 0).Attr("cellspacing", 0).Attr("cellpadding", 0).Attr("class", "table feedtable sortable"); // header ret.Start("tr") .Elem("th", "Bug#") .Elem("th", "Summary") .Elem("th", "Status") .Elem("th", "Priority") .Elem("th", "Opened By") .Elem("th", "Assigned To") .End(); int count = 0; foreach (RemoteIssue bug in issues) { count++; RemoteStatus status = null; if (!string.IsNullOrEmpty(bug.status)) { _statuses.TryGetValue(bug.status, out status); } RemotePriority priority = null; if (!string.IsNullOrEmpty(bug.priority)) { _priorities.TryGetValue(bug.priority, out priority); } string trClass = string.Format("{0} {1}", (count % 2 == 0) ? "even" : "odd", status == null ? string.Empty : status.name); ret.Start("tr").Attr("class", trClass); ret.Start("td"); ret = BuildBugLink(bug, ret); ret.End(); //td; ret.Elem("td", bug.summary); if (status == null) { ret.Elem("td", ""); } else { ret.Start("td").Start("img").Attr("src", status.icon).Attr("alt", status.name).Attr("title", status.description).End().Value(status.name).End(); } if (priority == null) { ret.Elem("td"); } else { ret.Start("td").Start("img").Attr("src", priority.icon).Attr("alt", priority.name).Attr("title", priority.description).End().Value(priority.name).End(); } ret.Elem("td", bug.reporter ?? string.Empty); ret.Elem("td", bug.assignee ?? string.Empty); ret.End(); //tr } ret.End(); // table return(ret); }
private static void OnRemoteError(string errorMsg) { CurrentRemoteStatus = RemoteStatus.FAILURE; UnityEngine.Debug.LogError(errorMsg); ActivateRemoteConfigs(); }
private static void OnRemoteSucces(System.Object retrievedGameData) { CurrentRemoteStatus = RemoteStatus.SUCCESS; ActivateRemoteConfigs(); // Debug.LogWarning(" Fetched : + " + JsonUtility.ToJson(retrievedGameData)); }
public void ThrowsExceptionForNullShell() { // Act var status = new RemoteStatus(null); } /* End of Function - ThrowsExceptionForNullShell */