Example #1
0
        private bool CheckForUnprotectedTranslation(string path)
        {
            if (!_withEncryption)
            {
                return(true);
            }

            var fi     = new FileInfo(path);
            var uiLang = TranslationSerializer.DeserializeDataJson <InterfaceTranslation>(path);

            if (uiLang == null)
            {
                return(true);
            }
            var langPath = path.Substring(0, path.Length - fi.Extension.Length) + _fileExtension;

            if (!File.Exists(langPath))
            {
#if DEBUG
                uiLang.CryptData(langPath, _entropy);
                LanguageList.Add(fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length));
#else
                File.Delete(path);
#endif
            }
            return(true);
        }
Example #2
0
        public bool SetLanguage(string languageName)
        {
            if (languageName == CurrentTranslationLanguage || languageName == null)
            {
                return(false);
            }
            if (!LanguageList.Contains(languageName))
            {
                return(false);
            }
            var lng = TranslationSerializer.DecryptData <InterfaceTranslation>(
                Path.Combine(Folder, languageName + _fileExtension), _entropy);

            if (lng == null)
            {
                return(false);
            }
            _alterTranslation          = lng;
            CurrentTranslationLanguage = languageName;
            return(true);
        }