Example #1
0
        public void stashFinishedProcessing(object sender, StashProcessingFinishedEventArgs e)
        {
            ArrayList tempStashList = ArrayList.Synchronized(stashList);

            if (!tempStashList.Contains(e.theStash.id))
            {
                poe_logger.logError("The ID that ended did not exist in the array list, retrying...: " + e.theStash.id);
                for (int x = 0; x <= 5; x++)
                {
                    if (stashList.Contains(e.theStash.id))
                    {
                        break;
                    }
                    else
                    {
                        poe_logger.logError("Still don't see ID in arraylist");
                    }
                }
            }
            lock (stashList.SyncRoot) { stashList.Remove(e.theStash.id); }
            if (stashList.Count == 0 && doneQueuing)
            {
                ChangeProcessingFinishedEventArgs a = new ChangeProcessingFinishedEventArgs();
                a.theThread = Thread.CurrentThread;
                a.theChange = this;
                poe_logger.logInfo("Calling Change Process Finished");
                complete();
                OnChangeProcessingFinished(a);
            }
            else
            {
                ignoredStashes++;
            }
            e.theStash.Dispose();
        }
Example #2
0
        protected virtual void OnStashProcessingFinished(StashProcessingFinishedEventArgs e)
        {
            EventHandler <StashProcessingFinishedEventArgs> handler = stashProcessingFinished;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #3
0
        public void addStash()
        {
            //Console.WriteLine("Processing stash: " + this.stash);
            this.addAccount();

            if (stashExists())
            {
                // update the stash name
                updateStashName();
            }
            else
            {
                DBConnector myConn = new DBConnector();
                myConn.connect();

                if (myConn.isConnected())
                {
                    MySqlCommand cmd = myConn.getSqlCommand();
                    cmd.CommandText = "INSERT INTO POE_STASH (ID,STASH_NAME,STASH_TYPE,ACCOUNT_ID) " +
                                      "VALUES (@STASHID, @STASHNAME, @STASHTYPE, @ACCOUNTID)";

                    cmd.Parameters.AddWithValue("@STASHID", this.id);
                    cmd.Parameters.AddWithValue("@STASHNAME", this.stash);
                    cmd.Parameters.AddWithValue("@STASHTYPE", this.stashType);
                    cmd.Parameters.AddWithValue("@ACCOUNTID", this.accountId);
                    cmd.Prepare();

                    cmd.ExecuteNonQuery();
                    this.stashId = cmd.LastInsertedId;
                    cmd.Dispose();
                    myConn.close();
                }
            }
            foreach (poe_item myItem in items)
            {
                //Console.WriteLine("Adding item: " + myItem.id);
                if (this.changeId == 0)
                {
                    Console.WriteLine("It was 0");
                }
                myItem.changeId      = this.changeId;
                myItem.uniqueStashId = this.stashId;
                myItem.addItem();
                //Console.WriteLine("Finished adding item: " + myItem.id);
            }
            StashProcessingFinishedEventArgs a = new StashProcessingFinishedEventArgs();

            a.theStash = this;
            //Console.WriteLine("Triggering stash complete event for stash: " + stash);
            OnStashProcessingFinished(a);
        }