コード例 #1
0
 void Start()
 {
     Index = int.Parse(MyTools.GetLastString(gameObject.name, '_'));
 }
コード例 #2
0
        private void AddGCNToList(GCNotification gcn, String keyIcon, List <GCNotification> lst, bool special = false, int index = -1)
        {
            String sLat2  = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlat, true);
            String sLon2  = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlon, false);
            String coord  = /*"DD° MM.MMM: " + */ sLat2 + " " + sLon2 + "\r\n";
            String radius = gcn.distance.ToString() + " Km";

            String lbl = gcn.name;

            if (special)
            {
                lbl = gcn.GetTypeKeyInEnglish();
            }

            EXImageListViewItem lvi = null;

            if (special)
            {
                lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized("Nothing"));
                EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized(keyIcon));
                lvi.SubItems.Add(svi2);
            }
            else
            {
                lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized(keyIcon));
                EXImageListViewSubItem svi2 = new EXImageListViewSubItem("");
                lvi.SubItems.Add(svi2);
            }
            if (lst.Count != 1)
            {
                lvi.Font = MyTools.ChangeFontStyle(lvi.Font, true, false);

                EXImageListViewSubItem svi2 = new EXImageListViewSubItem("");
                lvi.SubItems.Add(svi2);
            }
            else
            {
                if (gcn.checknotif)
                {
                    EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletgreen"));
                    lvi.SubItems.Add(svi2);
                }
                else
                {
                    EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletred"));
                    lvi.SubItems.Add(svi2);
                }
            }

            EXListViewSubItem svi = null;

            if (special)
            {
                svi = new EXListViewSubItem("");
                lvi.SubItems.Add(svi);
                svi = new EXListViewSubItem("");
                lvi.SubItems.Add(svi);
            }
            else
            {
                svi = new EXListViewSubItem(coord);
                lvi.SubItems.Add(svi);
                svi = new EXListViewSubItem(radius);
                lvi.SubItems.Add(svi);
            }
            String kind = "";

            if (lst.Count == 1)
            {
                foreach (String k in gcn.kindofnotifnames)
                {
                    kind += k + " - ";
                }
            }
            svi = new EXListViewSubItem(kind);
            lvi.SubItems.Add(svi);

            if (special)
            {
                lvGCNListGroup.Items.Insert(index + 1, lvi);
            }
            else
            {
                lvGCNListGroup.Items.Add(lvi);
            }

            _dicoItemGCs.Add(lvi, lst);
        }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            List <string> dohListStrings = null, dnsListStrings = null;
            var           bgWorker = new BackgroundWorker();

            bgWorker.DoWork += (o, args) =>
            {
                try
                {
                    dohListStrings = new WebClient()
                                     .DownloadString(UrlSettings.MDohList).Split('\n').ToList();
                    dnsListStrings = new WebClient()
                                     .DownloadString(UrlSettings.MDnsList).Split('\n').ToList();

                    if (string.IsNullOrWhiteSpace(dohListStrings[dohListStrings.Count - 1]))
                    {
                        dohListStrings.RemoveAt(dohListStrings.Count - 1);
                    }
                    if (string.IsNullOrWhiteSpace(dnsListStrings[dnsListStrings.Count - 1]))
                    {
                        dnsListStrings.RemoveAt(dnsListStrings.Count - 1);
                    }
                }
                catch (Exception exception)
                {
                    MyTools.BackgroundLog(@"| Download list failed : " + exception);
                }
            };
            bgWorker.RunWorkerCompleted += (o, args) =>
            {
                try
                {
                    if (dohListStrings != null && dohListStrings.Count != 0)
                    {
                        foreach (var item in dohListStrings)
                        {
                            DoHUrlText.Items.Add(item.Split('*', ',')[0].Trim());
                            SecondDoHUrlText.Items.Add(item.Split('*', ',')[0].Trim());
                        }
                    }
                    if (dnsListStrings != null && dnsListStrings.Count != 0)
                    {
                        foreach (var item in dnsListStrings)
                        {
                            SecondDNS.Items.Add(item.Split('*', ',')[0].Trim());
                        }
                    }

                    if (dohListStrings == null && dnsListStrings == null)
                    {
                        Snackbar.MessageQueue.Enqueue(new TextBlock()
                        {
                            Text = @"获取列表内容失败,请检查互联网连接。"
                        });
                    }

                    if (File.Exists($"{MainWindow.SetupBasePath}doh.list"))
                    {
                        foreach (var item in File.ReadAllLines($"{MainWindow.SetupBasePath}doh.list"))
                        {
                            DoHUrlText.Items.Add(item.Split('*', ',')[0].Trim());
                            SecondDoHUrlText.Items.Add(item.Split('*', ',')[0].Trim());
                        }
                    }

                    if (File.Exists($"{MainWindow.SetupBasePath}dns.list"))
                    {
                        foreach (var item in File.ReadAllLines($"{MainWindow.SetupBasePath}dns.list"))
                        {
                            SecondDNS.Items.Add(item.Split('*', ',')[0].Trim());
                        }
                    }
                }
                catch (Exception exception)
                {
                    MyTools.BackgroundLog(@"| Read list failed : " + exception);
                }
            };
            bgWorker.RunWorkerAsync();
        }
コード例 #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            List <string> dohListStrings = null, dnsListStrings = null;
            var           bgWorker = new BackgroundWorker();

            bgWorker.DoWork += (o, args) =>
            {
                try
                {
                    dohListStrings = new WebClient()
                                     .DownloadString(UrlSettings.MDohList).Split('\n').ToList();
                    dnsListStrings = new WebClient()
                                     .DownloadString(UrlSettings.MDnsList).Split('\n').ToList();
                }
                catch (Exception exception)
                {
                    MyTools.BgwLog(@"| Download list failed : " + exception);
                }

                if (string.IsNullOrWhiteSpace(dohListStrings[dohListStrings.Count - 1]))
                {
                    dohListStrings.RemoveAt(dohListStrings.Count - 1);
                }
                if (string.IsNullOrWhiteSpace(dnsListStrings[dnsListStrings.Count - 1]))
                {
                    dnsListStrings.RemoveAt(dnsListStrings.Count - 1);
                }
            };
            bgWorker.RunWorkerCompleted += (o, args) =>
            {
                if (UrlSettings.MDohList.Contains(".list"))
                {
                    foreach (var item in dohListStrings)
                    {
                        DoHUrlText.Items.Add(item.Split('*')[0].Trim());
                    }
                }
                if (UrlSettings.MDnsList.Contains(".list"))
                {
                    foreach (var item in dnsListStrings)
                    {
                        BackupDNS.Items.Add(item.Split('*')[0].Trim());
                    }
                }

                if (File.Exists($"{MainWindow.SetupBasePath}doh.list"))
                {
                    foreach (var item in File.ReadAllLines($"{MainWindow.SetupBasePath}doh.list"))
                    {
                        DoHUrlText.Items.Add(item);
                    }
                }
                if (File.Exists($"{MainWindow.SetupBasePath}dns.list"))
                {
                    foreach (var item in File.ReadAllLines($"{MainWindow.SetupBasePath}dns.list"))
                    {
                        BackupDNS.Items.Add(item);
                    }
                }
            };
            bgWorker.RunWorkerAsync();
        }
コード例 #5
0
    IEnumerator MultipleTranslateCoroutine(int nTranslations)
    {
        int cpt = 0;

        while (cpt < nTranslations)
        {
            yield return(StartCoroutine(TranslateFromAToBCoroutine(transform.position, transform.position + Random.onUnitSphere * 4, 0.5f, Kryz.Tweening.EasingFunctions.InOutBounce, () => MyTools.ChangeColorRandom(gameObject), () => MyTools.Log("End Action"))));

            cpt++;
        }
    }
コード例 #6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Visibility = Visibility.Hidden;
            if (Environment.OSVersion.Version.Major == 10)
            {
                WindowBlur.SetEnabled(this, true);
            }
            else
            {
                Background = new SolidColorBrush(Colors.White)
                {
                    Opacity = 1
                };
                NotifyIcon.Icon = Properties.Resources.AuroraBlack;
            }

            var desktopWorkingArea = SystemParameters.WorkArea;

            Left = desktopWorkingArea.Right - Width - 1;
            Top  = desktopWorkingArea.Bottom - Height - 0;

            FadeIn(0.2);
            Visibility         = Visibility.Visible;
            NotifyIcon.Visible = true;

            if (!MyTools.PortIsUse(53))
            {
                IsLog.IsChecked = DnsSettings.DebugLog;
                if (Equals(DnsSettings.ListenIp, IPAddress.Any))
                {
                    IsGlobal.IsChecked = true;
                }

                DnsEnable.IsChecked = true;
                Grid.Effect         = null;

                if (File.Exists($"{SetupBasePath}config.json"))
                {
                    WindowState = WindowState.Minimized;
                }
            }
            else
            {
                Snackbar.IsActive = true;
                if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
                    .Count(o => o.Id != Process.GetCurrentProcess().Id) > 0)
                {
                    var snackbarMsg = new SnackbarMessage()
                    {
                        Content       = "可能已有一个正在运行的实例, 请不要重复启动!",
                        ActionContent = "退出",
                    };
                    snackbarMsg.ActionClick += (o, args) => Environment.Exit(Environment.ExitCode);
                    Snackbar.Message         = snackbarMsg;
                    NotifyIcon.Text          = @"AuroraDNS - [请不要重复启动]";
                }
                else
                {
                    Snackbar.Message = new SnackbarMessage()
                    {
                        Content = "DNS 服务器无法启动, 53端口被占用。"
                    };
                    NotifyIcon.Text = @"AuroraDNS - [端口被占用]";
                }

                DnsEnable.IsEnabled   = false;
                ControlGrid.IsEnabled = false;
            }
        }
コード例 #7
0
        public bool SaveData(string path, ShipData data)
        {
            string json = JsonUtility.ToJson(data);

            return(MyTools.WriteJson <ShipData> (path, json));
        }
コード例 #8
0
        public bool DisplayFoundCalendar(bool bModal)
        {
            _Daddy.UpdateHttpDefaultWebProxy();
            String owner = ConfigurationManager.AppSettings["owner"];

            // On checke que les L/MDP soient corrects
            // Et on récupère les cookies au passage
            CookieContainer cookieJar = _Daddy.CheckGCAccount(true, false);

            if (cookieJar == null)
            {
                return(false);
            }

            _Daddy._ThreadProgressBarTitle = _Daddy.GetTranslator().GetString("LblFetchingProgressInfoMsg");
            _Daddy.CreateThreadProgressBar();
            string result = _Daddy.GetCacheHTMLFromClientImpl("https://www.geocaching.com/my/logs.aspx?s=1&lt=2", cookieJar);


            // On extrait la table
            result = MyTools.GetSnippetFromText("<table", "</table>", result);

            // Chaque <tr est un found it
            List <String> founds = MyTools.GetSnippetsFromText("<tr", "</tr>", result);

            // on parcourt chaque foundit
            Dictionary <DateTime, int> date_founds = new Dictionary <DateTime, int>();

            foreach (String bloc in founds)
            {
                // on splitte en <td
                List <String> cols = MyTools.GetSnippetsFromText("<td>", "</td>", bloc);

                // 2 : date
                String date = cols[2];
                date = MyTools.CleanString(date);
                DateTime ddate;
                if (DateTime.TryParse(date, out ddate) == true)
                {
                    ddate = new DateTime(ddate.Year, ddate.Month, ddate.Day);
                    if (date_founds.ContainsKey(ddate))
                    {
                        date_founds[ddate] = date_founds[ddate] + 1;
                    }
                    else
                    {
                        date_founds.Add(ddate, 1);
                    }
                }
            }
            _Daddy.KillThreadProgressBar();

            FoundCalendar cal = new FoundCalendar(date_founds);

            cal.Icon = _Daddy.Icon;
            if (bModal)
            {
                cal.ShowDialog();
            }
            else
            {
                cal.Show();
            }
            return(true);
        }
コード例 #9
0
 public void ClearCards()
 {
     MyTools.DestroyAllChild(transform);
 }
コード例 #10
0
 public ShipData GetData(string path)
 {
     return(MyTools.ReadJson <ShipData> (path));
 }
コード例 #11
0
 public void CloseUI()
 {
     MyTools.SetActive(UI, false);
     isStoring = false;
 }
コード例 #12
0
 public void OpenUI()
 {
     MyTools.SetActive(UI, true);
     isStoring = true;
     LoadFromWarehouseInfo();
 }
コード例 #13
0
 public void CanStore()
 {
     MyTools.SetActive(warehouseBtn.gameObject, true);
 }
コード例 #14
0
ファイル: CacheCoverage.cs プロジェクト: michaeloed/mgmgeo
        public bool DoIt()
        {
            if (_Daddy != null)
            {
                String pqdatapath = _Daddy.GetUserDataPath() + Path.DirectorySeparatorChar + "GPX" + Path.DirectorySeparatorChar + "PQ" + Path.DirectorySeparatorChar;
                String myfinds    = pqdatapath + "MyFindsPocketQuery.zip";
                if (File.Exists(myfinds) == false)
                {
                    _Daddy.MSG("Fichier " + myfinds + " manquant");
                    return(false);
                }
                string[] files = new string[1];
                files[0] = myfinds;
                _Daddy.LoadBatchOfFilesImpl(files, true, false, false);

                KmlManager kml = new KmlManager(_Daddy);

                // Le monde
                bool b = kml.DisplayWorldCoverage();
                if (!b)
                {
                    _Daddy.MSG("Erreur");
                    return(false);
                }
                //_Daddy._cacheDetail._gmap.Zoom = 2.5;
                //_Daddy._cacheDetail.Location = new Point(0,0);
                //_Daddy._cacheDetail.Size = new Size(1200,1200);
                //_Daddy._cacheDetail._gmap.Position = new PointLatLng(0, 0);
                Thread.Sleep(2000);

                Image img = _Daddy._cacheDetail._gmap.ToImage();
                img.Save(_Daddy.GetUserDataPath() + Path.DirectorySeparatorChar + "World.png", ImageFormat.Png);

                // La France et ses zones
                for (int i = 1; i <= 5; i++)
                {
                    b = kml.DisplayFranceCoverageImpl(i);
                    if (!b)
                    {
                        _Daddy.MSG("Erreur");
                        return(false);
                    }

                    //_Daddy._cacheDetail._gmap.Zoom = 6.0;
                    //_Daddy._cacheDetail.Location = new Point(0,0);
                    //_Daddy._cacheDetail.Size = new Size(1200,1200);
                    //_Daddy._cacheDetail._gmap.Position = new PointLatLng(46.5437496027386, 2.9443359375);
                    Thread.Sleep(2000);

                    img = _Daddy._cacheDetail._gmap.ToImage();
                    img.Save(_Daddy.GetUserDataPath() + Path.DirectorySeparatorChar + "France_" + i.ToString() + ".png", ImageFormat.Png);
                }

                MyTools.StartCmd(_Daddy.GetUserDataPath());
                return(true);
            }
            else
            {
                MessageBox.Show("Daddy is missing :-(");
                return(false);
            }
        }
コード例 #15
0
 public void CloseUI()
 {
     MyTools.SetActive(UI, false);
     YesButton.onClick.RemoveAllListeners();
 }
コード例 #16
0
 public void EnableNotFightActions()
 {
     MyTools.SetActive(notFightActions, true);
     MyTools.SetActive(fightActions, false);
 }
コード例 #17
0
        public MainWindow()
        {
            InitializeComponent();

            WindowStyle = WindowStyle.SingleBorderWindow;

            if (File.Exists($"{SetupBasePath}config.json"))
            {
                DnsSettings.ReadConfig($"{SetupBasePath}config.json");
            }

            if (DnsSettings.BlackListEnable && File.Exists($"{SetupBasePath}black.list"))
            {
                DnsSettings.ReadBlackList($"{SetupBasePath}black.list");
            }

            if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}white.list"))
            {
                DnsSettings.ReadWhiteList($"{SetupBasePath}white.list");
            }

            if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}rewrite.list"))
            {
                DnsSettings.ReadWhiteList($"{SetupBasePath}rewrite.list");
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            #pragma warning disable CS0162 //未实装
            if (false)
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                    (sender, cert, chain, sslPolicyErrors) => true;
            }

            switch (1.2F)
            {
            case 1:
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                break;

            case 1.1F:
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
                break;

            case 1.2F:
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                break;

            default:
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                break;
            }
            #pragma warning restore CS0162

            LocIPAddr = IPAddress.Parse(IpTools.GetLocIp());
            IntIPAddr = IPAddress.Parse(IpTools.GetIntIp());

            DnsServer myDnsServer = new DnsServer(DnsSettings.ListenIp, 10, 10);
            myDnsServer.QueryReceived += QueryResolve.ServerOnQueryReceived;
            DnsSvrWorker.DoWork       += (sender, args) => myDnsServer.Start();
            DnsSvrWorker.Disposed     += (sender, args) => myDnsServer.Stop();

            NotifyIcon = new NotifyIcon()
            {
                Text = @"AuroraDNS", Visible = true,
                Icon = Properties.Resources.AuroraWhite
            };
            WinFormMenuItem showItem    = new WinFormMenuItem("最小化 / 恢复", MinimizedNormal);
            WinFormMenuItem restartItem = new WinFormMenuItem("重新启动", (sender, args) =>
            {
                DnsSvrWorker.Dispose();
                Process.Start(new ProcessStartInfo {
                    FileName = GetType().Assembly.Location
                });
                Environment.Exit(Environment.ExitCode);
            });
            WinFormMenuItem notepadLogItem = new WinFormMenuItem("查阅日志", (sender, args) =>
            {
                if (File.Exists(
                        $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month}{DateTime.Today.Day}.log")
                    )
                {
                    Process.Start(new ProcessStartInfo("notepad.exe",
                                                       $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month}{DateTime.Today.Day}.log"));
                }
            });
            WinFormMenuItem abootItem    = new WinFormMenuItem("关于…", (sender, args) => new AboutWindow().ShowDialog());
            WinFormMenuItem updateItem   = new WinFormMenuItem("检查更新…", (sender, args) => MyTools.CheckUpdate(GetType().Assembly.Location));
            WinFormMenuItem settingsItem = new WinFormMenuItem("设置…", (sender, args) => new SettingsWindow().ShowDialog());
            WinFormMenuItem exitItem     = new WinFormMenuItem("退出", (sender, args) => Environment.Exit(Environment.ExitCode));

            NotifyIcon.ContextMenu =
                new WinFormContextMenu(new[]
            {
                showItem, notepadLogItem, new WinFormMenuItem("-"), abootItem, updateItem, settingsItem, new WinFormMenuItem("-"), restartItem, exitItem
            });

            NotifyIcon.DoubleClick += MinimizedNormal;

            if (MyTools.IsNslookupLocDns())
            {
                IsSysDns.ToolTip = "已设为系统 DNS";
            }
        }
コード例 #18
0
        public bool GenerateFieldNotes(bool bGetSelOnly, bool bAutoFile, ref String field_notes, DateTime deb, DateTime fin)
        {
            // Liste de commentaires par défaut
            List <String> l = new List <string>();

            l.Add("Jolie cache, merci pour la découverte du lieu ! Merci pour la cache !");
            l.Add("Trouvée, mais c'était pas évident. Merci pour la cache !");
            l.Add("Merci pour cette cache et la promenade. Merci pour la cache !");
            l.Add("Une belle journée de géocaching qui m'a permis de trouver de nouvelles caches, merci. Merci pour la cache !");
            l.Add("Cache trouvée rapidement, sympa comme endroit. Merci pour la cache !");
            l.Add("Une de plus au compteur, je crois que je suis devenu accro. Merci pour la cache !");
            l.Add("Merci pour la cache !");
            l.Add("En promenade dans le coin j'en profite pour faire des caches. Merci pour la cache !");
            l.Add("J'ai un peu cherché pour celle-ci je ne devais pas être trop inspiré. Merci pour la cache !");
            l.Add("Très bon emplacement pour la cache. Merci pour la cache !");
            l.Add("Merci pour m'avoir montré cet endroit. Merci pour la cache !");
            l.Add("Jolie découverte, c'est sympa. Merci pour la cache !");
            l.Add("Un coin cool, j'aime beaucoup. Merci pour la cache !");
            l.Add("Etrangement très calme, pas de problème. Merci pour la cache !");
            l.Add("Je sens que je suis sur une bonne série, pas de problème. Merci pour la cache !");
            l.Add("Relativement facile à trouver, cool. Merci pour la cache !");
            l.Add("Rapidement délogée. Merci pour la cache !");
            l.Add("Et voilà, encore une cache, cool. Merci pour la cache !");
            l.Add("Je sens que j'ai un bon fluide aujourd'hui. Merci pour la cache !");
            l.Add("Trouvée sans trop de difficulté. Merci pour la cache !");
            l.Add("Des gens au loin, sûrement des moldus. Merci pour la cache !");
            l.Add("Je devais dormir j'ai mis du temps à la voir celle-là. Merci pour la cache !");
            l.Add("Bonne coordonnées, super. Merci pour la cache !");
            l.Add("J'ai un peu tourné en rond à cause de mon GPS capricieux. Merci pour la cache !");
            l.Add("Et une boite de plus, cool. Merci pour la cache !");
            l.Add("Et hop main mise sur la boite et le logbook. Merci pour la cache !");
            l.Add("endroit sympa qui mérite le détour. Merci pour la cache !");
            l.Add("Merci au poseur pour cette cache. Merci pour la cache !");
            l.Add("En route vers la suivante, sympa. Merci pour la cache !");
            l.Add("Et on continue la promenade. Merci pour la cache !");

            // On le fait pour les caches affichées
            List <Geocache> caches = null;

            if (bGetSelOnly)
            {
                caches = _Daddy.GetSelectedCaches();
            }
            else
            {
                caches = _Daddy.GetDisplayedCaches();
            }
            if (caches.Count == 0)
            {
                return(false);
            }

            // On demande la date de début et de fin du run
            List <ParameterObject> lst = new List <ParameterObject>();

            lst.Add(new ParameterObject(ParameterObject.ParameterType.Label, "", "nb", caches.Count.ToString() + " caches vont être traitées !"));
            lst.Add(new ParameterObject(ParameterObject.ParameterType.Date, DateTime.Now, "date", "Date de début"));
            lst.Add(new ParameterObject(ParameterObject.ParameterType.Date, DateTime.Now, "date", "Date de fin"));

            ParametersChanger changer = new ParametersChanger();

            changer.Title         = "Période du run ?";
            changer.BtnCancel     = _Daddy.GetTranslator().GetString("BtnCancel");
            changer.BtnOK         = _Daddy.GetTranslator().GetString("BtnOk");
            changer.ErrorFormater = _Daddy.GetTranslator().GetString("ErrWrongParameter");
            changer.ErrorTitle    = _Daddy.GetTranslator().GetString("Error");
            changer.Parameters    = lst;
            changer.Font          = _Daddy.Font;
            changer.Icon          = _Daddy.Icon;

            bool bDateDefined = false;

            if ((deb != DateTime.MinValue) && (fin != DateTime.MinValue))
            {
                bDateDefined = true;
            }
            else
            {
                // On affiche le calendrier des trouvailles
                DisplayFoundCalendar(true);
            }

            if (bDateDefined || (changer.ShowDialog() == DialogResult.OK))
            {
                if (bDateDefined == false)
                {
                    deb = (DateTime)(lst[1].ValueO);
                    fin = (DateTime)(lst[2].ValueO);
                    //MSG(deb.ToString("yyyy-MM-ddT00:00:1Z"));
                }

                // Nombre de jours du run
                if (deb > fin)
                {
                    _Daddy.MSG("La date de début doit être antérieure à la date de fin !");
                    return(false);
                }
                int            nbJours         = (int)((fin - deb).TotalDays) + 1;
                int            index           = 0;
                int            cachesperday    = (int)((double)(caches.Count) / (double)nbJours + 1.0);
                DateTime       dateCache       = deb;
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.Filter           = "Field note (*.txt)|*.txt";
                saveFileDialog1.FileName         = "geocache_visits.txt";
                saveFileDialog1.RestoreDirectory = true;
                if (bAutoFile)
                {
                    String exePath = Path.GetDirectoryName(Application.ExecutablePath);
                    saveFileDialog1.FileName = exePath + Path.DirectorySeparatorChar + Guid.NewGuid().ToString();
                }

                if (bAutoFile || (saveFileDialog1.ShowDialog() == DialogResult.OK))
                {
                    FileInfo fi = new FileInfo(saveFileDialog1.FileName);
                    field_notes = saveFileDialog1.FileName;
                    Directory.SetCurrentDirectory(fi.Directory.ToString());
                    String fileRadix            = fi.Name.ToString();
                    System.IO.StreamWriter file = new System.IO.StreamWriter(fileRadix, false, System.Text.Encoding.GetEncoding("iso-8859-8"));
                    foreach (Geocache geo in caches)
                    {
                        String comment = l[MyTools.RandomNumber(l.Count - 1)];

                        file.WriteLine(geo._Code + "," +
                                       dateCache.ToString("yyyy-MM-ddT00:00Z") + "," +
                                       "Found it," +
                                       "\"" + comment + "\"");

                        index++;
                        if (index >= cachesperday)
                        {
                            // Jour suivant
                            index     = 0;
                            dateCache = dateCache.AddDays(1.0);
                        }
                    }
                    file.Close();
                }
            }
            return(true);
        }
コード例 #19
0
 public void DistroySelf()
 {
     MyTools.SetActive(gameObject, false);
 }
コード例 #20
0
 // Use this for initialization
 void Start()
 {
     play = MyTools.FindFunc <Button>(panelSelect.transform, "ButtonPlay");
     InitCharacterSelect(true);
     CharacterService.Instance.OnCreat += OnCharacterCreate;
 }
コード例 #21
0
 public void OpenUI()
 {
     MyTools.SetActive(UI, true);
 }
コード例 #22
0
        public MainWindow()
        {
            InitializeComponent();

            WindowStyle = WindowStyle.SingleBorderWindow;
            Grid.Effect = new BlurEffect {
                Radius = 5, RenderingBias = RenderingBias.Performance
            };

            if (TimeZoneInfo.Local.Id.Contains("China Standard Time") && RegionInfo.CurrentRegion.GeoId == 45)
            {
                //Mainland China PRC
                DnsSettings.SecondDnsIp = IPAddress.Parse("119.29.29.29");
                DnsSettings.HttpsDnsUrl = "https://neatdns.ustclug.org/resolve";
                UrlSettings.MDnsList    = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-CN.list";
                UrlSettings.WhatMyIpApi = "https://myip.ustclug.org/";
            }
            else if (TimeZoneInfo.Local.Id.Contains("Taipei Standard Time") && RegionInfo.CurrentRegion.GeoId == 237)
            {
                //Taiwan ROC
                DnsSettings.SecondDnsIp = IPAddress.Parse("101.101.101.101");
                DnsSettings.HttpsDnsUrl = "https://dns.twnic.tw/dns-query";
                UrlSettings.MDnsList    = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-TW.list";
            }
            else if (RegionInfo.CurrentRegion.GeoId == 104)
            {
                //HongKong SAR
                UrlSettings.MDnsList = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-HK.list";
            }

            try
            {
                if (File.Exists($"{SetupBasePath}url.json"))
                {
                    UrlSettings.ReadConfig($"{SetupBasePath}url.json");
                }
                if (File.Exists($"{SetupBasePath}config.json"))
                {
                    DnsSettings.ReadConfig($"{SetupBasePath}config.json");
                }
                if (DnsSettings.BlackListEnable && File.Exists($"{SetupBasePath}black.list"))
                {
                    DnsSettings.ReadBlackList($"{SetupBasePath}black.list");
                }
                if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}white.list"))
                {
                    DnsSettings.ReadWhiteList($"{SetupBasePath}white.list");
                }
                if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}rewrite.list"))
                {
                    DnsSettings.ReadWhiteList($"{SetupBasePath}rewrite.list");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error: 尝试读取配置文件错误{Environment.NewLine}Original error: {e.Message}");
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

//            if (false)
//                ServicePointManager.ServerCertificateValidationCallback +=
//                    (sender, cert, chain, sslPolicyErrors) => true;
//                //强烈不建议 忽略 TLS 证书安全错误
//
//            switch (0.0)
//            {
//                case 1:
//                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
//                    break;
//                case 1.1:
//                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
//                    break;
//                case 1.2:
//                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
//                    break;
//                default:
//                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
//                    break;
//            }

            LocIPAddr = IPAddress.Parse(IpTools.GetLocIp());
            IntIPAddr = IPAddress.Parse(IpTools.GetIntIp());

            MDnsServer = new DnsServer(DnsSettings.ListenIp, 10, 10);
            MDnsServer.QueryReceived += QueryResolve.ServerOnQueryReceived;
            MDnsSvrWorker.DoWork     += (sender, args) => MDnsServer.Start();
            MDnsSvrWorker.Disposed   += (sender, args) => MDnsServer.Stop();

            NotifyIcon = new NotifyIcon()
            {
                Text = @"AuroraDNS", Visible = false,
                Icon = Properties.Resources.AuroraWhite
            };
            WinFormMenuItem showItem    = new WinFormMenuItem("最小化 / 恢复", MinimizedNormal);
            WinFormMenuItem restartItem = new WinFormMenuItem("重新启动", (sender, args) =>
            {
                if (MDnsSvrWorker.IsBusy)
                {
                    MDnsSvrWorker.Dispose();
                }
                Process.Start(new ProcessStartInfo {
                    FileName = GetType().Assembly.Location
                });
                Environment.Exit(Environment.ExitCode);
            });
            WinFormMenuItem notepadLogItem = new WinFormMenuItem("查阅日志", (sender, args) =>
            {
                if (File.Exists(
                        $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month:00}{DateTime.Today.Day:00}.log"))
                {
                    Process.Start(new ProcessStartInfo("notepad.exe",
                                                       $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month:00}{DateTime.Today.Day:00}.log"));
                }
                else
                {
                    MessageBox.Show("找不到当前日志文件,或当前未产生日志文件。");
                }
            });
            WinFormMenuItem abootItem    = new WinFormMenuItem("关于…", (sender, args) => new AboutWindow().ShowDialog());
            WinFormMenuItem updateItem   = new WinFormMenuItem("检查更新…", (sender, args) => MyTools.CheckUpdate(GetType().Assembly.Location));
            WinFormMenuItem settingsItem = new WinFormMenuItem("设置…", (sender, args) => new SettingsWindow().ShowDialog());
            WinFormMenuItem exitItem     = new WinFormMenuItem("退出", (sender, args) => Environment.Exit(Environment.ExitCode));

            NotifyIcon.ContextMenu =
                new WinFormContextMenu(new[]
            {
                showItem, notepadLogItem, new WinFormMenuItem("-"), abootItem, updateItem, settingsItem, new WinFormMenuItem("-"), restartItem, exitItem
            });

            NotifyIcon.DoubleClick += MinimizedNormal;

            if (MyTools.IsNslookupLocDns())
            {
                IsSysDns.ToolTip = "已设为系统 DNS";
            }
        }
コード例 #23
0
        /// <summary>
        /// Create a list of empty geocaches from an OV2 file.
        /// Empty geocache will have the following valid attributes:
        /// - Longitude
        /// - Latitude
        /// - Type
        /// - Difficulty (only for SuperPP format)
        /// - Terrain (only for SuperPP format)
        /// All other attributes will have default values.
        /// </summary>
        /// <param name="daddy">Reference to main window (MainWindow instance), used for callback purposes</param>
        /// <param name="filename">OV2 file</param>
        /// <param name="sType">Type of Geocache to be created (Traditional, etc...)</param>
        /// <param name="bFromSuperPP">true if OV2 is generated by SuperPP
        /// SuperPP is a geocacher producing OV2 exports for France,
        /// see http://www.geocaching.com/profile/default.aspx?guid=05b50a82-2ae6-404b-958f-f184100acf25</param>
        /// <returns>List of created geocaches</returns>
        public List <Geocache> ProcessFile(MainWindow daddy, string filename, string sType, bool bFromSuperPP)
        {
            string[] data = null;
            try
            {
                List <Geocache> caches      = new List <Geocache>();
                FileStream      infile      = new FileStream(filename, FileMode.Open, FileAccess.Read);
                int             iIndexCache = 0;
                while (infile.Length != infile.Position)
                {
                    data = readOV2Record(infile);
                    if (data != null)
                    {
                        //for (int i = 0; i < data.Length; i++)
                        // 0 : nom
                        // 1 : latitude
                        // 2 : longitude
                        // data[i]
                        Geocache geo = new Geocache(daddy);
                        geo._Longitude  = data[2].ToString().Replace(",", ".");
                        geo._Latitude   = data[1].ToString().Replace(",", ".");
                        geo._dLongitude = MyTools.ConvertToDouble(geo._Longitude);
                        geo._dLatitude  = MyTools.ConvertToDouble(geo._Latitude);
                        if (bFromSuperPP)
                        {
                            // Le bon vieux format de SuperPP
                            geo._Code = data[0].Substring(0, data[0].IndexOf(' '));
                            String n    = data[0].Substring(data[0].IndexOf(" - ") + 3);
                            int    iend = n.LastIndexOf(" (");
                            if (iend != -1)
                            {
                                n = n.Substring(0, iend);
                            }
                            geo._Name             = n;
                            geo._CacheId          = (daddy._iCacheId++).ToString();
                            geo._OwnerId          = geo._CacheId;
                            geo._Country          = "France";
                            geo._State            = "Unknown";
                            geo._Type             = sType;
                            geo._Available        = "True";
                            geo._Archived         = "False";
                            geo._Url              = "http://coord.info/" + geo._Code;
                            geo._Owner            = "Unknown";
                            geo._PlacedBy         = "Unknown";
                            geo._ShortDescHTML    = "none";
                            geo._ShortDescription = "none";
                            geo._LongDescHTML     = "none";
                            geo._LongDescription  = "none";
                            geo._Hint             = "";
                            geo._DateCreation     = DateTime.Now.ToString(GeocachingConstants._FalseDatePattern);
                            geo._Container        = "Not chosen";

                            // On cherche à convertir la D/T
                            try
                            {
                                iend = data[0].LastIndexOf("(");
                                if (iend != -1)
                                {
                                    string dt = data[0].Substring(iend);
                                    dt     = dt.Substring(0, dt.Length - 1);
                                    geo._D = dt.Substring(1, dt.IndexOf('/') - 1).Replace(",", ".");
                                    geo._T = dt.Substring(dt.IndexOf('/') + 1).Replace(",", ".");
                                }
                                else
                                {
                                    geo._D = "1";
                                    geo._T = "1";
                                }
                            }
                            catch (Exception)
                            {
                                geo._D = "1";
                                geo._T = "1";
                            }
                        }
                        else
                        {
                            // Un format inconnu...
                            String code    = "GC";
                            String subcode = iIndexCache.ToString("X");
                            int    izero   = 5 - subcode.Length;
                            if (izero > 0)
                            {
                                String str = new String('0', izero);
                                code += str;
                            }
                            code += subcode;

                            geo._Code = code;
                            String n = data[0];

                            /*int iend = n.LastIndexOf(" (");
                             * if (iend != -1)
                             *  n = n.Substring(0, iend);*/
                            geo._Name             = n;
                            geo._CacheId          = (daddy._iCacheId++).ToString();
                            geo._OwnerId          = geo._CacheId;
                            geo._Country          = "Unknown";
                            geo._State            = "Unknown";
                            geo._Type             = sType;
                            geo._Available        = "True";
                            geo._Archived         = "False";
                            geo._Url              = "http://coord.info/FAKEGEOCACHE";
                            geo._Owner            = "Unknown";
                            geo._PlacedBy         = "Unknown";
                            geo._ShortDescHTML    = "none";
                            geo._ShortDescription = "none";
                            geo._LongDescHTML     = "none";
                            geo._LongDescription  = "none";
                            geo._Hint             = "";
                            geo._DateCreation     = DateTime.Now.ToString(GeocachingConstants._FalseDatePattern);
                            geo._Container        = "Not chosen";

                            // On cherche à convertir la D/T

                            /*try
                             * {
                             *  iend = data[0].LastIndexOf("(");
                             *  if (iend != -1)
                             *  {
                             *      string dt = data[0].Substring(iend);
                             *      dt = dt.Substring(0, dt.Length - 1);
                             *      geo._D = dt.Substring(1, dt.IndexOf('/') - 1).Replace(",", ".");
                             *      geo._T = dt.Substring(dt.IndexOf('/') + 1).Replace(",", ".");
                             *      if (geo._D == "")
                             *          geo._D = "1";
                             *      if (geo._T == "")
                             *          geo._T = "1";
                             *  }
                             *  else
                             *  {
                             *      geo._D = "1";
                             *      geo._T = "1";
                             *  }
                             * }
                             * catch (Exception)*/
                            {
                                geo._D = "1";
                                geo._T = "1";
                            }
                        }

                        iIndexCache++;
                        caches.Add(geo);
                    }
                }
                return(caches);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #24
0
 public void CloseUI()
 {
     MyTools.SetActive(UI, false);
 }
コード例 #25
0
        /// <summary>
        /// Create a list of empty geocaches from an OV2 file from SuperPP.
        /// SuperPP is a geocacher producing OV2 exports for France,
        /// see http://www.geocaching.com/profile/default.aspx?guid=05b50a82-2ae6-404b-958f-f184100acf25
        /// DB will be populated with the following valid attributes:
        /// - Code
        /// - Name
        /// - Type
        /// - Latitude
        /// - Longitude
        /// - Difficulty
        /// - Terrain
        /// </summary>
        /// <param name="con">SQLiteConnection</param>
        /// <param name="cmd">SQLiteCommand</param>
        /// <param name="filename">OV2 file</param>
        /// <param name="sType">Type of Geocache to be created (Traditional, etc...)</param>
        /// <returns>Number of inserted row into DB</returns>
        public int ProcessFileSuperPP(SQLiteConnection con, SQLiteCommand cmd, string filename, string sType)
        {
            int nb = 0;

            string[] data = null;
            try
            {
                if (!File.Exists(filename))
                {
                    return(0);
                }

                // Prepare transaction
                SQLiteTransaction transaction = con.BeginTransaction();

                cmd.CommandText = "INSERT INTO GeocacheLite(Code, Name, Type, Latitude, Longitude, Difficulty, Terrain) VALUES(@Code, @Name, @Type, @Latitude, @Longitude, @Difficulty, @Terrain)";
                cmd.Parameters.AddWithValue("@Code", "");
                cmd.Parameters.AddWithValue("@Name", "");
                cmd.Parameters.AddWithValue("@Type", "");
                cmd.Parameters.AddWithValue("@Latitude", 0.0);
                cmd.Parameters.AddWithValue("@Longitude", 0.0);
                cmd.Parameters.AddWithValue("@Difficulty", "");
                cmd.Parameters.AddWithValue("@Terrain", "");

                FileStream infile = new FileStream(filename, FileMode.Open, FileAccess.Read);
                while (infile.Length != infile.Position)
                {
                    data = readOV2Record(infile);
                    if (data != null)
                    {
                        //for (int i = 0; i < data.Length; i++)
                        // 0 : nom
                        // 1 : latitude
                        // 2 : longitude
                        // data[i]
                        double lon = MyTools.ConvertToDouble(data[2]);
                        double lat = MyTools.ConvertToDouble(data[1]);

                        // Le bon vieux format de SuperPP
                        String code = data[0].Substring(0, data[0].IndexOf(' '));
                        String name = data[0].Substring(data[0].IndexOf(" - ") + 3);
                        int    iend = name.LastIndexOf(" (");
                        if (iend != -1)
                        {
                            name = name.Substring(0, iend);
                        }

                        String D = "1";
                        String T = "1";
                        // On cherche à convertir la D/T
                        try
                        {
                            iend = data[0].LastIndexOf("(");
                            if (iend != -1)
                            {
                                string dt = data[0].Substring(iend);
                                dt = dt.Substring(0, dt.Length - 1);
                                D  = dt.Substring(1, dt.IndexOf('/') - 1).Replace(",", ".");
                                T  = dt.Substring(dt.IndexOf('/') + 1).Replace(",", ".");
                            }
                        }
                        catch (Exception)
                        {
                        }

                        // Insert values using preparedcommands
                        cmd.Parameters["@Code"].Value       = code;
                        cmd.Parameters["@Name"].Value       = name;
                        cmd.Parameters["@Type"].Value       = sType;
                        cmd.Parameters["@Latitude"].Value   = lat;
                        cmd.Parameters["@Longitude"].Value  = lon;
                        cmd.Parameters["@Difficulty"].Value = D;
                        cmd.Parameters["@Terrain"].Value    = T;
                        cmd.ExecuteNonQuery();

                        nb++;
                    }
                }
                infile.Close();

                // en transaction
                transaction.Commit();


                return(nb);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #26
0
 private void RunWithStart_Unchecked(object sender, RoutedEventArgs e) =>
 MyTools.SetRunWithStart(false, "AuroraDNS", GetType().Assembly.Location);
コード例 #27
0
 private void textBox_colWidth_KeyPress(object sender, KeyPressEventArgs e)
 {
     //限制输入浮点数
     e.Handled = MyTools.inputdouble(sender, e);
 }
コード例 #28
0
    string GetPlatformURL(EPlatformFunType FunType)
    {
        string Url = "";

        switch (Const.PlatformUrlType)
        {
        case 0:
            Url = "http://platformces.koigame.cn:8888/";
            break;

        case 1:
            Url = "http://platform01.baobaolong.club/";
            break;
        }
        switch (FunType)
        {
        case EPlatformFunType.eLeSDKLogin:
            Url += "platform/user/thirdOauthLogin?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=1&userId={0}&deviceType=" + deviceType + "&gameVersion=100&appVersion=200";
            break;

        case EPlatformFunType.eGetRole:
            Url += "platform/game/getRole?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&areaCode=3001&userId=" + PlatformInfo.userId + "&accessToken=" + PlatformInfo.accessToken + "&channel=" + PlatformInfo.siteId + "&giftId=0";
            break;

        case EPlatformFunType.eCheckRoleName:
            Url += "platform/game/checkRoleName?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&areaCode=3001&roleId=" + PlatformInfo.roleId + "&roleName={0}&accessToken=" + PlatformInfo.accessToken + "&userId=" + PlatformInfo.userId;
            break;

        case EPlatformFunType.eGetGoodsList:
            Url += "platform/billing/getGoodsList?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&areaCode=3001&roleId=" + PlatformInfo.roleId + "&shopType=1";
            break;

        case EPlatformFunType.eCreateOrder:
            Url += "platform/billing/createOrder?areaCode=3001&roleId=" + PlatformInfo.roleId + "&goodsCode={0}&payType=0&orderDesc={1}&payAmount={2}&gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&userId=" + PlatformInfo.userId + "&accessToken=" + PlatformInfo.accessToken;
            break;

        case EPlatformFunType.eSendSmsToUser:
            Url += "platform/user/public/sendSmsToUser?gameId=" + PlatformInfo.gameId + "&accountName={0}";
            break;

        case EPlatformFunType.eRegisterPhoneNumAccount:
            Url += "platform/user/registerAccount?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=6&deviceType=" + deviceType + "&gameVersion=100&accountName={0}&password=123456&signCode={1}";
            break;

        case EPlatformFunType.ePhoneNumLogin:
            Url += "platform/user/login?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=4&deviceType=" + deviceType + "&gameVersion=100&accountName={0}&password={1}";
            break;

        case EPlatformFunType.ePhoneNumLoginUseVerificationCode:
            Url += "platform/user/loginByPhoneTicket?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=6&deviceType=" + deviceType + "&gameVersion=100&accountName={0}&password=123456&signCode={1}";
            break;

        case EPlatformFunType.eTokenLogin:
            Url += "platform/user/tokenLogin?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=4&deviceType=" + deviceType + "&gameVersion=100&refreshToken=" + PlatformInfo.refreshToken;
            break;

        case EPlatformFunType.eQuickLogin:
            Url += "platform/user/public/quickLogin?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=1&userId=" + SystemInfo.deviceModel + MyTools.GenerateUniqueText(8) + "&deviceType=" + deviceType + "&gameVersion=100&appVersion=200";
            break;

        case EPlatformFunType.eWeChatLogin:
            Url += "platform/user/thirdOauthLogin?gameId=" + PlatformInfo.gameId + "&siteId=" + PlatformInfo.siteId + "&accountType=1&userId={0}&accountName={1}&accessToken={2}&deviceType=" + deviceType + "&gameVersion=100&appVersion=200";
            break;
        }
        return(Url);
    }
コード例 #29
0
 public void EnableFightActions()
 {
     MyTools.SetActive(notFightActions, false);
     fightActions.SetActive(true);
 }
コード例 #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wpts"></param>
        /// <param name="striphtml"></param>
        /// <param name="doc"></param>
        private void InsertWaypoints(List <Waypoint> wpts, bool striphtml, HtmlAgilityPack.HtmlDocument doc)
        {
            using (SQLiteConnection con = new SQLiteConnection(_dbpath))
            {
                con.Open();
                using (SQLiteCommand cmd = new SQLiteCommand(con))
                {
                    // Prepare transaction
                    SQLiteTransaction transaction = con.BeginTransaction();

                    cmd.CommandText =
                        @"INSERT  OR REPLACE INTO Waypoint(
Code,
Origin,
Latitude,
Longitude,
Date,
Comment,
Description,
Url,
UrlName,
Symbol,
Type,
DateExport
) VALUES(
@Code,
@Origin,
@Latitude,
@Longitude,
@Date,
@Comment,
@Description,
@Url,
@UrlName,
@Symbol,
@Type,
@DateExport
)";
                    cmd.Parameters.AddWithValue("@Code", "");
                    cmd.Parameters.AddWithValue("@Origin", 0);
                    cmd.Parameters.AddWithValue("@Latitude", "");
                    cmd.Parameters.AddWithValue("@Longitude", "");
                    cmd.Parameters.AddWithValue("@Date", "");
                    cmd.Parameters.AddWithValue("@Comment", "");
                    cmd.Parameters.AddWithValue("@Description", "");
                    cmd.Parameters.AddWithValue("@Url", "");
                    cmd.Parameters.AddWithValue("@UrlName", "");
                    cmd.Parameters.AddWithValue("@Symbol", "");
                    cmd.Parameters.AddWithValue("@Type", "");
                    cmd.Parameters.AddWithValue("@DateExport", "");

                    foreach (Waypoint wpt in wpts)
                    {
                        // Insert values using preparedcommands
                        cmd.Parameters["@Code"].Value        = wpt._name;
                        cmd.Parameters["@Origin"].Value      = (int)(wpt._eOrigin);
                        cmd.Parameters["@Latitude"].Value    = wpt._lat;
                        cmd.Parameters["@Longitude"].Value   = wpt._lon;
                        cmd.Parameters["@Date"].Value        = wpt._time;
                        cmd.Parameters["@Comment"].Value     = wpt._cmt;
                        cmd.Parameters["@Description"].Value = (striphtml)?MyTools.StripHtmlTags(wpt._desc, doc):wpt._desc;
                        cmd.Parameters["@Url"].Value         = wpt._url;
                        cmd.Parameters["@UrlName"].Value     = wpt._urlname;
                        cmd.Parameters["@Symbol"].Value      = wpt._sym;
                        cmd.Parameters["@Type"].Value        = wpt._type;
                        cmd.Parameters["@DateExport"].Value  = wpt._DateExport;

                        cmd.ExecuteNonQuery();
                    }

                    // en transaction
                    transaction.Commit();
                }
                con.Close();
            }
        }
コード例 #31
0
 private void CreateTool(MyTools.BaseTool tool)
 {
     if (Host.Global.SlectedTool == null)
     {
         Host.Global.SlectedTool = tool;
     }
     else
     {
         if (!Host.Global.SlectedTool.Compare(tool.ToString()))
         {
             Host.Global.SlectedTool = tool;
         }
     }
 }