public static void LoadAndInjectBackstoryData(IEnumerable <string> folderPaths, List <string> loadErrors)
 {
     foreach (XElement xelement in BackstoryTranslationUtility.BackstoryTranslationElements(folderPaths, loadErrors))
     {
         string text = "[unknown]";
         try
         {
             text = xelement.Name.ToString();
             string    value  = xelement.Element("title").Value;
             string    text2  = (xelement.Element("titleFemale") == null) ? null : xelement.Element("titleFemale").Value;
             string    value2 = xelement.Element("titleShort").Value;
             string    text3  = (xelement.Element("titleShortFemale") == null) ? null : xelement.Element("titleShortFemale").Value;
             string    value3 = xelement.Element("desc").Value;
             Backstory backstory;
             if (!BackstoryDatabase.TryGetWithIdentifier(text, out backstory, false))
             {
                 throw new Exception("Backstory not found matching identifier " + text);
             }
             if (value == backstory.title && text2 == backstory.titleFemale && value2 == backstory.titleShort && text3 == backstory.titleShortFemale && value3 == backstory.baseDesc)
             {
                 throw new Exception("Backstory translation exactly matches default data: " + text);
             }
             if (value != null)
             {
                 backstory.SetTitle(value, backstory.titleFemale);
             }
             if (text2 != null)
             {
                 backstory.SetTitle(backstory.title, text2);
             }
             if (value2 != null)
             {
                 backstory.SetTitleShort(value2, backstory.titleShortFemale);
             }
             if (text3 != null)
             {
                 backstory.SetTitleShort(backstory.titleShort, text3);
             }
             if (value3 != null)
             {
                 backstory.baseDesc = value3;
             }
         }
         catch (Exception ex)
         {
             loadErrors.Add(string.Concat(new object[]
             {
                 "Couldn't load backstory ",
                 text,
                 ": ",
                 ex,
                 "\nFull XML text:\n\n",
                 xelement.ToString()
             }));
         }
     }
 }
        public static List <string> BackstoryTranslationsMatchingEnglish(LoadedLanguage lang)
        {
            List <string> list = new List <string>();

            foreach (XElement current in BackstoryTranslationUtility.BackstoryTranslationElements(lang.FolderPaths, null))
            {
                try
                {
                    string    text = current.Name.ToString();
                    Backstory backstory;
                    if (BackstoryDatabase.allBackstories.TryGetValue(BackstoryDatabase.GetIdentifierClosestMatch(text, true), out backstory))
                    {
                        string text2 = BackstoryTranslationUtility.GetText(current, "title");
                        string text3 = BackstoryTranslationUtility.GetText(current, "titleFemale");
                        string text4 = BackstoryTranslationUtility.GetText(current, "titleShort");
                        string text5 = BackstoryTranslationUtility.GetText(current, "titleShortFemale");
                        string text6 = BackstoryTranslationUtility.GetText(current, "desc");
                        if (!text2.NullOrEmpty() && text2 == backstory.untranslatedTitle)
                        {
                            list.Add(text + ".title '" + text2.Replace("\n", "\\n") + "'");
                        }
                        if (!text3.NullOrEmpty() && text3 == backstory.untranslatedTitleFemale)
                        {
                            list.Add(text + ".titleFemale '" + text3.Replace("\n", "\\n") + "'");
                        }
                        if (!text4.NullOrEmpty() && text4 == backstory.untranslatedTitleShort)
                        {
                            list.Add(text + ".titleShort '" + text4.Replace("\n", "\\n") + "'");
                        }
                        if (!text5.NullOrEmpty() && text5 == backstory.untranslatedTitleShortFemale)
                        {
                            list.Add(text + ".titleShortFemale '" + text5.Replace("\n", "\\n") + "'");
                        }
                        if (!text6.NullOrEmpty() && text6 == backstory.untranslatedDesc)
                        {
                            list.Add(text + ".desc '" + text6.Replace("\n", "\\n") + "'");
                        }
                    }
                }
                catch (Exception ex)
                {
                    list.Add(string.Concat(new object[]
                    {
                        "Exception reading ",
                        current.Name,
                        ": ",
                        ex.Message
                    }));
                }
            }
            return(list);
        }
        public static IEnumerable <string> MissingBackstoryTranslations(LoadedLanguage lang)
        {
            List <string> neededTranslations = (from kvp in BackstoryDatabase.allBackstories
                                                select kvp.Key).ToList();

            foreach (XElement item in BackstoryTranslationUtility.BackstoryTranslationElements(lang))
            {
                string identifier = item.Name.ToString();
                if (neededTranslations.Contains(identifier))
                {
                    neededTranslations.Remove(identifier);
                    string title      = item.Element("title").Value;
                    string titleShort = item.Element("titleShort").Value;
                    string desc       = item.Element("desc").Value;
                    if (title.NullOrEmpty())
                    {
                        yield return(identifier + ".title missing");

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                    if (titleShort.NullOrEmpty())
                    {
                        yield return(identifier + ".titleShort missing");

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                    if (desc.NullOrEmpty())
                    {
                        yield return(identifier + ".desc missing");

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                    continue;
                }
                yield return("Translation doesn't correspond to any backstory: " + identifier);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            using (List <string> .Enumerator enumerator2 = neededTranslations.GetEnumerator())
            {
                if (enumerator2.MoveNext())
                {
                    string tra = enumerator2.Current;
                    yield return("Missing backstory: " + tra);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_02fa:
            /*Error near IL_02fb: Unexpected return in MoveNext()*/;
        }
 public static void LoadAndInjectBackstoryData(LoadedLanguage lang)
 {
     foreach (XElement current in BackstoryTranslationUtility.BackstoryTranslationElements(lang))
     {
         string text = "[unknown]";
         try
         {
             text = current.Name.ToString();
             string    value  = current.Element("title").Value;
             string    value2 = current.Element("titleShort").Value;
             string    value3 = current.Element("desc").Value;
             Backstory backstory;
             if (!BackstoryDatabase.TryGetWithIdentifier(text, out backstory))
             {
                 throw new Exception("Backstory not found matching identifier " + text);
             }
             if (value == backstory.Title && value2 == backstory.TitleShort && value3 == backstory.baseDesc)
             {
                 Log.Error("Backstory translation exactly matches default data: " + text);
             }
             else
             {
                 if (value != null)
                 {
                     backstory.SetTitle(value);
                 }
                 if (value2 != null)
                 {
                     backstory.SetTitleShort(value2);
                 }
                 if (value3 != null)
                 {
                     backstory.baseDesc = value3;
                 }
             }
         }
         catch (Exception ex)
         {
             Log.Warning(string.Concat(new object[]
             {
                 "Couldn't load backstory ",
                 text,
                 ": ",
                 ex,
                 "\nFull XML text:\n\n",
                 current.ToString()
             }));
         }
     }
 }
        public static IEnumerable <string> MissingBackstoryTranslations(LoadedLanguage lang)
        {
            List <string> neededTranslations = (from kvp in BackstoryDatabase.allBackstories
                                                select kvp.Key).ToList <string>();

            foreach (XElement element in BackstoryTranslationUtility.BackstoryTranslationElements(lang))
            {
                string identifier = element.Name.ToString();
                if (neededTranslations.Contains(identifier))
                {
                    neededTranslations.Remove(identifier);
                }
                else
                {
                    yield return("Translation doesn't correspond to any backstory: " + identifier);
                }
                string title      = element.Element("title").Value;
                string titleShort = element.Element("titleShort").Value;
                string desc       = element.Element("desc").Value;
                if (title.NullOrEmpty())
                {
                    yield return(identifier + ".title missing");
                }
                if (titleShort.NullOrEmpty())
                {
                    yield return(identifier + ".titleShort missing");
                }
                if (desc.NullOrEmpty())
                {
                    yield return(identifier + ".desc missing");
                }
            }
            foreach (string tra in neededTranslations)
            {
                yield return("Missing backstory: " + tra);
            }
        }
 public static void LoadAndInjectBackstoryData(IEnumerable <string> folderPaths, List <string> loadErrors)
 {
     foreach (XElement current in BackstoryTranslationUtility.BackstoryTranslationElements(folderPaths, loadErrors))
     {
         string text = "[unknown]";
         try
         {
             text = current.Name.ToString();
             string    text2 = BackstoryTranslationUtility.GetText(current, "title");
             string    text3 = BackstoryTranslationUtility.GetText(current, "titleFemale");
             string    text4 = BackstoryTranslationUtility.GetText(current, "titleShort");
             string    text5 = BackstoryTranslationUtility.GetText(current, "titleShortFemale");
             string    text6 = BackstoryTranslationUtility.GetText(current, "desc");
             Backstory backstory;
             if (!BackstoryDatabase.TryGetWithIdentifier(text, out backstory, false))
             {
                 throw new Exception("Backstory not found matching identifier " + text);
             }
             if (text2 == backstory.title && text3 == backstory.titleFemale && text4 == backstory.titleShort && text5 == backstory.titleShortFemale && text6 == backstory.baseDesc)
             {
                 throw new Exception("Backstory translation exactly matches default data: " + text);
             }
             if (text2 != null)
             {
                 backstory.SetTitle(text2, backstory.titleFemale);
                 backstory.titleTranslated = true;
             }
             if (text3 != null)
             {
                 backstory.SetTitle(backstory.title, text3);
                 backstory.titleFemaleTranslated = true;
             }
             if (text4 != null)
             {
                 backstory.SetTitleShort(text4, backstory.titleShortFemale);
                 backstory.titleShortTranslated = true;
             }
             if (text5 != null)
             {
                 backstory.SetTitleShort(backstory.titleShort, text5);
                 backstory.titleShortFemaleTranslated = true;
             }
             if (text6 != null)
             {
                 backstory.baseDesc       = text6;
                 backstory.descTranslated = true;
             }
         }
         catch (Exception ex)
         {
             loadErrors.Add(string.Concat(new string[]
             {
                 "Couldn't load backstory ",
                 text,
                 ": ",
                 ex.Message,
                 "\nFull XML text:\n\n",
                 current.ToString()
             }));
         }
     }
 }
        public static List <string> MissingBackstoryTranslations(LoadedLanguage lang)
        {
            List <KeyValuePair <string, Backstory> > list = BackstoryDatabase.allBackstories.ToList <KeyValuePair <string, Backstory> >();
            List <string> list2 = new List <string>();

            foreach (XElement current in BackstoryTranslationUtility.BackstoryTranslationElements(lang.FolderPaths, null))
            {
                try
                {
                    string text = current.Name.ToString();
                    string modifiedIdentifier = BackstoryDatabase.GetIdentifierClosestMatch(text, false);
                    bool   flag = list.Any((KeyValuePair <string, Backstory> x) => x.Key == modifiedIdentifier);
                    KeyValuePair <string, Backstory> backstory = list.Find((KeyValuePair <string, Backstory> x) => x.Key == modifiedIdentifier);
                    if (flag)
                    {
                        list.RemoveAt(list.FindIndex((KeyValuePair <string, Backstory> x) => x.Key == backstory.Key));
                        string text2 = BackstoryTranslationUtility.GetText(current, "title");
                        string text3 = BackstoryTranslationUtility.GetText(current, "titleFemale");
                        string text4 = BackstoryTranslationUtility.GetText(current, "titleShort");
                        string text5 = BackstoryTranslationUtility.GetText(current, "titleShortFemale");
                        string text6 = BackstoryTranslationUtility.GetText(current, "desc");
                        if (text2.NullOrEmpty())
                        {
                            list2.Add(text + ".title missing");
                        }
                        if (flag && !backstory.Value.titleFemale.NullOrEmpty() && text3.NullOrEmpty())
                        {
                            list2.Add(text + ".titleFemale missing");
                        }
                        if (text4.NullOrEmpty())
                        {
                            list2.Add(text + ".titleShort missing");
                        }
                        if (flag && !backstory.Value.titleShortFemale.NullOrEmpty() && text5.NullOrEmpty())
                        {
                            list2.Add(text + ".titleShortFemale missing");
                        }
                        if (text6.NullOrEmpty())
                        {
                            list2.Add(text + ".desc missing");
                        }
                    }
                    else
                    {
                        list2.Add("Translation doesn't correspond to any backstory: " + text);
                    }
                }
                catch (Exception ex)
                {
                    list2.Add(string.Concat(new object[]
                    {
                        "Exception reading ",
                        current.Name,
                        ": ",
                        ex.Message
                    }));
                }
            }
            foreach (KeyValuePair <string, Backstory> current2 in list)
            {
                list2.Add("Missing backstory: " + current2.Key);
            }
            return(list2);
        }