예제 #1
0
        /// <summary>
        /// Constructor from an object deserialized from the settings file.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        protected MarketOrder(SerializableOrderBase src)
        {
            src.ThrowIfNull(nameof(src));

            ID = src.OrderID;
            UnitaryPrice = src.UnitaryPrice;
            RemainingVolume = src.RemainingVolume;
            Issued = src.Issued;
            IssuedFor = src.IssuedFor == IssuedFor.None ? IssuedFor.Character : src.IssuedFor;
            LastStateChange = src.LastStateChange;
            m_state = src.State;
        }
예제 #2
0
 /// <summary>
 /// Constructor from an object deserialized from the settings file.
 /// </summary>
 /// <param name="src"></param>
 protected MarketOrder(SerializableOrderBase src)
 {
     Ignored = src.Ignored;
     m_orderID = src.OrderID;
     m_state = src.State;
     m_itemID = GetItemID(src);
     m_item = GetItem(src);
     m_station = GetStationByID(src.StationID);
     m_unitaryPrice = src.UnitaryPrice;
     m_initialVolume = src.InitialVolume;
     m_remainingVolume = src.RemainingVolume;
     m_lastStateChange = src.LastStateChange;
     m_minVolume = src.MinVolume;
     m_duration = src.Duration;
     m_issued = src.Issued;
     m_issuedFor = (src.IssuedFor == IssuedFor.None ? IssuedFor.Character : src.IssuedFor);
 }
예제 #3
0
        /// <summary>
        /// Fetches the data to the given source.
        /// </summary>
        /// <param name="src"></param>
        protected SerializableOrderBase Export(SerializableOrderBase src)
        {
            src.ThrowIfNull(nameof(src));

            src.OrderID = ID;
            src.State = m_state;
            src.UnitaryPrice = UnitaryPrice;
            src.RemainingVolume = RemainingVolume;
            src.Issued = Issued;
            src.IssuedFor = IssuedFor;
            src.LastStateChange = LastStateChange;

            return src;
        }
예제 #4
0
 /// <summary>
 /// Fetches the data to the given source.
 /// </summary>
 /// <param name="src"></param>
 protected void Export(SerializableOrderBase src)
 {
     src.Ignored = Ignored;
     src.OrderID = m_orderID;
     src.State = m_state;
     src.ItemID = m_itemID;
     src.Item = (m_item != null ? m_item.Name : "Unknown Item");
     src.StationID = m_station.ID;
     src.UnitaryPrice = m_unitaryPrice;
     src.InitialVolume = m_initialVolume;
     src.RemainingVolume = m_remainingVolume;
     src.LastStateChange = m_lastStateChange;
     src.MinVolume = m_minVolume;
     src.Duration = m_duration;
     src.Issued = m_issued;
     src.IssuedFor = m_issuedFor;
 }
예제 #5
0
        /// <summary>
        /// Gets an item by its ID or its name.
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        private static Item GetItem(SerializableOrderBase src)
        {
            // Try get item by its ID
            Item item = StaticItems.GetItemByID(src.ItemID);

            // We failed? Try get item by its name
            if (item == null)
                item = StaticItems.GetItemByName(src.Item);

            return item;
        }
예제 #6
0
        /// <summary>
        /// Gets an items ID either by source or by name.
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        private static long GetItemID(SerializableOrderBase src)
        {
            // Try get item ID by source
            var itemID = src.ItemID;

            // We failed? Try get item ID by name
            if (itemID == 0)
            {
                var item = StaticItems.GetItemByName(src.Item);
                itemID = (item == null ? 0 : item.ID);
            }
            
            return itemID;
        }
예제 #7
0
 /// <summary>
 /// Constructor from an object deserialized from the settings file.
 /// </summary>
 /// <param name="src"></param>
 internal SellOrder(SerializableOrderBase src)
     : base(src)
 {
 }
예제 #8
0
 /// <summary>
 /// Constructor from an object deserialized from the settings file.
 /// </summary>
 /// <param name="src"></param>
 internal BuyOrder(SerializableOrderBase src)
     : base(src)
 {
 }