private void refresh()
        {
            if (string.IsNullOrEmpty(CfgFullName))
            {
                GetCfgFileName();
            }

            lbCfgFile.ForeColor = !File.Exists(CfgFullName) ? Color.Red : SystemColors.ControlText;

            if (string.IsNullOrEmpty(CsvFullName))
            {
                GetCsvFileName();
            }

            var dayZProfile = new DayZProfile {
                CfgName = CfgFullName
            };

            dayZProfile.Read();

            if (_dayZProfile.LastWriteTime == dayZProfile.LastWriteTime)
            {
                return;
            }

            if (_dayZProfile.PlayerName == dayZProfile.PlayerName &&
                _dayZProfile.LastMpServerName == dayZProfile.LastMpServerName &&
                _dayZProfile.LastMpServer == dayZProfile.LastMpServer)
            {
                return;
            }

            _dayZProfile = dayZProfile;
            HistoryServerList.Update(_dayZProfile);
            HistoryServerList.Write();

            if (lvHistory.InvokeRequired)
            {
                BeginInvoke(new Action(refresh_lvHistory));
            }
            else
            {
                refresh_lvHistory();
            }
        }
Exemple #2
0
        internal void Update(DayZProfile dayzProfile)
        {
            var oldServer = (from s in Csv
                             where s.LastPlayTime == dayzProfile.LastWriteTime
                             select s)
                            .ToList();

            if (oldServer.Any())
            {
                return;
            }

            var server = new HistoryServer
            {
                PlayerName   = dayzProfile.PlayerName,
                AddrIpPort   = dayzProfile.LastMpServer,
                Name         = dayzProfile.LastMpServerName,
                LastPlayTime = dayzProfile.LastWriteTime
            };

            Csv.Add(server);
        }