/// <summary>
        /// Code GPS coordinates into a thread
        /// </summary>
        public string CodeTrame(List <LatitudeLongitude> zone)
        {
            if (zone?.Count <= 0)
            {
                return(null);
            }
            var trame = RefreshTime.ToString();

            foreach (var point in zone)
            {
                trame += string.Format(_enCultureInfo, ";{0:0.#########}:{1:0.#########}", point.Latitude, point.Longitude);
            }
            return(trame);
        }
Example #2
0
        public void Save()
        {
            //数据库配置
            m_Configuration.AppSettings.Settings["DBSource"].Value   = DBSource;
            m_Configuration.AppSettings.Settings["DBName"].Value     = DBName;
            m_Configuration.AppSettings.Settings["DBPort"].Value     = DBPort.ToString();
            m_Configuration.AppSettings.Settings["DBUserName"].Value = DBUserName;
            m_Configuration.AppSettings.Settings["DBPassword"].Value = DBPassword;

            m_Configuration.AppSettings.Settings["RefreshTime"].Value     = RefreshTime.ToString();
            m_Configuration.AppSettings.Settings["OfflineTime"].Value     = OfflineTime.ToString();
            m_Configuration.AppSettings.Settings["TollStationName"].Value = TollStationName;

            //LED文字
            int i = 1;

            foreach (LEDChannelInfo vTempLedText in LedTextArray)
            {
                if (i <= 10)
                {
                    m_Configuration.AppSettings.Settings[string.Format("LedText{0}", i)].Value = string.Format("{0}|{1}|{2}|{3}", vTempLedText.Content, vTempLedText.HoldTime, vTempLedText.InEff, vTempLedText.OutEff);
                }
                else
                {
                    break;
                }
                i++;
            }

            //LED图片
            i = 1;
            foreach (LEDChannelInfo vTempLedPic in LedPicArray)
            {
                if (i <= 4)
                {
                    m_Configuration.AppSettings.Settings[string.Format("LedPic{0}", i)].Value = string.Format("{0}|{1}|{2}|{3}", vTempLedPic.Content, vTempLedPic.HoldTime, vTempLedPic.InEff, vTempLedPic.OutEff);
                }
                else
                {
                    break;
                }
                i++;
            }

            //LED视频
            i = 1;
            foreach (LEDChannelInfo vTempLedVideo in LedVideoArray)
            {
                if (i <= 4)
                {
                    m_Configuration.AppSettings.Settings[string.Format("LedVideo{0}", i)].Value = string.Format("{0}|{1}|{2}|{3}", vTempLedVideo.Content, vTempLedVideo.HoldTime, vTempLedVideo.InEff, vTempLedVideo.OutEff);
                }
                else
                {
                    break;
                }
                i++;
            }


            m_Configuration.Save();
        }
Example #3
0
        public static void SaveConfiguration()
        {
            string fullFileName = Path.Combine(Assembly.GetExecutingAssembly().Location, fileName);

            if (!LocalConfig)
            {
                fullFileName = Path.Combine(GetLocalStoragePath(), fileName);
            }
            if (File.Exists(fullFileName))
            {
                FileInfo fileInfo = new FileInfo(fullFileName);
                fileInfo.Attributes = FileAttributes.Normal;
            }
            XmlWriterSettings xwSettings = new XmlWriterSettings();

            xwSettings.Indent = true;
            MemoryStream ms = new MemoryStream();

            using (XmlWriter xw = XmlWriter.Create(ms, xwSettings)) {
                xw.WriteStartDocument();
                xw.WriteStartElement("config");
                xw.WriteStartElement("integrators");
                foreach (string url in FarmList)
                {
                    xw.WriteStartElement("integrator");
                    xw.WriteAttributeString("url", url);
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();
                xw.WriteStartElement("buildNotifications");
                foreach (BuildNotificationViewInfo bnvi in buildNotifications)
                {
                    xw.WriteStartElement("notification");
                    xw.WriteRaw(SmartCCNetHelper.GetSerializeString(bnvi.Notification));
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();
                xw.WriteStartElement("PowerShellScripts");
                foreach (PSScript script in powerShellScripts)
                {
                    xw.WriteStartElement("PowerShellScript");
                    xw.WriteRaw(SmartCCNetHelper.GetSerializeString(script));
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();
                xw.WriteStartElement("lastProjectDurationDictionary");
                byte[] lastBuildDurationData = ProjectInfo.GetLastBuildDurationDictSaveData();
                xw.WriteBase64(lastBuildDurationData, 0, lastBuildDurationData.Length);
                xw.WriteEndElement();
                xw.WriteStartElement("layoutXml");
                xw.WriteRaw(layoutXml);
                xw.WriteEndElement();
                xw.WriteStartElement("gridProjectXml");
                xw.WriteRaw(gridProjectXml);
                xw.WriteEndElement();
                xw.WriteStartElement("gridTestsXml");
                xw.WriteRaw(gridTestsXml);
                xw.WriteEndElement();
                xw.WriteStartElement("gridServersXml");
                xw.WriteRaw(gridServersXml);
                xw.WriteEndElement();
                xw.WriteStartElement("gridNotificationsXml");
                xw.WriteRaw(gridNotificationsXml);
                xw.WriteEndElement();
                xw.WriteElementString("volunteerColorString", VolunteerColorString);
                xw.WriteElementString("alwaysOnTop", AlwaysOnTop.ToString());
                xw.WriteElementString("refreshTime", RefreshTime.ToString());
                xw.WriteElementString("minimized", Minimized.ToString());
                xw.WriteElementString("buildLogMaximized", BuildLogMaximized.ToString());
                xw.WriteElementString("formWidth", FormWidth.ToString());
                xw.WriteElementString("formHeight", FormHeight.ToString());
                xw.WriteElementString("formLeft", FormLeft.ToString());
                xw.WriteElementString("formTop", FormTop.ToString());
                xw.WriteElementString("updateUrl", UpdateUrl);
                xw.WriteElementString("workUserName", WorkUserName);
                xw.WriteElementString("useSkin", UseSkin.ToString());
                xw.WriteElementString("UsePowerShellScript", UsePowerShellScript.ToString());
                xw.WriteElementString("needAskForStutup", NeedAskForStutup.ToString());
                xw.WriteElementString("alreadyReloadGridTestsLayout", AlreadyReloadGridTestsLayout.ToString());
                xw.WriteElementString("skinName", SkinName);
                xw.WriteElementString("popupHideTimeout", PopupHideTimeout.ToString());
                xw.WriteStartElement("trackedProjects");
                foreach (ProjectShortInfo info in TrackedProjects)
                {
                    xw.WriteStartElement("trackedProject");
                    xw.WriteAttributeString("name", info.Name);
                    xw.WriteAttributeString("status", info.BuildStatus);
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();
                xw.WriteEndElement();
                xw.WriteEndDocument();
            }
            File.WriteAllBytes(fullFileName, ms.ToArray());
        }