Example #1
0
    public void Initialize(e_language defaultLanguage = e_language.English, e_language currentLanguage = e_language.French, e_languageExtension extension = e_languageExtension.Ini)
    {
        this.defaultLanguageTexts = new StringDictionary();
        this.currentLanguageTexts = new StringDictionary();

        this.repositoryPath = DirectoryFunction.CombinePath(DirectoryFunction.CombinePath(DirectoryFunction.GetMyDocumentsPath(), "Blood Of Evil"), "Language");

        this.defaultLanguage = e_language.English;
        this.currentLanguage = e_language.French;

        this.languageList = new LanguageType();

        this.Extension            = "." + extension.ToString().ToLower();
        this.extensionEnumeration = extension;

        this.CreateLanguageFilesIfDontExist();

        //Use those 2 lines for Generate Files and save
        //this.AddPredefinedLanguageNodes();
        //this.Save();

        //Use this line to load your files
        this.Load();
    }
Example #2
0
    public void SaveEditorLanguageData(e_language newLanguage, e_languageExtension newExtension, LanguageType languageData)
    {
        string path = DirectoryFunction.CombinePath(this.repositoryPath, newLanguage.ToString()) + "." + newExtension.ToString().ToLower();

        if (newExtension == e_languageExtension.Ini)
        {
            IniFile          parser        = new IniFile(path);
            StringDictionary languageTexts = new StringDictionary();

            languageData.ForEach(node => languageTexts.Add(node.Key, node.Value));
            parser.SaveFile(languageTexts);
        }
        else
        {
            SerializationTemplate.Save <LanguageType>(path, languageData, newExtension == e_languageExtension.Bin);
        }
    }
Example #3
0
    public LanguageType LoadEditorLanguageData(e_language newLanguage, e_languageExtension newExtension)
    {
        string path = DirectoryFunction.CombinePath(this.repositoryPath, newLanguage.ToString()) + "." + newExtension.ToString().ToLower();

        //LanguageType languageData = new LanguageType();

        if (newExtension == e_languageExtension.Ini)
        {
            IniFile parser = new IniFile(path);
            return(new StringDictionary(parser.KeysValues).ToList());
        }
        else
        {
            return(SerializationTemplate.Load <LanguageType>(path, newExtension == e_languageExtension.Bin));
        }
    }