public static TitleInfo MakeByIndexTitle(int value) { var instance = new TitleInfo { IndexStartTitle = value, Mode = TitleMode.AllTitle }; return(instance); }
/// <summary> /// 重置数据 /// </summary> void ResetData() { AllAttrNum.Clear(); titleList.Clear(); titleDictionary.Clear(); OwnTitleDictionary.Clear(); curUseTitle = null; isFirstTime = true; ChooseTitle = null; NewTitle = null; }
public TitleInfo CreateObject(string Code, string Name, string Description, bool IsShiftable) { TitleInfo titleInfo = new TitleInfo { Code = Code, Name = Name, Description = Description, IsShiftable = IsShiftable, }; return(this.CreateObject(titleInfo)); }
public TitleInfo VHasUniqueCode(TitleInfo titleInfo, ITitleInfoService _titleInfoService) { if (String.IsNullOrEmpty(titleInfo.Code) || titleInfo.Code.Trim() == "") { titleInfo.Errors.Add("Code", "Tidak boleh kosong"); } else if (_titleInfoService.IsCodeDuplicated(titleInfo)) { titleInfo.Errors.Add("Code", "Tidak boleh ada duplikasi"); } return(titleInfo); }
public static void fill( object obj, out SqlString name, out SqlString desc, out SqlInt32 time) { TitleInfo tinfo = (TitleInfo)obj; name = tinfo.name_local; desc = tinfo.description_title; time = tinfo.time; }
/// <summary> /// Initializes a new instance of the /// <see cref="ChartPanel" /> /// class. /// </summary> /// <param name="sourcebinding">The sourcebinding.</param> public ChartPanel(IChartBinding sourcebinding) : this() { SourceModel = new SourceModel(sourcebinding); Configuration = SourceModel.GetSeriesConfiguration(); ChartData = new SeriesModel(sourcebinding); DataMetric = SourceModel.GetMetric(); TitleInfo = new TitleInfo(DataMetric.Data?.CopyToDataTable()?.TableName); DataSeries = new DataSeries(ChartData); Series.Add(DataSeries); Titles.Add(TitleInfo.GetChartMainTitle()); }
/// <summary> /// Initializes a new instance of the /// <see cref="ChartPanel" /> /// class. /// </summary> /// <param name="model">The model.</param> public ChartPanel(ISourceModel model) : this() { SourceModel = model; Configuration = SourceModel.GetSeriesConfiguration(); ChartData = new SeriesModel(SourceModel.GetSourceBinding()); TitleInfo = new TitleInfo(Configuration.Name); DataMetric = SourceModel.GetMetric(); DataSeries = new DataSeries(ChartData); Series.Add(DataSeries); Titles.Add(TitleInfo.GetChartMainTitle()); }
/// <summary> /// Initializes a new instance of the <see cref="ChartPanel" /> class. /// </summary> /// <param name="data">The data.</param> /// <param name="seriesconfig">The seriesconfig.</param> public ChartPanel(IEnumerable <DataRow> data, ISeriesConfig seriesconfig) : this() { SourceModel = new SourceModel(data, seriesconfig); Configuration = SourceModel.GetSeriesConfiguration(); ChartData = new SeriesModel(data, seriesconfig); DataMetric = SourceModel.GetMetric(); TitleInfo = new TitleInfo(DataMetric.Data?.CopyToDataTable()?.TableName); DataSeries = new DataSeries(ChartData); Series.Add(DataSeries); Titles.Add(TitleInfo.GetChartMainTitle()); }
public string PrintError(TitleInfo obj) { string erroroutput = ""; KeyValuePair <string, string> first = obj.Errors.ElementAt(0); erroroutput += first.Key + "," + first.Value; foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1)) { erroroutput += Environment.NewLine; erroroutput += pair.Key + "," + pair.Value; } return(erroroutput); }
public static double GetScore(string search, TitleInfo titleInfo) { var score = Math.Max( search.GetFuzzyCoefficientCached(titleInfo.Title), search.GetFuzzyCoefficientCached(titleInfo.AlternativeTitle) ); if (score > 0.3) { return(score); } return(0); }
void TitleInfo_validation() { it["validates_titleInfo"] = () => { d.tit1.Errors.Count().should_be(0); }; it["titleInfo_with_no_code"] = () => { TitleInfo obj = new TitleInfo() { Name = "no code", }; obj = d._titleInfoService.CreateObject(obj); obj.Errors.Count().should_not_be(0); }; it["titleInfo_with_same_code"] = () => { TitleInfo obj = new TitleInfo() { Code = d.tit1.Code, Name = "same code", }; obj = d._titleInfoService.CreateObject(obj); obj.Errors.Count().should_not_be(0); }; it["titleInfo_with_no_name"] = () => { TitleInfo obj = new TitleInfo() { Code = "no_name", }; obj = d._titleInfoService.CreateObject(obj); obj.Errors.Count().should_not_be(0); }; it["update_titleInfo_with_no_code"] = () => { d.tit1.Code = ""; d._titleInfoService.UpdateObject(d.tit1); d.tit1.Errors.Count().should_not_be(0); }; it["delete_titleInfo_having_employees"] = () => { d._titleInfoService.SoftDeleteObject(d.tit1, d._employeeService); d.tit1.Errors.Count().should_not_be(0); }; }
public MetaInfo(BinaryReader br) { Unknown3 = br.ReadUInt32(); Title = new TitleInfo(br); Guild = new GuildInfo(br); Unknown4 = br.ReadUInt32(); Stats = new StatsInfo(br); Unknown5 = br.ReadUInt16(); Unknown6 = br.ReadByte(); Unknown7 = br.ReadUInt16(); Unknown8 = br.ReadUInt16(); Energy = new EnergyInfo(br); Unknown9 = br.ReadBytes(13); }
/// <summary> /// 填充数据 /// </summary> /// <param name="_info"></param> public void FillInfo(TitleInfo _info) { if (_info == null) { titleinfo = null; } else { titleinfo = _info; // oldSkillinfo = skillinfo; } RefreshTitle(); }
private Int32 AddTitle() { TitleInfo v = new TitleInfo(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.ID = 20; v.Code = "KZzlI"; v.Name = "xAWoi"; context.Set <TitleInfo>().Add(v); context.SaveChanges(); } return(v.ID); }
/// <summary> /// Gets the tile information. /// </summary> /// <returns></returns> public ITitleInfo GetTileInfo() { try { return(Verify.IsInput(TitleInfo?.GetAxisText()) ? TitleInfo : default(ITitleInfo)); } catch (Exception ex) { Fail(ex); return(default(ITitleInfo)); } }
private static string ToPrString(this TitleInfo info, string defaultString, bool link = false) { if ((info.Pr ?? 0) == 0) { return(defaultString); } if (link) { return($"[#{info.Pr}](https://github.com/RPCS3/rpcs3/pull/{info.Pr})"); } return($"#{info.Pr}"); }
/// <summary> /// 获取称号列表 /// </summary> private void S2C_GetTitleList(Pt _pt) { pt_title_list_d422 pt = _pt as pt_title_list_d422; if (pt != null) { AllAttrNum.Clear(); OwnTitleDictionary.Clear(); //GetAllTitle(); List <title_base_info_list> list = pt.title_list; for (int i = 0; i < list.Count; i++) { TitleInfo info = new TitleInfo(list[i]); if (!isFirstTime) { TitleInfo oldInfo = titleDictionary[info.ID] as TitleInfo; if (oldInfo != null) { if (!oldInfo.IsOwn) { NewTitle = info; GameCenter.curMainPlayer.StopForNextMove(); GameCenter.uIMng.GenGUI(GUIType.NEWTITLEMSG, true); } } } titleDictionary[info.ID] = info; OwnTitleDictionary.Add(info); if (list [i].put_state == 1) { CurUseTitle = (titleDictionary [info.ID]) as TitleInfo; } for (int j = 0; j < info.Attribute.Count; j++) { ActorPropertyTag act = (ActorPropertyTag)info.Attribute[j].eid; AllAttrNum.Add(new AttributePair(act, info.Attribute[j].count)); } } if (UpdateTitle != null) { UpdateTitle(); } if (isFirstTime) { isFirstTime = false; } } SortTitle(); GameCenter.coupleMng.GeTTitleRef(); }
public static DiscordEmbedBuilder BuildTitleEmbed(TitleInfo titleInfo, string type) { var embed = new DiscordEmbedBuilder { Title = BuildTitleName(titleInfo.russian, titleInfo.name, titleInfo.japanese), ImageUrl = GetUrlTo(titleInfo.image.original), Description = titleInfo.description, Url = GetUrlTo(titleInfo.url), }; if (titleInfo.ongoing) { embed.AddField("Статус:", $"{GetStatus(titleInfo.status)}, с {titleInfo.aired_on}", true); if (type == "anime") { string nextEpisodeDate = DateTime.Parse(titleInfo.next_episode_at).ToString(); embed.AddField("Следующая серия:", nextEpisodeDate.Substring(0, nextEpisodeDate.Length - 3), true); } } else if (titleInfo.released_on != null) { embed.AddField("Статус:", $"{GetStatus(titleInfo.status)}, с {titleInfo.aired_on} по {titleInfo.released_on}"); } else { embed.AddField("Статус:", $"{GetStatus(titleInfo.status)}, {titleInfo.aired_on}"); } embed.AddField("Тип:", titleInfo.kind.ToUpper()); if (type == "anime") { embed.AddField("Эпизоды (вышло / всего):", $"{titleInfo.episodes_aired}/{titleInfo.episodes}", true); embed.AddField("Длительность эпизода:", titleInfo.duration.ToString(), true); } embed.AddField("Оценка:", titleInfo.score); embed.AddField("Жанры:", GetGenres(titleInfo.genres)); if (titleInfo.studioOrPublisher != null) { embed.AddField(type == "anime" ? "Студия:" : "Издатель:", GetStudios(titleInfo.studioOrPublisher)); } embed.AddField("В списке:", titleInfo.user_rate == null ? "N/a" : GetUserStatus(titleInfo.user_rate.status)); return(embed); }
/// <summary> /// 获取配置的所有称号 /// </summary> void GetAllTitle() { titleDictionary.Clear(); List <TitleRef> list = ConfigMng.Instance.TitlesList(); for (int i = 0; i < list.Count; i++) { TitleInfo info = new TitleInfo(list[i].type); if (info.ID == 25 || info.ID == 26 || info.ID == 27 || info.ID == 28) { continue; } titleDictionary[info.ID] = info; } }
public ActionResult GetContent(string boardId, int count) { ArticleModel result = new ArticleModel(); try { int infoCount = 0; List <Article> articles = new List <Article>(); BasePtt basePtt = new BasePtt(); HtmlNode htmlNode = new HtmlNode(HtmlNodeType.Comment, new HtmlDocument(), 0); HtmlNodeCollection htmlNodes = new HtmlNodeCollection(htmlNode); var infos = basePtt.TraversalPtt(boardId, infoCount, count, htmlNodes); foreach (var item in infos) { TitleInfo titleInfo = new TitleInfo(); if (item.SelectSingleNode("div[@class='title']").ChildNodes.Count <= 1)//已刪除的文章 { continue; } var contentLink = item.SelectSingleNode("div[@class='title']").ChildNodes[1].Attributes["href"].Value; var res = basePtt.RequestPtt(contentLink); var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(res); var content = htmlDoc.DocumentNode.SelectNodes("//div[@class='article-metaline']"); if (content == null) { continue; } var article = new Article() { Author = content[0].ChildNodes[1].InnerText, Title = content[1].ChildNodes[1].InnerText, Time = basePtt.HandleTime(content[2].ChildNodes[1].InnerText).ToString("yyyy/MM/dd"), Content = content[2].NextSibling.InnerText, Heat = item.SelectSingleNode("div[@class='nrec']").ChildNodes.Count > 0 ? item.SelectSingleNode("div[@class='nrec']").ChildNodes[0].InnerText : "0" }; articles.Add(article); } result.Data = articles; } catch (Exception ex) { result.Status = "NG"; result.Msg = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
void Refesh() { if (GameCenter.titleMng.NewTitle != null) { curInfo = GameCenter.titleMng.NewTitle; if (titleSprite != null) { titleSprite.spriteName = curInfo.IconName; } titleSprite.MakePixelPerfect(); if (titleName != null) { titleName.text = "\"" + curInfo.NameDes + "\""; } } }
public void GetTest() { TitleInfo v = new TitleInfo(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.ID = 89; v.Code = "TLbJgMX5i"; v.Name = "cclfWj"; context.Set <TitleInfo>().Add(v); context.SaveChanges(); } var rv = _controller.Get(v.ID.ToString()); Assert.IsNotNull(rv); }
public bool Open(Stream fs) { PlainRegion = new CXIPlaingRegion(); byte[] plainRegionBuffer; OffsetInNCSD = fs.Position; Header = MarshalUtil.ReadStruct <CXIHeader>(fs); // get Plaing Region fs.Seek(OffsetInNCSD + Header.PlainRegionOffset * 0x200, SeekOrigin.Begin); plainRegionBuffer = new byte[Header.PlainRegionSize * 0x200]; fs.Read(plainRegionBuffer, 0, plainRegionBuffer.Length); PlainRegion = CXIHeader.getPlainRegionStringsFrom(plainRegionBuffer); // byte[] exhBytes = new byte[2048]; // fs.Read(exhBytes, 0, exhBytes.Length); //TODO: read extended header // Array.Reverse(exh); TitleInfo = TitleInfo.Resolve(Header.ProductCode, Header.MakerCode); return(true); }
/// <summary> /// 获取仙侣称号 /// </summary> public void GeTTitleRef() { List <int> allCoupleTitle = ConfigMng.Instance.GetTitleListByType(23); FDictionary coupleOwnTitleDic = GameCenter.titleMng.TitleDictionary; //bool isOwnCoupleTitle = false; for (int i = 0, max = allCoupleTitle.Count; i < max; i++) { if (coupleOwnTitleDic.ContainsKey(allCoupleTitle[i])) { TitleInfo info = coupleOwnTitleDic[allCoupleTitle[i]] as TitleInfo; //Debug.Log( " des " + info.Des + " icon " + info.IconName + " isoen : " + info.IsOwn); if (info.IsOwn) { //isOwnCoupleTitle = true; titleRef = ConfigMng.Instance.GetTitlesRef(allCoupleTitle[i]); if (allCoupleTitle.Count > (i + 1)) { nextTitleRef = ConfigMng.Instance.GetTitlesRef(allCoupleTitle[i + 1]); } else { nextTitleRef = null; } } } } if (titleRef == null) { nextTitleRef = ConfigMng.Instance.GetTitlesRef(allCoupleTitle[0]); } //if (!isOwnCoupleTitle) //{ // titleRef = null; // if (allCoupleTitle.Count > 0) // nextTitleRef = ConfigMng.Instance.GetTitlesRef(allCoupleTitle[0]); // else // nextTitleRef = null; //} //if (_title == CoupleTitle.CURTITLE) // return titleRef; //else // return nextTitleRef; }
public TitleInfo FindOrCreateObject(string Code, string Name, string Description, bool IsShiftable) { TitleInfo titleInfo = GetObjectByCode(Code); if (titleInfo != null) { titleInfo.Errors = new Dictionary <String, String>(); return(titleInfo); } titleInfo = new TitleInfo { Code = Code, Name = Name, Description = Description, IsShiftable = IsShiftable, }; return(this.CreateObject(titleInfo)); }
private void UpdateBook(TitleInfo titleInfo, XmlReader xmlreader) { // Read Genres [1..*] if (xmlreader.ReadToDescendant("genre")) { titleInfo.Genres.Add(new GenreType() { Value = xmlreader.ReadString() }); while (xmlreader.ReadToNextSibling("genre")) { titleInfo.Genres.Add(new GenreType() { Value = xmlreader.ReadString() }); } } }
public override Dictionary <string, object> Render() { var result = new Dictionary <string, object>(); if (xAxisInfo == null) { throw new Formula.Exceptions.BusinessException("条形图必须指定X轴对象"); } if (yAxisInfo == null) { throw new Formula.Exceptions.BusinessException("条形图必须指定Y轴对象"); } this.Chart.Type = "bar"; this.Chart.Is3D = this.Is3D; result.SetValue("chart", this.Chart.ToDic()); if (this.TitleInfo != null) { result.SetValue("title", TitleInfo.ToDic()); } if (this.SubTitleInfo != null) { result.SetValue("subtitle", SubTitleInfo.ToDic()); } var seriesInfos = new List <Dictionary <string, object> >(); foreach (var item in this.SeriesList) { seriesInfos.Add(item.ToDic()); } result.SetValue("plotOptions", this.PlotOption.ToDic()); result.SetValue("series", seriesInfos); result.SetValue("xAxis", xAxisInfo.ToDic()); result.SetValue("yAxis", yAxisInfo.ToDic()); var credits = new Dictionary <string, object>(); credits.SetValue("enabled", false); result.SetValue("credits", credits); //if (this.Colors != null && this.Colors.Count > 0) //{ // result.SetValue("colors", this.Colors); //} return(result); }
void RenderHeader(RenderContext context) { var header = new TagBuilder("div", "modal-header"); if (!Maximize) { header.MergeAttribute("v-drag-window", String.Empty); } header.RenderStart(context); var hdr = GetBinding(nameof(Title)); if ((hdr != null) || (Title != null)) { var span = new TagBuilder("span", "modal-title"); if (hdr != null) { span.MergeAttribute("v-text", hdr.GetPathFormat(context)); } else if (Title != null) { span.SetInnerText(context.LocalizeCheckApostrophe(Title)); } span.Render(context); } if (TitleInfo != null) { var span = new TagBuilder("span", "modal-title-info"); span.RenderStart(context); TitleInfo.RenderElement(context, null); span.RenderEnd(context); } var close = new TagBuilder("button", "btnclose"); close.MergeAttribute("tabindex", "-1"); close.MergeAttribute("@click.prevent", "$modalClose(false)"); close.SetInnerText("✕"); close.Render(context); RenderHelp(context); header.RenderEnd(context); }
public void LoadLowData() { { TextAsset data = Resources.Load("TestJson/Title_Title", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject Title = new JSONObject(strSrc); for (int i = 0; i < Title.list.Count; i++) { TitleInfo tmpInfo = new TitleInfo(); tmpInfo.Id = (uint)Title[i]["Id_ui"].n; tmpInfo.Type = (byte)Title[i]["Type_b"].n; tmpInfo.TitleName = (uint)Title[i]["TitleName_ui"].n; tmpInfo.LinkAchievement = (uint)Title[i]["LinkAchievement_ui"].n; TitleInfoDic.Add(tmpInfo.Id, tmpInfo); } } }
public static string AsString(this TitleInfo info, string titleId) { if (info.Status == TitleInfo.Maintenance.Status) { return("API is undergoing maintenance, please try again later."); } if (info.Status == TitleInfo.CommunicationError.Status) { return("Error communicating with compatibility API, please try again later."); } if (StatusColors.TryGetValue(info.Status, out _)) { var title = info.Title.Trim(40); return($"`[{titleId,-9}] {title,-40} {info.Status,8} since {info.ToUpdated(),-10} (PR {info.ToPrString("#????"),-5})` https://forums.rpcs3.net/thread-{info.Thread}.html"); } return($"Product code {titleId} was not found in compatibility database, possibly untested!"); }
public ChampionTitleInfo(GenericReader reader) { int version = reader.ReadEncodedInt(); switch (version) { case 0: { m_Harrower = reader.ReadEncodedInt(); int length = reader.ReadEncodedInt(); m_Values = new TitleInfo[length]; for (int i = 0; i < length; i++) { m_Values[i] = new TitleInfo(reader); } if (m_Values.Length != ChampionSpawnInfo.Table.Length) { TitleInfo[] oldValues = m_Values; m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; for (int i = 0; i < m_Values.Length && i < oldValues.Length; i++) { m_Values[i] = oldValues[i]; } } break; } } }
public void Atrophy(int index, int value) { if (m_Values == null) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; if (index < 0 || index >= m_Values.Length || value <= 0) return; if (m_Values[index] == null) m_Values[index] = new TitleInfo(); int before = m_Values[index].Value; if ((m_Values[index].Value - value) < 0) m_Values[index].Value = 0; else m_Values[index].Value -= value; if (before != m_Values[index].Value) m_Values[index].LastDecay = DateTime.Now; }
public void Award(int index, int value) { if (m_Values == null) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; if (index < 0 || index >= m_Values.Length || value <= 0) return; if (m_Values[index] == null) m_Values[index] = new TitleInfo(); m_Values[index].Value += value; }
public void SetValue(int index, int value) { if (m_Values == null) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; if (value < 0) value = 0; if (index < 0 || index >= m_Values.Length) return; if (m_Values[index] == null) m_Values[index] = new TitleInfo(); m_Values[index].Value = value; }
public DateTime GetLastDecay(int index) { if (m_Values == null || index < 0 || index >= m_Values.Length) return DateTime.MinValue; if (m_Values[index] == null) m_Values[index] = new TitleInfo(); return m_Values[index].LastDecay; }
public int GetValue(int index) { if (m_Values == null || index < 0 || index >= m_Values.Length) return 0; if (m_Values[index] == null) m_Values[index] = new TitleInfo(); return m_Values[index].Value; }
public static void Serialize(GenericWriter writer, TitleInfo info) { writer.WriteEncodedInt((int)0); // version writer.WriteEncodedInt(info.m_Value); writer.Write(info.m_LastDecay); }
private Task ReadTitlesFile() { return Task.Run(() => { _logger.Debug("Loading AniDB titles"); var titlesFile = _downloader.TitlesFilePath; var settings = new XmlReaderSettings { CheckCharacters = false, IgnoreProcessingInstructions = true, IgnoreComments = true, ValidationType = ValidationType.None }; using (var stream = new StreamReader(titlesFile, Encoding.UTF8)) using (var reader = XmlReader.Create(stream, settings)) { string aid = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "anime": reader.MoveToAttribute("aid"); aid = reader.Value; break; case "title": var title = reader.ReadElementContentAsString(); if (!string.IsNullOrEmpty(aid) && !string.IsNullOrEmpty(title)) { var type = ParseType(reader.GetAttribute("type")); TitleInfo currentTitleInfo; if (!_titles.TryGetValue(title, out currentTitleInfo) || (int)currentTitleInfo.Type < (int)type) { _titles[title] = new TitleInfo {AniDbId = aid, Type = type}; } } break; } } } } var comparable = (from pair in _titles let comp = GetComparableName(pair.Key) where !_titles.ContainsKey(comp) select new {Title = comp, Id = pair.Value}) .ToArray(); foreach (var pair in comparable) { _titles[pair.Title] = pair.Id; } }); }
/// <summary> /// Gets chapters from the given BDTitleInfo object /// </summary> /// <param name="titleInfo">BDTitleInfo object</param> /// <returns>chapters as an array consisting of the start time in seconds</returns> protected virtual double[] GetChapters(TitleInfo titleInfo) { double[] chapters = new double[titleInfo.native.chapter_count]; if (chapters.Length > 2) // only two chapters means beginning and end - no real chapters { for (int i = 0; i < chapters.Length; i++) { unsafe { double s = titleInfo.native.chapters[i].start/90000; chapters[i] = s; TimeSpan ts = TimeSpan.FromSeconds(s); Log.Debug("BDPlayer: Chapter info #{0}: start time: {1}", titleInfo.native.chapters[i].idx, String.Format("{0:D2}:{1:D2}:{2:D2}", ts.Hours, ts.Minutes, ts.Seconds)); } } if (chapters[chapters.Length - 1] < 300) // 5 min sanity check chapters = null; } else chapters = null; return chapters; }
/// <summary> /// Gets the title info for the specified index /// </summary> /// <param name="reader">IBDReader object</param> /// <param name="index">index of the title</param> /// <returns></returns> protected virtual TitleInfo GetTitleInfo(IBDReader reader, int index) { TitleInfo titleInfo = new TitleInfo(reader, index); return titleInfo; }