public BodyViewModel(CharacterViewModel parent) { CharacterViewModel = parent; BodyPart = new BodySection(this); FacePart = new FaceSection(this); HairPart = new HairSection(this); }
public GnomeBodyPartStatus(BodySection bodySection) { var flags = Enum.GetValues(typeof(BodySectionStatus)).Cast<BodySectionStatus>(); var statuses = flags.Where(flag => bodySection.Status.HasFlag(flag)).Select(flag => Enum.GetName(typeof(BodyPartStatus), flag)).ToArray(); BodyPart = bodySection.Name; Statuses = statuses; }
private void treat_limb(BodySection section) { if (section.Status == Game.BodySectionStatus.Missing) { bodySectionProperty.SetValue(section, Game.BodySectionStatus.Destroyed); bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Disabled); } section.RepairDestroyedBodySection(); bodySectionProperty.SetValue(section, Game.BodySectionStatus.Good); bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Good); }
private void treat_limb(BodySection section) { System.Reflection.FieldInfo bodyPartProperty = typeof(BodyPart) .GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .Where(field => (field.FieldType == typeof(Game.BodyPartStatus))) .Single(); System.Reflection.FieldInfo bodySectionProperty = typeof(BodySection) .GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .Where(field => (field.FieldType == typeof(Game.BodySectionStatus))) .Single(); if (section.Status == Game.BodySectionStatus.Missing) { bodySectionProperty.SetValue(section, Game.BodySectionStatus.Destroyed); bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Disabled); } section.RepairDestroyedBodySection(); bodySectionProperty.SetValue(section, Game.BodySectionStatus.Good); bodyPartProperty.SetValue(section.BodyPart, Game.BodyPartStatus.Good); }
protected void ImplementSection(BodySection section) { section.Node = PreviousNode; section.PreviousSection = this.previousSection; this.previousSection = section; }
static void Main(string[] args) { Console.WriteLine(GetText()); Console.ReadKey(); Fb2Document fb2Document = Fb2Document.CreateDocument(); var options = new ChromeOptions { //BinaryLocation = @"C:\Program Files\Google\Chrome Beta\Application\chrome.exe" }; options.AddArgument("--log-level=3"); options.AddArgument("--disable-logging"); //options.AddArgument("--headless"); var driver = new ChromeDriver(options) { Url = "https://author.today/" }; if (!File.Exists("cookies")) { driver.FindElement(By.LinkText("Войти")).Click(); input("Войдите в свой аккаунт, и нажмите *ENTER*"); SaveCookies(driver.Manage().Cookies.AllCookies.ToArray()); } else { driver.Manage().Cookies.DeleteAllCookies(); foreach (var cookie in LoadCookies()) { driver.Manage().Cookies.AddCookie(cookie); } driver.Navigate().Refresh(); SaveCookies(driver.Manage().Cookies.AllCookies.ToArray()); } var bookId = input("Введите ссылку на книгу (https://author.today/work/119568)") .Replace("https://", "") .Replace("http://", "") .Split('/')[2] .intParse(); driver.Navigate().GoToUrl($"https://author.today/reader/{bookId}"); again: Thread.Sleep(500); var fragments = driver.FindElements(By.XPath("//div[@class='text-container']//p")); foreach (var fragment in fragments) { Console.WriteLine($"{fragment.Text}\r\n"); var textItem = new TextItem(); textItem.Load(new XText(fragment.Text)); var p = new Paragraph(); p.Content.Add(textItem); var section = new BodySection(); section.Content.Add(p); var body = new BookBody(); body.Content.Add(section); fb2Document.Book.Content.Add(body); } File.WriteAllText("book.fb2", fb2Document.ToXmlString()); try { driver.FindElement(By.XPath("//li[@class='next']//span[1]")).Click(); goto again; } catch { } Console.ReadKey(); driver.Close(); driver.Quit(); Environment.Exit(0); }