/// <summary> /// 文字列を設定します。 /// 保存はしないので Save() を実行してください。 /// </summary> /// <param name="key">Key.</param> /// <param name="value">Value.</param> public static void SetEncryptedString(string key, string value) { string encKey = Enc.EncryptString(key); string encValue = Enc.EncryptString(value.ToString()); UnityEngine.PlayerPrefs.SetString(encKey, encValue); }
public void OnClickTask(int number) { if (currentEnc.choices[number].type == EncChoiceType.combat) { CombatChoiceNumber = number; } if (currentEnc.choices[number].cText == "Try Again?") { currentEnc = encList[2]; FindObjectOfType <AudioManager>().Play("buttonClick"); foreach (OptionButton button in buttons) { button.Destroy(); } Initialize(); } else { Debug.Log("numb " + number); currentEnc = currentEnc.PlayTurn(number); FindObjectOfType <AudioManager>().Play("buttonClick"); foreach (OptionButton button in buttons) { button.Destroy(); } Initialize(); } }
//登录 protected void btnLogin_Click(object sender, EventArgs e) { #region 验证 if (txtCompanyCode.Text.Trim().Length == 0) { Alert("请输入公司编码!"); Select(txtCompanyCode); return; } if (txtUserName.Text.Trim().Length == 0) { Alert("请输入用户名!"); Select(txtUserName); return; } if (txtPassWord.Text.Trim().Length == 0) { Alert("请输入密码!"); Select(txtPassWord); return; } #endregion string strAccountPwd = Enc.Encrypt(txtPassWord.Text.Trim(), txtCompanyCode.Text.Trim().PadLeft(8, '0')); SysLogin(0, txtUserName.Text.Trim(), strAccountPwd, string.Empty, txtCompanyCode.Text.Trim()); }
private void AutoLogin() { string strCompanyCode = CommonMethod.FinalString(Request.QueryString["code"]); if (strCompanyCode.Length > 0) { string strAuthKey = CommonMethod.FinalString(Request.QueryString["param"]); strAuthKey = Enc.Decrypt(strAuthKey, strCompanyCode.PadLeft(8, '0')); string[] param = strAuthKey.Split(','); if (param != null) { SysLogin(ValidatorHelper.ToInt(param[1], 0), "", "", param[0], strCompanyCode); } else { Alert("传入参数错误!"); return; } } else { Alert("传入参数错误!"); return; } }
public void pickRandomRest() { Debug.Log("getRandom Rest"); List <Enc> list = GetEncounterByTerrainAndFeature(restEncList, player.Tile.tileTerrain, player.Tile.tileFeatures); if (list.Count == 0) { list = GetEncounterByTerrainAndFeature(restEncList, TileTerrain.Land, player.Tile.tileFeatures); } if (list.Count == 0) { list = GetEncounterByTerrainAndFeature(restEncList, TileTerrain.Land, TileFeatures.None); } if (list.Count != 0) { int index = UnityEngine.Random.Range(0, list.Count); Debug.Log(index + " " + list.Count); currentEnc = list[UnityEngine.Random.Range(0, list.Count)]; } else { Enc temp = new Enc("Nothing eventful happens...", new List <EncChoice>(), player.Tile.tileTerrain, player.Tile.tileFeatures); currentEnc = temp; } Initialize(); }
private Enc CheckForDuplicate(List <Enc> list, Enc enc) { bool same = false; if (enc != null) { for (int i = 0; i < list.Count; i++) { same = list[i].text == enc.text; if (!same) { continue; } same = list[i].choices.Count == enc.choices.Count; if (same) { for (int l = 0; l < list[i].choices.Count; l++) { same = list[i].choices[l].cText == enc.choices[l].cText; if (!same) { break; } } } if (same) { return(list[i]); } } } return(null); }
public void pickRandom() { if (player.Tile.Encounter != null) { currentEnc = player.Tile.Encounter; player.Tile.Encounter = null; DestroyObject(player.Tile.EncQuestionMark); player.Tile.EncQuestionMark = null; } else { Debug.Log("getRandom"); List <Enc> list = GetEncounterByTerrainAndFeature(randEncList, player.Tile.tileTerrain, player.Tile.tileFeatures); if (list.Count == 0) { list = GetEncounterByTerrainAndFeature(randEncList, TileTerrain.Land, player.Tile.tileFeatures); } if (list.Count == 0) { list = GetEncounterByTerrainAndFeature(randEncList, TileTerrain.Land, TileFeatures.None); } if (list.Count != 0) { currentEnc = list[UnityEngine.Random.Range(0, list.Count)]; } else { Enc temp = new Enc("Nothing eventful happens...", new List <EncChoice>(), player.Tile.tileTerrain, player.Tile.tileFeatures); currentEnc = temp; } } Debug.Log(currentEnc.name + " " + player.Tile); Initialize(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["sesion"] != null) { Iniciar.Text = "menu"; } db = (BaseDatos)Session["db"]; if (db == null) { db = new BaseDatos(); Session["db"] = db; } //Session["sesion"]; //Session["encuestaActiva"]; if (!IsPostBack) { itemsEncuestas.Add(new ListItem("Vacio", "0")); foreach (Encuesta en in db.EncuestasActivas()) { itemsEncuestas.Add(new ListItem(en.Nombre, en.Descripcion)); } Session["itemsEncuestas"] = itemsEncuestas; Enc.DataSource = itemsEncuestas; Enc.DataBind(); } }
private List <Enc> buildEncList(string folder) { List <Enc> list = new List <Enc>(); List <Enc> tempEncList = new List <Enc>(); EncounterNodeGraph[] node = Resources.LoadAll <EncounterNodeGraph>(folder); Debug.Log(folder + " " + node.Length); Enc tempEnc = null; for (int n = 0; n < node.Length; n++) { Debug.Log("name " + node[n].name); if (node[n].nodes.Count != 0) { tempEnc = (Enc)node[n].nodes[0].GetOutputPort("encOutput").GetOutputValue(); if (tempEnc != null) { tempEnc.name = node[n].name; tempEnc.image = node[n].image; Debug.Log(tempEnc); recursiveBuildEnc(tempEnc, node, n, 0, tempEncList, tempEnc.image); list.Add(tempEnc); } } } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //项目下拉框 DataTable dt = CompanyBusiness.GetCompanyProjects(CompanyCode.ToString()); ControlHelper.BindListControl(ddlProject, dt, "PROJECTNAME", "PROJECTID"); ddlProject.Items.Remove(ddlProject.Items.FindByValue(CommonMethod.GetConfigValue("SYSPROJECTID"))); if (ProjectId > 0) { ControlHelper.SelectFlg(ddlProject, ProjectId.ToString()); } if (Request.QueryString["pid"] != null) { ControlHelper.SelectFlg(ddlProject, Enc.Decrypt(Request.QueryString["pid"], UrlEncKey)); } if (ddlProject.Items.Count > 1 && ProjectId == 0) //不是自动登录并且开通项目大于1个 { ExecStartScript("$('#sProject').show();"); } else { lblTip.Visible = true; } } }
/* * same as hip_decode1 (look in lame.h), but returns unclipped raw * floating-point samples. It is declared here, not in lame.h, because it * returns LAME's internal type sample_t. No more than 1152 samples per * channel are allowed. */ internal virtual int hip_decode1_unclipped( mpstr_tag hip, byte[] buffer, int bufferPos, int len, float[] pcm_l, float[] pcm_r) { var mp3data = new MP3Data(); var enc = new Enc(); if (hip != null) { IDecoder dec = new IDecoderAnonymousInnerClass(this, bufferPos); var @out = new float?[OUTSIZE_UNCLIPPED]; Decode.Factory <float?> tFactory = new FactoryAnonymousInnerClass(this); // XXX should we avoid the primitive type version? var pcmL = new float?[pcm_l.Length]; for (var i = 0; i < pcmL.Length; i++) { pcmL[i] = Convert.ToSingle(pcm_l[i]); } var pcmR = new float?[pcm_r.Length]; for (var i = 0; i < pcmR.Length; i++) { pcmR[i] = Convert.ToSingle(pcm_r[i]); } var decode1_headersB_clipchoice = this.decode1_headersB_clipchoice( hip, buffer, bufferPos, len, pcmL, 0, pcmR, 0, mp3data, enc, @out, OUTSIZE_UNCLIPPED, dec, tFactory); for (var i = 0; i < pcmL.Length; i++) { pcm_l[i] = pcmL[i].Value; } for (var i = 0; i < pcmR.Length; i++) { pcm_r[i] = pcmR[i].Value; } return(decode1_headersB_clipchoice); } return(0); }
private void btnLoad_Click(object sender, RoutedEventArgs e) { try { FileInfo preset = (FileInfo)Presets.SelectedItem; if (preset != null) { if (File.Exists(preset.FullName)) { var param = jxlNET.Presets.Load(preset.FullName); if (param != null) { //Enc.Params = param; Enc.Params.Clear(); if (param.Count > 0) { foreach (var p in param) { Enc.AddOrReplaceParam(p); } } } } else { MessageBox.Show("Preset not found: " + preset); } } } catch (Exception error) { Console.WriteLine(error.ToString()); } }
public static void SaveString(string key, string value) { string encKey = Enc.EncryptString(key); string encValue = Enc.EncryptString(value.ToString()); PlayerPrefs.SetString(encKey, encValue); PlayerPrefs.Save(); }
protected string GetAdminStr(string strAdminId, string strAccount, string strCode) { string strResult = string.Format(" <a href=\"###\" title=\"{3}\" name=\"account\" id=\"{0},{1}\">{2}</a>", Enc.Encrypt(strAdminId, UrlEncKey), Enc.Encrypt(strCode, UrlEncKey), strAdminId.Equals("0") ? "未开通" : strAccount, strAdminId.Equals("0") ? "点击开通初始账号" : "点击修改账号信息"); return(strResult); }
internal virtual int hip_decode1_headersB( mpstr_tag hip, byte[] buffer, int len, short[] pcm_l, short[] pcm_r, MP3Data mp3data, Enc enc) { if (hip != null) { IDecoder dec = new IDecoderAnonymousInnerClass2(this); var @out = new short?[OUTSIZE_CLIPPED]; Decode.Factory <short?> tFactory = new FactoryAnonymousInnerClass2(this); // XXX should we avoid the primitive type version? var pcmL = new short?[pcm_l.Length]; for (var i = 0; i < pcmL.Length; i++) { pcmL[i] = Convert.ToInt16(pcm_l[i]); } var pcmR = new short?[pcm_r.Length]; for (var i = 0; i < pcmR.Length; i++) { pcmR[i] = Convert.ToInt16(pcm_r[i]); } var decode1_headersB_clipchoice = this.decode1_headersB_clipchoice( hip, buffer, 0, len, pcmL, 0, pcmR, 0, mp3data, enc, @out, OUTSIZE_CLIPPED, dec, tFactory); for (var i = 0; i < pcmL.Length; i++) { pcm_l[i] = pcmL[i].Value; } for (var i = 0; i < pcmR.Length; i++) { pcm_r[i] = pcmR[i].Value; } return(decode1_headersB_clipchoice); } return(-1); }
private void btnEncode_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtBoxInput.Text) || string.IsNullOrEmpty(txtBoxOutput.Text)) { return; } // Start Encoding Enc.Encode(); // synchronous }
private void LoadAllEncounters() { encList = buildEncList("StoryEncounters"); if (encList.Count > 0) { encIndex = 0; currentEnc = GetEncounterByName(encList, firstMainStoryEncounterName); } randEncList = buildEncList("RandomStoryEncounters"); restEncList = buildEncList("RestEncounter"); }
protected void btnSave_Click(object sender, EventArgs e) { USER_SHARE_FUNMENUMODEL usfModel = null; bool isEdit = FmId > 0 && ActionType.Equals("edit"); bool isSuccess = false; //日志记录 USER_SHARE_LOGMODEL logModel = new USER_SHARE_LOGMODEL(); logModel.LOGID = CommonBusiness.GetSeqID("S_USER_SHARE_LOG"); logModel.OPERATEDATE = DateTime.Now; logModel.OPERATORID = AccountId; logModel.PROJECTID = ProjectId; logModel.COMPANYID = CompanyId; int nProjectId = ValidatorHelper.ToInt(Enc.Decrypt(Request.QueryString["projectid"], UrlEncKey), 0); //新增 if (!isEdit) { usfModel = new USER_SHARE_FUNMENUMODEL(); usfModel.FMID = CommonBusiness.GetSeqID("S_USER_SHARE_FUNMENU"); usfModel.PROJECTID = nProjectId; usfModel.FMPARENTID = FmId > 0 ? FmId : 0; logModel.OPERATETYPE = int.Parse(ShareEnum.LogType.AddProjectFunMenu.ToString("d")); logModel.OPERATECONTENT = "新增项目功能菜单,项目ID:" + usfModel.PROJECTID + ",菜单名称:" + txtFMName.Text.Trim(); } //修改 else { usfModel = ProjectFunBusiness.GetModel(FmId); logModel.OPERATETYPE = int.Parse(ShareEnum.LogType.EditProjectFunMenu.ToString("d")); logModel.OPERATECONTENT = "修改项目功能菜单,菜单ID:" + FmId + ",修改后菜单名称:" + txtFMName.Text.Trim(); } usfModel.FMNAME = txtFMName.Text.Trim(); usfModel.FMPAGEURL = txtFMPageUrl.Text.Trim(); usfModel.FMSORTNUM = ValidatorHelper.ToInt(txtFMSortNum.Text, 0); usfModel.FMDESC = txtFMDesc.Text.Trim(); if (!isEdit) { isSuccess = ProjectFunBusiness.AddProjectFun(usfModel, logModel); } else { isSuccess = ProjectFunBusiness.UpdateProjectFun(usfModel, logModel); } Alert((isEdit ? "修改" : "新增") + "功能菜单" + (isSuccess ? "成功" : "失败,请重试") + "!"); //刷新父页面 ExecStartScript(string.Format("parent.location='ProjectFunManage.aspx?pid={0}&s={1}';", Request.QueryString["projectid"], new Random(10000).Next())); }
public CString(string str, CEncoding env = CEncoding.Ascii) { Enc = env.ToEncoding(); Str = str; var data = Enc.GetBytes(str + '\0'); Size = data.Length; Alloc(Size); Marshal.Copy(data, 0, Ptr, Size); }
/* * For lame_decode: return code * -1 error * 0 ok, but need more data before outputing any samples * n number of samples output. Will be at most one frame of * MPEG data. */ internal virtual int hip_decode1_headers( mpstr_tag hip, byte[] buffer, int len, short[] pcm_l, short[] pcm_r, MP3Data mp3data) { var enc = new Enc(); return(hip_decode1_headersB(hip, buffer, len, pcm_l, pcm_r, mp3data, enc)); }
public static byte[] GetBytes(string str, Enc e = Enc.UTF8) { if (e == Enc.ASCII) { return(Encoding.ASCII.GetBytes(str)); } if (e == Enc.UTF8) { return(Encoding.UTF8.GetBytes(str)); } throw new Exception("Encoding not implemented"); }
/// <summary> /// 保存されている文字列を取得します。 /// Key がない場合は、デフォルト値を取得します(保存は行いません)。 /// </summary> /// <returns>The encrypted string.</returns> /// <param name="key">Key.</param> /// <param name="defaultValue">Default value.</param> public static string LoadEncryptedString(string key, string defaultValue) { string encKey = Enc.EncryptString(key); string encString = UnityEngine.PlayerPrefs.GetString(encKey, string.Empty); if (string.IsNullOrEmpty(encString)) { return(defaultValue); } string decryptedValueString = Enc.DecryptString(encString); return(decryptedValueString); }
/// <summary> /// Преобразование массива байтов в строку HEX /// </summary> /// <param name="md5Hash"></param> /// <param name="input"></param> /// <returns></returns> string GetMd5Hash(MD5 md5Hash, string input) { byte[] data = md5Hash.ComputeHash(Enc.GetBytes(input)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < data.Length; i++) { sBuilder.Append(data[i].ToString("x2")); } return(sBuilder.ToString()); }
private async void btnEncodeAsync_Click(object sender, RoutedEventArgs e) { txtBoxStatus.Text = "encoding started ..."; // run a encoding in other thread var result = await Enc.EncodeAsync(); //async Task // encoding is finished here // modify UI object in UI thread Console.WriteLine(result); txtBoxStatus.Text = "encoding done. "; }
public static byte[] ToByteArray(string Input, string EncodingType) { Encoding Enc; try { Enc = Encoding.GetEncoding(EncodingType); } catch { throw new Exception("Invalid Encoding Type Specified"); } return(Enc.GetBytes(Input)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //修改 if (Request.QueryString["id"] != null) { LoadProjectInfo(Enc.Decrypt(Request.QueryString["id"], UrlEncKey)); } else //新增 { lblProjectKey.Text = System.Guid.NewGuid().ToString().ToUpper(); } } }
/// <summary> /// 删除一个车辆分组 /// </summary> /// <param name="context"></param> /// <returns></returns> private string DelGroup(HttpContext context) { int nGroupId = ValidatorHelper.ToInt(Enc.Decrypt(context.Request.QueryString["gid"], UrlEncKey), 0); //日志记录 USER_SHARE_LOGMODEL logModel = new USER_SHARE_LOGMODEL(); logModel.LOGID = CommonBusiness.GetSeqID("S_USER_SHARE_LOG"); logModel.OPERATEDATE = DateTime.Now; logModel.OPERATORID = AccountId; logModel.PROJECTID = ProjectId; logModel.COMPANYID = CompanyId; logModel.OPERATETYPE = int.Parse(ShareEnum.LogType.ChangeProjectFunMenuStatus.ToString("d")); logModel.OPERATECONTENT = "设置车辆分组状态为" + EnumPlus.GetEnumDescription(typeof(ShareEnum.LogType), logModel.OPERATETYPE.ToString()); return(CompanyGroupBusiness.SetGroupStop(nGroupId, logModel) ? "0" : "1"); }
/// <summary> /// 加载项目菜单 /// </summary> /// <param name="context"></param> /// <returns></returns> private string LoadProjectFunMenu(HttpContext context) { string strProjectId = Enc.Decrypt(context.Request.QueryString["projectid"], UrlEncKey); StringBuilder sb = new StringBuilder(); sb.Append("["); if (strProjectId.Length > 0) { DataTable terminate = new DataTable(); terminate.Columns.Add("FMID"); terminate.Columns.Add("FMPARENTID"); terminate.Columns.Add("FMNAME"); terminate.Columns.Add("FMPAGEURL"); terminate.Columns.Add("FMDESC"); terminate.Columns.Add("FMSORTNUM"); DataTable dtProjectFunMenu = ProjectFunBusiness.GetFunMenuList(" AND PROJECTID=" + strProjectId); ReConstructionDataTable(dtProjectFunMenu, terminate, 0); DataRow row; DataRowCollection drc = terminate.Rows; int rowCount = drc.Count; if (rowCount > 0) { for (int i = 0; i < rowCount; i++) { row = drc[i]; sb.Append("["); sb.AppendFormat("{0},{1},", row["FMID"], row["FMPARENTID"]); sb.Append("["); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}'", row["FMNAME"], row["FMPAGEURL"], row["FMSORTNUM"], row["FMDESC"], Enc.Encrypt(row["FMID"].ToString(), UrlEncKey)); sb.Append("]"); if (i != rowCount - 1) { sb.Append("],"); } else { sb.Append("]"); } } sb.Append("]"); } } return(sb.ToString()); }
// GetValue should be overridden to return a value for any specified output port public override object GetValue(NodePort port) { // After you've gotten your input values, you can perform your calculations and return a value if (port.fieldName == "text") { return(text); } if (port.fieldName == "test") { if (GetInputPort("test") != null) { return(GetInputPort("test").GetInputValue()); } else { return(text); } } if (port.fieldName == "encOutput") { Enc temp = new Enc(text, choices, terrainType, featureType); temp.requiredVariable = requiredVariable; temp.requiredVariableKey = requiredVariableKey; temp.rollSleep = rollSleep; temp.hasReward = hasReward; temp.hasCost = hasCost; temp.hpCost = hpCost; temp.staminaCost = staminaCost; temp.goldCost = goldCost; temp.itemCost = itemCost; temp.hpReward = hpReward; temp.staminaReward = staminaReward; temp.goldReward = goldReward; temp.itemReward = itemReward; temp.hasVariable = hasVariable; temp.variableKey = variableKey; temp.variableValue = variableValue; temp.opensEncounter = opensEncounter; temp.encounters = encounters; temp.triggerOnComplete = triggerOnComplete; return(temp); } return(false); }
public void CloseDialogue() { FindObjectOfType <AudioManager>().Play("buttonClick"); //todo functionality encIndex++; List <string> openList = currentEnc.encounters; bool startRightAway = false; for (int i = 0; i < openList.Count; i++) { Enc temp = GetEncounterByName(encList, openList[i]); if (temp != null && CheckForDuplicate(openMainStory, temp) == null) { openMainStory.Add(GetEncounterByName(encList, openList[i])); } if (currentEnc.triggerOnComplete != null && i < currentEnc.triggerOnComplete.Count && currentEnc.triggerOnComplete[i]) { currentEnc = GetEncounterByName(encList, openList[i]); startRightAway = true; } else if (temp != null) { //todo spawn stuff GameTile spawn = GetNearestTile(temp.terrainType, temp.featureType, 3); spawn.Encounter = temp; spawn.EncQuestionMark = Instantiate(questionMarkPrefab); spawn.EncQuestionMark.transform.position = spawn.transform.position; } } foreach (OptionButton button in buttons) { button.Destroy(); } if (startRightAway) { Initialize(); } else { ui.gameObject.SetActive(false); GameStateManager.Instance.startMovement(); } }