private void CpuComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { CpuItem item = (CpuItem)cpuComboBox.SelectedItem; mWorkProps.CpuType = item.Type; IsDirty = true; }
/// <summary> /// Constructor. Initial state is configured from an existing ProjectProperties object. /// </summary> /// <param name="owner">Parent window.</param> /// <param name="project">Project object.</param> /// <param name="projectDir">Project directory, if known.</param> /// <param name="formatter">Text formatter.</param> /// <param name="initialTab">Tab to open initially. Pass "Unknown" for default.</param> public EditProjectProperties(Window owner, DisasmProject project, string projectDir, Formatter formatter, Tab initialTab) { InitializeComponent(); Owner = owner; DataContext = this; mWorkProps = new ProjectProperties(project.ProjectProps); // make a work copy mProjectDir = projectDir; mFormatter = formatter; mInitialTab = initialTab; IsRelocDataAvailable = (project.RelocList.Count > 0); // Construct arrays used as item sources for combo boxes. CpuItems = new CpuItem[] { new CpuItem((string)FindResource("str_6502"), CpuDef.CpuType.Cpu6502), new CpuItem((string)FindResource("str_65C02"), CpuDef.CpuType.Cpu65C02), new CpuItem((string)FindResource("str_W65C02"), CpuDef.CpuType.CpuW65C02), new CpuItem((string)FindResource("str_65816"), CpuDef.CpuType.Cpu65816), }; DefaultTextScanModeItems = new DefaultTextScanMode[] { new DefaultTextScanMode(Res.Strings.SCAN_LOW_ASCII, TextScanMode.LowAscii), new DefaultTextScanMode(Res.Strings.SCAN_LOW_HIGH_ASCII, TextScanMode.LowHighAscii), new DefaultTextScanMode(Res.Strings.SCAN_C64_PETSCII, TextScanMode.C64Petscii), new DefaultTextScanMode(Res.Strings.SCAN_C64_SCREEN_CODE, TextScanMode.C64ScreenCode), }; MinCharsItems = new MinCharsItem[] { new MinCharsItem((string)FindResource("str_DisableStringScan"), DataAnalysis.MIN_CHARS_FOR_STRING_DISABLED), new MinCharsItem("3", 3), new MinCharsItem("4", 4), new MinCharsItem("5", 5), new MinCharsItem("6", 6), new MinCharsItem("7", 7), new MinCharsItem("8", 8), new MinCharsItem("9", 9), new MinCharsItem("10", 10), }; AutoLabelItems = new AutoLabelItem[] { new AutoLabelItem((string)FindResource("str_AutoLabelSimple"), AutoLabel.Style.Simple), new AutoLabelItem((string)FindResource("str_AutoLabelAnnotated"), AutoLabel.Style.Annotated), new AutoLabelItem((string)FindResource("str_AutoLabelFullyAnnotated"), AutoLabel.Style.FullyAnnotated), }; }
/// <summary> /// Constructor. /// </summary> /// <param name="owner">Parent window.</param> /// <param name="formatter">Text formatter.</param> public InstructionChart(Window owner, Formatter formatter) { InitializeComponent(); Owner = owner; DataContext = this; mFormatter = formatter; CpuItems = new CpuItem[] { new CpuItem((string)FindResource("str_6502"), CpuDef.CpuType.Cpu6502), new CpuItem((string)FindResource("str_65C02"), CpuDef.CpuType.Cpu65C02), new CpuItem((string)FindResource("str_65816"), CpuDef.CpuType.Cpu65816), }; }
/// <summary> /// CpuItem インスタンスを作成 /// </summary> /// <param name="displayName">表示名</param> /// <param name="icons">アニメーションアイコン</param> /// <param name="instanceList">インスタンス名のリスト</param> /// <param name="popupMenu">ポップアップメニュー</param> /// <returns>CpuItem インスタンス</returns> public static CpuItem Create(string displayName, List <string> instanceList, List <Icon> icons, ContextMenuStrip popupMenu) { var ci = new CpuItem { _icons = icons.ToArray(), _anmSeq = 0, _displayName = displayName, _perfCount = new List <PerformanceCounter>(), _notifyIcon = new NotifyIcon { Icon = icons[0], Visible = true, Text = "", ContextMenuStrip = popupMenu, }, }; foreach (var instance in instanceList) { ci._perfCount.Add(new PerformanceCounter("Processor Information", "% Processor Time", instance)); } return(ci); }
/// <summary> /// 初期化処理 /// </summary> /// <returns>true:成功</returns> private bool InitAllIcons() { bool success = false; timerMonitor.Enabled = false; timerAnimation.Enabled = false; try { var icons = new List <Icon> { Properties.Resources._01, Properties.Resources._02, Properties.Resources._03, Properties.Resources._04, Properties.Resources._05, Properties.Resources._06, Properties.Resources._07, Properties.Resources._08, Properties.Resources._09, Properties.Resources._10 }; // 既に表示しているアイコンを消去 foreach (var cpuItem in _cpuItems) { cpuItem.ClearTaskTrayIcon(); } _cpuItems.Clear(); DISPLAY_MODE mode = (DISPLAY_MODE)Properties.Settings.Default.DisplayMode; if (mode == DISPLAY_MODE.TOTAL) { // トータル表示 _cpuItems.Add(CpuItem.Create("CPU", new List <string> { "_Total" }, icons, contextMenuStrip)); } else { var category = new PerformanceCounterCategory { CategoryName = "Processor Information" }; var instanceNames = category.GetInstanceNames(); var regex = new Regex(@"^\d+,\d+$"); // Socket,CPU の列のみフィルタ後、数値順にソート var query = instanceNames .Where(x => regex.IsMatch(x)) .Select(x => x.Split(new char[] { ',' })) .OrderBy(x => int.Parse(x[0])) // Socket .OrderBy(x => int.Parse(x[1])) // CPU .ToList(); // 物理コアあたりの論理コア数 int logicalCorePerPhisicalCore = 0; if (mode == DISPLAY_MODE.PHYSICAL_CORE) { // 物理コアを表示 uint numberOfCores = 0; // 物理プロセッサ数 uint numberOfLogicalProcessors = 0; // 論理プロセッサ数 var managementClass = new ManagementClass("Win32_Processor"); var managementObj = managementClass.GetInstances(); foreach (var mo in managementObj) { numberOfCores = (uint)mo["NumberOfCores"]; numberOfLogicalProcessors = (uint)mo["NumberOfLogicalProcessors"]; break; } if (numberOfCores > 0) { logicalCorePerPhisicalCore = (int)(numberOfLogicalProcessors / numberOfCores); } } else if (mode == DISPLAY_MODE.LOGICAL_CORE) { // 論理コアを表示 logicalCorePerPhisicalCore = 1; } if (logicalCorePerPhisicalCore > 0) { for (int i = 0; i < query.Count; i += logicalCorePerPhisicalCore) { var instanceList = new List <string>(); var cpuNames = new List <string>(); for (int j = 0; j < logicalCorePerPhisicalCore; j++) { instanceList.Add(query[i + j][0] + ',' + query[i + j][1]); cpuNames.Add((i + j + 1).ToString()); } _cpuItems.Add(CpuItem.Create( "CPU#" + string.Join(", ", cpuNames.ToArray()), instanceList, icons, contextMenuStrip )); } } } timerMonitor.Enabled = true; timerAnimation.Enabled = true; success = true; } catch (Exception ex) { MessageBox.Show("エラー : " + ex.Message); Application.Exit(); } return(success); }
private void UpdateControls() { CpuItem item = (CpuItem)cpuSelectionComboBox.SelectedItem; if (item == null) { // initializing return; } // Push current choice to settings. AppSettings.Global.SetEnum(AppSettings.INSTCH_MODE, typeof(CpuDef.CpuType), (int)item.Type); AppSettings.Global.SetBool(AppSettings.INSTCH_SHOW_UNDOC, mShowUndocumented); // Populate the items source. InstructionItems.Clear(); CpuDef cpuDef = CpuDef.GetBestMatch(item.Type, true, false); for (int opc = 0; opc < 256; opc++) { OpDef op = cpuDef[opc]; if (!mShowUndocumented && op.IsUndocumented) { continue; } int opLen = op.GetLength(StatusFlags.AllIndeterminate); string sampleValue = "$12"; if (op.AddrMode == OpDef.AddressMode.BlockMove) { sampleValue = "#$12,#$34"; } else if (opLen == 3) { sampleValue = "$1234"; } else if (opLen == 4) { sampleValue = "$123456"; } string instrSample = mFormatter.FormatMnemonic(op.Mnemonic, OpDef.WidthDisambiguation.None) + " " + mFormatter.FormatOperand(op, sampleValue, OpDef.WidthDisambiguation.None); StringBuilder flags = new StringBuilder(8); const string FLAGS = "NVMXDIZC"; Asm65.StatusFlags affectedFlags = op.FlagsAffected; for (int fl = 0; fl < 8; fl++) { if (affectedFlags.GetBit((StatusFlags.FlagBits)(7 - fl)) >= 0) { flags.Append(FLAGS[fl]); } else { flags.Append("-"); } } string cycles = op.Cycles.ToString(); OpDef.CycleMod mods = cpuDef.GetOpCycleMod(opc); if (mods != 0) { cycles += '+'; } InstructionItems.Add(new InstructionItem(mFormatter.FormatHexValue(opc, 2), instrSample, flags.ToString(), cycles, mOpDesc.GetShortDescription(op.Mnemonic), mOpDesc.GetAddressModeDescription(op.AddrMode), op.IsUndocumented)); } }
public List <SlotbarCategoryModule> GetCategories(Player player) { var counterValue = 0; var categories = new List <SlotbarCategoryModule>(); var items = new List <SlotbarCategoryItemModule>(); //LASERS var maxCounter = 1000; foreach (var itemId in Items.LaserIds) { if (!player.Information.Ammunitions.ContainsKey(itemId)) { continue; } var ammo = player.Information.Ammunitions[itemId]; var item = new LaserItem( itemId, counterValue, maxCounter ); item.CounterValue = ammo.Get(); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("lasers", items)); //ROCKETS items = new List <SlotbarCategoryItemModule>(); maxCounter = 200; foreach (var itemId in Items.RocketIds) { if (!player.Information.Ammunitions.ContainsKey(itemId)) { continue; } var ammo = player.Information.Ammunitions[itemId]; counterValue = ammo.Get(); var item = new RocketItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("rockets", items)); //ROCKET LAUNCHER items = new List <SlotbarCategoryItemModule>(); maxCounter = 200; foreach (var itemId in Items.RocketLauncherIds) { var item = new RocketLauncherItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("rocket_launchers", items)); //SPECIAL ITEMS items = new List <SlotbarCategoryItemModule>(); maxCounter = 100; foreach (var itemId in Items.SpecialItemsIds) { var item = new SpecialItem( itemId, counterValue, maxCounter ); item.CounterValue = 100; item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("special_items", items)); //MINES items = new List <SlotbarCategoryItemModule>(); maxCounter = 100; foreach (var itemId in Items.MinesIds) { var item = new MineItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("mines", items)); //CPUS items = new List <SlotbarCategoryItemModule>(); maxCounter = 100; foreach (var itemId in Items.CpusIds) { var item = new CpuItem( itemId, counterValue, maxCounter, null, 1, false, false ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("cpus", items)); //BUY NOW //items = new List<SlotbarCategoryItemModule>(); //maxCounter = 0; //foreach (var itemId in Items.BuyNowIds) //{ // var item = new BuyItem( // itemId, // counterValue, // maxCounter // ); // item.Create(); // items.Add(item.Object); // _items[item.ClickedId] = item; //} //categories.Add(new SlotbarCategoryModule("buy_now", items)); //TECH ITEMS items = new List <SlotbarCategoryItemModule>(); maxCounter = 99; foreach (var itemId in Items.TechIds) { var item = new TechItem( itemId, counterValue, maxCounter ); item.Create(); item.CounterValue = 99; items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("tech_items", items)); //SHIP ABILITIES items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in Items.ShipAbilitiesIds) { var item = new ShipAbilityItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("ship_abilities", items)); //DRONE FORMATION items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in Items.FormationIds) { var item = new FormationItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); _items[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("drone_formations", items)); return(categories); }