public void Run() { var listEn = PublicationEntry.ReadAll("Akinshin.En.bib", "Akinshin.InRussian.bib", "Akinshin.Translation.bib"); var listRu = PublicationEntry.ReadAll("Akinshin.En.bib", "Akinshin.Ru.bib", "Akinshin.Translation.bib"); var tomlEn = listEn.ToToml(); var tomlRu = listRu.ToToml(PublicationLanguage.Russian); var dataGenDirectory = DirectoryDetector.GetDataGenDirectory(); if (!Directory.Exists(dataGenDirectory)) { Directory.CreateDirectory(dataGenDirectory); } File.WriteAllText(Path.Combine(dataGenDirectory, "publications_en.toml"), tomlEn); File.WriteAllText(Path.Combine(dataGenDirectory, "publications_ru.toml"), tomlRu); }
private void CreatePublicationEntriesForAlternativeTargets(List <RaidTarget> targets, KeyValuePair <string, PogoAfoRaidInfo> entry, RaidParticipation raidStruct) { // Just create a publication entry for these alternative targets. A separate process will take care of the actual // publication for those. foreach (var target in targets) { // It either is in the list of levels (always if not defined) OR it's an ex trigger gym and it's in the list of ex levels bool addToThisChannel = (target.Levels == null || target.Levels.Any(x => x == entry.Value.raid_level)) || (target.ExRaidLevels != null && entry.Value.ex_trigger && target.ExRaidLevels.Any(x => x == entry.Value.raid_level)); // If it's outside the specified rectangle on the map, it's going to be ignored if (target.NorthEastCorner != null && target.SouthWestCorner != null && entry.Value.latitude.HasValue && entry.Value.longitude.HasValue) { if (!(Between(entry.Value.latitude.Value, target.NorthEastCorner.Latitude, target.SouthWestCorner.Latitude) && Between(entry.Value.longitude.Value, target.NorthEastCorner.Longitude, target.SouthWestCorner.Longitude))) { addToThisChannel = false; } } if (addToThisChannel) { _log.Trace($"{SourceID} - For target {target.Description}: adding publication for {entry.Key} @{entry.Value.raid_battle} (level {entry.Value.raid_level})."); var existingEntry = raidStruct.Raid.Publications.Where(x => x.ChannelID == target.ChannelID).FirstOrDefault(); if (null == existingEntry) { var publicationEntry = new PublicationEntry { ChannelID = target.ChannelID, LastModificationTimeUTC = DateTime.MinValue, TelegramMessageID = 0 }; raidStruct.Raid.Publications.Add(publicationEntry); } else { // request update existingEntry.LastModificationTimeUTC = DateTime.MinValue; } } } }
public static string[] GetKeywords(this PublicationEntry entry) => entry.GetProperty("keywords") .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
public static string[] GetUrls(this PublicationEntry entry) => entry.GetProperty("url").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
public static PublicationLanguage GetLanguage(this PublicationEntry entry) => entry.GetProperty("language").StartsWith("ru") ? PublicationLanguage.Russian : PublicationLanguage.English;
public static string GetDoi(this PublicationEntry entry) => entry.GetProperty("doi");
public static string GetIsbn(this PublicationEntry entry) => entry.GetProperty("isbn");
public static int GetYear(this PublicationEntry entry) => int.Parse(entry.GetProperty("year"));
public static string GetNumber(this PublicationEntry entry) => entry.GetProperty("number");
public static string GetVolume(this PublicationEntry entry) => entry.GetProperty("volume");
public static string GetPages(this PublicationEntry entry) => entry.GetProperty("pages").Replace("--", "–");
public static string GetOrganization(this PublicationEntry entry) => entry.GetProperty("organization");
public static string GetJournal(this PublicationEntry entry) => entry.GetProperty("journal");
public static string GetAddress(this PublicationEntry entry) => entry.GetProperty("address");
public static string GetPublisher(this PublicationEntry entry) => entry.GetProperty("publisher");
public static PublicationEntryAuthor[] GetAuthors(this PublicationEntry entry) => PublicationEntryAuthor.Parse(entry.GetProperty("author"));
public static string ToHtml(this PublicationEntry entry) { var lang = entry.GetLanguage(); var builder = new StringBuilder(); builder.Append(entry.GetAuthors().ToHtml()); builder.Append(" "); builder.Append($"<span title=\"{entry.GetAbstract()}\">"); builder.Append(Resolve(lang, "“", "«")); builder.Append(entry.GetTitle()); builder.Append(Resolve(lang, "”", "»")); builder.Append("</span>"); builder.Append(" //"); if (entry.GetBookTitle() != "") { builder.Append(" " + entry.GetBookTitle() + "."); } if (entry.GetJournal() != "") { builder.Append(" " + entry.GetJournal() + "."); } if (entry.GetPublisher() != "") { builder.Append($" {Resolve(lang, "Publisher", "Издательство")}: " + entry.GetPublisher() + "."); } if (entry.GetAddress() != "") { builder.Append(" " + entry.GetAddress() + "."); } if (entry.GetOrganization() != "") { builder.Append(" " + entry.GetOrganization() + "."); } if (entry.GetIsbn() != "") { builder.Append(" ISBN: " + entry.GetIsbn() + "."); } if (entry.GetVolume() != "") { builder.Append($" {Resolve(lang, "Vol", "Т")}. " + entry.GetVolume() + "."); } if (entry.GetNumber() != "") { builder.Append($" {Resolve(lang, "No", "№")} " + entry.GetNumber() + "."); } if (entry.GetPages() != "") { builder.Append($" {Resolve(lang, "Pp", "Стр")}. " + entry.GetPages() + "."); } if (entry.GetDoi() != "") { builder.Append($" DOI: {entry.GetDoi()}"); } var urls = entry.GetUrls(); bool isVak = entry.GetKeywords().Contains("Vak"); if (urls.Any() || isVak) { // builder.Append(" //"); // foreach (var url in urls) // { // var title = Resolve(lang, "Link", "Ссылка"); // if (url.EndsWith(".pdf")) // title = "Pdf"; // else if (url.Contains("ieeexplore.ieee.org")) // title = "IEEE"; // else if (url.Contains("apps.webofknowledge.com")) // title = "Web of Science"; // else if (url.Contains("www.scopus.com")) // title = "Scopus"; // else if (url.Contains("elibrary.ru")) // title = Resolve(lang, "RSCI", "РИНЦ"); // else if (url.Contains("mathnet.ru")) // title = "MathNet"; // else if (url.Contains("link.springer.com")) // title = "Springer"; // else if (url.Contains("www.packtpub.com")) // title = "PacktPub"; // else if (url.Contains("conf.nsc.ru") || url.Contains("uni-bielefeld.de") || // url.Contains("cmb.molgen.mpg.de") || url.Contains("sites.google.com")) // title = Resolve(lang, "Conference site", "Сайт конференции"); // else if (url.Contains("authorea")) // title = url.Substring(url.IndexOf("authorea.com", StringComparison.Ordinal)).TrimEnd('/'); // else if (url.Contains("scholar.google.ru")) // title = "Google Scholar"; // builder.AppendLine($" <a href=\"{url}\">[{title}]</a>"); // } // if (isVak) // builder.AppendLine(Resolve(lang, " [VAK]", " [ВАК]")); } return(builder.ToString()); }
public static string GetAbstract(this PublicationEntry entry) => entry.GetProperty("abstract");
public static string GetBookTitle(this PublicationEntry entry) => entry.GetProperty("booktitle");
public static string GetProperty(this PublicationEntry entry, string name) => entry.Properties.ContainsKey(name) ? entry.Properties[name] : "";