Esempio n. 1
0
        public virtual SnapShot GetSnapShot()
        {
            SnapShot snapShot = new SnapShot();

            snapShot.BinaryImage = new byte[1000];
            return(snapShot);
        }
Esempio n. 2
0
        public void SnapShot_GetAllValuesMultiLevelData()
        {
            IDataContainer A = (DataContainerBase)DataContainerBuilder.Create("A")
                               .Data("A", 1)
                               .Data("B", 2)
                               .Data("C", 3)
                               .DataContainer("AB", b => b
                                              .Data("AB1", 1)
                                              .Data("AB2", 2))
                               .Build();

            SnapShot snapShot = A.GetSnapShot();

            Assert.Equal(5, snapShot.Count());
            Assert.Contains("A", snapShot.Keys);
            Assert.Contains("B", snapShot.Keys);
            Assert.Contains("C", snapShot.Keys);
            Assert.Contains("AB.AB1", snapShot.Keys);
            Assert.Contains("AB.AB2", snapShot.Keys);

            Assert.Equal(A["A"], snapShot["A"].Value);
            Assert.Equal(A["B"], snapShot["B"].Value);
            Assert.Equal(A["C"], snapShot["C"].Value);
            Assert.Equal(A["AB.AB1"], snapShot["AB.AB1"].Value);
            Assert.Equal(A["AB.AB2"], snapShot["AB.AB2"].Value);
        }
Esempio n. 3
0
        public static bool DrinkPotion()
        {
            var legendaryPotions = Core.Inventory.Backpack.Where(i => i.InternalName.ToLower().Contains("healthpotion_legendary_")).ToList();

            if (legendaryPotions.Any())
            {
                Core.Logger.Verbose(LogCategory.None, "Using Potion", 0);
                var dynamicId = legendaryPotions.First().AnnId;
                InventoryManager.UseItem(dynamicId);
                SpellHistory.RecordSpell(new TrinityPower(SNOPower.DrinkHealthPotion));
                SnapShot.Record();
                return(true);
            }

            var potion = InventoryManager.BaseHealthPotion;

            if (potion != null)
            {
                Core.Logger.Verbose(LogCategory.None, "Using Potion", 0);
                InventoryManager.UseItem(potion.AnnId);
                SpellHistory.RecordSpell(new TrinityPower(SNOPower.DrinkHealthPotion));
                SnapShot.Record();
                return(true);
            }

            Core.Logger.Verbose(LogCategory.None, "No Available potions!", 0);
            return(false);
        }
        public void SnapshotConstructor(long last, long current, bool expected)
        {
            var snapShotAfter    = new SnapShot <TestEntity>(3);
            var doesNeedSnapshot = snapShotAfter.DoesNeedSnapshot(last, current);

            Assert.AreEqual(expected, doesNeedSnapshot);
        }
Esempio n. 5
0
            void Scroll(int target)
            {
                var snapShot = new SnapShot(__counter);

                _listView.ScrollTo(_itemsList[target], ScrollToPosition.MakeVisible, animated: true);
                snapShot.Update();

                // TEST
                if (!_listView.IsGroupingEnabled &&
                    _listView.CachingStrategy == ListViewCachingStrategy.RecycleElementAndDataTemplate)
                {
                    if (snapShot.Attached > MaxAttachDelta)
                    {
                        throw new Exception($"Attached Delta: {snapShot.Attached}");
                    }
                    if (snapShot.Views > MaxViewDelta)
                    {
                        throw new Exception($"Views Delta: {snapShot.Views}");
                    }
                    if (snapShot.Asks > MaxAskDelta)
                    {
                        throw new Exception($"Asks Delta: {snapShot.Asks}");
                    }
                }
            }
Esempio n. 6
0
        private async Task<SnapShot> CheckDish(string filename)
        {
            CheckFood checkFood = new CheckFood();
            SnapShot snapShot = await checkFood.IsDishEmptyAsync(filename);

            return snapShot;
        }
Esempio n. 7
0
        protected void SerializeDirtyFieldsSnapshot()
        {
            if (IsServer)
            {
                //server keeps snapshots for the rewind ability

                ulong timestep = Networker.Time.Timestep;
                //need to locally produce store the snapshot
                SnapShot snapshot = new SnapShot()
                {
                    tick     = (long)timestep,
                    position = _position,
                    rotation = _rotation,
                    velocity = _velocity,
                    Health   = _Health
                };

                lock (_Snapshots)
                {
                    _Snapshots.AddLast(snapshot);
                    if (_Snapshots.Count > 5)
                    {
                        Debug.LogFormat("SerializeDirtyFieldsSnapshot: {0} {1} {2} {3}", _Snapshots.Count, _Snapshots.First.Value.tick, timestep, _Snapshots.Last.Value.tick);
                    }
                }
            }
        }
Esempio n. 8
0
    private void SaveSnapShot()
    {
        var snapShot = new SnapShot
        {
            moves       = moves,
            formulaText = formulaText.text,
            formula     = new Formula(formula),
        };

        for (var x = 0; x < grid.Count; ++x)
        {
            for (var y = 0; y < grid[x].Count; ++y)
            {
                if (grid[x][y] == null)
                {
                    continue;
                }
                var snapShotData = new SnapShotData
                {
                    isSelected = grid[x][y].isSelected,
                    value      = grid[x][y].GetValue(),
                    position   = grid[x][y].GetPosition(),
                };
                snapShot.datas.Add(snapShotData);
            }
        }
        snapShots.Add(snapShot);
    }
Esempio n. 9
0
 public void ApplySnapshot(SnapShot snapshot)
 {
     _position = snapshot.position;
     _rotation = snapshot.rotation;
     _velocity = snapshot.velocity;
     _Health   = snapshot.Health;
 }
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserId,SnapShotTime")] SnapShot snapShot)
        {
            if (id != snapShot.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(snapShot);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SnapShotExists(snapShot.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(snapShot));
        }
Esempio n. 11
0
        private async void Capture()
        {
            SnapShot snapShot = new SnapShot();

            string rootPath = dataManager.ValidPath();
            string filename = DateTime.Now.ToString(ComDef.FILENAME_DATETIMEFORMAT);
            string imageFullPath = Path.Combine(rootPath, filename) + ComDef.FILEEXTENSION;

            if (string.IsNullOrEmpty(imageFullPath))
                return;

#if true
            ImageSource source = previewImageCtrl.Source;
            webcam.SaveImageCapture((BitmapSource)source, imageFullPath);

            image.Source = new BitmapImage(new Uri(imageFullPath, UriKind.Absolute));
#else
            BitmapSource bitmapSource = webcam.SaveImageCapture(imageFullPath); 
            image.Source = bitmapSource;
#endif
            snapShot = await CheckDish(imageFullPath);
            snapShot.CaptureDateTime = DateTime.Now.ToString("G");
            snapShot.Id = filename;
            snapShot.Path = imageFullPath;
            
            App.snapShotViewModel.Add(snapShot);

            EnableRecog(false);

            return;
        }
Esempio n. 12
0
        public void LoadData()
        {
            if (System.IO.File.Exists(ComDef.LOGFILENAME))
            {
                StreamReader sr = new StreamReader(ComDef.LOGFILENAME, Encoding.GetEncoding("UTF-8"));
                while (!sr.EndOfStream)
                {
                    string   data      = sr.ReadLine();
                    string[] dataArray = data.Split(ComDef.SEPARATECHAT);

                    SnapShot snapShot = new SnapShot
                    {
                        Id = dataArray[0],
                        CaptureDateTime = dataArray[1],
                        Path            = dataArray[2],
                        Category        = dataArray[3],
                        IsEmpty         = bool.Parse(dataArray[4]),
                        Accuracy        = int.Parse(dataArray[5]),
                        Message         = dataArray[6],
                        LoadingTime     = float.Parse(dataArray[7])
                    };

                    App.snapShotViewModel.Add(snapShot);
                    App.snapShotViewModel.AddAlreadySaved(snapShot);
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 13
0
        public DbSnapshot(DB db, long height, bool bUndo)
        {
            Monitor.Enter(db);

            this.db       = db;
            this.snapshot = db.CreateSnapshot();
            this.batch    = new WriteBatch();
            this.options  = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            if (bUndo)
            {
                Undos        = new DbUndo();
                Undos.height = height;
                long.TryParse(db.Get("UndoHeight"), out long UndoHeight);
                if (UndoHeight + 1 != Undos.height)
                {
                    throw new InvalidOperationException($"{UndoHeight} heightTotal+1 != Undos.height {Undos.height}");
                }
            }

            Snap            = new DbCache <string>(db, options, batch, Undos, "Snap");
            Blocks          = new DbCache <Block>(db, options, batch, null, "Blocks");
            Heights         = new DbCache <List <string> >(db, options, batch, null, "Heights");
            Transfers       = new DbCache <BlockSub>(db, options, batch, Undos, "Trans");
            Accounts        = new DbCache <Account>(db, options, batch, Undos, "Accounts");
            Contracts       = new DbCache <LuaVMScript>(db, options, batch, Undos, "Contracts");
            Storages        = new DbCache <LuaVMContext>(db, options, batch, Undos, "Storages");
            BlockChains     = new DbCache <BlockChain>(db, options, batch, Undos, "BlockChain");
            StoragesAccount = new DbCache <string>(db, options, batch, Undos, "StgAcc");
            ABC             = new DbCache <List <string> >(db, options, batch, Undos, "ABC");
            List            = new DbList <string>(db, options, batch, Undos, "List");
        }
Esempio n. 14
0
        /// <summary>
        /// Sets up the crawl with all the parameters it needs to continue until finished.
        /// </summary>
        /// <param name="urlToStart">The valid url to start crawling from</param>
        /// <param name="maxAttempts">Number of times to try failed pages (not implemented)</param>
        /// <param name="secondsDelay">Number of seconds to wait between page loads</param>
        /// <param name="steps">Number of steps away from the urlToStart to transverse before stopping</param>
        /// <param name="databaseFileName">Name of the file to store data in</param>
        public void Seed(string urlToStart, int maxAttempts, int secondsDelay, int steps, string databaseFileName)
        {
            try
            {
                _seedUri = new Uri(urlToStart);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Invalid URI supplied as seed", ex);
            }
            if (!_seedUri.IsWellFormedOriginalString() || !_seedUri.IsAbsoluteUri)
            {
                throw new ArgumentException("Invliad URI supplied as seed");
            }
            var seedNode = new WebNode {
                NodeUri = new Uri(urlToStart)
            };

            WebNodes.Add(seedNode);

            _maxCrawlAttempts = maxAttempts;
            _secondsDelay     = secondsDelay;
            _maxSteps         = steps;

            var dbSetup = new Database();

            dbSetup.ConnectToDatabase(databaseFileName);
            _snapShot   = new SnapShot(databaseFileName);
            _snapShotId = _snapShot.InsertSnapShot(urlToStart, secondsDelay, steps);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ImageUrl,CreatedAt,NewsSiteId")] SnapShot snapShot)
        {
            if (id != snapShot.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(snapShot);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SnapShotExists(snapShot.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NewsSiteId"] = new SelectList(_context.NewsSites, "Id", "Id", snapShot.NewsSiteId);
            return(View(snapShot));
        }
Esempio n. 16
0
    private void SetInitialSnapshot(SnapShot snapshot)
    {
        ClientEntity clientEntity;
        EntityState  state;

        snap = snapshot;
        CUtils.PlayerStateToEntityState(snap.playerState, ref clientEntities[snap.playerState.clientIndex].currentState, false);
        BuildSolidList();

        ExecuteNewServerCommands(snap.serverCommandSequence);

        for (int i = 0; i < snap.numEntities; i++)
        {
            state        = snap.entities[i];
            clientEntity = clientEntities[state.clientNum];

            clientEntity.currentState.CopyTo(state);
            clientEntity.interpolate  = false;
            clientEntity.currentValid = true;

            // clientEntity.Reset();
            ResetEntity(ref clientEntity);

            CheckEvents(ref clientEntity);
        }
    }
Esempio n. 17
0
        /// <summary>
        /// Constructs a new snapshot module using LVM
        /// </summary>
        /// <param name="folders">The list of folders to create snapshots for</param>
        /// <param name="options">A set of commandline options</param>
        public LinuxSnapshot(string[] folders, Dictionary<string, string> options)
        {
            try
            {
                m_entries = new List<KeyValuePair<string,SnapShot>>();

                //Make sure we do not create more snapshots than we have to
                Dictionary<string, SnapShot> snaps = new Dictionary<string, SnapShot>();
                foreach (string s in folders)
                {
                    SnapShot sn = new SnapShot(s);
                    if (!snaps.ContainsKey(sn.DeviceName))
                        snaps.Add(sn.DeviceName, sn);

                    m_entries.Add(new KeyValuePair<string, SnapShot>(s, snaps[sn.DeviceName]));
                }

                m_activeSnapShots = new List<SnapShot>(snaps.Values);

                //We have all the snapshots that we need, lets activate them
                foreach (SnapShot s in m_activeSnapShots)
                    s.CreateSnapshotVolume();
            }
            catch
            {
                //If something goes wrong, try to clean up
                try { Dispose(); }
                catch { }

                throw;
            }
        }
Esempio n. 18
0
 public TruckSteps(ScenarioContext scenarioContext)
 {
     this.homePage         = new HomePage();
     this.automobilePage   = new AutomobilePage();
     this.snapShot         = new SnapShot();
     this.truckPage        = new TruckPage();
     this._scenarioContext = scenarioContext;
 }
Esempio n. 19
0
 public AutomobileSteps(ScenarioContext scenarioContext)
 {
     this.homePage       = new HomePage();
     this.automobilePage = new AutomobilePage();
     this.isuranceData   = new IsuranceData();
     this.validator      = new Validator();
     this.snapShot       = new SnapShot();
     _scenarioContext    = scenarioContext;
 }
Esempio n. 20
0
    private void TransitionSnapshot()
    {
        ClientEntity clientEntity;
        SnapShot     oldFrame;
        int          i;

        if (snap == null)
        {
            CLog.Error("TransitionSnapshot: null snap");
        }
        if (nextSnap == null)
        {
            CLog.Error("TransitionSnapshot: null nextSnap");
        }

        ExecuteNewServerCommands(nextSnap.serverCommandSequence);

        for (i = 0; i < snap.numEntities; i++)
        {
            clientEntity = clientEntities[snap.entities[i].entityIndex];
            clientEntity.currentValid = false;
        }

        oldFrame = snap;
        snap     = nextSnap;

        CUtils.PlayerStateToEntityState(snap.playerState, ref clientEntities[snap.playerState.clientIndex].currentState, false);
        clientEntities[snap.playerState.clientIndex].interpolate = false;

        for (i = 0; i < snap.numEntities; i++)
        {
            clientEntity = clientEntities[snap.entities[i].entityIndex];
            TransitionEntity(ref clientEntity);

            //记录这个entity最后更新的snapshot的时间
            clientEntity.snapShotTime = snap.serverTime;
        }

        nextSnap = null;

        if (oldFrame != null)
        {
            PlayerState ops, ps;
            ops = oldFrame.playerState;
            ps  = snap.playerState;

            if (((ps.entityFlags ^ ops.entityFlags) ^ EntityFlags.TELEPORT_BIT) != EntityFlags.NONE)
            {
                this.thisFrameTeleport = true;
            }

            if (demoPlayback || (snap.playerState.pmFlags & PMoveFlags.FOLLOW) == PMoveFlags.NONE || CConstVar.NoPredict || CConstVar.SynchronousClients)
            {
                TransitionPlayerState(ps, ref ops);
            }
        }
    }
Esempio n. 21
0
        public override SnapShot GetSnapShot()
        {
            string requestUrl = string.Format("{0}/{1}?camera={2}", this.BaseURL, this.SnapShotURL, this.CameraID);

            SnapShot snapShot = new SnapShot();

            snapShot.BinaryImage = GetByterArrayResponseForRequest(requestUrl, null);

            return(snapShot);
        }
Esempio n. 22
0
        public override SnapShot GetSnapShotWithResolutionAndCompression(string resolution, string compression)
        {
            string requestUrl = string.Format("{0}/{1}?resolution={2}&compression={3}&camera={4}", this.BaseURL, this.SnapShotURL, resolution, compression, this.CameraID);

            SnapShot snapShot = new SnapShot();

            snapShot.BinaryImage = GetByterArrayResponseForRequest(requestUrl, null);

            return(snapShot);
        }
Esempio n. 23
0
        private void btn_Apply_Click(object sender, EventArgs e)
        {
            SnapShot snap = (SnapShot)this.listSnap.SelectedItem;

            if (snap == null)
            {
                return;
            }

            snap.Apply();
        }
        public async Task <IActionResult> Create([Bind("ID,UserId,SnapShotTime")] SnapShot snapShot)
        {
            if (ModelState.IsValid)
            {
                _context.Add(snapShot);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(snapShot));
        }
Esempio n. 25
0
    public void FastForwardPlayers()
    {
        SnapShot sn = _game.Network.Snapshots[_game.Network.Snapshots.Count - 1];

        foreach (PlayerSnap psn in sn.PlayerSnap)
        {
            Player    brp = GetNode(psn.NodeName) as Player;
            Transform t   = brp.GlobalTransform;
            t.origin            = psn.Origin;
            brp.GlobalTransform = t;
        }
    }
        public async Task <IActionResult> Create([Bind("Id,ImageUrl,CreatedAt,NewsSiteId")] SnapShot snapShot)
        {
            if (ModelState.IsValid)
            {
                _context.Add(snapShot);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NewsSiteId"] = new SelectList(_context.NewsSites, "Id", "Id", snapShot.NewsSiteId);
            return(View(snapShot));
        }
Esempio n. 27
0
        private void btn_Take_Click(object sender, EventArgs e)
        {
            if (this.txt_Name.Text == "")
            {
                return;
            }

            SnapShot snap = new SnapShot(this.txt_Name.Text);

            snap.Take();
            this.listSnap.Items.Add(snap);
        }
Esempio n. 28
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            SnapShot snap = (SnapShot)this.listSnap.SelectedItem;

            if (snap == null)
            {
                return;
            }

            SnapShot.List.Remove(snap);
            this.listSnap.SelectedIndex = -1;
            this.listSnap.Items.Remove(snap);
        }
Esempio n. 29
0
 public virtual void Dispose()
 {
     if (snapshot != null)
     {
         options?.Dispose();
         batch?.Dispose();
         snapshot?.Dispose();
         options  = null;
         batch    = null;
         snapshot = null;
         Monitor.Exit(db);
     }
 }
Esempio n. 30
0
    private void InterpolatePlayerState(bool grabAngles)
    {
        float       f;
        int         i;
        var         gamestate = CDataModel.GameState;
        PlayerState outP      = predictedPlayerState;
        SnapShot    prev      = gamestate.snap;
        SnapShot    next      = gamestate.nextSnap;

        gamestate.snap.playerState.CopyTo(outP);

        var cl = CDataModel.GameState.ClActive;

        if (grabAngles)
        {
            UserCmd cmd;
            int     cmdNum = cl.cmdNum;

            CDataModel.GameState.GetUserCmd(cmdNum, out cmd);

            PMove.UpdateViewAngles(outP, cmd);
        }

        if (gamestate.nextFrameTeleport)
        {
            return;
        }

        if (next == null || next.serverTime <= prev.serverTime)
        {
            return;
        }

        f = (float)(gamestate.time - prev.serverTime) / (next.serverTime - prev.serverTime);
        i = next.playerState.bobCycle;
        if (i < prev.playerState.bobCycle)
        {
            i += 256;
        }
        outP.bobCycle = prev.playerState.bobCycle + (int)(f * (i - prev.playerState.bobCycle));

        for (i = 0; i < 3; i++)
        {
            outP.origin[i] = prev.playerState.origin[i] * (int)(f * (next.playerState.origin[i] - prev.playerState.origin[i]));
            if (!grabAngles)
            {
                outP.viewangles[i] = CUtils.LerpAngles(prev.playerState.viewangles[i], next.playerState.viewangles[i], f);
            }
            outP.velocity[i] = prev.playerState.velocity[i] + f * (next.playerState.velocity[i] - prev.playerState.velocity[i]);
        }
    }
Esempio n. 31
0
        public void StartRewind()
        {
            ulong timestep = Networker.Time.Timestep;

            //need to locally produce store the snapshot
            _RewindSnapshot = new SnapShot()
            {
                tick     = (long)timestep,
                position = _position,
                rotation = _rotation,
                velocity = _velocity,
                Health   = _Health
            };
        }
Esempio n. 32
0
            public SnapShot(Log log, int index, SnapShot prev)
            {
                if (prev.mIndex > index)
                    throw new Exception("Snapshot passed needs to be behind current one");

                mIndex = index;
                Utility.AllocLists li;

                mAllocListsMutex.WaitOne();
                if (mAllocListsLastIndex == prev.mIndex)
                {
                    li = mAllocLists;
                    mAllocListsMutex.ReleaseMutex();
                }
                else
                {
                    mAllocListsMutex.ReleaseMutex();

                    // Populate snapshot with previous snapshot
                    li = new Utility.AllocLists();
                    for (int i = 0; i < prev.mArray.Count; i++)
                    {
                        int idx = (int)(prev.mArray[i]);
                        uint address = log[idx].address;
                        li.Allocate( address, idx );
                    }
                }

                // Play through allocations till index reached.
                for (int i = prev.mIndex; i < index; i++)
                {
                    LogEntry logentry = log[i];
                    if (logentry.type == 'A')
                        li.Allocate(logentry.address, i);
                    else if (logentry.type == 'F')
                        li.Free(logentry.address);
                }

                // Now store as an array
                mArray = li.GetArray();
                mSorted = false;

                mAllocListsMutex.WaitOne();
                mAllocListsLastIndex = index;
                mAllocLists = li;
                mAllocListsMutex.ReleaseMutex();
            }
Esempio n. 33
0
            public SnapShot(Log log, SnapShot snap, string filter, int size, bool dir)
            {
                Utility.AllocLists li = new Utility.AllocLists();
                Regex r = new Regex(filter, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                for (int i = 0, e = snap.Count; i < e; i++)
                {
                    int logindex = snap[i];
                    MemManager.Log.LogEntry le = log[logindex];

                    string name = log.GetString(le.nameString);
                    if ( r.IsMatch(log.GetString(le.nameString)) )
                    {
                        if(size == 0)
                            li.Allocate(log[logindex].address, logindex);
                        else if(dir==false && le.allocSize >= size)
                            li.Allocate(log[logindex].address, logindex);
                        else if(dir==true && le.allocSize <= size)
                            li.Allocate(log[logindex].address, logindex);
                    }
                }

                mArray = li.GetArray(ref mMaxLogIndex);
                mArray.Sort();
            }
Esempio n. 34
0
            public SnapShot(Log log, int index, SnapShot prev, bool diff)
            {
                if (prev.mIndex > index)
                {
                    System.Diagnostics.Debug.Print("Second selection must be on the right hand side of the first one to compare");
                    //throw new Exception("Snapshot passed needs to be behind current one");
                    return;
                }

                mIndex = index;
                Utility.AllocLists li;
                if (!diff)
                {
                    mAllocListsMutex.WaitOne();
                    if (mAllocListsLastIndex == prev.mIndex)
                    {
                        li = mAllocLists;
                        mAllocListsMutex.ReleaseMutex();
                    }
                    else
                    {
                        mAllocListsMutex.ReleaseMutex();

                        // Populate snapshot with previous snapshot
                        li = new Utility.AllocLists();
                        for (int i = 0; i < prev.mArray.Count; i++)
                        {
                            int idx = (int)(prev.mArray[i]);
                            uint address = log[idx].address;
                            li.Allocate(address, idx);
                        }
                    }
                }
                else
                    li = new MemManager.Utility.AllocLists();

                // Play through allocations till index reached.
                for (int i = prev.mIndex; i < index; i++)
                {
                    LogEntry logentry = log[i];
                    if (logentry.type == 'A')
                        li.Allocate(logentry.address, i);
                    else if (logentry.type == 'F')
                        li.Free(logentry.address);
                }

                // Now store as an array
                mArray = li.GetArray(ref mMaxLogIndex);
                mSorted = false;

                mAllocListsMutex.WaitOne();
                mAllocListsLastIndex = index;
                mAllocLists = li;
                mAllocListsMutex.ReleaseMutex();
            }
Esempio n. 35
0
 /**
  * Copy information to object member variables and initialize the menus.
  */
 public void CopyGvInfo(GVstruct input, Log log, SnapShot logSnap, ArrayList allocinfo, int category)
 {
     mInfo2Graph = input;
     mLog = log;
     mLogSnap = logSnap;
     mAllocators = allocinfo;
     mCategories =  mLog.GetCategories();
     mSelectedCategory = category;
     // Initialize first time
     PopulateDropDownMenu(category);
     PopulateBlockSize();
     SelectAppropriateBlockSize();
 }
Esempio n. 36
0
        public void NewSnapShot(SnapShot logSnapShot)
        {
            mHighlightedLogEntry = -1;
              //  mHighlightLogSnap = null;
            mLogSnap = logSnapShot;

            mInfo2Graph = new GVstruct();
            for (int i = 0, e = mLogSnap.Count; i < e; i++)
            {
                LogEntry le = mLog[mLogSnap[i]];
            #if DEBUG
                if (!(mLowerBound < le.address && le.address < mUpperBound))
                    System.Diagnostics.Debug.Print( "!! Why this address is not in range?\n");
            #endif
                mInfo2Graph.mMemoryBlockIndex.Add(mLogSnap[i]);
            }

            Array.Clear(mMemoryMap, 0, mMemoryMap.Length);
            UpdateView(true);
        }
Esempio n. 37
0
        public void UpdateHighlights(SnapShot HSnapShot)
        {
            mHighlightedLogEntry = -1;
            mHighlightLogSnap = HSnapShot;
            // clear down memory map
             //       Array.Clear(mMemoryMap, 0, mMemoryMap.Length);

            UpdateView(false);
        }