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
 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 #3
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 #4
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 #5
0
 public override void OnSuccess(WWW www)
 {
     FileUtil.Write(extendLocalPath, www.bytes);
     CrateData(DESUtil.Decrypt(www.bytes, FileUtil.sKey), true);
 }