public static DotrADb CreateDBContext() { //加解密的class MyEncrypt myEncrypt = new MyEncrypt(); //從App.Config(or Web.Config)取出的設定加密字串,並解密 String db_Catalog = myEncrypt.Decrypt(ConfigurationManager.AppSettings["db_Catalog"]); String db_User = myEncrypt.Decrypt(ConfigurationManager.AppSettings["db_User"]); String db_Pwd = myEncrypt.Decrypt(ConfigurationManager.AppSettings["db_Pwd"]); string db_ConnectionStr = string.Format(ConfigurationManager.AppSettings["db_ConnectionStr"], db_Catalog, db_User, db_Pwd); //回傳上面我自訂的ContosoUniversityEntities Constructor(有參數) return new DotrADb(db_ConnectionStr); }
private byte[] ConvertOldCache(int seed) { byte[] data = this.ReadCacheOld(); if (data == null || data.Length <= 0) { return((byte[])null); } string src = MyEncrypt.Decrypt(seed, data, false); DebugUtility.LogWarning("[MyGUID]ConvertCacheData:" + src); byte[] numArray = this.Encrypt(seed, src); this.SaveCache(numArray); return(numArray); }
private FlowNode_OnUrlSchemeLaunch.LINEParam Analyze(string str) { string[] strArray1 = str.Split('?'); if (strArray1 == null) { return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } if (strArray1.Length <= 1 || strArray1[1] == null) { return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } string s = WWW.UnEscapeURL(strArray1[1].Split('=')[1]); byte[] data; try { data = Convert.FromBase64String(s); } catch { DebugUtility.LogError("UrlScheme invalid param"); return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } string[] strArray2 = MyEncrypt.Decrypt(JSON_MyPhotonRoomParam.LINE_PARAM_ENCODE_KEY, data, false).Split('&'); if (strArray2 == null || strArray2.Length != 4) { return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } int num = 0; FlowNode_OnUrlSchemeLaunch.LINEParam lineParam = new FlowNode_OnUrlSchemeLaunch.LINEParam(); foreach (string str1 in strArray2) { char[] chArray = new char[1] { '=' }; string[] strArray3 = str1.Split(chArray); if (strArray3 == null || strArray3.Length != 2) { return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } if (strArray3[0].Equals("iname")) { lineParam.iname = strArray3[1]; num |= 1; } else if (strArray3[0].Equals("type")) { lineParam.type = (JSON_MyPhotonRoomParam.EType) int.Parse(strArray3[1]); num |= 2; } else if (strArray3[0].Equals("creatorFUID")) { lineParam.creatorFUID = strArray3[1]; num |= 4; } else if (strArray3[0].Equals("roomid")) { lineParam.roomid = int.Parse(strArray3[1]); num |= 8; } } for (int index = 0; index < 4; ++index) { if ((num & 1 << index) == 0) { return((FlowNode_OnUrlSchemeLaunch.LINEParam)null); } } return(lineParam); }