Esempio n. 1
0
        internal void WriteObject(EndNonZeroBusyStateEventArgs obj)
        {
            if (ActiveSettings.Instance.DebugLevel == DebugLevel.None)
                return;

            lock (this._writeLock)
            {
                using (StreamWriter stream = new StreamWriter(this._currentPath, true))
                {
                    this.LogRawMessage(this.FormatWithPrefix("EndNonZeroBusyStateEventArgs"), stream);
                    this.LogRawMessage(string.Format("  BusyState = {0}", obj.BusyState), stream);
                    this.LogRawMessage(string.Format("  BusyStateId = {0}", obj.BusyStateId), stream);

                    //this.WriteCurrentStateStuff(stream, false);

                    this.LogRawMessage("", stream);
                }
            }
        }
Esempio n. 2
0
        private void FireEndNonZeroBusyState(object sender, EndNonZeroBusyStateEventArgs eventArgs)
        {
            try
            {
                this._nonZeroActionStatePending.Reset();

                REPlugin.Instance.Debug.WriteObject(eventArgs);

                // Check for busy states that we fire events for.
                switch (this._pendingBusyState)
                {
                    case BusyStateConstants.GivingItem:  // Give Object
                        // If the pending give event is still set at this point, that means we were not able to
                        // verify a successful (or failed) give.  Every Begin event needs a correspond End event,
                        // so since no one else took care of it, we should fire a failed End now
                        if (this._giveItemPending.WaitOne(0))
                        {
                            var tmpEventArgs = new EndGiveItemEventArgs(null, string.Empty, GiveItemOutcome.FailedUnknown);
                            REPlugin.Instance.Debug.WriteObject(eventArgs);
                            if (this.EndGiveItem != null)
                            {
                                this.EndGiveItem(sender, tmpEventArgs);
                            }

                            this._giveItemPending.Reset();
                        }

                        break;

                    case BusyStateConstants.EquipingItem:
                        // TODO : Investigate how to detect failed equips.  Once found, introduce a manual reset event
                        if (this.EndEquipItem != null)
                        {
                            this.EndEquipItem(sender, new ObjectIdEventArgs(this._pendingBusyStateId));
                        }
                        break;

                    case BusyStateConstants.UnequipingItem:
                        // TODO : Investigate how to detect failed equips.  Once found, introduce a manual reset event
                        if (this.EndUnequipItem != null)
                        {
                            this.EndUnequipItem(sender, new ObjectIdEventArgs(this._pendingBusyStateId));
                        }
                        break;
                }

                if (this.EndNonZeroBusyState != null)
                {
                    this.EndNonZeroBusyState(sender, eventArgs);
                }
            }
            finally
            {
                this._pendingBusyState = int.MaxValue;
                this._pendingBusyStateId = int.MaxValue;
            }
        }
 void RTEvents_EndNonZeroBusyState(object sender, EndNonZeroBusyStateEventArgs e)
 {
     this.TransitionToIdle(sender);
 }