protected override int Sort(BaseData a, BaseData b) { ItemDataEx itemDataEx = (ItemDataEx)a; ItemDataEx itemDataEx2 = (ItemDataEx)b; if (itemDataEx.Info.Type > itemDataEx2.Info.Type) { return 1; } if (itemDataEx.Info.Type < itemDataEx2.Info.Type) { return -1; } if (itemDataEx.Info.SubType > itemDataEx2.Info.SubType) { return 1; } if (itemDataEx.Info.SubType < itemDataEx2.Info.SubType) { return -1; } if (itemDataEx.Info.ID < itemDataEx2.Info.ID) { return -1; } if (itemDataEx.Info.ID > itemDataEx2.Info.ID) { return 1; } return 0; }
private int Sort(BaseData a, BaseData b) { PetViewItemData petViewItemData = (PetViewItemData)a; PetViewItemData petViewItemData2 = (PetViewItemData)b; if (petViewItemData == null || petViewItemData2 == null) { return 0; } if (petViewItemData.info.Quality > petViewItemData2.info.Quality) { return -1; } if (petViewItemData.info.Quality < petViewItemData2.info.Quality) { return 1; } if (petViewItemData.info.ID < petViewItemData2.info.ID) { return -1; } if (petViewItemData.info.ID > petViewItemData2.info.ID) { return 1; } return 0; }
/// <summary> /// Performs universe selection using the data specified /// </summary> /// <param name="utcTime">The current utc time</param> /// <param name="data">The symbols to remain in the universe</param> /// <returns>The data that passes the filter</returns> public override IEnumerable<Symbol> SelectSymbols(DateTime utcTime, BaseDataCollection data) { var optionsUniverseDataCollection = data as OptionChainUniverseDataCollection; if (optionsUniverseDataCollection == null) { throw new ArgumentException(string.Format("Expected data of type '{0}'", typeof (OptionChainUniverseDataCollection).Name)); } _underlying = optionsUniverseDataCollection.Underlying ?? _underlying; optionsUniverseDataCollection.Underlying = _underlying; if (_underlying == null || data.Data.Count == 0) { return Unchanged; } var availableContracts = optionsUniverseDataCollection.Data.Select(x => x.Symbol); var results = _option.ContractFilter.Filter(availableContracts, _underlying).ToHashSet(); // we save off the filtered results to the universe data collection for later // population into the OptionChain. This is non-ideal and could be remedied by // the universe subscription emitting a special type after selection that could // be checked for in TimeSlice.Create, but for now this will do optionsUniverseDataCollection.FilteredContracts = results; return results; }
protected int Sort(BaseData a, BaseData b) { PetDataEx petDataEx = (PetDataEx)a; PetDataEx petDataEx2 = (PetDataEx)b; if (petDataEx == null || petDataEx2 == null) { return 0; } if (!petDataEx.IsPlayerBattling()) { if (!petDataEx2.IsPlayerBattling()) { return this.SortByPetBattling(petDataEx, petDataEx2); } return 1; } else { if (!petDataEx2.IsPlayerBattling()) { return -1; } return this.SortByPetBattling(petDataEx, petDataEx2); } }
protected int Sort(BaseData a, BaseData b) { ItemDataEx itemDataEx = (ItemDataEx)a; ItemDataEx itemDataEx2 = (ItemDataEx)b; if (itemDataEx == null || itemDataEx2 == null) { return 0; } if (!itemDataEx.CanCreate()) { if (!itemDataEx2.CanCreate()) { return this.SortByQuality(itemDataEx, itemDataEx2); } return 1; } else { if (!itemDataEx2.CanCreate()) { return -1; } return this.SortByQuality(itemDataEx, itemDataEx2); } }
private int SortByMemberJob(BaseData a, BaseData b) { GuildMemberItemData guildMemberItemData = (GuildMemberItemData)a; GuildMemberItemData guildMemberItemData2 = (GuildMemberItemData)b; if (this.mSortType == 1) { return guildMemberItemData2.MemberData.TotalReputation - guildMemberItemData.MemberData.TotalReputation; } if (this.mSortType == 2) { return guildMemberItemData2.MemberData.Level - guildMemberItemData.MemberData.Level; } if (this.mSortType == 3) { return guildMemberItemData2.MemberData.LastOnlineTime - guildMemberItemData.MemberData.LastOnlineTime; } if (guildMemberItemData.MemberData.Rank < guildMemberItemData2.MemberData.Rank) { return -1; } if (guildMemberItemData.MemberData.Rank > guildMemberItemData2.MemberData.Rank) { return 1; } if (guildMemberItemData.MemberData.TotalReputation > guildMemberItemData2.MemberData.TotalReputation) { return -1; } if (guildMemberItemData.MemberData.TotalReputation < guildMemberItemData2.MemberData.TotalReputation) { return 1; } return guildMemberItemData2.MemberData.Level - guildMemberItemData.MemberData.Level; }
protected override int Sort(BaseData a, BaseData b) { ItemDataEx itemDataEx = (ItemDataEx)a; ItemDataEx itemDataEx2 = (ItemDataEx)b; if (itemDataEx == null || itemDataEx2 == null) { return 0; } if (!itemDataEx.IsEquiped()) { if (!itemDataEx2.IsEquiped()) { return this.SortByQuality(itemDataEx, itemDataEx2); } return 1; } else { if (!itemDataEx2.IsEquiped()) { return -1; } return this.SortByQuality(itemDataEx, itemDataEx2); } }
void DisplayDataToEditor() { // ExcelData _excelData = new ExcelData(); // _excelData.OpenFile("UserLevel","xlsx"); int tableCount = _excelData.result.Tables.Count; if(tableCount <= 0) return; DataTable tableData = _excelData.result.Tables[tableCount - 1]; Debug.Log("Rows :" + tableData.Rows.Count + " Cols :" + tableData.Columns.Count); int tableRows = tableData.Rows.Count; int tableCols = tableData.Columns.Count; EditorBaseData = new BaseData[tableRows - 1]; for(int i = 1;i < tableRows;i++) { int j = 0; EditorBaseData[i-1] = new BaseData(); EditorBaseData[i - 1].value = new string[tableCols]; foreach(DataColumn dCol in tableData.Columns) { EditorBaseData[i-1].value[j++] = tableData.Rows[i][dCol].ToString(); } } }
private int SortBy(BaseData a, BaseData b) { AchievementDataEx data = (AchievementDataEx)a; AchievementDataEx data2 = (AchievementDataEx)b; int sortWeight = this.GetSortWeight(data); int sortWeight2 = this.GetSortWeight(data2); return sortWeight.CompareTo(sortWeight2); }
protected override int Sort(BaseData a, BaseData b) { LopetDataEx lopetDataEx = (LopetDataEx)a; LopetDataEx lopetDataEx2 = (LopetDataEx)b; if (lopetDataEx != null && lopetDataEx2 != null) { if (lopetDataEx.Info.Quality > lopetDataEx2.Info.Quality) { return -1; } if (lopetDataEx.Info.Quality < lopetDataEx2.Info.Quality) { return 1; } if (lopetDataEx.Data.Awake > lopetDataEx2.Data.Awake) { return -1; } if (lopetDataEx.Data.Awake < lopetDataEx2.Data.Awake) { return 1; } if (lopetDataEx.Data.Level > lopetDataEx2.Data.Level) { return -1; } if (lopetDataEx.Data.Level < lopetDataEx2.Data.Level) { return 1; } if (lopetDataEx.Data.Exp > lopetDataEx2.Data.Exp) { return -1; } if (lopetDataEx.Data.Exp < lopetDataEx2.Data.Exp) { return 1; } if (lopetDataEx.Info.ID < lopetDataEx2.Info.ID) { return -1; } if (lopetDataEx.Info.ID > lopetDataEx2.Info.ID) { return 1; } if (lopetDataEx.GetID() > lopetDataEx.GetID()) { return 1; } if (lopetDataEx.GetID() < lopetDataEx.GetID()) { return -1; } } return 0; }
private int SortByRankLvl(BaseData a, BaseData b) { GUIAwakePageItemData gUIAwakePageItemData = (GUIAwakePageItemData)a; GUIAwakePageItemData gUIAwakePageItemData2 = (GUIAwakePageItemData)b; if (gUIAwakePageItemData != null && gUIAwakePageItemData2 != null) { return gUIAwakePageItemData.mPageIndex - gUIAwakePageItemData2.mPageIndex; } return 0; }
private int SortByRankLvl(BaseData a, BaseData b) { GuildCraftKillLogData guildCraftKillLogData = (GuildCraftKillLogData)a; GuildCraftKillLogData guildCraftKillLogData2 = (GuildCraftKillLogData)b; if (guildCraftKillLogData != null && guildCraftKillLogData2 != null) { return guildCraftKillLogData.mRankNum - guildCraftKillLogData2.mRankNum; } return 0; }
private int SortBy(BaseData a, BaseData b) { SevenDayRewardDataEx sevenDayRewardDataEx = (SevenDayRewardDataEx)a; SevenDayRewardDataEx sevenDayRewardDataEx2 = (SevenDayRewardDataEx)b; int sortWeight = this.GetSortWeight(sevenDayRewardDataEx); int sortWeight2 = this.GetSortWeight(sevenDayRewardDataEx2); if (sortWeight == sortWeight2) { return sevenDayRewardDataEx.Info.ID.CompareTo(sevenDayRewardDataEx2.Info.ID); } return (sortWeight >= sortWeight2) ? -1 : 1; }
private int SortByRankLvl(BaseData a, BaseData b) { GuildJoinTabItemData guildJoinTabItemData = (GuildJoinTabItemData)a; GuildJoinTabItemData guildJoinTabItemData2 = (GuildJoinTabItemData)b; if (guildJoinTabItemData == null || guildJoinTabItemData2 == null) { return 0; } if (guildJoinTabItemData.mIsRefreshBtn && !guildJoinTabItemData2.mIsRefreshBtn) { return 1; } if (!guildJoinTabItemData.mIsRefreshBtn && guildJoinTabItemData2.mIsRefreshBtn) { return -1; } if (guildJoinTabItemData.mBriefGuildData == null || guildJoinTabItemData2.mBriefGuildData == null) { return 0; } GuildInfo info = Globals.Instance.AttDB.GuildDict.GetInfo(guildJoinTabItemData.mBriefGuildData.Level); GuildInfo info2 = Globals.Instance.AttDB.GuildDict.GetInfo(guildJoinTabItemData2.mBriefGuildData.Level); if (info != null && info2 != null) { bool flag = guildJoinTabItemData.mBriefGuildData.MemberNum >= info.MaxMembers; bool flag2 = guildJoinTabItemData2.mBriefGuildData.MemberNum >= info2.MaxMembers; if (flag && !flag2) { return 1; } if (!flag && flag2) { return -1; } } if (guildJoinTabItemData.mBriefGuildData.Level > guildJoinTabItemData2.mBriefGuildData.Level) { return -1; } if (guildJoinTabItemData.mBriefGuildData.Level < guildJoinTabItemData2.mBriefGuildData.Level) { return 1; } if (guildJoinTabItemData.mBriefGuildData.MemberNum > guildJoinTabItemData2.mBriefGuildData.MemberNum) { return -1; } if (guildJoinTabItemData.mBriefGuildData.MemberNum < guildJoinTabItemData2.mBriefGuildData.MemberNum) { return 1; } return (int)guildJoinTabItemData.mBriefGuildData.ID - (int)guildJoinTabItemData2.mBriefGuildData.ID; }
protected override int Sort(BaseData a, BaseData b) { ItemDataEx itemDataEx = (ItemDataEx)a; ItemDataEx itemDataEx2 = (ItemDataEx)b; if (itemDataEx == null || itemDataEx2 == null) { return 0; } if (itemDataEx.Info.Quality > itemDataEx2.Info.Quality) { return 1; } if (itemDataEx.Info.Quality < itemDataEx2.Info.Quality) { return -1; } if (itemDataEx.Info.SubQuality > itemDataEx2.Info.SubQuality) { return 1; } if (itemDataEx.Info.SubQuality < itemDataEx2.Info.SubQuality) { return -1; } if (itemDataEx.GetEquipRefineLevel() > itemDataEx2.GetEquipRefineLevel()) { return 1; } if (itemDataEx.GetEquipRefineLevel() < itemDataEx2.GetEquipRefineLevel()) { return -1; } if (itemDataEx.GetEquipEnhanceLevel() > itemDataEx2.GetEquipEnhanceLevel()) { return 1; } if (itemDataEx.GetEquipEnhanceLevel() < itemDataEx2.GetEquipEnhanceLevel()) { return -1; } if (itemDataEx.Info.ID < itemDataEx2.Info.ID) { return 1; } if (itemDataEx.Info.ID > itemDataEx2.Info.ID) { return -1; } return 0; }
protected override int Sort(BaseData a, BaseData b) { ItemDataEx itemDataEx = (ItemDataEx)a; ItemDataEx itemDataEx2 = (ItemDataEx)b; if (itemDataEx != null && itemDataEx2 != null) { if (itemDataEx.CanCreate() && !itemDataEx2.CanCreate()) { return -1; } if (!itemDataEx.CanCreate() && itemDataEx2.CanCreate()) { return 1; } if (itemDataEx.Info.Quality > itemDataEx2.Info.Quality) { return -1; } if (itemDataEx.Info.Quality < itemDataEx2.Info.Quality) { return 1; } if (itemDataEx.Info.SubQuality > itemDataEx2.Info.SubQuality) { return -1; } if (itemDataEx.Info.SubQuality < itemDataEx2.Info.SubQuality) { return 1; } if (itemDataEx.GetCount() > itemDataEx2.GetCount()) { return -1; } if (itemDataEx.GetCount() < itemDataEx2.GetCount()) { return 1; } if (itemDataEx.Info.ID < itemDataEx2.Info.ID) { return -1; } if (itemDataEx.Info.ID > itemDataEx2.Info.ID) { return 1; } } return 0; }
private int SortBy(BaseData a, BaseData b) { ASPItemDataEx aSPItemDataEx = (ASPItemDataEx)a; ASPItemDataEx aSPItemDataEx2 = (ASPItemDataEx)b; int sortWeight = this.GetSortWeight(aSPItemDataEx); int sortWeight2 = this.GetSortWeight(aSPItemDataEx2); if (sortWeight != sortWeight2) { return (sortWeight <= sortWeight2) ? 1 : -1; } if (aSPItemDataEx.ASPItem.ProductID == aSPItemDataEx2.ASPItem.ProductID) { return 0; } return (aSPItemDataEx.ASPItem.ProductID >= aSPItemDataEx2.ASPItem.ProductID) ? 1 : -1; }
private int SortBy(BaseData a, BaseData b) { FundRewardData fundRewardData = (FundRewardData)a; FundRewardData fundRewardData2 = (FundRewardData)b; int sortWeight = this.GetSortWeight(fundRewardData); int sortWeight2 = this.GetSortWeight(fundRewardData2); if (sortWeight != sortWeight2) { return (sortWeight >= sortWeight2) ? -1 : 1; } if (fundRewardData.Info.ID == fundRewardData2.Info.ID) { return 0; } return (fundRewardData.Info.ID >= fundRewardData2.Info.ID) ? 1 : -1; }
private int SortBy(BaseData a, BaseData b) { ActivityGroupBuyingDataEx activityGroupBuyingDataEx = (ActivityGroupBuyingDataEx)a; ActivityGroupBuyingDataEx activityGroupBuyingDataEx2 = (ActivityGroupBuyingDataEx)b; int sortWeight = this.GetSortWeight(activityGroupBuyingDataEx); int sortWeight2 = this.GetSortWeight(activityGroupBuyingDataEx2); if (sortWeight != sortWeight2) { return (sortWeight >= sortWeight2) ? -1 : 1; } if (activityGroupBuyingDataEx.mGUIGroupBuyingItem.ID == activityGroupBuyingDataEx2.mGUIGroupBuyingItem.ID) { return 0; } return (activityGroupBuyingDataEx.mGUIGroupBuyingItem.ID >= activityGroupBuyingDataEx2.mGUIGroupBuyingItem.ID) ? 1 : -1; }
private int SortBy(BaseData a, BaseData b) { APItemDataEx aPItemDataEx = (APItemDataEx)a; APItemDataEx aPItemDataEx2 = (APItemDataEx)b; int sortWeight = this.GetSortWeight(aPItemDataEx); int sortWeight2 = this.GetSortWeight(aPItemDataEx2); if (sortWeight != sortWeight2) { return (sortWeight >= sortWeight2) ? -1 : 1; } if (aPItemDataEx.APData.ID == aPItemDataEx2.APData.ID) { return 0; } return (aPItemDataEx.APData.ID >= aPItemDataEx2.APData.ID) ? 1 : -1; }
private int Sort(BaseData a, BaseData b) { PillageFarmItemData pillageFarmItemData = (PillageFarmItemData)a; PillageFarmItemData pillageFarmItemData2 = (PillageFarmItemData)b; if (pillageFarmItemData != null && pillageFarmItemData2 != null) { if (pillageFarmItemData.GetID() > pillageFarmItemData2.GetID()) { return 1; } if (pillageFarmItemData.GetID() < pillageFarmItemData2.GetID()) { return -1; } } return 0; }
private int SortByID(BaseData a, BaseData b) { GUIGuildMinesRecordData gUIGuildMinesRecordData = (GUIGuildMinesRecordData)a; GUIGuildMinesRecordData gUIGuildMinesRecordData2 = (GUIGuildMinesRecordData)b; if (gUIGuildMinesRecordData != null && gUIGuildMinesRecordData2 != null) { if (gUIGuildMinesRecordData.GetID() > gUIGuildMinesRecordData2.GetID()) { return -1; } if (gUIGuildMinesRecordData.GetID() < gUIGuildMinesRecordData2.GetID()) { return 1; } } return 0; }
private int SortByRankLvl(BaseData a, BaseData b) { CraftRecordItemData craftRecordItemData = (CraftRecordItemData)a; CraftRecordItemData craftRecordItemData2 = (CraftRecordItemData)b; if (craftRecordItemData == null || craftRecordItemData2 == null) { return 0; } if (craftRecordItemData.RecordData.TimeStamp > craftRecordItemData2.RecordData.TimeStamp) { return -1; } if (craftRecordItemData.RecordData.TimeStamp < craftRecordItemData2.RecordData.TimeStamp) { return 1; } return 0; }
protected int Sort(BaseData a, BaseData b) { RecycleGetItemData recycleGetItemData = (RecycleGetItemData)a; RecycleGetItemData recycleGetItemData2 = (RecycleGetItemData)b; if (recycleGetItemData == null || recycleGetItemData2 == null) { return 0; } if (recycleGetItemData.GetID() > recycleGetItemData2.GetID()) { return 1; } if (recycleGetItemData.GetID() < recycleGetItemData2.GetID()) { return -1; } return 0; }
private int SortByIndex(BaseData a, BaseData b) { CommonSourceItemData commonSourceItemData = (CommonSourceItemData)a; CommonSourceItemData commonSourceItemData2 = (CommonSourceItemData)b; if (commonSourceItemData == null || commonSourceItemData2 == null) { return 0; } if (commonSourceItemData.GetID() > commonSourceItemData2.GetID()) { return 1; } if (commonSourceItemData.GetID() < commonSourceItemData2.GetID()) { return -1; } return 0; }
public int SortByRank(BaseData a, BaseData b) { BillboardInfoData billboardInfoData = (BillboardInfoData)a; BillboardInfoData billboardInfoData2 = (BillboardInfoData)b; if (billboardInfoData == null || billboardInfoData2 == null) { return 0; } if (billboardInfoData.GetID() > billboardInfoData2.GetID()) { return 1; } if (billboardInfoData.GetID() < billboardInfoData2.GetID()) { return -1; } return 0; }
public int SortByRank(BaseData a, BaseData b) { ZoneItemInfoData zoneItemInfoData = (ZoneItemInfoData)a; ZoneItemInfoData zoneItemInfoData2 = (ZoneItemInfoData)b; if (zoneItemInfoData == null || zoneItemInfoData2 == null) { return 0; } if (zoneItemInfoData.GetID() > zoneItemInfoData2.GetID()) { return 1; } if (zoneItemInfoData.GetID() < zoneItemInfoData2.GetID()) { return -1; } return 0; }
public int SortByRank(BaseData a, BaseData b) { GroupItemInfoData groupItemInfoData = (GroupItemInfoData)a; GroupItemInfoData groupItemInfoData2 = (GroupItemInfoData)b; if (groupItemInfoData == null || groupItemInfoData2 == null) { return 0; } if (groupItemInfoData.GetID() > groupItemInfoData2.GetID()) { return -1; } if (groupItemInfoData.GetID() < groupItemInfoData2.GetID()) { return 1; } return 0; }
private int SortByRankLvl(BaseData a, BaseData b) { PVPRecordItemData pVPRecordItemData = (PVPRecordItemData)a; PVPRecordItemData pVPRecordItemData2 = (PVPRecordItemData)b; if (pVPRecordItemData == null || pVPRecordItemData2 == null) { return 0; } if (pVPRecordItemData.RecordData.TimeStamp > pVPRecordItemData2.RecordData.TimeStamp) { return -1; } if (pVPRecordItemData.RecordData.TimeStamp < pVPRecordItemData2.RecordData.TimeStamp) { return 1; } return 0; }
public int SortMailItem(BaseData a, BaseData b) { MailItemData mailItemData = (MailItemData)a; MailItemData mailItemData2 = (MailItemData)b; if (mailItemData == null || mailItemData2 == null) { return 0; } if (MailContentsUITable.IsReadMailFlag(mailItemData.mMailData) && !MailContentsUITable.IsReadMailFlag(mailItemData2.mMailData)) { return 1; } if (!MailContentsUITable.IsReadMailFlag(mailItemData.mMailData) && MailContentsUITable.IsReadMailFlag(mailItemData2.mMailData)) { return -1; } return mailItemData2.mMailData.TimeStamp - mailItemData.mMailData.TimeStamp; }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { ChatData mData = (ChatData)data; if (this.type != mData.type) { return(false); } if (this.text != mData.text) { return(false); } if (mData.elements != null) { if (this.elements == null) { return(false); } if (this.elements.size() != mData.elements.size()) { return(false); } SList <ChatElementData> elementsT = this.elements; SList <ChatElementData> elementsR = mData.elements; int elementsLen = elementsT.size(); for (int elementsI = 0; elementsI < elementsLen; ++elementsI) { ChatElementData elementsU = elementsT.get(elementsI); ChatElementData elementsV = elementsR.get(elementsI); if (elementsV != null) { if (elementsU == null) { return(false); } if (!elementsU.dataEquals(elementsV)) { return(false); } } else { if (elementsU != null) { return(false); } } } } else { if (this.elements != null) { return(false); } } return(true); }
public override bool Filter(Security vehicle, BaseData data) { return(true); }
private void AddDataImpl(BaseData data, bool cacheByType) { var tick = data as Tick; if (tick?.TickType == TickType.OpenInterest) { if (cacheByType) { StoreDataPoint(data); } OpenInterest = (long)tick.Value; return; } // Only cache non fill-forward data. if (data.IsFillForward) { return; } if (cacheByType) { StoreDataPoint(data); } var isDefaultDataType = SubscriptionManager.IsDefaultDataType(data); // don't set _lastData if receive quotebar then tradebar w/ same end time. this // was implemented to grant preference towards using quote data in the fill // models and provide a level of determinism on the values exposed via the cache. if ((_lastData == null || _lastQuoteBarUpdate != data.EndTime || data.DataType != MarketDataType.TradeBar) // we will only set the default data type to preserve determinism and backwards compatibility && isDefaultDataType) { _lastData = data; } if (tick != null) { if (tick.Value != 0) { Price = tick.Value; } switch (tick.TickType) { case TickType.Trade: if (tick.Quantity != 0) { Volume = tick.Quantity; } break; case TickType.Quote: if (tick.BidPrice != 0) { BidPrice = tick.BidPrice; } if (tick.BidSize != 0) { BidSize = tick.BidSize; } if (tick.AskPrice != 0) { AskPrice = tick.AskPrice; } if (tick.AskSize != 0) { AskSize = tick.AskSize; } break; } return; } var bar = data as IBar; if (bar != null) { // we will only set OHLC values using the default data type to preserve determinism and backwards compatibility. // Gives priority to QuoteBar over TradeBar, to be removed when default data type completely addressed GH issue 4196 if ((_lastQuoteBarUpdate != data.EndTime || _lastOHLCUpdate != data.EndTime) && isDefaultDataType) { _lastOHLCUpdate = data.EndTime; if (bar.Open != 0) { Open = bar.Open; } if (bar.High != 0) { High = bar.High; } if (bar.Low != 0) { Low = bar.Low; } if (bar.Close != 0) { Price = bar.Close; Close = bar.Close; } } var tradeBar = bar as TradeBar; if (tradeBar != null) { if (tradeBar.Volume != 0) { Volume = tradeBar.Volume; } } var quoteBar = bar as QuoteBar; if (quoteBar != null) { _lastQuoteBarUpdate = quoteBar.EndTime; if (quoteBar.Ask != null && quoteBar.Ask.Close != 0) { AskPrice = quoteBar.Ask.Close; } if (quoteBar.Bid != null && quoteBar.Bid.Close != 0) { BidPrice = quoteBar.Bid.Close; } if (quoteBar.LastBidSize != 0) { BidSize = quoteBar.LastBidSize; } if (quoteBar.LastAskSize != 0) { AskSize = quoteBar.LastAskSize; } } } else if (data.DataType != MarketDataType.Auxiliary) { Price = data.Price; } }
/// <summary> /// Reads the specified <paramref name="source"/> /// </summary> /// <param name="source">The source to be read</param> /// <returns>An <see cref="IEnumerable{BaseData}"/> that contains the data in the source</returns> public IEnumerable <BaseData> Read(SubscriptionDataSource source) { List <BaseData> cache; _shouldCacheDataPoints = _shouldCacheDataPoints && // only cache local files source.TransportMedium == SubscriptionTransportMedium.LocalFile; var cacheItem = _shouldCacheDataPoints ? BaseDataSourceCache.GetCacheItem(source.Source + _config.Type) : null; if (cacheItem == null) { cache = new List <BaseData>(); using (var reader = CreateStreamReader(source)) { // if the reader doesn't have data then we're done with this subscription if (reader == null || reader.EndOfStream) { OnCreateStreamReaderError(_date, source); yield break; } // while the reader has data while (!reader.EndOfStream) { // read a line and pass it to the base data factory var line = reader.ReadLine(); BaseData instance = null; try { instance = _factory.Reader(_config, line, _date, _isLiveMode); } catch (Exception err) { OnReaderError(line, err); } if (instance != null && instance.EndTime != default(DateTime)) { if (_shouldCacheDataPoints) { cache.Add(instance); } else { yield return(instance); } } else if (reader.ShouldBeRateLimited) { yield return(instance); } } } if (!_shouldCacheDataPoints) { yield break; } cacheItem = new CacheItem(source.Source + _config.Type, cache); BaseDataSourceCache.Add(cacheItem, CachePolicy); } cache = cacheItem.Value as List <BaseData>; if (cache == null) { throw new InvalidOperationException("CacheItem can not be cast into expected type. " + $"Type is: {cacheItem.Value.GetType()}"); } // Find the first data point 10 days (just in case) before the desired date // and subtract one item (just in case there was a time gap and data.Time is after _date) var frontier = _date.AddDays(-10); var index = cache.FindIndex(data => data.Time > frontier); index = index > 0 ? (index - 1) : 0; foreach (var data in cache.Skip(index)) { var clone = data.Clone(); clone.Symbol = _config.Symbol; yield return(clone); } }
/// <summary> /// Process an admin command. /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="chat"></param> /// <returns>Returns true if the command was processed and further processing should be stopped</returns> public static bool ProcessAdminCommands(Player.Player from, uint to, string chat) { // If this is an admin command and the player has admin permissions // then dispatch if (chat[0] == '.') { // Echo the chat back to the player. SendEcho(from, chat); string[] args = chat.Split(' '); // Figure out if the charname argument for the command is for // a partial, FL ID match or exact match. int searchMode = 2; if (args.Length > 0 && args[0].EndsWith("&")) { args[0] = args[0].Substring(0, args[0].Length - 1); searchMode = 1; } else if (args.Length > 0 && args[0].EndsWith("$")) { args[0] = args[0].Substring(0, args[0].Length - 1); searchMode = 0; } // Process the command. if (args.Length == 3 && args[0] == ".beam") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } string basename = args[2]; BaseData basedata = UniverseDB.FindBase(basename); if (basedata == null) { SendEcho(from, "ERR base not found"); return(true); } if (player.Ship.Basedata != null) { SendEcho(from, "ERR player not in space"); return(true); } player.Runner.AddEvent(new DPGRBeam(player, basedata)); SendEcho(from, "OK"); // fixme: need feedback. } else if (args.Length == 3 && args[0] == ".addcash") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } int money = 0; if (!Int32.TryParse(args[2], out money)) { SendEcho(from, "ERR invalid money"); return(true); } player.Runner.AddEvent(new DPGRAddCash(player, money)); SendEcho(from, "OK"); // fixme: SendChatToPlayer(from, "OK cash=" + player.money); } else if (args.Length == 3 && args[0] == ".setcash") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } int money = 0; if (!Int32.TryParse(args[2], out money)) { SendEcho(from, "ERR invalid money count"); return(true); } player.Runner.AddEvent(new DPGRSetCash(player, money)); SendEcho(from, "OK"); // fixme: SendChatToPlayer(from, "OK cash=" + player.money); } else if (args.Length == 3 && args[0] == ".setcash") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } int money = Int32.Parse(args[2]); player.Money += money; player.SendSetMoney(); SendEcho(from, "OK cash=" + player.Money); } else if (args.Length == 3 && args[0] == ".getrep") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } string factionname = args[2]; Faction faction = UniverseDB.FindFaction(factionname); if (faction == null) { SendEcho(from, "ERR not found faction=" + factionname); return(true); } float attitude = player.Ship.GetAttitudeTowardsFaction(faction); SendEcho(from, "OK faction=" + factionname + " rep=" + attitude); } else if (args.Length == 4 && args[0] == ".setrep") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } string factionname = args[2]; Faction faction = UniverseDB.FindFaction(factionname); if (faction == null) { SendEcho(from, "ERR not found faction=" + factionname); return(true); } float attitude = 0; if (!float.TryParse(args[3], out attitude)) { SendEcho(from, "ERR invalid rep=" + args[3]); return(true); } player.Ship.SetReputation(faction, attitude); SendEcho(from, "OK faction=" + faction.Nickname + " rep=" + player.Ship.GetAttitudeTowardsFaction(faction)); } else if (args.Length == 3 && args[0] == ".setrept") { var player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } float attitude = 0; if (!float.TryParse(args[2], out attitude)) { SendEcho(from, "ERR invalid rep=" + args[3]); return(true); } Object.Solar.Solar solar = UniverseDB.FindSolar(player.Ship.TargetObjID); if (solar != null) { SendEcho(from, "OK solar=" + solar.Faction + " rep=" + attitude); player.Ship.SetReputation(solar.Faction, attitude); return(true); } SendEcho(from, "ERR only solar's supported cause I was lazy"); } else if (args.Length == 2 && args[0] == ".kill") { Player.Player player = FindActivePlayerByCharname(from.Runner, args[1], searchMode); if (player == null) { SendEcho(from, "ERR charname not found"); return(true); } if (player.Ship.Basedata != null) { SendEcho(from, "ERR player not in space"); return(true); } player.Ship.Destroy(DeathCause.Command); SendEcho(from, "OK"); } else if (args.Length == 4 && args[0] == ".move") { float x = 0; float y = 0; float z = 0; if (!float.TryParse(args[1], out x) || !float.TryParse(args[2], out y) || !float.TryParse(args[3], out z)) { SendEcho(from, String.Format("ERR invalid position={0:0} {1:0} {2:0}", x, y, z)); return(true); } var dummyAction = new LaunchInSpaceAction { Position = new Vector(x, y, z), Orientation = Quaternion.MatrixToQuaternion(@from.Ship.Orientation) }; from.Ship.CurrentAction = dummyAction; from.SendServerLaunch(); from.Ship.CurrentAction = null; SendEcho(from, String.Format("OK position={0:0} {1:0} {2:0}", x, y, z)); } else if (args.Length == 1 && args[0] == ".help") { from.SendInfocardUpdate(500000, "Admin Commands"); from.SendInfocardUpdate(500001, from.Runner.Server.AdminHelpMsg); from.SendPopupDialog(new FLFormatString(500000), new FLFormatString(500001), Player.Player.PopupDialogButtons.POPUPDIALOG_BUTTONS_CENTER_OK); } else { SendEcho(from, "ERR command invalid, type .help for valid commands"); } return(true); } return(false); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { PlayerListData mData = (PlayerListData)data; if (mData.system != null) { if (this.system == null) { return(false); } if (!this.system.dataEquals(mData.system)) { return(false); } } else { if (this.system != null) { return(false); } } if (mData.func != null) { if (this.func == null) { return(false); } if (!this.func.dataEquals(mData.func)) { return(false); } } else { if (this.func != null) { return(false); } } if (mData.activity != null) { if (this.activity == null) { return(false); } if (!this.activity.dataEquals(mData.activity)) { return(false); } } else { if (this.activity != null) { return(false); } } if (mData.role != null) { if (this.role == null) { return(false); } if (!this.role.dataEquals(mData.role)) { return(false); } } else { if (this.role != null) { return(false); } } if (mData.scene != null) { if (this.scene == null) { return(false); } if (!this.scene.dataEquals(mData.scene)) { return(false); } } else { if (this.scene != null) { return(false); } } if (mData.character != null) { if (this.character == null) { return(false); } if (!this.character.dataEquals(mData.character)) { return(false); } } else { if (this.character != null) { return(false); } } if (mData.social != null) { if (this.social == null) { return(false); } if (!this.social.dataEquals(mData.social)) { return(false); } } else { if (this.social != null) { return(false); } } if (mData.bag != null) { if (this.bag == null) { return(false); } if (!this.bag.dataEquals(mData.bag)) { return(false); } } else { if (this.bag != null) { return(false); } } if (mData.mail != null) { if (this.mail == null) { return(false); } if (!this.mail.dataEquals(mData.mail)) { return(false); } } else { if (this.mail != null) { return(false); } } if (mData.quest != null) { if (this.quest == null) { return(false); } if (!this.quest.dataEquals(mData.quest)) { return(false); } } else { if (this.quest != null) { return(false); } } if (mData.guide != null) { if (this.guide == null) { return(false); } if (!this.guide.dataEquals(mData.guide)) { return(false); } } else { if (this.guide != null) { return(false); } } if (mData.friend != null) { if (this.friend == null) { return(false); } if (!this.friend.dataEquals(mData.friend)) { return(false); } } else { if (this.friend != null) { return(false); } } if (mData.equip != null) { if (this.equip == null) { return(false); } if (!this.equip.dataEquals(mData.equip)) { return(false); } } else { if (this.equip != null) { return(false); } } if (mData.team != null) { if (this.team == null) { return(false); } if (!this.team.dataEquals(mData.team)) { return(false); } } else { if (this.team != null) { return(false); } } if (mData.union != null) { if (this.union == null) { return(false); } if (!this.union.dataEquals(mData.union)) { return(false); } } else { if (this.union != null) { return(false); } } if (mData.achievement != null) { if (this.achievement == null) { return(false); } if (!this.achievement.dataEquals(mData.achievement)) { return(false); } } else { if (this.achievement != null) { return(false); } } if (mData.pet != null) { if (this.pet == null) { return(false); } if (!this.pet.dataEquals(mData.pet)) { return(false); } } else { if (this.pet != null) { return(false); } } return(true); }
public SignChangedPacketProcessor(BaseData baseData, PlayerManager playerManager) { this.baseData = baseData; this.playerManager = playerManager; }
public override async Task <IEnumerable <IMessageBase> > GetReply(ChainEventArgs chat) { if (chat.Message.ToLower().StartsWith("/玩家资料")) { try { var cocid = chat.Message.Replace("/玩家资料", "").Trim(); if (!BaseData.CheckIP()) { TokenApi.GetNewToken(); } if (cocid == BaseData.Instance.config["部落冲突"][chat.FromGroup.ToString()]) { return(new IMessageBase[] { new AtMessage(chat.FromQQ), new PlainMessage("你当我傻?拿部落标签给我查玩家?草你马的") }); } ICocCorePlayers players = BaseData.Instance.container.Resolve <ICocCorePlayers>(); var player = players.GetPlayer(cocid); if (player != null) { StringBuilder sb = new StringBuilder(); sb.AppendLine("大本营等级:" + player.TownHallLevel + ",名字:" + player.Name); sb.AppendLine("进攻次数: " + player.AttackWins + ",防御次数: " + player.DefenseWins + ",战星: " + player.WarStars); sb.AppendLine("=================================="); sb.AppendLine("兵力:"); foreach (var troop in player.Troops) { try { sb.AppendLine("* " + BaseData.Instance.config["兵种翻译"][troop.Name.Replace(" ", "_")] + " - " + troop.Level + "级"); } catch { sb.AppendLine("* " + troop.Name + " - " + troop.Level + "级"); } } sb.AppendLine("=================================="); sb.AppendLine("药水:"); foreach (var spell in player.Spells) { try { sb.AppendLine("* " + BaseData.Instance.config["兵种翻译"][spell.Name.Replace(" ", "_")] + " - " + spell.Level + "级"); } catch { sb.AppendLine("* " + spell.Name + " - " + spell.Level + "级"); } } sb.AppendLine("=================================="); sb.AppendLine("英雄:"); foreach (var hero in player.Heroes) { try { sb.AppendLine("* " + BaseData.Instance.config["兵种翻译"][hero.Name.Replace(" ", "_")] + " - " + hero.Level + "级"); } catch { sb.AppendLine("* " + hero.Name + " - " + hero.Level + "级"); } } return(new IMessageBase[] { BaseData.TextToImg(sb.ToString(), chat.Session) }); } else { return(new IMessageBase[] { new PlainMessage("未知的部落冲突ID,无法搜索该玩家资料!") }); } } catch (Exception ex) { return(new IMessageBase[] { new PlainMessage("请确保发送/PlayerAPI时是/PlayerAPI 玩家标签!错误资料:" + ex.Message) }); } } return(await base.GetReply(chat)); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is PlayerListData)) { return; } PlayerListData mData = (PlayerListData)data; if (mData.system != null) { this.system = (SystemPartData)mData.system.clone(); } else { this.system = null; nullObjError("system"); } if (mData.func != null) { this.func = (FuncPartData)mData.func.clone(); } else { this.func = null; nullObjError("func"); } if (mData.activity != null) { this.activity = (ActivityPartData)mData.activity.clone(); } else { this.activity = null; nullObjError("activity"); } if (mData.role != null) { this.role = (RolePartData)mData.role.clone(); } else { this.role = null; nullObjError("role"); } if (mData.scene != null) { this.scene = (ScenePartData)mData.scene.clone(); } else { this.scene = null; nullObjError("scene"); } if (mData.character != null) { this.character = (CharacterPartData)mData.character.clone(); } else { this.character = null; nullObjError("character"); } if (mData.social != null) { this.social = (SocialPartData)mData.social.clone(); } else { this.social = null; nullObjError("social"); } if (mData.bag != null) { this.bag = (BagPartData)mData.bag.clone(); } else { this.bag = null; nullObjError("bag"); } if (mData.mail != null) { this.mail = (MailPartData)mData.mail.clone(); } else { this.mail = null; nullObjError("mail"); } if (mData.quest != null) { this.quest = (QuestPartData)mData.quest.clone(); } else { this.quest = null; nullObjError("quest"); } if (mData.guide != null) { this.guide = (GuidePartData)mData.guide.clone(); } else { this.guide = null; nullObjError("guide"); } if (mData.friend != null) { this.friend = (FriendPartData)mData.friend.clone(); } else { this.friend = null; nullObjError("friend"); } if (mData.equip != null) { this.equip = (EquipPartData)mData.equip.clone(); } else { this.equip = null; nullObjError("equip"); } if (mData.team != null) { this.team = (TeamPartData)mData.team.clone(); } else { this.team = null; nullObjError("team"); } if (mData.union != null) { this.union = (UnionPartData)mData.union.clone(); } else { this.union = null; nullObjError("union"); } if (mData.achievement != null) { this.achievement = (AchievementPartData)mData.achievement.clone(); } else { this.achievement = null; nullObjError("achievement"); } if (mData.pet != null) { this.pet = (PetPartData)mData.pet.clone(); } else { this.pet = null; nullObjError("pet"); } }
/// <summary> /// Handles the specified data. /// </summary> /// <param name="data">The data to be handled</param> public virtual void HandleData(BaseData data) { _handleData(data); }
public void Update(Security security, BaseData data) { }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); this.type = stream.readInt(); this.text = stream.readUTF(); if (stream.readBoolean()) { int elementsLen = stream.readLen(); if (this.elements != null) { this.elements.clear(); this.elements.ensureCapacity(elementsLen); } else { this.elements = new SList <ChatElementData>(); } SList <ChatElementData> elementsT = this.elements; for (int elementsI = elementsLen - 1; elementsI >= 0; --elementsI) { ChatElementData elementsV; if (stream.readBoolean()) { BaseData elementsVT = stream.readDataFullNotNull(); if (elementsVT != null) { if (elementsVT is ChatElementData) { elementsV = (ChatElementData)elementsVT; } else { elementsV = new ChatElementData(); if (!(elementsVT.GetType().IsAssignableFrom(typeof(ChatElementData)))) { stream.throwTypeReadError(typeof(ChatElementData), elementsVT.GetType()); } elementsV.shadowCopy(elementsVT); } } else { elementsV = null; } } else { elementsV = null; } elementsT.add(elementsV); } } else { this.elements = null; } stream.endReadObj(); }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); BaseData systemT = stream.readDataFullNotNull(); if (systemT != null) { if (systemT is SystemPartData) { this.system = (SystemPartData)systemT; } else { this.system = new SystemPartData(); if (!(systemT.GetType().IsAssignableFrom(typeof(SystemPartData)))) { stream.throwTypeReadError(typeof(SystemPartData), systemT.GetType()); } this.system.shadowCopy(systemT); } } else { this.system = null; } BaseData funcT = stream.readDataFullNotNull(); if (funcT != null) { if (funcT is FuncPartData) { this.func = (FuncPartData)funcT; } else { this.func = new FuncPartData(); if (!(funcT.GetType().IsAssignableFrom(typeof(FuncPartData)))) { stream.throwTypeReadError(typeof(FuncPartData), funcT.GetType()); } this.func.shadowCopy(funcT); } } else { this.func = null; } BaseData activityT = stream.readDataFullNotNull(); if (activityT != null) { if (activityT is ActivityPartData) { this.activity = (ActivityPartData)activityT; } else { this.activity = new ActivityPartData(); if (!(activityT.GetType().IsAssignableFrom(typeof(ActivityPartData)))) { stream.throwTypeReadError(typeof(ActivityPartData), activityT.GetType()); } this.activity.shadowCopy(activityT); } } else { this.activity = null; } BaseData roleT = stream.readDataFullNotNull(); if (roleT != null) { if (roleT is RolePartData) { this.role = (RolePartData)roleT; } else { this.role = new RolePartData(); if (!(roleT.GetType().IsAssignableFrom(typeof(RolePartData)))) { stream.throwTypeReadError(typeof(RolePartData), roleT.GetType()); } this.role.shadowCopy(roleT); } } else { this.role = null; } BaseData sceneT = stream.readDataFullNotNull(); if (sceneT != null) { if (sceneT is ScenePartData) { this.scene = (ScenePartData)sceneT; } else { this.scene = new ScenePartData(); if (!(sceneT.GetType().IsAssignableFrom(typeof(ScenePartData)))) { stream.throwTypeReadError(typeof(ScenePartData), sceneT.GetType()); } this.scene.shadowCopy(sceneT); } } else { this.scene = null; } BaseData characterT = stream.readDataFullNotNull(); if (characterT != null) { if (characterT is CharacterPartData) { this.character = (CharacterPartData)characterT; } else { this.character = new CharacterPartData(); if (!(characterT.GetType().IsAssignableFrom(typeof(CharacterPartData)))) { stream.throwTypeReadError(typeof(CharacterPartData), characterT.GetType()); } this.character.shadowCopy(characterT); } } else { this.character = null; } BaseData socialT = stream.readDataFullNotNull(); if (socialT != null) { if (socialT is SocialPartData) { this.social = (SocialPartData)socialT; } else { this.social = new SocialPartData(); if (!(socialT.GetType().IsAssignableFrom(typeof(SocialPartData)))) { stream.throwTypeReadError(typeof(SocialPartData), socialT.GetType()); } this.social.shadowCopy(socialT); } } else { this.social = null; } BaseData bagT = stream.readDataFullNotNull(); if (bagT != null) { if (bagT is BagPartData) { this.bag = (BagPartData)bagT; } else { this.bag = new BagPartData(); if (!(bagT.GetType().IsAssignableFrom(typeof(BagPartData)))) { stream.throwTypeReadError(typeof(BagPartData), bagT.GetType()); } this.bag.shadowCopy(bagT); } } else { this.bag = null; } BaseData mailT = stream.readDataFullNotNull(); if (mailT != null) { if (mailT is MailPartData) { this.mail = (MailPartData)mailT; } else { this.mail = new MailPartData(); if (!(mailT.GetType().IsAssignableFrom(typeof(MailPartData)))) { stream.throwTypeReadError(typeof(MailPartData), mailT.GetType()); } this.mail.shadowCopy(mailT); } } else { this.mail = null; } BaseData questT = stream.readDataFullNotNull(); if (questT != null) { if (questT is QuestPartData) { this.quest = (QuestPartData)questT; } else { this.quest = new QuestPartData(); if (!(questT.GetType().IsAssignableFrom(typeof(QuestPartData)))) { stream.throwTypeReadError(typeof(QuestPartData), questT.GetType()); } this.quest.shadowCopy(questT); } } else { this.quest = null; } BaseData guideT = stream.readDataFullNotNull(); if (guideT != null) { if (guideT is GuidePartData) { this.guide = (GuidePartData)guideT; } else { this.guide = new GuidePartData(); if (!(guideT.GetType().IsAssignableFrom(typeof(GuidePartData)))) { stream.throwTypeReadError(typeof(GuidePartData), guideT.GetType()); } this.guide.shadowCopy(guideT); } } else { this.guide = null; } BaseData friendT = stream.readDataFullNotNull(); if (friendT != null) { if (friendT is FriendPartData) { this.friend = (FriendPartData)friendT; } else { this.friend = new FriendPartData(); if (!(friendT.GetType().IsAssignableFrom(typeof(FriendPartData)))) { stream.throwTypeReadError(typeof(FriendPartData), friendT.GetType()); } this.friend.shadowCopy(friendT); } } else { this.friend = null; } BaseData equipT = stream.readDataFullNotNull(); if (equipT != null) { if (equipT is EquipPartData) { this.equip = (EquipPartData)equipT; } else { this.equip = new EquipPartData(); if (!(equipT.GetType().IsAssignableFrom(typeof(EquipPartData)))) { stream.throwTypeReadError(typeof(EquipPartData), equipT.GetType()); } this.equip.shadowCopy(equipT); } } else { this.equip = null; } BaseData teamT = stream.readDataFullNotNull(); if (teamT != null) { if (teamT is TeamPartData) { this.team = (TeamPartData)teamT; } else { this.team = new TeamPartData(); if (!(teamT.GetType().IsAssignableFrom(typeof(TeamPartData)))) { stream.throwTypeReadError(typeof(TeamPartData), teamT.GetType()); } this.team.shadowCopy(teamT); } } else { this.team = null; } BaseData unionT = stream.readDataFullNotNull(); if (unionT != null) { if (unionT is UnionPartData) { this.union = (UnionPartData)unionT; } else { this.union = new UnionPartData(); if (!(unionT.GetType().IsAssignableFrom(typeof(UnionPartData)))) { stream.throwTypeReadError(typeof(UnionPartData), unionT.GetType()); } this.union.shadowCopy(unionT); } } else { this.union = null; } BaseData achievementT = stream.readDataFullNotNull(); if (achievementT != null) { if (achievementT is AchievementPartData) { this.achievement = (AchievementPartData)achievementT; } else { this.achievement = new AchievementPartData(); if (!(achievementT.GetType().IsAssignableFrom(typeof(AchievementPartData)))) { stream.throwTypeReadError(typeof(AchievementPartData), achievementT.GetType()); } this.achievement.shadowCopy(achievementT); } } else { this.achievement = null; } BaseData petT = stream.readDataFullNotNull(); if (petT != null) { if (petT is PetPartData) { this.pet = (PetPartData)petT; } else { this.pet = new PetPartData(); if (!(petT.GetType().IsAssignableFrom(typeof(PetPartData)))) { stream.throwTypeReadError(typeof(PetPartData), petT.GetType()); } this.pet.shadowCopy(petT); } } else { this.pet = null; } stream.endReadObj(); }
/// <summary> /// Prints Ticket collection /// </summary> private void ProcessPrint(List <Spot> spots) { if (spots.Count == 0) { return; } Spot spotBlank = spots.FirstOrDefault(x => x.Blank == null); if (spotBlank != null) { StatusText = OperationResult = "Недостаточно бланков для печати. Печать отменена"; return; } spots.Sort(); _printProgress = new PrintProgress { Message = "Идет печать билетов..." }; _printProgress.Cancel += CancelProcess; _worker = new BackgroundWorker { WorkerSupportsCancellation = true }; Dispatcher dispatcher = _progressDialog.Dispatcher; int ticketsCount = spots.Count; int printedCount = 0; _worker.DoWork += delegate(object s, DoWorkEventArgs args) { decimal percent = 100 / (ticketsCount); int progress = 0; for (int i = 1; i <= ticketsCount; i++) { if (_worker.CancellationPending) { args.Cancel = true; return; } Spot spot = spots[i - 1]; if (spot.Status == ItemStatus.Sold) { string msg = string.Format("{0} из {1} - печать билета № {2} на бланке {3}", i, ticketsCount, spot.Id, spot.Blank.Key); _updatePrintDelegate = UpdatePrintText; dispatcher.BeginInvoke(_updatePrintDelegate, progress, msg); byte[] bytes = GetTicketImage(Customer.Order.Id, spot.Id, 2).ToArray(); //Thread.Sleep(500); //bool result = _printRequest.Print(bytes); bool result = true; if (!result) { PrinterStatus = string.Format("Ошибка печати билета № {0} ", spot.Id); _worker.CancelAsync(); } else { Ticket ticket = new Ticket { Id = spot.Id, BlankId = spot.Blank.Id, Status = ItemStatus.Printed }; ticket = Access.SetTicketPrinted(ticket); if (ticket.BlankId == spot.Blank.Id) { spot.Status = ItemStatus.Printed; } else { //t.Status = ItemStatus.Printed; } } } progress = (int)(progress + percent); printedCount++; } }; _worker.RunWorkerCompleted += delegate { _printProgress.Close(); _worker = null; }; _worker.RunWorkerAsync(); _printProgress.ShowDialog(); StatusText = OperationResult = String.Format("Печать завершена. Напечатано {0} из {1} билетов.", printedCount, ticketsCount); BaseData.ClearCache(); }
public CarrierMicroController(MapDataService mapDataService, SharkyUnitData sharkyUnitData, ActiveUnitData activeUnitData, DebugService debugService, IPathFinder sharkyPathFinder, BaseData baseData, SharkyOptions sharkyOptions, DamageService damageService, UnitDataService unitDataService, TargetingData targetingData, MicroPriority microPriority, bool groupUpEnabled) : base(mapDataService, sharkyUnitData, activeUnitData, debugService, sharkyPathFinder, baseData, sharkyOptions, damageService, unitDataService, targetingData, microPriority, groupUpEnabled) { }
/// <summary> /// Computes the start time of the bar this data belongs in /// </summary> /// <param name="data"></param> /// <returns></returns> private DateTime ComputeBarStartTime(BaseData data) { // for live data feeds compute a bar start time base on wall clock time, this prevents splitting of data into the algorithm return(DateTime.Now.RoundDown(_increment)); }
public override void Render() { PanelSetOrderHer2AmplificationByFish panelSetOrderHer2AmplificationByFish = (PanelSetOrderHer2AmplificationByFish)this.m_PanelSetOrder; if (panelSetOrderHer2AmplificationByFish.NonBreast == false) { this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\HER2AmplificationByFish.6.xml"; } else { this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\HER2AmplificationByFishNonBreast.6.xml"; } base.OpenTemplate(); this.SetDemographicsV2(); this.SetReportDistribution(); this.SetCaseHistory(); if (this.m_AccessionOrder.OrderCancelled == false) { YellowstonePathology.Business.Document.AmendmentSection amendmentSection = new YellowstonePathology.Business.Document.AmendmentSection(); amendmentSection.SetAmendment(m_PanelSetOrder.AmendmentCollection, this.m_ReportXml, this.m_NameSpaceManager, true); YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrder(this.m_PanelSetOrder.OrderedOn, this.m_PanelSetOrder.OrderedOnId); string collectionDateTimeString = YellowstonePathology.Business.Helper.DateTimeExtensions.CombineDateAndTime(specimenOrder.CollectionDate, specimenOrder.CollectionTime); this.SetXmlNodeData("date_time_collected", collectionDateTimeString); this.SetXmlNodeData("test_result", panelSetOrderHer2AmplificationByFish.Result); if (string.IsNullOrEmpty(panelSetOrderHer2AmplificationByFish.HER2CEN17SignalRatio) == false) { this.SetXmlNodeData("test_ratio", "Ratio = " + panelSetOrderHer2AmplificationByFish.HER2CEN17SignalRatio); } else { this.SetXmlNodeData("test_ratio", string.Empty); } this.SetXmlNodeData("averageher2_copynumber", "Average HER2 Copy Number = " + panelSetOrderHer2AmplificationByFish.AverageHER2SignalsPerNucleus); this.SetXmlNodeData("final_date", BaseData.GetShortDateString(this.m_PanelSetOrder.ReferenceLabFinalDate)); this.SetXmlNodeData("result_comment", panelSetOrderHer2AmplificationByFish.Comment); this.SetXmlNodeData("cell_cnt", panelSetOrderHer2AmplificationByFish.NucleiScored); this.SetXmlNodeData("avg_her", panelSetOrderHer2AmplificationByFish.AverageHER2SignalsPerNucleus); this.SetXmlNodeData("avg_chr", panelSetOrderHer2AmplificationByFish.AverageCEN17SignalsPerNucleus); this.SetXmlNodeData("tst_ratio", panelSetOrderHer2AmplificationByFish.HER2CEN17SignalRatio); this.SetXmlNodeData("report_reference_ranges", panelSetOrderHer2AmplificationByFish.ReferenceRanges); XmlNode tableNode = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='report_interpretation']", this.m_NameSpaceManager); this.SetXMLNodeParagraphDataNode(tableNode, "report_interpretation", panelSetOrderHer2AmplificationByFish.Interpretation); YellowstonePathology.Business.Test.AliquotOrder aliquotOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetAliquotOrder(this.m_PanelSetOrder.OrderedOnId); string blockDescription = string.Empty; if (aliquotOrder != null) { blockDescription = " - Block " + aliquotOrder.Label; } SetXmlNodeData("specimen_type", specimenOrder.Description + blockDescription); SetXmlNodeData("specimen_fixation", specimenOrder.LabFixation); SetXmlNodeData("time_to_fixation", specimenOrder.TimeToFixationHourString); this.SetXmlNodeData("report_reference", panelSetOrderHer2AmplificationByFish.Reference); SetXmlNodeData("duration_of_fixation", specimenOrder.FixationDurationString); if (panelSetOrderHer2AmplificationByFish.Result != "NOT INTERPRETABLE") { this.SetXmlNodeData("fixation_comment", specimenOrder.FixationComment); } else { this.DeleteRow("fixation_comment"); SetXmlNodeData("avg_her", string.Empty); SetXmlNodeData("tst_ratio", string.Empty); } SetXmlNodeData("date_time_collected", collectionDateTimeString); SetXmlNodeData("report_distribution", "No Distribution Selected"); this.ReplaceText("pathologist_signature", this.m_PanelSetOrder.ReferenceLabSignature); } else { this.SetXmlNodeData("result_comment", panelSetOrderHer2AmplificationByFish.Comment); this.SetXmlNodeData("final_date", BaseData.GetShortDateString(this.m_PanelSetOrder.ReferenceLabFinalDate)); } this.SaveReport(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { if (!base.toDataEquals(data)) { return(false); } PlayerRoleGroupClientToolData mData = (PlayerRoleGroupClientToolData)data; if (mData.groups != null) { if (this.groups == null) { return(false); } if (this.groups.size() != mData.groups.size()) { return(false); } LongObjectMap <PlayerRoleGroupData> groupsR = mData.groups; if (!this.groups.isEmpty()) { long groupsKFreeValue = this.groups.getFreeValue(); long[] groupsKKeys = this.groups.getKeys(); PlayerRoleGroupData[] groupsVValues = this.groups.getValues(); for (int groupsKI = groupsKKeys.Length - 1; groupsKI >= 0; --groupsKI) { long groupsK = groupsKKeys[groupsKI]; if (groupsK != groupsKFreeValue) { PlayerRoleGroupData groupsV = groupsVValues[groupsKI]; PlayerRoleGroupData groupsU = groupsR.get(groupsK); if (groupsU != null) { if (groupsV == null) { return(false); } if (!groupsV.dataEquals(groupsU)) { return(false); } } else { if (groupsV != null) { return(false); } } } } } } else { if (this.groups != null) { return(false); } } if (mData.applyDic != null) { if (this.applyDic == null) { return(false); } if (this.applyDic.size() != mData.applyDic.size()) { return(false); } LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicR = mData.applyDic; if (!this.applyDic.isEmpty()) { long applyDicKFreeValue = this.applyDic.getFreeValue(); long[] applyDicKKeys = this.applyDic.getKeys(); PlayerApplyRoleGroupSelfData[] applyDicVValues = this.applyDic.getValues(); for (int applyDicKI = applyDicKKeys.Length - 1; applyDicKI >= 0; --applyDicKI) { long applyDicK = applyDicKKeys[applyDicKI]; if (applyDicK != applyDicKFreeValue) { PlayerApplyRoleGroupSelfData applyDicV = applyDicVValues[applyDicKI]; PlayerApplyRoleGroupSelfData applyDicU = applyDicR.get(applyDicK); if (applyDicU != null) { if (applyDicV == null) { return(false); } if (!applyDicV.dataEquals(applyDicU)) { return(false); } } else { if (applyDicV != null) { return(false); } } } } } } else { if (this.applyDic != null) { return(false); } } if (this.canInviteInAbs != mData.canInviteInAbs) { return(false); } if (mData.inviteList != null) { if (this.inviteList == null) { return(false); } if (this.inviteList.size() != mData.inviteList.size()) { return(false); } SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList; SList <InviteRoleGroupReceiveData> inviteListR = mData.inviteList; int inviteListLen = inviteListT.size(); for (int inviteListI = 0; inviteListI < inviteListLen; ++inviteListI) { InviteRoleGroupReceiveData inviteListU = inviteListT.get(inviteListI); InviteRoleGroupReceiveData inviteListV = inviteListR.get(inviteListI); if (inviteListV != null) { if (inviteListU == null) { return(false); } if (!inviteListU.dataEquals(inviteListV)) { return(false); } } else { if (inviteListU != null) { return(false); } } } } else { if (this.inviteList != null) { return(false); } } return(true); }
public UsuariosService() { Data = new BaseData(); }
public override void Render() { YellowstonePathology.Business.Test.HPV1618ByPCR.HPV1618ByPCRTestOrder panelSetOrder = (YellowstonePathology.Business.Test.HPV1618ByPCR.HPV1618ByPCRTestOrder) this.m_PanelSetOrder; this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\HPV1618GenotypingByPCR.1.xml"; base.OpenTemplate(); base.SetDemographicsV2(); YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrder(this.m_PanelSetOrder.OrderedOn, this.m_PanelSetOrder.OrderedOnId); base.ReplaceText("specimen_description", specimenOrder.Description); string collectionDateTimeString = YellowstonePathology.Business.Helper.DateTimeExtensions.CombineDateAndTime(specimenOrder.CollectionDate, specimenOrder.CollectionTime); this.SetXmlNodeData("date_time_collected", collectionDateTimeString); YellowstonePathology.Business.Document.AmendmentSection amendmentSection = new YellowstonePathology.Business.Document.AmendmentSection(); amendmentSection.SetAmendment(this.m_PanelSetOrder.AmendmentCollection, this.m_ReportXml, this.m_NameSpaceManager, false); base.ReplaceText("hpv16_result", panelSetOrder.HPV16Result); base.ReplaceText("hpv18_result", panelSetOrder.HPV18Result); if (panelSetOrder.Indication == YellowstonePathology.Business.Test.HPV1618ByPCR.HPV1618ByPCRIndication.SquamousCellCarcinoma) { base.ReplaceText("report_interpretation_header", "Interpretation"); base.ReplaceText("report_interpretation", panelSetOrder.Interpretation); base.ReplaceText("pathologist_signature", panelSetOrder.Signature); if (panelSetOrder.FinalTime.HasValue == true) { string esignedHeader = "*** E-signed " + panelSetOrder.FinalTime.Value.ToString("MM/dd/yyyy HH:mm") + "***"; base.ReplaceText("esigned_header", esignedHeader); } } else { base.DeleteRow("report_interpretation_header"); base.DeleteRow("report_interpretation"); base.DeleteRow("pathologist_signature"); base.DeleteRow("esigned_header"); } if (string.IsNullOrEmpty(panelSetOrder.Comment) == false) { base.ReplaceText("report_comment", panelSetOrder.Comment); } else { base.DeleteRow("report_comment"); } base.ReplaceText("report_method", panelSetOrder.Method); this.ReplaceText("report_date", BaseData.GetShortDateString(this.m_PanelSetOrder.FinalDate)); this.SetXmlNodeData("pathologist_signature", this.m_PanelSetOrder.Signature); this.SetReportDistribution(); this.SetCaseHistory(); this.SaveReport(); }
public override void setData(BaseData data) { base.setData(data); _d = (GCharacterPartData)data; }
/// <summary> /// Initializes a new instance of the <see cref="NewTradableDateEventArgs"/> class /// </summary> /// <param name="date">The new tradable date</param> /// <param name="lastBaseData">The last <see cref="BaseData"/> of the /// <see cref="Security"/> for which we are enumerating</param> /// <param name="symbol">The <see cref="Symbol"/> of the new tradable date</param> public NewTradableDateEventArgs(DateTime date, BaseData lastBaseData, Symbol symbol) : base(symbol) { Date = date; LastBaseData = lastBaseData; }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { base.toReadBytesFull(stream); stream.startReadObj(); int groupsLen = stream.readLen(); if (this.groups != null) { this.groups.clear(); this.groups.ensureCapacity(groupsLen); } else { this.groups = new LongObjectMap <PlayerRoleGroupData>(groupsLen); } LongObjectMap <PlayerRoleGroupData> groupsT = this.groups; for (int groupsI = groupsLen - 1; groupsI >= 0; --groupsI) { PlayerRoleGroupData groupsV; BaseData groupsVT = stream.readDataFullNotNull(); if (groupsVT != null) { if (groupsVT is PlayerRoleGroupData) { groupsV = (PlayerRoleGroupData)groupsVT; } else { groupsV = new PlayerRoleGroupData(); if (!(groupsVT.GetType().IsAssignableFrom(typeof(PlayerRoleGroupData)))) { stream.throwTypeReadError(typeof(PlayerRoleGroupData), groupsVT.GetType()); } groupsV.shadowCopy(groupsVT); } } else { groupsV = null; } groupsT.put(groupsV.groupID, groupsV); } int applyDicLen = stream.readLen(); if (this.applyDic != null) { this.applyDic.clear(); this.applyDic.ensureCapacity(applyDicLen); } else { this.applyDic = new LongObjectMap <PlayerApplyRoleGroupSelfData>(applyDicLen); } LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicT = this.applyDic; for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI) { PlayerApplyRoleGroupSelfData applyDicV; BaseData applyDicVT = stream.readDataFullNotNull(); if (applyDicVT != null) { if (applyDicVT is PlayerApplyRoleGroupSelfData) { applyDicV = (PlayerApplyRoleGroupSelfData)applyDicVT; } else { applyDicV = new PlayerApplyRoleGroupSelfData(); if (!(applyDicVT.GetType().IsAssignableFrom(typeof(PlayerApplyRoleGroupSelfData)))) { stream.throwTypeReadError(typeof(PlayerApplyRoleGroupSelfData), applyDicVT.GetType()); } applyDicV.shadowCopy(applyDicVT); } } else { applyDicV = null; } applyDicT.put(applyDicV.data.groupID, applyDicV); } this.canInviteInAbs = stream.readBoolean(); int inviteListLen = stream.readLen(); if (this.inviteList != null) { this.inviteList.clear(); this.inviteList.ensureCapacity(inviteListLen); } else { this.inviteList = new SList <InviteRoleGroupReceiveData>(); } SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList; for (int inviteListI = inviteListLen - 1; inviteListI >= 0; --inviteListI) { InviteRoleGroupReceiveData inviteListV; BaseData inviteListVT = stream.readDataFullNotNull(); if (inviteListVT != null) { if (inviteListVT is InviteRoleGroupReceiveData) { inviteListV = (InviteRoleGroupReceiveData)inviteListVT; } else { inviteListV = new InviteRoleGroupReceiveData(); if (!(inviteListVT.GetType().IsAssignableFrom(typeof(InviteRoleGroupReceiveData)))) { stream.throwTypeReadError(typeof(InviteRoleGroupReceiveData), inviteListVT.GetType()); } inviteListV.shadowCopy(inviteListVT); } } else { inviteListV = null; } inviteListT.add(inviteListV); } stream.endReadObj(); }
protected override ISubscriptionDataSourceReader GetSubscriptionDataSourceReader(SubscriptionDataSource source, IDataCacheProvider dataCacheProvider, SubscriptionDataConfig config, DateTime date, BaseData baseData, IDataProvider dataProvider) { return(_dataSourceReader); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { base.toCopy(data); if (!(data is PlayerRoleGroupClientToolData)) { return; } PlayerRoleGroupClientToolData mData = (PlayerRoleGroupClientToolData)data; if (mData.groups != null) { if (this.groups != null) { this.groups.clear(); this.groups.ensureCapacity(mData.groups.size()); } else { this.groups = new LongObjectMap <PlayerRoleGroupData>(mData.groups.size()); } LongObjectMap <PlayerRoleGroupData> groupsT = this.groups; if (!mData.groups.isEmpty()) { PlayerRoleGroupData[] groupsVValues = mData.groups.getValues(); for (int groupsVI = groupsVValues.Length - 1; groupsVI >= 0; --groupsVI) { PlayerRoleGroupData groupsV = groupsVValues[groupsVI]; if (groupsV != null) { PlayerRoleGroupData groupsU; if (groupsV != null) { groupsU = (PlayerRoleGroupData)groupsV.clone(); } else { groupsU = null; nullObjError("groupsU"); } groupsT.put(groupsU.groupID, groupsU); } } } } else { this.groups = null; nullObjError("groups"); } if (mData.applyDic != null) { if (this.applyDic != null) { this.applyDic.clear(); this.applyDic.ensureCapacity(mData.applyDic.size()); } else { this.applyDic = new LongObjectMap <PlayerApplyRoleGroupSelfData>(mData.applyDic.size()); } LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicT = this.applyDic; if (!mData.applyDic.isEmpty()) { PlayerApplyRoleGroupSelfData[] applyDicVValues = mData.applyDic.getValues(); for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI) { PlayerApplyRoleGroupSelfData applyDicV = applyDicVValues[applyDicVI]; if (applyDicV != null) { PlayerApplyRoleGroupSelfData applyDicU; if (applyDicV != null) { applyDicU = (PlayerApplyRoleGroupSelfData)applyDicV.clone(); } else { applyDicU = null; nullObjError("applyDicU"); } applyDicT.put(applyDicU.data.groupID, applyDicU); } } } } else { this.applyDic = null; nullObjError("applyDic"); } this.canInviteInAbs = mData.canInviteInAbs; if (mData.inviteList != null) { if (this.inviteList != null) { this.inviteList.clear(); this.inviteList.ensureCapacity(mData.inviteList.size()); } else { this.inviteList = new SList <InviteRoleGroupReceiveData>(); } SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList; if (!mData.inviteList.isEmpty()) { InviteRoleGroupReceiveData[] inviteListVValues = mData.inviteList.getValues(); for (int inviteListVI = 0, inviteListVLen = mData.inviteList.length(); inviteListVI < inviteListVLen; ++inviteListVI) { InviteRoleGroupReceiveData inviteListV = inviteListVValues[inviteListVI]; InviteRoleGroupReceiveData inviteListU; if (inviteListV != null) { inviteListU = (InviteRoleGroupReceiveData)inviteListV.clone(); } else { inviteListU = null; nullObjError("inviteListU"); } inviteListT.add(inviteListU); } } } else { this.inviteList = null; nullObjError("inviteList"); } }
public ProxyScoutTask(SharkyUnitData sharkyUnitData, TargetingData targetingData, BaseData baseData, SharkyOptions sharkyOptions, bool enabled, float priority, IIndividualMicroController individualMicroController) { SharkyUnitData = sharkyUnitData; TargetingData = targetingData; BaseData = baseData; SharkyOptions = sharkyOptions; Priority = priority; IndividualMicroController = individualMicroController; UnitCommanders = new List <UnitCommander>(); Enabled = enabled; LateGame = false; }
/// <summary> /// 审核 /// </summary> /// <param name="bd"></param> /// <param name="dt"></param> /// <returns></returns> public override Model.DealResult MakeAudit(BaseData bd, Model.Synergismlogdt dt) { Model.DealResult dr = base.MakeAudit(bd, dt); return(dr); }
/******************************************************** * CLASS METHODS *********************************************************/ /// <summary> /// Forex data filter: a true value means accept the packet, a false means fail. /// </summary> /// <param name="data">Data object we're scanning to filter</param> /// <param name="vehicle">Security asset</param> public override bool Filter(Security vehicle, BaseData data) { //FX data is from FXCM and fairly clean already. Accept all packets. return true; }
public List <double> CaculateClassIndex(ESRI.ArcGIS.Geodatabase.IFeatureCursor pFeatureCursor, BaseData basedata) { throw new NotImplementedException(); }
/// <summary> /// Enqueues the data /// </summary> /// <param name="data">The data to be handled</param> public override void HandleData(BaseData data) { _enqueueable.Enqueue(data); }