public void FileEncrypt(string path) { string text1 = myFileReader.read(path); string text2 = mycCipherMachine.Encrypt(text1); myFileWrite.Write(path, text2); }
private void ParallelDownLoad(Dictionary <int, string> container, string info, IPlugin lrcDown) { toolStripStatusLabel_Information.Text = info; toolStripProgressBar_DownLoad.Value = 0; toolStripProgressBar_DownLoad.Maximum = container.Count; Parallel.ForEach(container, new ParallelOptions() { MaxDegreeOfParallelism = Config.configValue.option_ThreadNumber }, (item) => { try { FileWrite fs = new FileWrite(); byte[] lrcData = null; if (Config.configValue.option_IgnoreFile && checkMusicExits(item.Value)) { listView_Music.Items[item.Key].SubItems[1].Text = "略过"; } else { // 下载歌词 if (lrcDown.Down(item.Value, ref lrcData, Config.configValue.option_ThreadNumber) == true) { listView_Music.Items[item.Key].SubItems[1].Text = "成功"; if (fs.Write(ref lrcData, item.Value, Config.configValue.option_Encoding, Config.configValue.option_UserDirectory)) { lock (LongLife.MusicPathFailedList) LongLife.MusicPathFailedList.Remove(item.Key); } else { listView_Music.Items[item.Key].SubItems[1].Text = "失败"; } } else { listView_Music.Items[item.Key].SubItems[1].Text = "失败"; lock (LongLife.MusicPathFailedList) { if (!LongLife.MusicPathFailedList.ContainsKey(item.Key)) { LongLife.MusicPathFailedList.Add(item.Key, item.Value); } } } } } catch (Exception exp) { Console.WriteLine(exp.ToString()); } toolStripProgressBar_DownLoad.Value++; }); }
void Update() { if (Story.canWrite == true) { FileWrite.Write(incorrectAns); Story.canWrite = false; } addQuestion = finalQuestion; finalAns = finalAnswer; if (reload2) { reload2 = false; getMathQuestions(); destroyEnemies(); reloadEnemies(); } //if correct is true get the next question and answer, add 1 to the score and destroy enemies and reload them for the next round if (Correct) { Debug.Log(answerPoints); Correct = false; getMathQuestions(); answerPoints++; destroyEnemies(); if (Story.CanReload == true) { if (answerPoints != 20) { reloadEnemies(); } } Debug.Log("Correct"); } //if incorrect is true target the player and shoot them, take 1 away from the score, get next question adn answer and destroy and relaod enemies if (incorrect) { incorrect = false; Debug.Log(answerPoints); targetPlayer(correctAnswerShip); if (reload == true) { incorrectAns.Add(finalQuestion); if (answerPoints != 0) { answerPoints--; } getMathQuestions(); reload = false; destroyEnemies(); if (Story.CanReload == true || answerPoints == 8) { if (answerPoints != 20) { reloadEnemies(); } } Debug.Log("incorrect"); } } points.text = answerPoints.ToString(); }