Beispiel #1
0
        private void ReadConfigFromLocal(string configPath)
        {
            TextAsset textAsset = Resources.Load(configPath, typeof(TextAsset)) as TextAsset;

            if (textAsset != null)
            {
                CrateData((DESUtil.Decrypt(textAsset.bytes, FileUtil.sKey)), false);
            }
        }
Beispiel #2
0
 public static void SetStringEncrypt(string key, string value)
 {
     if (value == null)
     {
         PlayerPrefs.SetString(DESUtil.Encrypt(key, sKey), value);
     }
     else
     {
         PlayerPrefs.SetString(DESUtil.Encrypt(key, sKey), DESUtil.Encrypt(value, sKey));
     }
 }
Beispiel #3
0
 private bool ReadConfigFromExtern()
 {
     if (FileUtil.Exists(extendLocalPath))
     {
         if (LaunchInfoManager.Instant.VersionChanged())
         {
             FileUtil.DeleteFile(extendLocalPath);
         }
         try{
             byte[] dataByte = FileUtil.Read(extendLocalPath);
             CrateData((DESUtil.Decrypt(dataByte, FileUtil.sKey)), false);
             return(true);
         }catch (Exception e) {}
     }
     return(false);
 }
Beispiel #4
0
 private SGConfig(OnCompleteDelegate onCompleteDelegate = null) : base()
 {
                 #if UNITY_IOS
     configInitPath = "Cogfig_init_IOS.plist";
                 #else
     configInitPath = "Cogfig_init_Android.plist";
                 #endif
     this.onCompleteDelegate = onCompleteDelegate;
     TextAsset textAsset = Resources.Load(configInitPath, typeof(TextAsset)) as TextAsset;
     if (textAsset.bytes != null)
     {
         Dictionary <string, object> plist = Plist.readPlist(DESUtil.Decrypt(textAsset.bytes, FileUtil.sKey)) as Dictionary <string, object>;
         _data           = (Dictionary <string, object>)plist ["Data"];
         remoteUrl       = GetStringValue("", "ConfigPath", "RemoteConfig");
         localPath       = GetStringValue("", "ConfigPath", "LocalConfig");
         extendLocalPath = Application.persistentDataPath + "//" + localPath;
     }
 }
Beispiel #5
0
        public static string GetStringDecrypt(string key, string defaultValue)
        {
            string value = null;

            if (defaultValue == null)
            {
                value = PlayerPrefs.GetString(DESUtil.Encrypt(key, sKey), defaultValue);
            }
            else
            {
                value = PlayerPrefs.GetString(DESUtil.Encrypt(key, sKey), DESUtil.Encrypt(defaultValue, sKey));
            }


            if (value == null)
            {
                return(value);
            }

            return(DESUtil.Decrypt(value, sKey));
        }
Beispiel #6
0
 public override void OnSuccess(WWW www)
 {
     FileUtil.Write(extendLocalPath, www.bytes);
     CrateData(DESUtil.Decrypt(www.bytes, FileUtil.sKey), true);
 }
Beispiel #7
0
 public static bool HasKeyEncrypt(string key)
 {
     return(PlayerPrefs.HasKey(DESUtil.Encrypt(key, sKey)));
 }
Beispiel #8
0
 public static void DeleteKeyEncrypt(string key)
 {
     PlayerPrefs.DeleteKey(DESUtil.Encrypt(key, sKey));
 }
Beispiel #9
0
 public static bool WriteEncrypt(string filePath, byte[] data)
 {
     return(Write(filePath, DESUtil.Encrypt(data, sKey)));
 }