void Reconstruct(byte[] secbuf, int type) { //sync secbuf[0] = 0; for (int i = 1; i <= 10; i++) { secbuf[i] = 0xFF; } secbuf[11] = 0x00; //misc stuff switch (type) { case 1: //mode 1 secbuf[15] = 0x01; //reserved for (int i = 0x814; i <= 0x81B; i++) { secbuf[i] = 0x00; } break; case 2: case 3: //mode 2 secbuf[15] = 0x02; //flags - apparently CD XA specifies two copies of these 4bytes of flags. ECM didnt store the first copy; so we clone the second copy which was stored down to the spot for the first copy. secbuf[0x10] = secbuf[0x14]; secbuf[0x11] = secbuf[0x15]; secbuf[0x12] = secbuf[0x16]; secbuf[0x13] = secbuf[0x17]; break; } //edc switch (type) { case 1: ECM.PokeUint(secbuf, 0x810, ECM.EDC_Calc(secbuf, 0, 0x810)); break; case 2: ECM.PokeUint(secbuf, 0x818, ECM.EDC_Calc(secbuf, 16, 0x808)); break; case 3: ECM.PokeUint(secbuf, 0x92C, ECM.EDC_Calc(secbuf, 16, 0x91C)); break; } //ecc switch (type) { case 1: ECM.ECC_Populate(secbuf, 0, secbuf, 0, false); break; case 2: ECM.ECC_Populate(secbuf, 0, secbuf, 0, true); break; } }
public void ShowCharacterRender(ECM.Character character, ECM.API.ImageApi.ImageRequestSize size512x512) { BackgroundWorker fetchRender = new BackgroundWorker(); this.Title = character.Name; imgItemRender.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF); fetchRender.DoWork += delegate(object sender, DoWorkEventArgs e) { imgItemRender.Pixbuf = ECM.API.ImageApi.GetCharacterPortraitGTK(character.ID, ECM.API.ImageApi.ImageRequestSize.Size512x512); }; fetchRender.RunWorkerAsync(); ShowAll(); }
/// <summary> /// Synthesizes the complete ECM data (EDC + ECC) for a Mode 1 data sector (and puts it in place) /// Make sure everything else in the sector userdata is done before calling this /// </summary> public static void ECM_Mode1(byte[] buf2352, int offset, int LBA) { //EDC uint edc = ECM.EDC_Calc(buf2352, offset, 2064); ECM.PokeUint(buf2352, offset + 2064, edc); //reserved, zero for (int i = 0; i < 8; i++) { buf2352[offset + 2068 + i] = 0; } //ECC ECM.ECC_Populate(buf2352, offset, buf2352, offset, false); }
public void ShowItemRender(ECM.EveItem item) { BackgroundWorker fetchRender = new BackgroundWorker(); this.Title = item.Name; imgItemRender.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF); fetchRender.DoWork += delegate(object sender, DoWorkEventArgs e) { imgItemRender.Pixbuf = ECM.API.ImageApi.GetItemRenderGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size512x512); //Show(); }; fetchRender.RunWorkerAsync(); ShowAll(); }
public void ShowItemDetails(ECM.EveItem item) { if (m_CurrentItems.ContainsKey (item.ID)) { ntbItems.CurrentPage = ntbItems.PageNum(m_CurrentItems [item.ID]); } else { // Create new page Widget page = CreateNewPage(item); // Add item to dictionary m_CurrentItems.Add(item.ID, page); // Actually create the page ntbItems.CurrentPage = ntbItems.AppendPage(page, CreateTabLabel(item, page)); } ShowAll(); }
private void AppendAssetToNode(TreeIter parentNode, ECM.API.EVE.AssetListInfo info) { ECM.EveItem item = ECM.ItemDatabase.Items[info.TypeID]; string text = item.Name; string qty = string.Empty; if (info.Quantity > 1) qty = string.Format("{0:#,0}", info.Quantity); TreeIter thisNode = assetStore.AppendValues(parentNode, text, info.TypeID, false, qty); foreach (ECM.API.EVE.ContentInfo contentInfo in info.Contents) { if (contentInfo is ECM.API.EVE.AssetListInfo) AppendAssetToNode(thisNode, contentInfo as ECM.API.EVE.AssetListInfo); else { item = ECM.ItemDatabase.Items[contentInfo.TypeID]; assetStore.AppendValues(thisNode, item.Name, contentInfo.TypeID, false, qty); } } }
void ShowItemMarketDetails(ECM.EveItem item, TreeModel model, TreeIter iter) { ntbMarketDetails.CurrentPage = 0; foreach (Widget w in hbxItemPath.Children) { hbxItemPath.Remove(w); w.Destroy(); } // First work out the tree path TreeIter parentIter; string path = ""; long ID = 0; while (model.IterParent(out parentIter, iter)) { iter = parentIter; path = model.GetValue(parentIter, 1).ToString(); ID = Convert.ToInt64(model.GetValue(iter, 2)); ECM.EveMarketGroup g = ECM.ItemDatabase.MarketGroups[ID]; Button btn = new Button(new Label(path)); btn.Relief = ReliefStyle.None; btn.Clicked += delegate(object sender, EventArgs e) { SelectItemInMarket(g); }; hbxItemPath.PackEnd(new Label("\\")); hbxItemPath.PackEnd(btn); } hbxItemPath.ShowAll(); lblItemNameDetails.Markup = string.Format("<b>{0}</b>", item.Name); imgItemIconDetails.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF); BackgroundWorker fetchImage = new BackgroundWorker(); fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e) { imgItemIconDetails.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64); }; btnShowRender.Name = item.ID.ToString(); btnShowRender.Sensitive = true; fetchImage.RunWorkerAsync(); //lblItemTreeDetails.Visible = true; imgItemIconDetails.Visible = true; btnItemInfo.Visible = true; vbxBuySell.Visible = true; frmItemImage.ShadowType = ShadowType.EtchedOut; }
/// <summary> /// Synthesizes the EDC checksum for a Mode 2 Form 1 data sector (and puts it in place) /// </summary> public static void EDC_Mode2_Form1(byte[] buf2352, int offset) { uint edc = ECM.EDC_Calc(buf2352, offset + 16, 2048 + 8); ECM.PokeUint(buf2352, offset + 2072, edc); }
protected Widget CreateAccountWidget(ECM.Account account) { VBox accWidget = new VBox(); accWidget.Spacing = 3; Label accKey = new Label(string.Format("Account #{0}", account.KeyID)); accKey.Xalign = 0; HSeparator sep = new HSeparator(); Button delAccBtn = new Button(); delAccBtn.Relief = ReliefStyle.None; delAccBtn.TooltipText = "Delete Account"; delAccBtn.Add(new Image("gtk-delete", IconSize.Menu)); delAccBtn.Clicked += delegate(object sender, EventArgs e) { //TODO: Make this work Console.WriteLine(string.Format("Deleting Account #{0}", account.KeyID)); }; Button editAccBtn = new Button(); editAccBtn.Relief = ReliefStyle.None; editAccBtn.TooltipText = "Edit Account"; editAccBtn.Add(new Image("gtk-edit", IconSize.Menu)); editAccBtn.Clicked += delegate(object sender, EventArgs e) { //TODO: Make this work Console.WriteLine(string.Format("Editing Account #{0}", account.KeyID)); }; HBox accHeader = new HBox(); accHeader.Spacing = 2; accHeader.PackStart(accKey, false, false, 0); accHeader.PackStart(sep, true, true, 0); accHeader.PackStart(editAccBtn, false, false, 0); accHeader.PackStart(delAccBtn, false, false, 0); accWidget.PackStart(accHeader, true, false, 0); TextView accStats = new TextView(); accWidget.PackStart(accStats, true, false, 0); TextTag expired = new TextTag("expired"); expired.Weight = Pango.Weight.Bold; expired.Foreground = "red"; accStats.Editable = false; accStats.Sensitive = false; TimeSpan playTime = new TimeSpan(0, account.LogonMinutes, 0); string paidUntilString = account.PaidUntil.ToLocalTime().ToString(); string accStatus = "Paid Until:"; if (account.PaidUntilExpired) { accKey.UseMarkup = true; accKey.Markup = string.Format("<span foreground=\"red\" font_weight=\"bold\">{0}</span>", accKey.Text); accStatus = "Expired:"; accStats.Buffer.TagTable.Add(expired); } accStats.Buffer.Text = string.Format("Time spent playing: {0}", ECM.Helper.GetDurationInWords(playTime)); TextIter itr = accStats.Buffer.GetIterAtLine(0); accStats.Buffer.InsertWithTags(ref itr, string.Format("{0} {1}\n", accStatus, paidUntilString), expired); foreach (ECM.Character ecmChar in account.Characters) { if (ecmChar.AutoUpdate) accWidget.PackStart(CreateCharacterButton(ecmChar), true, false, 0); } accWidget.ShowAll(); return accWidget; }
protected Widget CreateCharacterButton(ECM.Character character) { HBox box = new HBox(); Frame frm = new Frame(); frm.Shadow = ShadowType.EtchedOut; frm.BorderWidth = 3; Image img = new Image(); img.WidthRequest = 64; img.HeightRequest = 64; if (character.Portrait != null) img.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(character.Portrait).ScaleSimple(64, 64, Gdk.InterpType.Bilinear); else img.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(ECM.Core.NoPortraitJPG).ScaleSimple(64, 64, Gdk.InterpType.Bilinear); frm.Add(img); box.PackStart(frm, false, false, 3); Label text = new Label(); text.UseMarkup = true; text.Markup = string.Format("<span size=\"larger\" weight=\"bold\">{0}</span>\n<span size=\"small\">{1}\n{2:0,0.00} ISK\nLocation: {3}</span>", character.Name, character.Background, character.AccountBalance, character.LastKnownLocation); text.Xalign = 0; text.Yalign = 0; box.PackStart(text, true, true, 0); Button btn = new Button(box); btn.Name = string.Format("btn{0}", character.ID); btn.Clicked += delegate(object sender, EventArgs e) { ECM.Core.CurrentCharacter = character; }; btn.ShowAll(); return btn; }
void TQServerUpdate(ECM.API.EVE.ServerStatus status) { string serverStatus = string.Empty; if(status.ServerOnline) { serverStatus = string.Format("Tranquility is online with {0:0,0} pilots", status.NumberOfPlayers); } else { serverStatus = "Tranquility is offline"; } stbStatus.Pop(0); stbStatus.Push(0, serverStatus); }
void HandleApiAccountAccountUpdated(ECM.Account account, IApiResult result) { if (result != null && result.Error == null) { if(result is ApiResult<ApiKeyInfo>) { vbxKeyInfo.Sensitive = true; btnImport.Sensitive = true; ApiResult<ApiKeyInfo> keyInfo = result as ApiResult<ApiKeyInfo>; ApiKeyData keyData = keyInfo.Result.Key; accCharacters.Clear(); apiAccount.UpdateOnHeartbeat(); foreach (ECM.Character character in apiAccount.Characters) { accCharacters.AppendValues(true, character.Name, character.ID); } // Show key access imgAccBalance.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.AccountBalance); imgAccountStatus.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.AccountStatus); imgAssetList.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.AssetList); imgCalEvents.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.CalendarEventAttendees) && keyData.AccessMask.HasFlag(ApiKeyMask.UpcomingCalendarEvents); imgCharInfo.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.CharacterInfoPrivate) || keyData.AccessMask.HasFlag(ApiKeyMask.CharacterInfoPublic); imgCharSheet.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.CharacterSheet); imgContactNotifications.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.ContactNotifications); imgContacts.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.ContactList); imgContracts.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.Contracts); imgFacWarStats.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.FacWarStats); imgIndJobs.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.IndustryJobs); imgKillLog.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.KillLog); // TODO: What about mailing lists? imgMail.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.MailBodies) && keyData.AccessMask.HasFlag(ApiKeyMask.MailMessages); imgMarketOrders.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.MarketOrders); imgMedals.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.Medals); ImgNotifications.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.Notifications) && keyData.AccessMask.HasFlag(ApiKeyMask.NotificationTexts); imgReseach.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.Research); imgSkillQueue.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.SkillQueue); imgSkillTraining.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.SkillInTraining); imgStandings.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.Standings); imgWallJournal.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.WalletJournal); imgWallTransactions.Sensitive = keyData.AccessMask.HasFlag(ApiKeyMask.WalletTransactions); ntbInfoAndLoading.CurrentPage = 0; } } }
public EveItemUseability GetItemUseability(ECM.EveItem item) { EveItemUseability useability = EveItemUseability.Useable; for (int i = 0; i < 6; i++) { RequiredSkill req = item.RequiredSkills[i]; if (req.IsValid) { if (!Skills.ContainsKey(req.SkillID)) { return EveItemUseability.Untrainable; } else if(Skills[req.SkillID].Level < req.SkillLevel) { useability = EveItemUseability.Trainable; } } } return useability; }
private Widget CreateNewPage(ECM.EveItem item) { VBox itemDetails = new VBox(); HBox detailsTop = new HBox(); Frame imageFrame = new Frame(); Image itemImage = new Image(); Label itemName = new Label(item.Name); itemImage.WidthRequest = 64; itemImage.HeightRequest = 64; imageFrame.Add(itemImage); imageFrame.Shadow = ShadowType.EtchedIn; detailsTop.PackStart(imageFrame); detailsTop.PackEnd(itemName); itemName.Yalign = 0.1f; itemDetails.ShowAll(); return itemDetails; }
void ShowCharacterSheet(ECM.Character currentCharacter) { Console.WriteLine("****** Changing Character"); // unhook models? trvAttributes.Model = null; trvSkills.FreezeChildNotify(); trvCertificates.FreezeChildNotify(); trvAssets.FreezeChildNotify(); //trvStandings.FreezeChildNotify(); charAttributeStore.Clear(); lblCharName.Markup = string.Format("<b>{0}</b>", currentCharacter.Name); if (currentCharacter.Portrait != null) imgCharPortrait.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(currentCharacter.Portrait).ScaleSimple(160, 160, Gdk.InterpType.Bilinear); else imgCharPortrait.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(ECM.Core.NoPortraitJPG).ScaleSimple(160, 160, Gdk.InterpType.Bilinear); lblCurrentLocation.Markup = string.Format("<b>{0}</b>", currentCharacter.LastKnownLocation); lblBackground.Markup = string.Format("<b>{0}</b>", currentCharacter.Background); lblSkillpoints.Markup = string.Format("<b>{0}</b>", currentCharacter.SkillPoints.ToString("#0,0")); lblCone.Markup = string.Format("<b>{0} ({1:0,0})</b>", currentCharacter.CloneName, currentCharacter.CloneSkillPoints); lblDoB.Markup = string.Format("<b>{0}</b>", currentCharacter.Birthday.ToString("dd.MM.yyyy HH:mm:ss")); lblSecStatus.Markup = string.Format("<b>{0}</b>", currentCharacter.SecurityStatus.ToString("#0.00")); lblActiveShip.Markup = string.Format("<b>{0}\n({1})</b>", currentCharacter.ShipName, currentCharacter.ShipTypeName); if (string.IsNullOrEmpty(currentCharacter.Corporation)) { lblCorporation.Text = string.Empty; lblAlliance.Text = string.Empty; } else { lblCorporation.Markup = string.Format("<b>{0}</b>", currentCharacter.Corporation); if (string.IsNullOrEmpty(currentCharacter.Alliance)) { lblAlliance.Text = string.Empty; } else { lblAlliance.Markup = string.Format("<b>{0}</b>", currentCharacter.Alliance); } } lblCorporation.Visible = !string.IsNullOrEmpty(lblCorporation.Text); lblAlliance.Visible = !string.IsNullOrEmpty(lblAlliance.Text); lblAllianceTag.Visible = lblAlliance.Visible; lblCorporationTag.Visible = lblCorporation.Visible; // Load Attributes int charisma = currentCharacter.Attributes.Charisma + currentCharacter.Implants.Charisma.Amount; int intelligence = currentCharacter.Attributes.Intelligence + currentCharacter.Implants.Intelligence.Amount; int memory = currentCharacter.Attributes.Memory + currentCharacter.Implants.Memory.Amount; int perception = currentCharacter.Attributes.Perception + currentCharacter.Implants.Perception.Amount; int willpower = currentCharacter.Attributes.Willpower + currentCharacter.Implants.Willpower.Amount; charAttributeStore.AppendValues(new Gdk.Pixbuf(null, "ECMGTK.Resources.Icons.IntelligenceBrain"), string.Format("INTELLIGENCE\n{0} points", intelligence)); charAttributeStore.AppendValues(new Gdk.Pixbuf(null, "ECMGTK.Resources.Icons.PerceptionBrain"), string.Format("PERCEPTION\n{0} points", perception)); charAttributeStore.AppendValues(new Gdk.Pixbuf(null, "ECMGTK.Resources.Icons.CharismaBrain"), string.Format("CHARISMA\n{0} points", charisma)); charAttributeStore.AppendValues(new Gdk.Pixbuf(null, "ECMGTK.Resources.Icons.WillpowerBrain"), string.Format("WILLPOWER\n{0} points", willpower)); charAttributeStore.AppendValues(new Gdk.Pixbuf(null, "ECMGTK.Resources.Icons.MemoryBrain"), string.Format("MEMORY\n{0} points", memory)); trvAttributes.Model = charAttributeStore; #region Update Skill Store // Traverse character skills tree and update the values TreeIter iter; charSkillStore.GetIterFirst(out iter); bool cont = true; while (cont) { // These are all the main categories if (charSkillStore.IterHasChild(iter)) { charSkillStore.SetValue(iter, SkillLearntColumn, false); TreeIter child; charSkillStore.IterChildren(out child, iter); int numSkills = 0; int totalPoints = 0; bool showGroup = false; while (cont) { long id = (long)charSkillStore.GetValue(child, SkillIdColumn); ECM.EveSkill skill = ECM.ItemDatabase.Items[id] as ECM.EveSkill; bool learnt = currentCharacter.Skills.ContainsKey(id); int level = 0; int points = 0; double minsToNext = 0; if (learnt) { level = currentCharacter.Skills[id].Level; points = currentCharacter.Skills[id].Skillpoints; showGroup = true; numSkills++; } int pointsAtNext = skill.PointsAtLevel(level + 1); int pointsAtCurr = skill.PointsAtLevel(level); if (level < 5) { long diff = pointsAtNext - points; double spPerMin = ECM.Core.CurrentCharacter.SkillpointsPerMinute(skill.PrimaryAttribute, skill.SecondaryAttribute); minsToNext = diff / spPerMin; } charSkillStore.SetValue(child, SkillLevelColumn, level); charSkillStore.SetValue(child, SkillTimeToNextColumn, minsToNext); charSkillStore.SetValue(child, SkillLearntColumn, learnt); charSkillStore.SetValue(child, SkillCurrSPColumn, points); charSkillStore.SetValue(child, SkillNextSPColumn, pointsAtNext); charSkillStore.SetValue(child, SkillLevlSPColumn, pointsAtCurr); totalPoints += points; cont = charSkillStore.IterNext(ref child); } charSkillStore.SetValue(iter, SkillLearntColumn, showGroup); charSkillStore.SetValue(iter, SkillCurrSPColumn, numSkills); charSkillStore.SetValue(iter, SkillNextSPColumn, totalPoints); } cont = charSkillStore.IterNext(ref iter); } #endregion #region Update Certificate Store certStore.GetIterFirst(out iter); cont = true; while (cont) { // These are all the main categories if (certStore.IterHasChild(iter)) { TreeIter child; certStore.IterChildren(out child, iter); bool showGroup = false; while (cont) { long id = (long)certStore.GetValue(child, 2); bool learnt = false; foreach (ECM.API.EVE.CharacterCertificates cert in currentCharacter.Certificates) { if (cert.ID == id) learnt = true; } if (learnt) { showGroup = true; // Remove any prerequisite certificates ECM.EveCertificate cert = ECM.ItemDatabase.Certificates[id]; foreach (ECM.EveCertificateRequirement req in cert.Requirements) { if(req.RequirementIsSkill == false) { ECM.EveCertificate reqCert = ECM.ItemDatabase.Certificates[req.RequirementID]; TreeIter reqIter; if (certStore.GetIter(out reqIter, reqCert.TreeReference.Path)) { certStore.SetValue(reqIter, 4, false); } } } } certStore.SetValue(child, 4, learnt); cont = certStore.IterNext(ref child); } certStore.SetValue(iter, 4, showGroup); } cont = certStore.IterNext(ref iter); } #endregion #region Update Asset Store assetStore.Clear(); foreach (long locationID in currentCharacter.Assets.Keys) { ECM.EveStation station = ECM.MapDatabase.Stations[locationID]; List<ECM.API.EVE.AssetListInfo> locAssets = currentCharacter.Assets[locationID]; string locHeader = string.Format("{0} - {1:#,0} items", station.Name, locAssets.Count); TreeIter locationNode = assetStore.AppendValues(locHeader, locationID, true, ""); foreach (ECM.API.EVE.AssetListInfo info in locAssets) { AppendAssetToNode(locationNode, info); } } #endregion #region Update Standings Store standingsStore.Clear(); if (currentCharacter.Standings != null) { TreeIter standingParent; standingParent = standingsStore.AppendValues("Factions", null, true, 3); foreach (ECM.API.EVE.StandingInfo standings in currentCharacter.Standings.Factions) { string text = string.Format("{0} ({1:0.00}) ({2})", standings.FromName, standings.Standing, standings.Status); ECM.API.ImageLoader icon = new ECM.API.ImageLoader(standings.FromID, ECM.API.ImageApi.ImageRequestSize.Size32x32, ECM.API.ImageApi.ImageRequestType.Alliance); TreeIter standingIter = standingsStore.AppendValues(standingParent, text, icon, false, standings.Standing); TreeRowReference iterRef = new Gtk.TreeRowReference(standingsStore, standingsStore.GetPath(standingIter)); icon.OnImageUpdated += delegate { Gdk.Rectangle rect = trvStandings.GetCellArea(iterRef.Path, trvStandings.GetColumn(0)); trvStandings.QueueDrawArea(rect.X, rect.Y, rect.Width, rect.Height); //trvStandings.QueueDraw(); }; } standingParent = standingsStore.AppendValues("Corporations", null, true, 2); foreach (ECM.API.EVE.StandingInfo standings in currentCharacter.Standings.NPCCorporations) { string text = string.Format("{0} ({1:0.00}) ({2})", standings.FromName, standings.Standing, standings.Status); ECM.API.ImageLoader icon = new ECM.API.ImageLoader(standings.FromID, ECM.API.ImageApi.ImageRequestSize.Size32x32, ECM.API.ImageApi.ImageRequestType.Corporation); TreeIter standingIter = standingsStore.AppendValues(standingParent, text, icon, false, standings.Standing); TreeRowReference iterRef = new Gtk.TreeRowReference(standingsStore, standingsStore.GetPath(standingIter)); icon.OnImageUpdated += delegate { Gdk.Rectangle rect = trvStandings.GetCellArea(iterRef.Path, trvStandings.GetColumn(0)); trvStandings.QueueDrawArea(rect.X, rect.Y, rect.Width, rect.Height); //trvStandings.QueueDraw(); }; } standingParent = standingsStore.AppendValues("Agents", null, true, 1); foreach (ECM.API.EVE.StandingInfo standings in currentCharacter.Standings.Agents) { string text = string.Format("{0} ({1:0.00}) ({2})", standings.FromName, standings.Standing, standings.Status); ECM.API.ImageLoader icon = new ECM.API.ImageLoader(standings.FromID, ECM.API.ImageApi.ImageRequestSize.Size32x32, ECM.API.ImageApi.ImageRequestType.Character); TreeIter standingIter = standingsStore.AppendValues(standingParent, text, icon, false, standings.Standing); TreeRowReference iterRef = new Gtk.TreeRowReference(standingsStore, standingsStore.GetPath(standingIter)); icon.OnImageUpdated += delegate { Gdk.Rectangle rect = trvStandings.GetCellArea(iterRef.Path, trvStandings.GetColumn(0)); trvStandings.QueueDrawArea(rect.X, rect.Y, rect.Width, rect.Height); //trvStandings.QueueDraw(); }; } } #endregion skillsFilter.Refilter(); certFilter.Refilter(); assetFilter.Refilter(); standingFilter.Refilter(); trvSkills.ThawChildNotify(); trvCertificates.ThawChildNotify(); trvAssets.ThawChildNotify(); //trvStandings.ThawChildNotify(); trvStandings.ExpandAll(); }
void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter) { if (vbbMarketGroups.IsRealized == false) vbbMarketGroups.Realize(); Image itemPic = new Image(); itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF); itemPic.WidthRequest = 64; itemPic.HeightRequest = 64; BackgroundWorker fetchImage = new BackgroundWorker(); fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e) { itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64); }; fetchImage.RunWorkerAsync(); Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22); Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG); EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item); if (useability == EveItemUseability.Untrainable) buf.Fill(m_Untrainable.ToUint()); else if (useability == EveItemUseability.Trainable) buf.Fill(m_Trainable.ToUint()); else buf.Fill(m_Useable.ToUint()); book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255); Image skillsMet = new Image(buf); skillsMet.WidthRequest = 22; skillsMet.HeightRequest = 22; skillsMet.Xalign = 0; Pango.FontDescription font = new Pango.FontDescription(); font.Size = 24; Label itemName = new Label(); itemName.UseMarkup = true; itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name); itemName.Xalign = 0; //itemName.ModifyFont(font); Image infoPic = new Image(ECM.Core.Info16PNG); infoPic.WidthRequest = 16; infoPic.HeightRequest = 16; Button btnInfo = new Button(); btnInfo.Relief = ReliefStyle.None; btnInfo.Add(infoPic); btnInfo.Clicked += delegate(object sender, EventArgs e) { m_ViewDetails.ShowItemDetails(item); }; HBox itemNameHeader = new HBox(); itemNameHeader.PackStart(itemName, false, false, 0); itemNameHeader.PackStart(btnInfo, false, false, 3); WrapLabel itemDesc = new WrapLabel(item.Description); Frame picFrame = new Frame(); picFrame.Shadow = ShadowType.Out; picFrame.Add(itemPic); VBox heading = new VBox(); heading.Spacing = 6; heading.PackEnd(itemNameHeader, false, false, 0); if(item.HasRequirements) heading.PackEnd(skillsMet, false, false, 0); HBox inner = new HBox(); inner.PackStart(picFrame, false, false, 0); inner.PackStart(heading, true, true, 1); Button viewDets = new Button(new Label("View Market Details")); viewDets.Clicked += delegate(object sender, EventArgs e) { ShowItemMarketDetails(item, model, iter); }; HButtonBox itemButtons = new HButtonBox(); itemButtons.Layout = ButtonBoxStyle.End; itemButtons.BorderWidth = 3; itemButtons.Add(viewDets); itemButtons.ShowAll(); HSeparator sep = new HSeparator(); VBox itemBlock = new VBox(); itemBlock.Spacing = 10; itemBlock.PackStart(inner, false, false, 0); itemBlock.PackStart(itemDesc, true, true, 0); itemBlock.PackEnd(itemButtons, false, false, 0); itemBlock.ShowAll(); sep.ShowAll(); vbbMarketGroups.PackStart(itemBlock, false, false, 3); vbbMarketGroups.PackStart(sep, false, false, 3); }
void SelectItemInMarket(ECM.EveBase item) { Gtk.TreeIter iter; if (marketStore.GetIter(out iter, item.TreeReference.Path)) { ntbPages.CurrentPage = 5; TreeModelSort sortedMarket = trvMarket.Model as TreeModelSort; trvMarket.CollapseAll(); trvMarket.ExpandToPath(sortedMarket.ConvertChildPathToPath(item.TreeReference.Path)); trvMarket.Selection.SelectIter(sortedMarket.ConvertChildIterToIter(iter)); trvSelectionChanged(null, null); } }
/// <summary> /// Synthesizes the EDC checksum for a Mode 2 Form 2 data sector (and puts it in place) /// </summary> public static void EDC_Mode2_Form2(byte[] buf2352, int offset) { uint edc = ECM.EDC_Calc(buf2352, offset + 16, 2324 + 8); ECM.PokeUint(buf2352, offset + 2348, edc); }
private Widget CreateTabLabel(ECM.EveItem item, Widget page) { HBox box = new HBox(); Image icon = new Image("gtk-close", IconSize.Menu); Button btnClose = new Button(icon); btnClose.Relief = ReliefStyle.None; btnClose.Clicked += delegate(object sender, EventArgs e) { ntbItems.RemovePage(ntbItems.PageNum(page)); m_CurrentItems.Remove(item.ID); // If all pages are gone - hide if(ntbItems.NPages == 0) Hide (); }; Label label = new Label(item.Name); label.Xalign = 0; box.PackEnd(btnClose, false, false, 3); box.PackStart(label, true, true, 6); box.ShowAll(); return box; }