SetRootValues() public method

Sets the dictionaries necessary to change them within the extension
public SetRootValues ( LocalizedObject>.Dictionary rootValues ) : void
rootValues LocalizedObject>.Dictionary /// Root values. ///
return void
    void TestCreateNewRootKeys()
    {
        // Show root language editor window and get root values
        EditRootLanguageFileWindow           window = EditRootLanguageFileWindow.ShowWindow();
        Dictionary <string, LocalizedObject> dict   = LanguageHandlerEditor.LoadParsedLanguageFile(string.Empty, true);

        // Add any missing TEXT.RSC records
        DaggerfallUnity dfUnity = DaggerfallUnity.Instance;

        if (dfUnity.IsReady)
        {
            TextResourceFile rscFile = new TextResourceFile(dfUnity.Arena2Path, "TEXT.RSC");
            for (int i = 0; i < rscFile.RecordCount; i++)
            {
                TextResourceFile.TextRecord record = rscFile.GetTextRecordByIndex(i);
                string key = RSCNamespacePrefix + record.id.ToString();
                if (!dict.ContainsKey(key))
                {
                    LocalizedObject obj = new LocalizedObject();
                    obj.ObjectType = LocalizedObjectType.STRING;
                    obj.TextValue  = record.text;
                    LanguageDictionaryHelper.AddNewKeyPersistent(dict, key, obj);
                }
            }
        }

        //// Add new root keys and values
        //LocalizedObject obj = new LocalizedObject();
        //obj.ObjectType = LocalizedObjectType.STRING;
        //obj.TextValue = "This is a new text key.";
        //LanguageDictionaryHelper.AddNewKeyPersistent(dict, "NewKey.Test", obj);

        // Set new root values
        window.SetRootValues(dict);
    }
Beispiel #2
0
 private void ShowRootEditWindow(Dictionary <string, LocalizedObject> rootValues)
 {
     if (editRootWindow == null)
     {
         editRootWindow = EditRootLanguageFileWindow.ShowWindow();
         editRootWindow.ShowTab();
     }
     else
     {
         editRootWindow.SetRootValues(rootValues);
         editRootWindow.ShowTab();
     }
 }