コード例 #1
0
ファイル: NetLogWatcherTests.cs プロジェクト: jgoode/EliteLog
        public void TestStart()
        {
            INetLogWatcher logWatcher = new NetLogWatcher();
            Assert.IsTrue(logWatcher.Status == NetLogWatcherStatus.Initialized);

            logWatcher.Start();
            Assert.IsTrue(logWatcher.Status == NetLogWatcherStatus.NoPath);
            var path = @"c:\EliteLogTestFiles";
            if (!Directory.Exists(path)) {
                Directory.CreateDirectory(path);
            }

            logWatcher.Watcher.Path = path;
            Assert.IsTrue(logWatcher.Watcher.Path == path);
            logWatcher.Start();
            Assert.IsTrue(logWatcher.Status == NetLogWatcherStatus.Started);
            Assert.IsTrue(logWatcher.Watcher.EnableRaisingEvents);
        }
コード例 #2
0
ファイル: EliteExplorer.cs プロジェクト: jgoode/EliteLog
        // events
        private async void EliteExplorer_Load(object sender, EventArgs e) {
            if (ParseUser.CurrentUser != null) {
                // do stuff with the user
                _user = UserMapper.Map(ParseUser.CurrentUser);
            } else {
                // show the signup or login screen
                if (!ConfigurationManager.AppSettings.HasKeys()) {
                    // TODO: Form Popup to signup 
                    ConfigurationManager.AppSettings.Add("commander", "The Mule");
                } else {
                    // TODO: Login screen popup
                    var login = new Login();
                    var a = true;
                    while (a)
                        if (login.ShowDialog() == DialogResult.OK) {
                            var commander = login.UsernameText;
                            var pass = login.PasswordText;

                            try {
                                await ParseUser.LogInAsync(commander, pass);
                                // Login was successful.
                                a = !a;
                            } catch (Exception ex) {
                                // The login failed. Check the error to see why.
                                MessageBox.Show(ex.Message);
                            }
                        }
                }
            }

            _persistentStore = new ParsePersistentStore(_user);
            _watcher = new NetLogWatcher(_persistentStore);
            _watcher.Watcher.Path = @"C:\Users\John Goode\AppData\Local\Frontier_Developments\Products\FORC-FDEV-D-1003\Logs";
            // C:\Users\John Goode\AppData\Local\Frontier_Developments\Products\FORC-FDEV-D-1003\Logs
            _watcher.OnNewPosition += new NetLogWatcherHandler(this.NewPosition);
            //_watcher.SystemFound += _watcher_SystemFound;
            _watcher.Start();


        }