public static CharacterOrderCollection GetCharacterOrderList(Database db, EveApiId id,
                                                                     string CharID, bool bUseCache)
        {
            if (!id.IsFullKey())
            {
                return(new CharacterOrderCollection()); // return empty
            }
            string url = String.Format("{0}{1}?userID={2}&characterID={3}&apiKey={4}",
                                       ApiSite, EveApi.CharMarketOrders, id.UserId, CharID, id.Key);
            string str = CheckRequestCache(db, RequestID.CharacterOrder, id.UserId, url);

            if (null == str)
            {
                str = new StreamReader(openUrl(url)).ReadToEnd();
                WriteRequestCache(db, RequestID.CharacterOrder, id.UserId, url, str);
            }
            else if (!bUseCache)
            {
                return(new CharacterOrderCollection()); // not allowed to use caching
            }

            XmlDocument xmlDoc = GetXml(new StringReader(str));

            if (null == xmlDoc)
            {
                return(new CharacterOrderCollection()); // error
            }
            return(new CharacterOrderCollection(CharID, xmlDoc));
        }
Exemplo n.º 2
0
        private void buttonMemberActivityFetch_Click(object sender, EventArgs e)
        {
            m_MemberActivityList.Clear();

            if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex)
            {
                return;
            }

            CharacterObject charObj = (CharacterObject)
                                      this.toolStripComboBoxCharacterSelection.SelectedItem;

            EveApiId id = new EveApiId(charObj.UserID.ToString(), charObj.FullKey);
            CorporationMemberTrackingCollection collection =
                EveApi.GetCorporationMemberTrackingList(m_db, id, charObj.CharID, true);

            IDBCollectionContents contents = collection as IDBCollectionContents;

            if (null != contents && 0 != contents.Count())
            {
                for (int idx = 0; idx < contents.Count(); ++idx)
                {
                    CorporationMemberTrackingObject obj = contents.GetRecordInterface(idx).GetDataObject() as CorporationMemberTrackingObject;
                    if (null != obj)
                    {
                        m_MemberActivityList.Add(obj);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void buttonSelectCharacter_Click(object sender, EventArgs e)
        {
            if (0 == this.textBoxUserID.Text.Length ||
                (0 == this.textBoxLimitedKey.Text.Length && 0 == this.textBoxFullKey.Text.Length)
                )
            {
                MessageBox.Show("You must enter a UserID, and a Key before selecting a character.");
                return;
            }
            EveApiId id = new EveApiId(this.textBoxUserID.Text,
                                       (0 != textBoxFullKey.Text.Length) ? textBoxFullKey.Text : textBoxLimitedKey.Text);
            CharacterCollection   col = EveApi.GetCharacterList(m_db, id);
            IDBCollectionContents con = (IDBCollectionContents)col;

            if (1 > con.Count())
            {
                return;
            }

            ListSelectDlg ls = new ListSelectDlg();

            for (int i = 0; i < con.Count(); ++i)
            {
                IDBRecord rec = con.GetRecordInterface(i);
                rec.SetValueString((ulong)Character.QueryValues.UserID, this.textBoxUserID.Text);
                rec.SetValueString((ulong)Character.QueryValues.LimitedKey, this.textBoxLimitedKey.Text);
                rec.SetValueString((ulong)Character.QueryValues.FullKey, this.textBoxFullKey.Text);
                rec.SetValueString((ulong)Character.QueryValues.RegCode, this.textBoxRegCode.Text);
                CharacterObject obj  = (CharacterObject)rec.GetDataObject();
                string          test = obj.ToString();
                ls.List.Items.Add(obj);
            }

            Button btn = (Button)sender;

            ls.Location = this.PointToScreen(new Point(btn.Location.X, btn.Location.Y + btn.Height));
            DialogResult ret = ls.ShowDialog();

            if (DialogResult.OK == ret)
            {
                CharacterObject newObj = (CharacterObject)ls.List.SelectedItem;
                foreach (CharacterObject obj in this.listBoxCharacters.Items)
                {
                    if (0 == obj.ToString().CompareTo(newObj.ToString()))
                    {
                        this.listBoxCharacters.SelectedItem = obj;
                        this.textBoxLimitedKey.Text         = this.textBoxLimitedKey.Text;
                        this.textBoxFullKey.Text            = this.textBoxFullKey.Text;
                        return;
                    }
                }
                this.listBoxCharacters.SelectedIndex = -1;
                m_SelectedObject = newObj;
                FillFromNewCharacter();
            }
        }
Exemplo n.º 4
0
        private void buttonOrdersFetch_Click(object sender, EventArgs e)
        {
            if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex)
            {
                return;
            }

            CharacterObject charObj = (CharacterObject)
                                      this.toolStripComboBoxCharacterSelection.SelectedItem;

            EveApiId id = new EveApiId(charObj.UserID, charObj.FullKey);
            CharacterOrderCollection collection =
                EveApi.GetCharacterOrderList(m_db, id, charObj.CharID, true);

            m_db.InsertRecord(null as ProcessingDlg, collection);
        }
Exemplo n.º 5
0
        public static CorporationTransactionCollection GetCorporationTransactionList(
            Database db, EveApiId id, string CharID, string CorpID,
            string beforeTransId, string CorpDivision, bool bAutoWalk,
            bool bAllDivisions, bool bUseCache)
        {
            if (!id.IsFullKey())
            {
                return(new CorporationTransactionCollection()); // return empty
            }
            string url = String.Format("{0}{1}?userID={2}&characterID={3}&apiKey={4}&version=2",
                                       ApiSite, CorpWalletTransactions, id.UserId, CharID, id.Key);

            if (null != beforeTransId && 0 < long.Parse(beforeTransId))
            {
                url += String.Format("&beforeTransID={0}", beforeTransId);
            }
            XmlDocument xmlDoc = GetXml(url);

            return(new CorporationTransactionCollection(CorpID, CorpDivision, xmlDoc));
        }
Exemplo n.º 6
0
        private void buttonTransactionFetch_Click(object sender, EventArgs e)
        {
            if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex)
            {
                return;
            }

            CharacterObject charObj = (CharacterObject)
                                      this.toolStripComboBoxCharacterSelection.SelectedItem;

            EveApiId id = new EveApiId(charObj.UserID, charObj.FullKey);
            CharacterTransactionCollection collection =
                EveApi.GetCharacterTransactionList(m_db, id, charObj.CharID, null, true);

            if (null == collection)
            {
                return;
            }

            Logger.ReportNotice("Using BulkLoader");
            collection.DoBulkLoader(m_db);
            Logger.ReportNotice("Done With BulkLoader");
        }
Exemplo n.º 7
0
        public static CharacterCollection GetCharacterList(Database db, EveApiId id)
        {
            string url = String.Format("{0}{1}?userID={2}&apiKey={3}",
                                       ApiSite, CharacterList, id.UserId, id.Key);

            string str = CheckRequestCache(db, RequestID.CharacterList, id.UserId, url);

            if (null != str)
            {
                return(new CharacterCollection(GetXml(new StringReader(str))));
            }

            str = new StreamReader(openUrl(url)).ReadToEnd();

            XmlDocument xmlDoc = GetXml(new StringReader(str));

            if (null == xmlDoc)
            {
                return(new CharacterCollection());
            }

            WriteRequestCache(db, RequestID.CharacterList, id.UserId, url, str);
            return(new CharacterCollection(xmlDoc));
        }
        public static CharacterJournalCollection GetCharacterJournalList(Database db, EveApiId id,
                                                                         string CharID, string beforeRefID, bool bAutoWalk, bool bUseCache)
        {
            if (!id.IsFullKey())
            {
                return(new CharacterJournalCollection()); // return empty
            }
            CharacterJournalCollection journal = null;
            long remainder = 0;
            long lastCount = 0;

            do
            {
                string url = String.Format("{0}{1}?userID={2}&characterID={3}&apiKey={4}&accountKey=1000",
                                           ApiSite, CharJournalEntries, id.UserId, CharID, id.Key);
                if (null != beforeRefID && 0 < long.Parse(beforeRefID))
                {
                    url += String.Format("&beforeRefID={0}", beforeRefID);
                }

                string str = CheckRequestCache(db, RequestID.CharacterJournal, id.UserId, url);
                if (null == str)
                {
                    Stream s = openUrl(url);
                    if (null == s)
                    {
                        return((null != journal) ? journal : (new CharacterJournalCollection()));
                    }
                    str = new StreamReader(s).ReadToEnd();
                    WriteRequestCache(db, RequestID.CharacterJournal, id.UserId, url, str);
                }
                else if (!bUseCache)
                {
                    break; // not allowed to use caching
                }

                XmlDocument xmlDoc = GetXml(new StringReader(str));
                if (null == xmlDoc)
                {
                    break;
                }

                if (null == journal)
                {
                    journal = new CharacterJournalCollection(CharID, xmlDoc);
                }
                else
                {
                    journal.AppendList(CharID, xmlDoc);
                }

                if (null == journal)
                {
                    remainder = -1;
                }
                else
                {
                    IDBCollectionContents con = (IDBCollectionContents)journal;
                    if (0 == con.Count())
                    {
                        remainder = -1;
                    }
                    else if (lastCount == con.Count())
                    {
                        remainder = -1;
                    }
                    else
                    {
                        lastCount = con.Count();
                        remainder = con.Count() % 1000;
                        if (0 == remainder)
                        {
                            IDBRecord     rec1 = con.GetRecordInterface(con.Count() - 1000);
                            JournalObject obj1 = (JournalObject)rec1.GetDataObject();
                            IDBRecord     rec2 = con.GetRecordInterface(con.Count() - 1);
                            JournalObject obj2 = (JournalObject)rec2.GetDataObject();
                            beforeRefID = Math.Min(obj1.refID, obj2.refID).ToString();
                            TimeSpan span = (obj2.date > obj1.date) ? obj2.date.Subtract(obj1.date) :
                                            obj1.date.Subtract(obj2.date);
                            if (span.Days >= 7)
                            {
                                remainder = -1; // more than a week, so no more accessable
                            }
                        }
                    }
                }
            } while (0 == remainder && bAutoWalk);

            if (null == journal)
            {
                return(new CharacterJournalCollection()); // create empty
            }
            return(journal);
        }
 public static CharacterJournalCollection GetCharacterJournalList(Database db, EveApiId id,
                                                                  string CharID, string beforeRefID, bool bAutoWalk)
 {
     return(GetCharacterJournalList(db, id, CharID, beforeRefID, bAutoWalk, false));
 }
Exemplo n.º 10
0
 public static CharacterTransactionCollection GetCharacterTransactionList(Database db, EveApiId id,
                                                                          string CharID, string beforeTransId, bool bAutoWalk)
 {
     return(GetCharacterTransactionList(db, id, CharID, beforeTransId, bAutoWalk, false));
 }
 public static CharacterOrderCollection GetCharacterOrderList(Database db, EveApiId id,
                                                              string CharID)
 {
     return(GetCharacterOrderList(db, id, CharID, false));
 }