Exemplo n.º 1
0
        public void i_TransmitQueuedData(object sender, System.Timers.ElapsedEventArgs e)
        {
            EDSMTransmissionData currentData;

            try
            {
                m_SendTimer.Stop();

                if (m_SendQueue.Count > 0)
                {
                    while (m_SendQueue.Count > 0)
                    {
                        currentData = m_SendQueue.Dequeue();

                        if (m_GUIInterface.GetIniValue <Boolean>("SendToEDSM", true.ToString(), false) && (!Program.actualCondition.GameversionIsBeta_Jrnl))
                        {
                            switch (currentData.TType)
                            {
                            case TransmissionType.Visit:
                                i_TransmitVisit(currentData);
                                break;

                            case TransmissionType.CommentExtension:
                                String oldComment = GetSystemComment(currentData.SystemName, currentData.DateVisited);

                                if (!String.IsNullOrWhiteSpace(oldComment))
                                {
                                    currentData.Comment = oldComment + "\r\n" + currentData.Comment;
                                }

                                i_TransmitComment(currentData);
                                break;

                            default:
                                break;
                            }
                        }

                        System.Threading.Thread.Sleep(25);
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                }

                m_SendTimer.Start();
            }
            catch (Exception ex)
            {
                DataTransmittedEvent.Raise(this, new DataTransmittedEventArgs(enTransmittedStates.Error, m_SendQueue.Count));
                m_SendTimer.Start();
                m_LogFile.Log("Exception: /n/d" + ex.Message + "/n/d" + ex.StackTrace);
            }
        }