Пример #1
0
        private void dumpMemoryMenuItem_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog sfd = new SaveFileDialog
            {
                FileName = "Memory.bin",
                Filter = "Binary Files (*.bin)|*.bin|All Files (*.*)|*.*"
            })
            {
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.VmRead))
                            using (FileHandle fhandle = FileHandle.CreateWin32(sfd.FileName, FileAccess.GenericWrite, FileShareMode.Read))
                            {
                                foreach (ListViewItem litem in listMemory.SelectedItems)
                                {
                                    MemoryItem item = (MemoryItem)litem.Tag;

                                    using (MemoryAlloc alloc = new MemoryAlloc((int)item.Size))
                                    {
                                        phandle.ReadMemory(item.Address, (IntPtr)alloc, (int)item.Size);
                                        fhandle.Write(alloc.Memory, (int)item.Size);
                                    }
                                }
                            }
                    }
                    catch (Exception ex)
                    {
                        PhUtils.ShowException("Unable to dump the selected memory regions", ex);
                    }
                }
            }
        }
Пример #2
0
        static IEnumerable <PresentItemActions> GetActions(MemoryItem mi)
        {
            Func <string, string, dynamic, PresentItemActions> createStep = (text, action, content) =>
                                                                            new PresentItemActions
            {
                Text     = text,
                Group    = "/Memory",
                Action   = action,
                Metadata = new { GroupKey = mi.GroupKey, MemberKey = mi.MemberKey, ReferenceKey = Guid.NewGuid().ToString() },
                Content  = content
            };

            yield return(createStep("step", MapAction.Memory.NewMemory.Name, new { Text = "[text]", Hint = "[hint]", ParentId = mi.Id }));

            yield return(createStep("update", MapAction.Memory.UpdateMemory.Name, new { Text = "[text]", Hint = "[hint]", Id = mi.Id }));

            yield return(createStep("delete", MapAction.Memory.DelMemory.Name, new { Id = mi.Id }));

            yield return(createStep("learnt", MapAction.Memory.LearntMemory.Name, new { Id = mi.Id }));

            if (!string.IsNullOrEmpty(mi.Hint))
            {
                yield return(createStep("hint", MapAction.Memory.HintMemory.Name, new { Hint = mi.Hint }));
            }
        }
Пример #3
0
        private void FillMemoryListViewItem(ListViewItem litem, MemoryItem item)
        {
            switch (item.State)
            {
            case MemoryState.Free:
                litem.Text = "Free";
                break;

            default:
                if (item.Type == MemoryType.Image)
                {
                    if (!string.IsNullOrEmpty(item.ModuleName))
                    {
                        litem.Text = item.ModuleName;
                    }
                    else
                    {
                        litem.Text = "Image";
                    }

                    litem.Text += " (" + this.GetStateStr(item.State) + ")";
                }
                else
                {
                    litem.Text  = this.GetTypeStr(item.Type);
                    litem.Text += " (" + this.GetStateStr(item.State) + ")";
                }
                break;
            }

            litem.SubItems[1].Text = Utils.FormatAddress(item.Address);
            litem.SubItems[2].Text = Utils.FormatSize(item.Size);
            litem.SubItems[3].Text = GetProtectStr(item.Protection);
            litem.Tag = item;
        }
        public void MemoryPanelMinus()
        {
            var calculator = calculatorPanel.TestCalculator;

            InputKey("7", calculatorPanel.TestKeypadButtonMouseClick);
            calculatorPanel.TestCalculatorMemoryStore(null, null);
            InputKey("9", calculatorPanel.TestKeypadButtonMouseClick);
            calculatorPanel.TestCalculatorMemoryStore(null, null);
            InputKey("3", calculatorPanel.TestKeypadButtonMouseClick);
            calculatorPanel.TestCalculatorMemoryStore(null, null);
            calculatorPanel.TestDisplay.DisplayResult("25", service.NumberFormatter);

            CollectionAssert.AreEqual(new decimal[] { 7, 9, 3 }, calculator.MemoryValues);

            var item = new MemoryItem(0, 0, service.NumberFormatter, helper.Object);

            calculatorPanel.TestMemoryPanelMinus(item, null);

            CollectionAssert.AreEqual(new decimal[] { -18, 9, 3 }, calculator.MemoryValues);

            item = new MemoryItem(1, 0, service.NumberFormatter, helper.Object);
            calculatorPanel.TestMemoryPanelMinus(item, null);

            CollectionAssert.AreEqual(new decimal[] { -18, -16, 3 }, calculator.MemoryValues);
        }
Пример #5
0
        public MemoryList()
        {
            InitializeComponent();

            _highlightingContext  = new HighlightingContext(listMemory);
            listMemory.KeyDown   += new KeyEventHandler(listMemory_KeyDown);
            listMemory.MouseDown += new MouseEventHandler(listMemory_MouseDown);
            listMemory.MouseUp   += new MouseEventHandler(listMemory_MouseUp);

            ColumnSettings.LoadSettings(Settings.Instance.MemoryListViewColumns, listMemory);
            listMemory.ContextMenu = menuMemory;
            GenericViewMenu.AddMenuItems(copyMemoryMenuItem.MenuItems, listMemory, null);

            listMemory.ListViewItemSorter = new SortedListViewComparer(listMemory)
            {
                SortColumn = 1,
                SortOrder  = SortOrder.Ascending
            };

            (listMemory.ListViewItemSorter as SortedListViewComparer).CustomSorters.Add(2,
                                                                                        (x, y) =>
            {
                MemoryItem ix = (MemoryItem)x.Tag;
                MemoryItem iy = (MemoryItem)y.Tag;

                return(ix.Size.CompareTo(iy.Size));
            });
        }
Пример #6
0
        public async Task Forget(CommandContext context, string key)
        {
            await context.TriggerTypingAsync();

            string guildedKey = $"{context.Guild.Id}-{key}";

            using var memory = serviceScope.ServiceProvider.GetRequiredService <IMemoryProvider>();
            MemoryItem existing = await memory.GetItemAsync <MemoryItem>(guildedKey);

            if (existing != null)
            {
                if (existing.Owner == context.User.Id.ToString() || botConfig.Admins.Contains(context.User.Username))
                {
                    if (await forgetItem <MemoryItem>(existing))
                    {
                        await context.RespondAsync("I'm not saying another word about it");
                    }
                    else
                    {
                        await context.RespondAsync("I don't think I can do that...");
                    }
                }
                else
                {
                    var owner = await context.Client.GetUserAsync(ulong.Parse(existing.Owner));

                    await context.RespondAsync($"Sorry homie, only {owner.Username} can delete this");
                }
            }
            else
            {
                await context.RespondAsync($"I don't know anything about {key}, sorry");
            }
        }
        public override List <MemoryItem> GetMemoryItems()
        {
            List <MemoryItem> memoryItemList = new List <MemoryItem>();

            //get latest input (MemoryItem) from ListenerProcess, which should be the quantity given
            MemoryItem latestListenerItem = ownerAgent.WorkingMemory.GetLastItemByTag(MemoryItemTags.ListenerProcess);
            string     quantityString     = latestListenerItem.Content.ToLower();

            int quantity = int.Parse(quantityString);

            //Get the portfolio brain process to check if sufficient funds available
            BrainProcess portfolioProcess = ownerAgent.BrainProcessList.Find(x => x.Name == "Portfolio");

            if (((PortfolioProcess)portfolioProcess).IsTradeSuccessful(quantity, 1))
            {
            }

            /*
             * MemoryItem outputItem = new MemoryItem();
             * outputItem.CreationDateTime = DateTime.Now;
             * outputItem.Tag = MemoryItemTags.InternetDataAcquisitionProcess;
             * outputItem.Content = "requestSearch*" + tickerToQuery;
             * memoryItemList.Add(outputItem);*/

            memoryItemList.Reverse(); // Doesn't matter really, but looks more elegant in the display:
                                      // Displayed as action first, then deactivation, then activation (on top).
            return(memoryItemList);
        }
Пример #8
0
        private void decommitMenuItem_Click(object sender, EventArgs e)
        {
            if (PhUtils.ShowConfirmMessage(
                    "decommit",
                    "the memory region",
                    "Decommitting memory regions may cause the process to crash.",
                    true
                    ))
            {
                try
                {
                    using (ProcessHandle phandle =
                               new ProcessHandle(_pid, ProcessAccess.VmOperation))
                    {
                        MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;

                        phandle.FreeMemory(item.Address, (int)item.Size, true);
                    }
                }
                catch (Exception ex)
                {
                    PhUtils.ShowException("Unable to decommit the memory region", ex);
                }
            }
        }
Пример #9
0
        private void changeMemoryProtectionMemoryMenuItem_Click(object sender, EventArgs e)
        {
            MemoryItem           item = (MemoryItem)listMemory.SelectedItems[0].Tag;
            VirtualProtectWindow w    = new VirtualProtectWindow(_pid, item.Address, item.Size);

            w.ShowDialog();
        }
Пример #10
0
        public static void UnsignedOuput(RichTextBox output, MemoryItem variable, string name)
        {
            StringBuilder temp = new StringBuilder(name);

            temp.Append(": " + ((ushort)variable.GetValue()).ToString() + "\n");
            output.Text += temp.ToString();
        }
Пример #11
0
    public void AddToList(GameObject g, float type)
    {
        alreadyInList = false;

        foreach (MemoryItem mi in memoryList)
        {
            if (g == mi.g)
            {
                alreadyInList     = true;
                mi.lastMemoryTime = Time.time;
                mi.memoryTimeLeft = memoryTime;
                if (type > mi.sensorType)
                {
                    mi.sensorType = type;
                }
                break;
            }
        }

        if (!alreadyInList)
        {
            MemoryItem newItem = new MemoryItem(g, Time.time, memoryTime, type);
            memoryList.Add(newItem);
        }
    }
Пример #12
0
        public bool SetPublicKey(string IP, string Key, string ID)
        {
            Scan();

            if (Itms.ContainsKey(ID))
            {
                MemoryItem   mi  = Itms[ID];
                DomainObject obj = mi.Obj;
                if (obj.IPAddr == IP)
                {
                    obj.Public_Key = Key;
                    mi.Obj         = obj;
                    Itms[ID]       = mi;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                LoadDomain(ID);
                return(SetPublicKey(IP, Key, ID));
            }
        }
Пример #13
0
        private void InsertSearchResult()
        {
            MemoryItem idaItem = agent.WorkingMemory.GetLastItemByTag(MemoryItemTags.InternetDataAcquisitionProcess);

            if (idaItem != null)
            {
                //Only go further if idaItem is a response (both IDA requests and responses share the same MemoryItemTag)
                string idaItemType    = idaItem.Content.Split('*')[0];
                string idaItemMessage = idaItem.Content.Split('*')[1];


                if (idaItemType.Equals("responseSearch"))
                {
                    JavaScriptSerializer parser = new JavaScriptSerializer();

                    //Put ':' back into string to make JSON compatible
                    string idaItemMessageJson = idaItemMessage.Replace(';', ':');

                    List <StockInfo> stockInfoList = (List <StockInfo>)parser.Deserialize(idaItemMessageJson, typeof(List <StockInfo>));
                    StockInfo        stockInfo     = stockInfoList.First();

                    stockInfoTextBox.Text = stockInfo.t + "\n\r" + stockInfo.l_fix;
                }
                if (idaItemType.Equals("responsePortfolio"))
                {
                }
            }
        }
Пример #14
0
        public string GetString(Random randomNumberGenerator, List <StringMemoryItem> queryMemoryItemList)
        {
            string        outputString = "";
            List <string> queryItems   = new List <string>();

            if (queryMemoryItemList != null)
            {
                foreach (StringMemoryItem queryMemoryItem in queryMemoryItemList)
                {
                    string queryMemoryItemString = (string)queryMemoryItem.GetContent();
                    queryItems.Add(queryMemoryItemString);
                }
            }

            foreach (PatternItem patternItem in patternItemList) // Only the PositiveList is used when generating output
            {
                if (patternItem.PositiveList.Count > 0)          // Should ALWAYS be the case, but just to be sure..
                {
                    if (patternItem.PositiveList[0][0] == queryStartCharacter)
                    {
                        string     queryTagString  = patternItem.PositiveList[0];
                        MemoryItem queryMemoryItem = queryMemoryItemList.Find(q => q.TagList.Contains(queryTagString));
                        outputString += queryMemoryItem.GetContent() + " ";
                    }
                    else
                    {
                        int numberOfOptions = patternItem.PositiveList.Count;
                        int selectedIndex   = randomNumberGenerator.Next(0, numberOfOptions); // Exclusive upper bound
                        outputString += patternItem.PositiveList[selectedIndex] + " ";
                    }
                }
            }
            outputString = outputString.TrimEnd(new char[] { ' ' });
            return(outputString);
        }
Пример #15
0
        public void LoadDomain(string ID, string api_key = "")
        {
            if (Directory.Exists("domains"))
            {
                if (File.Exists($"domains/{ID}.json"))
                {
                    lock (_lck)
                    {
                        MemoryItem   mi1  = new MemoryItem();
                        DomainObject obj1 = JsonConvert.DeserializeObject <DomainObject>(File.ReadAllText($"domains/{ID}.json"));
                        mi1.Obj = obj1;
                        Itms.Add(obj1.DomainID, mi1);
                        return;
                    }
                }
            }

            MemoryItem   mi  = new MemoryItem();
            DomainObject obj = new DomainObject
            {
                DomainID = ID
            };
            PlaceNameGenerator pngl = new PlaceNameGenerator();

            obj.PlaceName = pngl.GenerateRandomPlaceName() + "-" + pngl.GenerateRandomPlaceName() + "-" + (new Random()).Next(500, 8000).ToString(); //<-- Does this need to be changed in the future??
            obj.IPAddr    = Session.Instance.CFG.DefaultIceServerAddress;
            obj.API_Key   = api_key;
            mi.Obj        = obj;

            Itms.Add(obj.DomainID, mi);
        }
Пример #16
0
        public async Task Remember(CommandContext context, string key, [RemainingText] string value)
        {
            await context.TriggerTypingAsync();

            string guildedKey = $"{context.Guild.Id}-{key}";

            // check if the item exists first
            using var memory = serviceScope.ServiceProvider.GetRequiredService <IMemoryProvider>();
            MemoryItem existing = memory.GetItem <MemoryItem>(guildedKey);

            if (existing == null)
            {
                existing           = new MemoryItem(guildedKey);
                existing.Owner     = context.User.Id.ToString();
                existing.Message   = value;
                existing.GuildName = context.Guild.Id.ToString();
                if (await rememberItem <MemoryItem>(existing))
                {
                    await context.RespondAsync("You betcha");
                }
                else
                {
                    await context.RespondAsync("Don't think I will...");
                }
            }
        }
Пример #17
0
        public async Task <MemoryItem> AddMemory(MemoryItem memory)
        {
            var table = azClient.GetTable <MemoryItem>();
            await table.InsertAsync(memory);

            return(memory);
        }
Пример #18
0
        private void FillMemoryListViewItem(ListViewItem litem, MemoryItem item)
        {
            if (item.State == MemoryState.Free)
            {
                litem.Text = "Free";
            }
            else if (item.Type == MemoryType.Image)
            {
                if (item.ModuleName != null)
                {
                    litem.Text = item.ModuleName;
                }
                else
                {
                    litem.Text = "Image";
                }

                litem.Text += " (" + GetStateStr(item.State) + ")";
            }
            else
            {
                litem.Text  = GetTypeStr(item.Type);
                litem.Text += " (" + GetStateStr(item.State) + ")";
            }

            litem.SubItems[1].Text = Utils.FormatAddress(item.Address);
            litem.SubItems[2].Text = Utils.FormatSize(item.Size);
            litem.SubItems[3].Text = GetProtectStr(item.Protection);
            litem.Tag = item;
        }
Пример #19
0
 public void Display(MemoryItem caller, MemoryItemData data)
 {
     this.caller = caller;
     this.data   = data;
     display     = Instantiate(data.model, spawnPoint.transform.position, spawnPoint.rotation) as GameObject;
     _state.Transition(StateType.In_Game_Memory);
     camera.depth = 0;
 }
Пример #20
0
        public void SetMemoryItemInvalidType()
        {
            MemoryItem testItem = new MemoryItem(new MemoryProperty("Prop", TestType));
            var        o        = new DataObject(AnotherTestType);

            Assert.ThrowsException <MemoryException>(() => testItem.Set(o), "Set operation should not have succeeded with incorrect type.");
            Assert.AreNotEqual(o, testItem.Value, "Value was incorrectly stored in memory.");
        }
Пример #21
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="memItem">The MemoryItem for validating and retrieving items from references.</param>
        /// <param name="tabPage">The tab page that the list is on.</param>
        /// <param name="list">The list containing all of the MemoryItem values.</param>
        public ItemController(MemoryItem <T> memItem, TabPage tabPage, ListBox list)
        {
            this.memItem = memItem;
            this.tabPage = tabPage;
            this.listBox = list;

            memItem.InitList(list, MainWindow.instance.sharp);
        }
Пример #22
0
        public void SetMemoryItem()
        {
            MemoryItem testItem = new MemoryItem(new MemoryProperty("Prop", TestType));
            var        o        = new DataObject(TestType);

            testItem.Set(o);
            Assert.AreEqual(o, testItem.Value, "Value failed to store in memory.");
        }
Пример #23
0
        private void refreshPortfolioDataQuery()
        {
            MemoryItem outputItem = new MemoryItem();

            outputItem.CreationDateTime = DateTime.Now;
            outputItem.Tag     = MemoryItemTags.InternetDataAcquisitionProcess;
            outputItem.Content = "requestPortfolio*" + TickerListString;
            ownerAgent.WorkingMemory.InsertItem(outputItem);
        }
Пример #24
0
        static void AddMemoryItem(string id, string groupKey, string memberKey, string text, string hint, string parentId, DateTimeOffset actionTime, MemoryType memoryType)
        {
            var memory = new MemoryItem {
                Id = id, ParentId = parentId, GroupKey = groupKey, MemberKey = memberKey, Hint = hint, Text = text, MemoryType = memoryType, Stage = MemoryStage.Stage0
            };

            Memories.Add(memory);
            SendFeedbackMessage(type: MsgType.Success, actionTime: actionTime, action: MapAction.MemoryFeedback.NewMemoryAdded.Name, content: memory);
        }
Пример #25
0
        public void DuplicateMemoryInGroup()
        {
            IWritableMemoryGroup testGroup = new MemoryGroup();
            MemoryProperty       prop      = new MemoryProperty("Property", new DataType("TestType", new MemoryProperty[0], new MemoryProperty[0]));
            MemoryItem           i         = new MemoryItem(prop);

            Assert.IsTrue(testGroup.Add(i), "Failed to add item.");
            Assert.IsFalse(testGroup.Add(i), "Duplicate was allowed to be added.");
        }
Пример #26
0
        private void longTermMemoryViewer_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = longTermMemoryViewer.SelectedIndex;

            if (selectedIndex >= 0)
            {
                MemoryItem memoryItem = agent.LongTermMemory.ItemList[selectedIndex];
                memoryItemDataGridView.SetMemoryItem(memoryItem);
            }
        }
Пример #27
0
        private void readWriteMemoryMemoryMenuItem_Click(object sender, EventArgs e)
        {
            if (listMemory.SelectedIndices.Count != 1)
            {
                return;
            }

            MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;

            MemoryEditor.ReadWriteMemory(_pid, item.Address, (int)item.Size, false);
        }
Пример #28
0
        private async void Btn_AddMemory_Clicked(object sender, EventArgs e)
        {
            MemoryItem memory = new MemoryItem
            {
                title       = this.Entry_Title.Text,
                Description = this.Entry_Description.Text,
                date        = this.DatePicker.Date,
            };

            await App.GetMemoryService().AddMemory(memory);
        }
Пример #29
0
        public async void ExecuteAddMemory(MemoryItem parameter)
        {
            //   var newMemoryItem = await App.GetMemoryService().AddUser(
            //  new MemoryItem { Memory_ID = targetItem.Id, BidAmount = BidAmount });

            // Item.CurrentBid = newBid.BidAmount;

            MessagingCenter.Send <AddMemoryViewModel, MemoryItem>(this, Constants.MSG_ITEMUPDATED, Item);

            //move back to the page they were on before bidding
            await Navigation.PopAsync();
        }
Пример #30
0
        public override Boolean Run(List <object> parameterList, out string targetContext, out string targetID)
        {
            base.Run(parameterList, out targetContext, out targetID);

            string movieTitle        = inputQueryTagList[0];
            string movieRatingString = inputQueryTagList[1];
            string currentUser       = inputQueryTagList[2];

            //TODO: get all in one call
            MemoryItem itemSought1 = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTagList[0]);

            if (itemSought1 != null)  // 20171201
            {
                movieTitle = (string)itemSought1.GetContent();
            }
            MemoryItem itemSought2 = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTagList[1]);

            if (itemSought2 != null)  // 20171201
            {
                movieRatingString = (string)itemSought2.GetContent();
            }
            double     movieRating = Convert.ToDouble(movieRatingString);
            MemoryItem itemSought3 = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTagList[2]);

            if (itemSought3 != null)  // 20171201
            {
                currentUser = (string)itemSought3.GetContent();
            }

            Boolean existingRating = false;

            foreach (var rating in _ultraManager.RatingList)
            {
                if (rating.UserName == currentUser)
                {
                    if (rating.MovieTitle == movieTitle)
                    {
                        existingRating     = true;
                        rating.RatingValue = movieRating;
                    }
                }
            }
            if (existingRating == false)
            {
                var rating = new Rating(movieTitle, currentUser, movieRating);
                _ultraManager.RatingList.Add(rating);
            }

            targetContext = outputAction.TargetContext;
            targetID      = outputAction.TargetID;
            return(true);
        }
Пример #31
0
        private void provider_DictionaryRemoved(MemoryItem item)
        {
            this.BeginInvoke(new MethodInvoker(() =>
                {
                    lock (listMemory)
                    {

                        try
                        {
                            listMemory.Items[item.Address.ToString()].Remove();
                        }
                        catch (Exception ex)
                        {
                            Logging.Log(ex);
                        }
                    }
                }));
        }
Пример #32
0
        private void provider_DictionaryModified(MemoryItem oldItem, MemoryItem newItem)
        {
            this.BeginInvoke(new MethodInvoker(() =>
                {
                    lock (listMemory)
                    {
                        ListViewItem litem = listMemory.Items[newItem.Address.ToString()];

                        if (litem != null)
                            this.FillMemoryListViewItem(litem, newItem);
                    }
                }));
        }
Пример #33
0
        private void provider_DictionaryAdded(MemoryItem item)
        {
            this.BeginInvoke(new MethodInvoker(() =>
                {
                    HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
                        item.RunId > 0 && _runCount > 0);

                    litem.Name = item.Address.ToString();

                    litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
                    litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
                    litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));

                    this.FillMemoryListViewItem(litem, item);

                    _needsAdd.Add(litem);
                }));
        }
Пример #34
0
        private void FillMemoryListViewItem(ListViewItem litem, MemoryItem item)
        {
            if (item.State == MemoryState.Free)
            {
                litem.Text = "Free";
            }
            else if (item.Type == MemoryType.Image)
            {
                if (item.ModuleName != null)
                    litem.Text = item.ModuleName;
                else
                    litem.Text = "Image";

                litem.Text += " (" + GetStateStr(item.State) + ")";
            }
            else
            {
                litem.Text = GetTypeStr(item.Type);
                litem.Text += " (" + GetStateStr(item.State) + ")";
            }

            litem.SubItems[1].Text = Utils.FormatAddress(item.Address);
            litem.SubItems[2].Text = Utils.FormatSize(item.Size);
            litem.SubItems[3].Text = GetProtectStr(item.Protection);
            litem.Tag = item;
        }
Пример #35
0
        private void FillMemoryListViewItem(ListViewItem litem, MemoryItem item)
        {
            switch (item.State)
            {
                case MemoryState.Free:
                    litem.Text = "Free";
                    break;
                default:
                    if (item.Type == MemoryType.Image)
                    {
                        if (!string.IsNullOrEmpty(item.ModuleName))
                            litem.Text = item.ModuleName;
                        else
                            litem.Text = "Image";

                        litem.Text += " (" + this.GetStateStr(item.State) + ")";
                    }
                    else
                    {
                        litem.Text = this.GetTypeStr(item.Type);
                        litem.Text += " (" + this.GetStateStr(item.State) + ")";
                    }
                    break;
            }

            litem.SubItems[1].Text = Utils.FormatAddress(item.Address);
            litem.SubItems[2].Text = Utils.FormatSize(item.Size);
            litem.SubItems[3].Text = GetProtectStr(item.Protection);
            litem.Tag = item;
        }