Пример #1
0
            private StatusContainer EnsureTarget(object target, object parent)
            {
                var sItem = _statusList.FirstOrDefault((s, mTarget) => s.Object == mTarget, target);

                if (sItem != null)
                {
                    return(sItem);
                }

                sItem = new StatusContainer {
                    Object = target, Parent = parent
                };
                _statusList.Add(sItem);
                var gFuncInstance = new StatusAttributesContainer(target);

                _statusAttributeContainer.Add(gFuncInstance);
                var baseFunc = gFuncInstance.GetFuncByAttribute();

                if (baseFunc != null)
                {
                    sItem.AddStatusItemDelegate(baseFunc);
                    baseFunc();
                }
                return(sItem);
            }
Пример #2
0
 private void Connect_Click(object sender, EventArgs e)
 {
     if (!connect())
     {
         if (blueToothConnect())
         {
             if (connect())
             {
                 StatusDat.Text = "Connected";
                 StatusDat.Update();
                 StatusContainer.Update();
             }
             else
             {
                 StatusDat.Text = "Connection Problem.  Paired with bluetooth but did not connect.  Try again.";
                 StatusDat.Update();
                 StatusContainer.Update();
             }
         }
         else
         {
             StatusDat.Text = "Bluetooth pairing timed out.   Try to connect again, and be sure to press the sync button on Balance Board";
             StatusDat.Update();
             StatusContainer.Update();
         }
     }
     else
     {
         StatusDat.Text = "Connected";
         StatusDat.Update();
         StatusContainer.Update();
     }
 }
        public DistributedBruteForceManager(KeySearcher keySearcher, KeyPattern.KeyPattern keyPattern, KeySearcherSettings settings,
                                            KeyQualityHelper keyQualityHelper, P2PQuickWatchPresentation quickWatch, KeyPoolTreePresentation keyPoolTreePresentation)
        {
            this.keySearcher         = keySearcher;
            this.settings            = settings;
            this.keyQualityHelper    = keyQualityHelper;
            this.quickWatch          = quickWatch;
            _keyPoolTreePresentation = keyPoolTreePresentation;

            // TODO when setting is still default (21), it is only displayed as 21 - but the settings-instance contains 0 for that key!
            if (settings.ChunkSize == 0)
            {
                settings.ChunkSize = 21;
            }

            StopWatch = new Stopwatch();
            status    = new StatusContainer(keySearcher);
            status.IsCurrentProgressIndeterminate = true;

            keyGenerator        = new StorageKeyGenerator(keySearcher, settings);
            patternPool         = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, settings.ChunkSize)));
            StatisticsGenerator = new StatisticsGenerator(status, quickWatch, keySearcher, settings, this);
            quickWatch.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(UpdateStatusContainerInQuickWatch));

            _keyPoolTreePresentation.PatternPool      = patternPool;
            _keyPoolTreePresentation.KeyQualityHelper = keyQualityHelper;
            _keyPoolTreePresentation.KeyGenerator     = keyGenerator;
            _keyPoolTreePresentation.StatusContainer  = status;
        }
Пример #4
0
    // Start is called before the first frame update
    void Start()
    {
        Button btn = registerClientButton.GetComponent <Button>();

        btn.onClick.AddListener(TaskOnClick);

        statusContainer = GameObject.Find("/UICanvas/SampleOutput").GetComponent <StatusContainer>();
        mexSample       = GameObject.Find("/UICanvas/MexSampleObject").GetComponent <MexSample>();
    }
        public HandsGui(HandsComponent hands, HandsSystem handsSystem)
        {
            _handsComponent = hands;
            _handsSystem    = handsSystem;

            RobustXamlLoader.Load(this);
            IoCManager.InjectDependencies(this);

            StatusPanel = ItemStatusPanel.FromSide(HandLocation.Middle);
            StatusContainer.AddChild(StatusPanel);
            StatusPanel.SetPositionFirst();
        }
Пример #6
0
        private void Disconnect_Click(object sender, EventArgs e)
        {
            wiiDevice.Disconnect();
            Connect.Enabled    = true;
            Start30.Enabled    = false;
            Start60.Enabled    = false;
            Disconnect.Enabled = false;

            StatusDat.Text = "Not Connected";
            StatusDat.Refresh();
            StatusContainer.Update();
        }
        private void ShowNotification()
        {
            DoubleAnimation da = new DoubleAnimation
            {
                From     = 0,
                To       = 0.9,
                Duration = TimeSpan.FromMilliseconds(500)
            };

            da.Completed += (s, a) => HideNotification(4000);
            StatusContainer.Visibility = Visibility.Visible;
            StatusContainer.BeginAnimation(OpacityProperty, da, HandoffBehavior.SnapshotAndReplace);
        }
        private void HideNotification(int delay)
        {
            DoubleAnimation da = new DoubleAnimation
            {
                From      = 0.9,
                To        = 0,
                BeginTime = TimeSpan.FromMilliseconds(delay),
                Duration  = TimeSpan.FromMilliseconds(500)
            };

            da.Completed += (s, a) => StatusContainer.Visibility = Visibility.Hidden;
            StatusContainer.BeginAnimation(OpacityProperty, da, HandoffBehavior.SnapshotAndReplace);
        }
Пример #9
0
        public static void PushToDatabase(StatusContainer status, long bruteForceTime, string identifier, KeySearcherSettings settings, KeySearcher keySearcher)
        {
            if (string.IsNullOrEmpty(settings.EvaluationHost))
            {
                return;
            }

            var connectionString = "Data Source=" + settings.EvaluationHost + ";";

            connectionString += "User ID=" + settings.EvaluationUser + ";";
            connectionString += "Password="******";";
            connectionString += "Initial Catalog=" + settings.EvaluationDatabase;

            var sqlConnection = new SqlConnection();

            try
            {
                sqlConnection.ConnectionString = connectionString;
                sqlConnection.Open();

                // You can get the server version
                // SQLConnection.ServerVersion
            }
            catch (Exception ex)
            {
                sqlConnection.Dispose();
                keySearcher.GuiLogMessage("DB Error: " + ex.Message, NotificationLevel.Error);
                return;
            }

            var globalProgress        = status.GlobalProgress.ToString(CultureInfo.CreateSpecificCulture("en-US"));
            var dhtTimeInMilliseconds = status.DhtOverheadInReadableTime.TotalMilliseconds.ToString(CultureInfo.CreateSpecificCulture("en-US"));
            var sqlStatement          = string.Format("INSERT INTO [statistics] ([host],[date],[localFinishedChunks],[currentChunk],[globalProgress],[totalAmountOfParticipants],[totalDhtRequests],[requestsPerNode],[retrieveRequests],[removeRequests],[storeRequests],[dhtTimeInMilliseconds],[dhtOverheadInPercent],[storedBytes],[retrievedBytes],[totalBytes],[sentBytesByLinkManager],[receivedBytesByLinkManager],[totalBytesByLinkManager],[bruteForceTimeInMilliseconds],[identifier],[processID]) "
                                                      + "VALUES ('{0}', GetDate(), {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, '{11}', {12}, {13}, {14}, {15}, {16}, {17}, {18}, '{19}', {20});",
                                                      Environment.MachineName, status.LocalFinishedChunks, status.CurrentChunk, globalProgress, status.TotalAmountOfParticipants, status.TotalDhtRequests, status.RequestsPerNode, status.RetrieveRequests, status.RemoveRequests, status.StoreRequests, dhtTimeInMilliseconds, status.DhtOverheadInPercent, status.StoredBytes, status.RetrievedBytes, status.TotalBytes, status.SentBytesByLinkManager, status.ReceivedBytesByLinkManager, status.TotalBytesByLinkManager, bruteForceTime, identifier, Process.GetCurrentProcess().Id);

            try
            {
                var command = new SqlCommand(sqlStatement, sqlConnection);
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                keySearcher.GuiLogMessage("DB Error: " + ex.Message, NotificationLevel.Error);
            }
            finally
            {
                sqlConnection.Close();
                sqlConnection.Dispose();
            }
        }
Пример #10
0
        public static StatusContainer DrawShareInfluencesContent(StatusContainer _influences, string _help)
        {
            if (_influences.Enabled)
            {
                EditorGUI.indentLevel++;

                _influences.Damage   = ICEEditorLayout.DefaultSlider("Damage (%)", "Damage influence in percent", _influences.Damage, 0.0025f, -100, 100, 0, Info.STATUS_INFLUENCES_DAMAGE);
                _influences.Stress   = ICEEditorLayout.DefaultSlider("Stress (%)", "Stress influence in percent", _influences.Stress, 0.0025f, -100, 100, 0, Info.STATUS_INFLUENCES_STRESS);
                _influences.Debility = ICEEditorLayout.DefaultSlider("Debility (%)", "Debility influence in percent", _influences.Debility, 0.0025f, -100, 100, 0, Info.STATUS_INFLUENCES_DEBILITY);
                _influences.Hunger   = ICEEditorLayout.DefaultSlider("Hunger (%)", "Hunger influence in percent", _influences.Hunger, 0.0025f, -100, 100, 0, Info.STATUS_INFLUENCES_HUNGER);
                _influences.Thirst   = ICEEditorLayout.DefaultSlider("Thirst (%)", "Thirst influence in percent", _influences.Thirst, 0.0025f, -100, 100, 0, Info.STATUS_INFLUENCES_THIRST);

                EditorGUI.indentLevel--;

                EditorGUILayout.Separator();
            }

            return(_influences);
        }
Пример #11
0
            private void EnsureParent(object parent)
            {
                if (parent == null || _statusList.FirstOrDefault((s, mParent) => s.Object == mParent, parent) != null)
                {
                    return;
                }

                var sParent = new StatusContainer {
                    Object = parent
                };

                _statusList.Add(sParent);
                var gFuncInstance = new StatusAttributesContainer(parent);

                _statusAttributeContainer.Add(gFuncInstance);
                var parentFunc = gFuncInstance.GetFuncByAttribute();

                if (parentFunc != null)
                {
                    sParent.AddStatusItemDelegate(parentFunc);
                    parentFunc();
                }
            }
Пример #12
0
        public KeyPoolTree(BigInteger length, KeySearcher keySearcher, KeyQualityHelper keyQualityHelper, StorageKeyGenerator identifierGenerator, StatusContainer statusContainer, StatisticsGenerator statisticsGenerator)
        {
            this.keySearcher         = keySearcher;
            this.statusContainer     = statusContainer;
            this.statisticsGenerator = statisticsGenerator;
            Identifier = identifierGenerator.Generate();

            statusUpdater        = new StatusUpdater(statusContainer, identifierGenerator.GenerateStatusKey());
            skippedReservedNodes = false;
            updateIntervalMod    = 5;

            if (statisticsGenerator != null)
            {
                statisticsGenerator.MarkStartOfNodeSearch();
            }
            rootNode = NodeFactory.CreateNode(keyQualityHelper, null, 0, length - 1,
                                              Identifier);
            if (statisticsGenerator != null)
            {
                statisticsGenerator.MarkEndOfNodeSearch();
            }

            currentNode = rootNode;
        }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     statusContainer = GameObject.Find("/UICanvas/SampleOutput").GetComponent <StatusContainer>();
 }
Пример #14
0
        public static StatusContainer DrawSharedInfluences(StatusContainer _influences, string _help)
        {
            _influences.Enabled = ICEEditorLayout.ToggleLeft("Influences", "", _influences.Enabled, true, Info.STATUS_INFLUENCES);

            return(DrawShareInfluencesContent(_influences, _help));
        }
Пример #15
0
        private bool connect()
        {
            try
            {
                // Find all connected Wii devices.

                StatusDat.Text = "Looking for Balance Board";
                StatusDat.Refresh();
                StatusContainer.Update();


                var deviceCollection = new WiimoteCollection();
                deviceCollection.FindAllWiimotes();

                for (int i = 0; i < deviceCollection.Count; i++)
                {
                    wiiDevice = deviceCollection[i];

                    // Device type can only be found after connection, so prompt for multiple devices.

                    if (deviceCollection.Count > 1)
                    {
                        var devicePathId = new Regex("e_pid&.*?&(.*?)&").Match(wiiDevice.HIDDevicePath).Groups[1].Value.ToUpper();

                        //var response = MessageBox.Show("Connect to HID " + devicePathId + " device " + (i + 1) + " of " + deviceCollection.Count + " ?", "Multiple Wii Devices Found", MessageBoxButtons.YesNoCancel);
                        //if (response == DialogResult.Cancel) return;
                        //if (response == DialogResult.No) continue;
                    }

                    // Setup update handlers.

                    //   wiiDevice.WiimoteChanged += wiiDevice_WiimoteChanged;
                    //  wiiDevice.WiimoteExtensionChanged += wiiDevice_WiimoteExtensionChanged;

                    // Connect and send a request to verify it worked.

                    StatusDat.Text = "Found Device, connecting ...";
                    StatusDat.Refresh();
                    StatusContainer.Update();


                    wiiDevice.Connect();
                    wiiDevice.SetReportType(InputReport.IRAccel, false); //ALSE = DEVICE ONLY SENDS UPDATES WHEN VALUES CHANGE!
                    wiiDevice.SetLEDs(true, false, false, false);


                    // Enable processing of updates.

                    infoUpdateTimer.Enabled = true;

                    // Prevent connect being pressed more than once.

                    //   button_Connect.Enabled = false;
                    //   button_BluetoothAddDevice.Enabled = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                StatusDat.Text = ex.Message;
                StatusDat.Refresh();
                StatusContainer.Update();

                return(false);
                // MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Connect.Enabled    = false;
            Start30.Enabled    = true;
            Start60.Enabled    = true;
            Disconnect.Enabled = true;
            return(true);
        }
Пример #16
0
        private bool blueToothConnect()
        {
            bool success = false;

            try
            {
                using (var btClient = new BluetoothClient())
                {
                    // PROBLEM:
                    // false false true: finds only unknown devices, which excludes existing but broken device entries.
                    // false true  true: finds broken entries, but even if powered off, so pairing attempts then crash.
                    // WORK-AROUND:
                    // Remove existing entries first, then find powered on entries.

                    var btIgnored = 0;

                    // Find remembered bluetooth devices.

                    //label_Status.Text = "Removing existing bluetooth devices...";
                    //label_Status.Refresh();

                    // Remove existing connections
                    var btExistingList = btClient.DiscoverDevices(255, false, true, false);

                    foreach (var btItem in btExistingList)
                    {
                        if (!btItem.DeviceName.Contains("Nintendo"))
                        {
                            continue;
                        }

                        BluetoothSecurity.RemoveDevice(btItem.DeviceAddress);
                        btItem.SetServiceState(BluetoothService.HumanInterfaceDevice, false);
                    }

                    // Find unknown bluetooth devices.

                    StatusDat.Text = "Press the SYNC button (inside battery case of Balance Board)";
                    StatusDat.Refresh();

                    var btDiscoveredList = btClient.DiscoverDevices(255, false, false, true);

                    foreach (var btItem in btDiscoveredList)
                    {
                        // Just in-case any non Wii devices are waiting to be paired.

                        if (!btItem.DeviceName.Contains("Nintendo"))
                        {
                            btIgnored += 1;
                            continue;
                        }

                        StatusDat.Text = "Adding: " + btItem.DeviceName + " ( " + btItem.DeviceAddress + " )";
                        StatusDat.Refresh();
                        StatusContainer.Update();

                        // Send special pin for permanent sync.


                        // Install as a HID device and allow some time for it to finish.

                        success = true;
                        btItem.SetServiceState(BluetoothService.HumanInterfaceDevice, true);
                    }

                    // Allow slow computers to finish installation before connecting.

                    if (success)
                    {
                        System.Threading.Thread.Sleep(4000);
                    }
                    // Connect and send a command, otherwise they sleep and the device disappears.

                    //try
                    //{
                    //    if (btDiscoveredList.Length > btIgnored)
                    //    {
                    //        var deviceCollection = new WiimoteCollection();
                    //        deviceCollection.FindAllWiimotes();

                    //        foreach (var wiiDevice in deviceCollection)
                    //        {
                    //            wiiDevice.Connect();
                    //            wiiDevice.SetLEDs(true, false, false, false);
                    //            wiiDevice.Disconnect();
                    //        }
                    //    }
                    //}
                    //catch (Exception) { }

                    // Status report.

                    //label_Status.Text = "Finished - You can now close this window. Found: " + btDiscoveredList.Length + " Ignored: " + btIgnored;
                    //label_Status.Refresh();
                }
            }
            catch (Exception ex)
            {
                //label_Status.Text = "Error: " + ex.Message;
            }
            return(success);
        }
Пример #17
0
 public StatusUpdater(StatusContainer status, string statusKey)
 {
     this.status    = status;
     this.statusKey = statusKey;
 }
Пример #18
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityExplainerLbl != null)
            {
                ActivityExplainerLbl.Dispose();
                ActivityExplainerLbl = null;
            }

            if (AreYouInfectetLbl != null)
            {
                AreYouInfectetLbl.Dispose();
                AreYouInfectetLbl = null;
            }

            if (AreYouInfectetView != null)
            {
                AreYouInfectetView.Dispose();
                AreYouInfectetView = null;
            }

            if (LogInAndRegisterLbl != null)
            {
                LogInAndRegisterLbl.Dispose();
                LogInAndRegisterLbl = null;
            }

            if (MenuIcon != null)
            {
                MenuIcon.Dispose();
                MenuIcon = null;
            }

            if (MessageIcon != null)
            {
                MessageIcon.Dispose();
                MessageIcon = null;
            }

            if (MessageLbl != null)
            {
                MessageLbl.Dispose();
                MessageLbl = null;
            }

            if (MessageView != null)
            {
                MessageView.Dispose();
                MessageView = null;
            }

            if (NewIndicatorView != null)
            {
                NewIndicatorView.Dispose();
                NewIndicatorView = null;
            }

            if (NewRegistrationLbl != null)
            {
                NewRegistrationLbl.Dispose();
                NewRegistrationLbl = null;
            }

            if (OnOffBtn != null)
            {
                OnOffBtn.Dispose();
                OnOffBtn = null;
            }

            if (OnOffBtnContainer != null)
            {
                OnOffBtnContainer.Dispose();
                OnOffBtnContainer = null;
            }

            if (StatusContainer != null)
            {
                StatusContainer.Dispose();
                StatusContainer = null;
            }

            if (StatusHeader != null)
            {
                StatusHeader.Dispose();
                StatusHeader = null;
            }

            if (StatusText != null)
            {
                StatusText.Dispose();
                StatusText = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ActivityExplainerLbl != null)
            {
                ActivityExplainerLbl.Dispose();
                ActivityExplainerLbl = null;
            }

            if (appLogo != null)
            {
                appLogo.Dispose();
                appLogo = null;
            }

            if (AreYouInfectetLbl != null)
            {
                AreYouInfectetLbl.Dispose();
                AreYouInfectetLbl = null;
            }

            if (AreYouInfectetView != null)
            {
                AreYouInfectetView.Dispose();
                AreYouInfectetView = null;
            }

            if (DailyNumbersView != null)
            {
                DailyNumbersView.Dispose();
                DailyNumbersView = null;
            }

            if (dailyNumbersIcon != null)
            {
                dailyNumbersIcon.Dispose();
                dailyNumbersIcon = null;
            }

            if (dailyNumbersLbl != null)
            {
                dailyNumbersLbl.Dispose();
                dailyNumbersLbl = null;
            }

            if (dailyNumbersUpdatedLbl != null)
            {
                dailyNumbersUpdatedLbl.Dispose();
                dailyNumbersUpdatedLbl = null;
            }

            if (fhiLogo != null)
            {
                fhiLogo.Dispose();
                fhiLogo = null;
            }

            if (LogInAndRegisterLbl != null)
            {
                LogInAndRegisterLbl.Dispose();
                LogInAndRegisterLbl = null;
            }

            if (MenuIcon != null)
            {
                MenuIcon.Dispose();
                MenuIcon = null;
            }

            if (MessageIcon != null)
            {
                MessageIcon.Dispose();
                MessageIcon = null;
            }

            if (MessageLbl != null)
            {
                MessageLbl.Dispose();
                MessageLbl = null;
            }

            if (MessageView != null)
            {
                MessageView.Dispose();
                MessageView = null;
            }

            if (NewIndicatorView != null)
            {
                NewIndicatorView.Dispose();
                NewIndicatorView = null;
            }

            if (NewRegistrationLbl != null)
            {
                NewRegistrationLbl.Dispose();
                NewRegistrationLbl = null;
            }

            if (OnOffBtn != null)
            {
                OnOffBtn.Dispose();
                OnOffBtn = null;
            }

            if (OnOffBtnContainer != null)
            {
                OnOffBtnContainer.Dispose();
                OnOffBtnContainer = null;
            }

            if (ScrollDownBackgroundView != null)
            {
                ScrollDownBackgroundView.Dispose();
                ScrollDownBackgroundView = null;
            }

            if (StatusContainer != null)
            {
                StatusContainer.Dispose();
                StatusContainer = null;
            }

            if (StatusText != null)
            {
                StatusText.Dispose();
                StatusText = null;
            }
        }
Пример #20
0
 public void Start()
 {
     statusContainer = GameObject.Find("/UICanvas/SampleOutput").GetComponent <StatusContainer>();
     statusContainer.Post("Location Services Start()");
 }
Пример #21
0
 public StatusEntry(GameObject target, StatusContainer statusContainer)
 {
     this.target          = target;
     this.statusContainer = statusContainer;
 }
Пример #22
0
 public StatusEntry(Entity target, StatusContainer statusContainer)
 {
     this.target          = target;
     this.statusContainer = statusContainer;
 }
Пример #23
0
 public KeyPoolTree(KeyPatternPool patternPool, KeySearcher keySearcher, KeyQualityHelper keyQualityHelper, StorageKeyGenerator identifierGenerator, StatusContainer statusContainer, StatisticsGenerator statisticsGenerator)
     : this(patternPool.Length, keySearcher, keyQualityHelper, identifierGenerator, statusContainer, statisticsGenerator)
 {
 }