Пример #1
0
        public string GetExport(YamlExport ex)
        {
            var r = ex.Text;
            var m = Regex.Match(r, @"<Name(\d*)>", RegexOptions.IgnoreCase);

            if (m.Success)
            {
                int    i   = 0;
                string idx = m.Groups[1].Value;
                if (!string.IsNullOrEmpty(idx))
                {
                    i = Int32.Parse(idx);
                    --i;
                    if (i < 0)
                    {
                        i = 0;
                    }
                }
                r = r.Replace(m.Value, this.Name(i));
            }
            string min     = "up";
            string poptime = "--:--";

            if (PopTime != DateTime.MinValue)
            {
                var repop = Math.Floor((RepopTime - DateTime.Now).TotalMinutes);
                if (repop >= 0)
                {
                    min = repop.ToString() + "m";
                }
                poptime = PopTime.ToString("HH:mm");
            }
            r = r.Replace("<PopTime>", poptime).Replace("<RepopMin>", min).Replace("<Prefix>", Prefix);
            return(r);
        }
Пример #2
0
 private void load_yaml()
 {
     timer1.Stop();
     listView_NM.Items.Clear();
     comboBox_export.Items.Clear();
     try
     {
         if (eurekaPlugin.LoadYaml())
         {
             var nmlist = eurekaPlugin.NMList;
             if (nmlist == null || nmlist.List == null)
             {
                 return;
             }
             foreach (var nm in nmlist.List)
             {
                 var i = new ListViewItem(nm.Lv.ToString());
                 i.SubItems.Add(nm.Name());
                 i.SubItems.Add("");
                 i.SubItems.Add("");
                 listView_NM.Items.Add(i);
                 nm.Item = i;
             }
             if (nmlist.Export == null)
             {
                 var ex = new YamlExport();
                 ex.Text       = "<Name> (<RepopMin>)";
                 ex.Join       = " > ";
                 nmlist.Export = new List <YamlExport>();
                 nmlist.Export.Add(ex);
             }
             comboBox_export.Items.AddRange(nmlist.Export.Select(x => x.Text).ToArray());
             timer1.Start();
             listView_NM.Columns[0].Width = -1;
             listView_NM.Columns[1].Width = -1;
             ViewWeather();
         }
     }
     catch (YamlException e)
     {
         MessageBox.Show(e.ToString());
     }
     catch (UnauthorizedAccessException)
     {
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }