private void i_TransmitComment(EDSMTransmissionData data) { dynamic answer = null; ErrorCodes retValue = ErrorCodes.No_Answer; String transmissionString; String cmdrName = m_GUIInterface.DBConnection.getIniValue(DB_GROUPNAME, "CommandersName", ""); String apiKey = m_GUIInterface.DBConnection.getIniValue(DB_GROUPNAME, "API_Key", ""); try { if(String.IsNullOrWhiteSpace(cmdrName) || String.IsNullOrWhiteSpace(apiKey)) throw new Exception("Invalid credentials for EDSM"); transmissionString = String.Format("/api-logs-v1/set-comment" + "?commanderName={0}" + "&apiKey={1}" + "&systemName={2}" + "&fromSoftware={3}" + "&fromSoftwareVersion={4}" + "&dateVisited={5:yyyy-MM-dd HH:mm:ss}" + "&comment={6}", System.Web.HttpUtility.UrlEncode(cmdrName), apiKey, System.Web.HttpUtility.UrlEncode(data.SystemName), "ED-IBE", m_CurrentVersion, data.DateVisited.ToUniversalTime(), System.Web.HttpUtility.UrlEncode(data.Comment)); if(m_GUIInterface.GetIniValue<Boolean>("SaveToFile", false.ToString(), false)) m_LogFile.Log(RemoveApiKey(transmissionString)); answer = GetDataFromServer(transmissionString); if(answer != null) { if(m_GUIInterface.GetIniValue<Boolean>("SaveToFile", false.ToString(), false)) m_LogFile.Log(RemoveApiKey(answer.ToString())); retValue = answer.msgnum; } if(retValue == ErrorCodes.OK) DataTransmittedEvent.Raise(this, new DataTransmittedEventArgs(enTransmittedStates.Sent, m_SendQueue.Count)); else DataTransmittedEvent.Raise(this, new DataTransmittedEventArgs(enTransmittedStates.Error, m_SendQueue.Count)); } catch (Exception ex) { throw new Exception("Error while transmitting comment", ex); } }
private void i_TransmitComment(EDSMTransmissionData data) { dynamic answer = null; ErrorCodes retValue = ErrorCodes.No_Answer; String transmissionString; String cmdrName = m_GUIInterface.DBConnection.getIniValue(DB_GROUPNAME, "CommandersName", ""); String apiKey = m_GUIInterface.DBConnection.getIniValue(DB_GROUPNAME, "API_Key", ""); try { if (String.IsNullOrWhiteSpace(cmdrName) || String.IsNullOrWhiteSpace(apiKey)) { throw new Exception("Invalid credentials for EDSM"); } transmissionString = String.Format("/api-logs-v1/set-comment" + "?commanderName={0}" + "&apiKey={1}" + "&systemName={2}" + "&fromSoftware={3}" + "&fromSoftwareVersion={4}" + "&dateVisited={5:yyyy-MM-dd HH:mm:ss}" + "&comment={6}", System.Web.HttpUtility.UrlEncode(cmdrName), apiKey, System.Web.HttpUtility.UrlEncode(data.SystemName), "ED-IBE", m_CurrentVersion, data.DateVisited.ToUniversalTime(), System.Web.HttpUtility.UrlEncode(data.Comment)); if (m_GUIInterface.GetIniValue <Boolean>("SaveToFile", false.ToString(), false)) { m_LogFile.Log(RemoveApiKey(transmissionString)); } answer = GetDataFromServer(transmissionString); if (answer != null) { if (m_GUIInterface.GetIniValue <Boolean>("SaveToFile", false.ToString(), false)) { m_LogFile.Log(RemoveApiKey(answer.ToString())); } retValue = answer.msgnum; } if (retValue == ErrorCodes.OK) { DataTransmittedEvent.Raise(this, new DataTransmittedEventArgs(enTransmittedStates.Sent, m_SendQueue.Count)); } else { DataTransmittedEvent.Raise(this, new DataTransmittedEventArgs(enTransmittedStates.Error, m_SendQueue.Count)); } } catch (Exception ex) { throw new Exception("Error while transmitting comment", ex); } }