/// <summary>
        /// Prevents a default instance of the <see cref="ScanResultsViewModel" /> class from being created.
        /// </summary>
        private ScanResultsViewModel() : base("Scan Results")
        {
            this.ContentId = ScanResultsViewModel.ToolContentId;
            this.ChangeTypeSByteCommand  = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(SByte))), () => true);
            this.ChangeTypeInt16Command  = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Int16))), () => true);
            this.ChangeTypeInt32Command  = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Int32))), () => true);
            this.ChangeTypeInt64Command  = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Int64))), () => true);
            this.ChangeTypeByteCommand   = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Byte))), () => true);
            this.ChangeTypeUInt16Command = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(UInt16))), () => true);
            this.ChangeTypeUInt32Command = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(UInt32))), () => true);
            this.ChangeTypeUInt64Command = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(UInt64))), () => true);
            this.ChangeTypeSingleCommand = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Single))), () => true);
            this.ChangeTypeDoubleCommand = new RelayCommand(() => Task.Run(() => this.ChangeType(typeof(Double))), () => true);
            this.FirstPageCommand        = new RelayCommand(() => Task.Run(() => this.FirstPage()), () => true);
            this.LastPageCommand         = new RelayCommand(() => Task.Run(() => this.LastPage()), () => true);
            this.PreviousPageCommand     = new RelayCommand(() => Task.Run(() => this.PreviousPage()), () => true);
            this.NextPageCommand         = new RelayCommand(() => Task.Run(() => this.NextPage()), () => true);
            this.AddAddressCommand       = new RelayCommand <ScanResult>((address) => Task.Run(() => this.AddAddress(address)), (address) => true);
            this.ScanResultsObservers    = new List <IScanResultsObserver>();
            this.ObserverLock            = new Object();
            this.ActiveType = typeof(Int32);
            this.addresses  = new ObservableCollection <ScanResult>();

            SnapshotManager.GetInstance().Subscribe(this);
            MainViewModel.GetInstance().Subscribe(this);

            this.UpdateScanResults();
        }
Exemple #2
0
        /// <summary>Delete a snapshot of a snapshottable directory</summary>
        /// <param name="snapshotRoot">The snapshottable directory</param>
        /// <param name="snapshotName">The name of the to-be-deleted snapshot</param>
        /// <exception cref="System.IO.IOException"/>
        internal static INode.BlocksMapUpdateInfo DeleteSnapshot(FSDirectory fsd, SnapshotManager
                                                                 snapshotManager, string snapshotRoot, string snapshotName, bool logRetryCache)
        {
            INodesInPath iip = fsd.GetINodesInPath4Write(snapshotRoot);

            if (fsd.IsPermissionEnabled())
            {
                FSPermissionChecker pc = fsd.GetPermissionChecker();
                fsd.CheckOwner(pc, iip);
            }
            INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo();
            ChunkedArrayList <INode>  removedINodes   = new ChunkedArrayList <INode>();

            fsd.WriteLock();
            try
            {
                snapshotManager.DeleteSnapshot(iip, snapshotName, collectedBlocks, removedINodes);
                fsd.RemoveFromInodeMap(removedINodes);
            }
            finally
            {
                fsd.WriteUnlock();
            }
            removedINodes.Clear();
            fsd.GetEditLog().LogDeleteSnapshot(snapshotRoot, snapshotName, logRetryCache);
            return(collectedBlocks);
        }
Exemple #3
0
    public void BuySelected()
    {
        //Called from button, so need to get variables from main gameManager ↓
        if (GetGameManager().selectedTile != null && UIManager.GetUIManager().currentSelection != -1)
        {
            float buildingCost = UIManager.GetUIManager().lastBuilding.GetComponent <BuildingCost>().cost;

            if (!MoneyTracker.GetMoneyTracker().CanAfford(buildingCost))
            {
                AudioManager.GetAudioManager().PlayDenied();
                return;
            }

            MoneyTracker.GetMoneyTracker().BuyFor(buildingCost);

            GameObject gameObject = UIManager.GetUIManager().lastBuilding;

            if (gameObject.name == "Nuclear Plant" && !GetGameManager().nuclearAlready)
            {
                SnapshotManager.GetSnapshotManager().FirstNuclear();
            }
            else
            {
                GetGameManager().nuclearAlready = true;
            }

            if (GetGameManager().selectedTile.CreateBuilding(UIManager.GetUIManager().lastBuilding))
            {
                UIManager.GetUIManager().lastBuilding.GetComponent <BuildSound>().Play();
            }
            UIManager.GetUIManager().ShowMenu(true, GetGameManager().selectedTile);
        }
    }
        /// <summary>
        /// Loads the results for the current page.
        /// </summary>
        private void LoadScanResults()
        {
            Snapshot           snapshot     = SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshot, this.ActiveType);
            IList <ScanResult> newAddresses = new List <ScanResult>();

            if (snapshot != null)
            {
                UInt64 startIndex = Math.Min(ScanResultsViewModel.PageSize * this.CurrentPage, snapshot.ElementCount);
                UInt64 endIndex   = Math.Min((ScanResultsViewModel.PageSize * this.CurrentPage) + ScanResultsViewModel.PageSize, snapshot.ElementCount);

                for (UInt64 index = startIndex; index < endIndex; index++)
                {
                    SnapshotElementIndexer element = snapshot[index];

                    String label = element.GetElementLabel() != null?element.GetElementLabel().ToString() : String.Empty;

                    Object currentValue  = element.HasCurrentValue() ? element.LoadCurrentValue() : null;
                    Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null;

                    String moduleName = String.Empty;
                    UInt64 address    = Query.Default.AddressToModule(element.BaseAddress, out moduleName);

                    PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: this.ActiveType, moduleName: moduleName, value: currentValue);
                    newAddresses.Add(new ScanResult(new PointerItemView(pointerItem), previousValue, label));
                }
            }

            this.Addresses = new FullyObservableCollection <ScanResult>(newAddresses);

            // Ensure results are visible
            this.IsVisible  = true;
            this.IsSelected = true;
            this.IsActive   = true;
        }
        public void CanSnapshotSingleViewDuringDispatch()
        {
            var repository         = new TestRepository();
            var views              = new View[] { new SomeView(repository) };
            var snapshotRepository = new MemoryRepository <string, Snapshot>();
            var firstEvent         = new SomeEvent {
                Id = "test"
            };
            var secondEvent = new SomeEvent {
                Id = "test2"
            };

            using (var snapshotManager = new SnapshotManager(views, snapshotRepository, 20))
            {
                snapshotManager.Dispatch(new Event {
                    SequenceNumber = 1, Payload = firstEvent
                });

                // act
                var preSnapshotEvent = repository.Get(secondEvent.Id);
                repository.WaitUntilSnapshotSaveStarted();
                repository.WaitUntilSnapshotSaveEnded();
                snapshotManager.Dispatch(new Event {
                    SequenceNumber = 2, Payload = secondEvent
                });

                repository.WaitUntilSnapshotSaveEnded();
                var postSnapshotEvent = repository.Get(secondEvent.Id);

                // assert
                preSnapshotEvent.Should().BeNull();
                postSnapshotEvent.Should().Be(secondEvent);
            }
        }
        public void CanDispatchMultipleEventsToMultipleViews()
        {
            var firstRepository    = new MemoryRepository <string, SomeEvent>();
            var secondRepository   = new MemoryRepository <string, SomeEvent>();
            var views              = new View[] { new SomeView(firstRepository), new SomeView(secondRepository) };
            var snapshotRepository = new MemoryRepository <string, Snapshot>();
            var firstEvent         = new SomeEvent {
                Id = "test"
            };
            var secondEvent = new SomeEvent {
                Id = "test2"
            };

            using (var snapshotManager = new SnapshotManager(views, snapshotRepository, Timeout.Infinite))
            {
                // act
                snapshotManager.Dispatch(new Event {
                    SequenceNumber = 1, Payload = firstEvent
                });
                snapshotManager.Dispatch(new Event {
                    SequenceNumber = 2, Payload = secondEvent
                });

                // assert
                firstRepository.Get(firstEvent.Id).Should().Be(firstEvent);
                firstRepository.Get(secondEvent.Id).Should().Be(secondEvent);
                secondRepository.Get(firstEvent.Id).Should().Be(firstEvent);
                secondRepository.Get(secondEvent.Id).Should().Be(secondEvent);
            }
        }
Exemple #7
0
        public MainViewModel(InspectionProcess inspectionProcess, SnapshotManager snapshotManager, SettingsViewModel settingsViewModel, ApplicationController controller)
        {
            InspectionProcess     = inspectionProcess;
            SnapshotManager       = snapshotManager;
            Settings              = settingsViewModel;
            ApplicationController = controller;

            InspectionProcess.ProcessChanged += InspectionProcessOnProcessChanged;

            // STYLE? Who exutes the commands? Dialogs are propagated to the ApplicationController, other code
            // is directly executed in the view model.
            TakeSnapshotCommand = Command.CreateWithRegistration(obj => ExecuteTakeSnapshot(),
                                                                 obj => { return(IsUmdhActive == false && InspectionProcess.IsRunning); });

            CompareSnapshotsCommand = Command.CreateWithRegistration(obj => ExecuteCompareSnapshots(),
                                                                     obj => { return(IsUmdhActive == false && FirstSnapshot != null && SecondSnapshot != null); });

            ConfigureGFlagsCommand = new Command(obj => ExecuteConfigureGFlags());
            SettingsCommand        = new Command(obj => ExecuteSettings());
            SelectProcessCommand   = new Command(obj => ExecuteSelectProcess());
            LoadDiffFileCommand    = new Command(obj => ExecuteLoadDiffFile());


            StartProcessCommand = new Command(obj => ApplicationController.ShowRunProcessDialog());
        }
        private static ISnapshotManager CreateSnapshotManager(IServiceLocator serviceLocator = null)
        {
            var snapshotStorageService = new InMemorySnapshotStorageService();
            var snapshotManager        = new SnapshotManager(snapshotStorageService, serviceLocator ?? ServiceLocator.Default);

            return(snapshotManager);
        }
Exemple #9
0
        public void ApplyThreshold()
        {
            lock (this.SnapshotLock)
            {
                if (this.Snapshot == null)
                {
                    return;
                }
            }

            dynamic lowerValue = this.Histogram.Keys[this.LowerIndex];
            dynamic upperValue = this.Histogram.Keys[this.UpperIndex];

            lock (this.SnapshotLock)
            {
                if (!this.Inverted)
                {
                    //// this.Snapshot.SetAllValidBits(false);

                    foreach (SnapshotRegion region in this.Snapshot.SnapshotRegions)
                    {
                        for (IEnumerator <SnapshotElementComparer> enumerator = region.IterateComparer(SnapshotElementComparer.PointerIncrementMode.ValuesOnly, null); enumerator.MoveNext();)
                        {
                            SnapshotElementComparer element = enumerator.Current;

                            dynamic label = element.GetElementLabel();

                            if (label >= lowerValue && label <= upperValue)
                            {
                                //// element.SetValid(true);
                            }
                        }
                    }
                }
                else
                {
                    //// this.Snapshot.SetAllValidBits(true);

                    foreach (SnapshotRegion region in this.Snapshot.SnapshotRegions)
                    {
                        for (IEnumerator <SnapshotElementComparer> enumerator = region.IterateComparer(SnapshotElementComparer.PointerIncrementMode.LabelsOnly, null); enumerator.MoveNext();)
                        {
                            SnapshotElementComparer element = enumerator.Current;

                            dynamic label = element.GetElementLabel();

                            if (label >= lowerValue && label <= upperValue)
                            {
                                //// element.SetValid(false);
                            }
                        }
                    }
                }

                //// this.Snapshot.DiscardInvalidRegions();
            }

            SnapshotManager.SaveSnapshot(this.Snapshot);
            this.UpdateHistogram(forceUpdate: true);
        }
Exemple #10
0
        public void Setup_chain()
        {
            // Import blocks
            _blockTree = Build.A.BlockTree().TestObject;
            Block block1       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block1Rlp)));
            Block block2       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block2Rlp)));
            Block block3       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block3Rlp)));
            Block block4       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block4Rlp)));
            Block block5       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block5Rlp)));
            Block genesisBlock = GetRinkebyGenesis();

            // Add blocks
            MineBlock(_blockTree, genesisBlock);
            MineBlock(_blockTree, block1);
            MineBlock(_blockTree, block2);
            MineBlock(_blockTree, block3);
            MineBlock(_blockTree, block4);
            MineBlock(_blockTree, block5);
            // Get a test private key
            PrivateKey key = Build.A.PrivateKey.TestObject;
            // Init snapshot db
            MemDb        db     = new MemDb();
            CliqueConfig config = new CliqueConfig();

            _ecdsa           = new EthereumEcdsa(RinkebySpecProvider.Instance, LimboLogs.Instance);
            _snapshotManager = new SnapshotManager(config, db, _blockTree, _ecdsa, LimboLogs.Instance);
            _clique          = new CliqueSealer(new BasicWallet(key), config, _snapshotManager, key.Address, LimboLogs.Instance);
            _sealValidator   = new CliqueSealValidator(config, _snapshotManager, LimboLogs.Instance);
        }
        public void Setup_chain()
        {
            // Import blocks
            _blockTree = Build.A.BlockTree().TestObject;
            Block genesisBlock = GetRinkebyGenesis();
            Block block1       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block1Rlp)));
            Block block2       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block2Rlp)));
            Block block3       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block3Rlp)));
            Block block4       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block4Rlp)));
            Block block5       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(Block5Rlp)));

            _lastBlock = block5;
            // Add blocks
            MineBlock(_blockTree, genesisBlock);
            MineBlock(_blockTree, block1);
            MineBlock(_blockTree, block2);
            MineBlock(_blockTree, block3);
            MineBlock(_blockTree, block4);
            MineBlock(_blockTree, block5);
            IEthereumEcdsa ecdsa = new EthereumEcdsa(RinkebySpecProvider.Instance, LimboLogs.Instance);
            // Init snapshot db
            IDb          db     = new MemDb();
            CliqueConfig config = new CliqueConfig();
            // Select in-turn signer
            int currentBlock       = 6;
            int currentSignerIndex = (currentBlock % _signers.Count);

            _currentSigner   = _signers[currentSignerIndex];
            _snapshotManager = new SnapshotManager(config, db, _blockTree, ecdsa, LimboLogs.Instance);
            _sealValidator   = new CliqueSealValidator(config, _snapshotManager, LimboLogs.Instance);
            _clique          = new CliqueSealer(new BasicWallet(_currentSigner), config, _snapshotManager, _currentSigner.Address, LimboLogs.Instance);
        }
Exemple #12
0
        //=========================================================================
        //
        //  REGULAR ACTIONS
        //
        //=========================================================================

        /// <summary>
        /// Creates a new snapshot based on the current primary.
        /// </summary>
        /// <returns></returns>
        public ActionResult New()
        {
            var uri = SnapshotManager.MakeSnapshot(ServerStatus.Primary.Id, RoleSettings.StorageCredentials, RoleSettings.ReplicaSetName);

            TempData["flashSuccess"] = "Snapshot created!";
            return(RedirectToAction("Index", "Dashboard"));
        }
Exemple #13
0
        /// <summary>
        /// Called when the repeated task completes.
        /// </summary>
        protected override void OnEnd()
        {
            // Prefilter items with negative penalties (ie constantly changing variables)
            this.Snapshot.SetAllValidBits(false);

            foreach (SnapshotRegion region in this.Snapshot)
            {
                for (IEnumerator <SnapshotElementIterator> enumerator = region.IterateElements(PointerIncrementMode.LabelsOnly); enumerator.MoveNext();)
                {
                    SnapshotElementIterator element = enumerator.Current;

                    if ((Int16)element.ElementLabel > 0)
                    {
                        element.SetValid(true);
                    }
                }
            }

            this.Snapshot.DiscardInvalidRegions();

            SnapshotManager.GetInstance().SaveSnapshot(this.Snapshot);

            this.CleanUp();
            LabelThresholderViewModel.GetInstance().OpenLabelThresholder();
        }
Exemple #14
0
 private void Start()
 {
     _objectIdManager = new ObjectIdManager();
     _snapshotManager = new SnapshotManager(SnapshotInterval);
     _eventManager    = new EventManager(ServerPort, null, Delay, PacketLoss);
     _timeManager     = new TimeManager(SnapshotAction.MaxCycleTime);
 }
Exemple #15
0
        /// <summary>
        /// Starts the scan using the current constraints.
        /// </summary>
        private void StartScan()
        {
            // Create a constraint manager that includes the current active constraint
            ConstraintNode scanConstraints = this.ActiveConstraint.Clone();

            if (!scanConstraints.IsValid())
            {
                Logger.Log(LogLevel.Warn, "Unable to start scan with given constraints");
                return;
            }

            DataType dataType = ScanResultsViewModel.GetInstance().ActiveType;

            // Collect values
            TrackableTask <Snapshot> valueCollectorTask = ValueCollector.CollectValues(
                SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter, dataType));

            TaskTrackerViewModel.GetInstance().TrackTask(valueCollectorTask);

            // Perform manual scan on value collection complete
            valueCollectorTask.OnCompletedEvent += ((completedValueCollection) =>
            {
                Snapshot snapshot = valueCollectorTask.Result;
                TrackableTask <Snapshot> scanTask = ManualScanner.Scan(
                    snapshot,
                    scanConstraints);

                TaskTrackerViewModel.GetInstance().TrackTask(scanTask);
                SnapshotManager.SaveSnapshot(scanTask.Result);
            });
        }
        public void Sets_clique_block_producer_properly()
        {
            CliqueConfig        cliqueConfig = new CliqueConfig();
            IBlockTree          blockTree    = Substitute.For <IBlockTree>();
            CliqueBlockProducer producer     = new CliqueBlockProducer(
                Substitute.For <ITxPool>(),
                Substitute.For <IBlockchainProcessor>(),
                blockTree,
                Substitute.For <ITimestamper>(),
                Substitute.For <ICryptoRandom>(),
                Substitute.For <IStateProvider>(),
                Substitute.For <ISnapshotManager>(),
                new CliqueSealer(new BasicWallet(TestItem.PrivateKeyA), cliqueConfig, Substitute.For <ISnapshotManager>(), TestItem.PrivateKeyA.Address, NullLogManager.Instance),
                TestItem.AddressA,
                cliqueConfig,
                NullLogManager.Instance);

            SnapshotManager snapshotManager = new SnapshotManager(CliqueConfig.Default, new MemDb(), Substitute.For <IBlockTree>(), NullEthereumEcdsa.Instance, LimboLogs.Instance);

            CliqueBridge bridge = new CliqueBridge(producer, snapshotManager, blockTree);

            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, true));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, false));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
        }
Exemple #17
0
        public void Sets_clique_block_producer_properly()
        {
            CliqueConfig        cliqueConfig = new CliqueConfig();
            IBlockTree          blockTree    = Substitute.For <IBlockTree>();
            Signer              signer       = new Signer(ChainId.Ropsten, TestItem.PrivateKeyA, LimboLogs.Instance);
            CliqueBlockProducer producer     = new CliqueBlockProducer(
                Substitute.For <ITxSource>(),
                Substitute.For <IBlockchainProcessor>(),
                Substitute.For <IStateProvider>(),
                blockTree,
                Substitute.For <ITimestamper>(),
                Substitute.For <ICryptoRandom>(),
                Substitute.For <ISnapshotManager>(),
                new CliqueSealer(signer, cliqueConfig, Substitute.For <ISnapshotManager>(), LimboLogs.Instance),
                new TargetAdjustedGasLimitCalculator(GoerliSpecProvider.Instance, new MiningConfig()),
                MainnetSpecProvider.Instance,
                cliqueConfig,
                LimboLogs.Instance);

            SnapshotManager snapshotManager = new SnapshotManager(CliqueConfig.Default, new MemDb(), Substitute.For <IBlockTree>(), NullEthereumEcdsa.Instance, LimboLogs.Instance);

            CliqueRpcModule bridge = new CliqueRpcModule(producer, snapshotManager, blockTree);

            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, true));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
            Assert.DoesNotThrow(() => bridge.CastVote(TestItem.AddressB, false));
            Assert.DoesNotThrow(() => bridge.UncastVote(TestItem.AddressB));
        }
Exemple #18
0
 public LabelThresholder(Action onUpdateHistogram)
 {
     this.ItemLock          = new Object();
     this.SnapshotLock      = new Object();
     this.ProgressLock      = new Object();
     this.OnUpdateHistogram = onUpdateHistogram;
     Task.Run(() => SnapshotManager.Subscribe(this));
 }
        public void Creates_new_snapshot()
        {
            SnapshotManager snapshotManager = new SnapshotManager(CliqueConfig.Default, _snapshotDb, _blockTree, NullEthereumEcdsa.Instance, LimboLogs.Instance);
            Block           genesis         = CliqueTests.GetRinkebyGenesis();
            Snapshot        snapshot        = snapshotManager.GetOrCreateSnapshot(0, genesis.Hash);

            Assert.AreEqual(genesis.Hash, snapshot.Hash);
        }
Exemple #20
0
        //=========================================================================
        //
        //  AJAX ACTIONS
        //
        //=========================================================================

        /// <summary>
        /// Returns a list of all snapshots, including their URLs, blob names, and dates.
        /// </summary>
        /// <returns></returns>
        public JsonResult List()
        {
            var snapshots = SnapshotManager.GetSnapshots(RoleSettings.StorageCredentials, RoleSettings.ReplicaSetName);

            var data = snapshots.Select(blob => new { dateString = ToString(blob.Attributes.Snapshot), blob = blob.Name, uri = SnapshotManager.GetSnapshotUri(blob) });

            return(Json(new { snapshots = data }, JsonRequestBehavior.AllowGet));
        }
Exemple #21
0
 public SettingsViewModel(ApplicationSettings settings, ApplicationController controller,
                          SnapshotManager snapshotManager)
 {
     _settings              = settings;
     _controller            = controller;
     ChooseDirectoryCommand = new Command(ExecuteChooseDirectory);
     CleanOutputCommand     = new Command(obj => snapshotManager.CleanOutputDirectory());
 }
        /// <summary>
        /// Called when the scan ends.
        /// </summary>
        protected override void OnEnd()
        {
            this.Snapshot.DiscardInvalidRegions();
            SnapshotManager.GetInstance().SaveSnapshot(this.Snapshot);
            Snapshot = null;

            base.OnEnd();
        }
        /// <summary>
        /// Called when the repeated task completes.
        /// </summary>
        protected override void OnEnd()
        {
            SnapshotManager.GetInstance().SaveSnapshot(this.Snapshot);
            LabelThresholderViewModel.GetInstance().OpenLabelThresholder();
            this.Snapshot = null;

            base.OnEnd();
        }
        private void StartScan(int index, Int64 searchAddress, bool validatingProcess = false)
        {
            if (index > 0)
            {
                SnapshotManager.ClearSnapshots();
            }

            ConstraintNode scanConstraints = new ScanConstraint(ScanConstraint.ConstraintType.Equal, searchAddress, dataType);

            TrackableTask <Snapshot> valueCollectorTask = ValueCollector.CollectValues(
                SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter, dataType),
                TrackableTask.UniversalIdentifier);

            valueCollectorTask.OnCompletedEvent += ((completedValueCollectionTask) =>
            {
                Snapshot snapshot = valueCollectorTask.Result;

                TrackableTask <Snapshot> scanTask = ManualScanner.Scan(
                    snapshot,
                    scanConstraints,
                    TrackableTask.UniversalIdentifier);

                SnapshotManager.SaveSnapshot(scanTask.Result);

                snapshot = scanTask.Result;

                scannedAddresses.Add(new List <Int64>());

                if (snapshot != null)
                {
                    for (UInt64 i = 0; i < snapshot.ElementCount; ++i)
                    {
                        SnapshotElementIndexer element = snapshot[i];

                        Object currentValue = element.HasCurrentValue() ? element.LoadCurrentValue() : null;
                        Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null;

                        String moduleName = String.Empty;
                        UInt64 address = Query.Default.AddressToModule(element.BaseAddress, out moduleName);

                        PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: dataType, moduleName: moduleName, value: currentValue);
                        pointerItem.ForceResolveAddress();

                        scannedAddresses[index].Add(Int64.Parse(pointerItem.AddressSpecifier, NumberStyles.HexNumber, CultureInfo.CurrentCulture));
                    }
                }

                int nextIteration = index + 1;
                if (nextIteration < addressesToFind.Count)
                {
                    StartScan(nextIteration, addressesToFind[nextIteration], validatingProcess);
                }
                else
                {
                    SearchLogic(validatingProcess);
                }
            });
        }
Exemple #25
0
    public static SnapshotManager GetSnapshotManager()
    {
        if (snapshotManager == null)
        {
            snapshotManager = GameObject.FindGameObjectWithTag("SnapshotManager").GetComponent <SnapshotManager>();
        }

        return(snapshotManager);
    }
Exemple #26
0
        /// <summary>
        /// Performs the value collection scan.
        /// </summary>
        protected override void OnBegin()
        {
            Snapshot snapshot = SnapshotManager.GetInstance().GetActiveSnapshot(createIfNone: true).Clone(this.ScannerName);

            snapshot.ReadAllMemory();
            SnapshotManager.GetInstance().SaveSnapshot(snapshot);

            base.OnBegin();
        }
Exemple #27
0
        /// <summary>
        /// Snapshots the instance with the given number. Returns the URI of the snapshot.
        /// </summary>
        private static Uri Snapshot(int instance)
        {
            Console.WriteLine("Snapshotting instance #" + instance + "...");

            var snapshotUri = SnapshotManager.MakeSnapshot(instance, RoleSettings.StorageCredentials, RoleSettings.ReplicaSetName);

            Console.WriteLine("Done: " + snapshotUri);
            return(snapshotUri);
        }
        public void ValidateButton()
        {
            scannedAddresses.Clear();
            validatingEntityList.Clear();

            SnapshotManager.ClearSnapshots();

            StartScan(index: 0, searchAddress: addressesToFind[0], validatingProcess: true);
        }
        public void Can_calculate_clique_header_hash()
        {
            BlockHeader header = BuildCliqueBlock();

            Keccak expectedHeaderHash = new Keccak("0x7b27b6add9e8d0184c722dde86a2a3f626630264bae3d62ffeea1585ce6e3cdd");
            Keccak headerHash         = SnapshotManager.CalculateCliqueHeaderHash(header);

            Assert.AreEqual(expectedHeaderHash, headerHash);
        }
Exemple #30
0
        private void InspectionProcessOnProcessChanged(object sender, EventArgs eventArgs)
        {
            TracesView = null;
            Details    = "";
            SnapshotManager.ClearSnapshots();
            FirstSnapshot  = null;
            SecondSnapshot = null;

            Command.RefreshAll();
        }
Exemple #31
0
        public CincoClient(IClientConnection connection)
            : base(connection, MessageTypes.Reliable)
        {
            CincoProtocol.Protocol.Discover (typeof (CincoMessageBase).Assembly);

            this.snapshotManager = new SnapshotManager (10);
            this.entities = new List<NetworkEntity> ();
            this.entityMap = new Dictionary<uint, NetworkEntity> ();
            this.entityTypeInformation = new Dictionary<string, EntityInformation> ();

            TickRate = new TimeSpan (0, 0, 0, 0, 15);

            this.RegisterMessageHandler<EntitySnapshotMessage> (OnEntitySnapshotMessage);
            this.RegisterMessageHandler<ServerInformationMessage> (OnServerInformationMessage);
        }
Exemple #32
0
 public async void Start(Rectangle rect)
 {
     // intoduce a delay of one second.
     await Task.Delay(TimeSpan.FromSeconds(1));
     _snapshotManager = new SnapshotManager(rect.Left, rect.Top, rect.Width, rect.Height);
     _stream = new MemoryStream();
     _gifBitmapEncoder = new GifBitmapEncoder(_imagingFactory);
     _gifBitmapEncoder.Initialize(_stream);
     _width = rect.Width;
     _height = rect.Height;
     InitAndLaunchTimer();
 }