public void ReadTex(string graphicsName) { List <byte> byteList = new List <byte>(); FileStream fileStream = new FileStream("ShaGResource.tcd", FileMode.Open, FileAccess.Read); if (!this.parent.Tex.ContainsKey(graphicsName)) { int num1 = 0; fileStream.Position = Textures.texSizeList[graphicsName][0]; int num2; for (int index = Textures.texSizeList[graphicsName][1]; (num2 = fileStream.ReadByte()) != -1 && num1 < index - 1; ++num1) { byte code = (byte)num2; if (num1 > 1024) { byteList.Add(code); } else { byteList.Add(Masking.DecryptByte(code)); } } Stream Memory = new MemoryStream(byteList.ToArray()); try { this.parent.Tex.Add(graphicsName, new SlimTex(Memory, Usage.None)); } catch { } } fileStream.Close(); fileStream.Dispose(); }
public void Init() { string path1 = "music/looppoint.txt"; if (!File.Exists(path1)) { return; } StreamReader streamReader1 = new StreamReader(path1, Encoding.GetEncoding("Shift_JIS")); int index1 = 0; this.musicNames.Clear(); string str; while ((str = streamReader1.ReadLine()) != null) { string[] strArray = str.Split(','); this.musiclength[0, index1] = int.Parse(strArray[0]); this.musiclength[1, index1] = int.Parse(strArray[1]); this.musicNames.Add(strArray[3] + ".ogg"); ++index1; } streamReader1.Close(); string path2 = "ShaSPattern.tcd"; if (!File.Exists(path2)) { return; } StreamReader streamReader2 = new StreamReader(path2, Encoding.GetEncoding("Shift_JIS")); RijndaelManaged rijndaelManaged = new RijndaelManaged(); Masking.GenerateKeyFromPassword("sasanasi", rijndaelManaged.KeySize, out byte[] key, rijndaelManaged.BlockSize, out byte[] iv); FileStream fileStream = new FileStream("ShaSResource.tcd", FileMode.Open, FileAccess.Read); var fileStreamTotalBytes = fileStream.Length; string sourceString; while ((sourceString = streamReader2.ReadLine()) != null) { List <byte> byteList = new List <byte>(); string[] strArray = Masking.DecryptString(sourceString, "sasanasi").Split('_'); int num1 = int.Parse(strArray[1]); if (!File.Exists(path2)) { return; } int num2; for (int index2 = 0; (num2 = fileStream.ReadByte()) != -1 && index2 < num1 - 1; ++index2) { byte code = (byte)num2; if (index2 > 1024) { byteList.Add(code); } else { byteList.Add(Masking.DecryptByte(code)); } } var currentByteOffset = fileStream.Position; Stream stream = new MemoryStream(byteList.ToArray()); if (strArray[0].Split('.')[1] == "wav") { this.SoundMake(strArray[0], stream); this.soundNames.Add(strArray[0]); } this.ProgressUpdated?.Invoke(this, new AudioLoadProgressUpdatedEventArgs(strArray[0], (double)currentByteOffset / fileStreamTotalBytes)); } fileStream.Close(); streamReader2.Close(); this.ProgressUpdated?.Invoke(this, null); }