Exemple #1
0
        public void Tex()
        {
            string path = "ShaGPattern.tcd";

            if (!File.Exists(path))
            {
                return;
            }
            StreamReader    streamReader    = new StreamReader(path, 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("ShaGResource.tcd", FileMode.Open, FileAccess.Read);
            int        num1       = 0;
            string     sourceString;

            while ((sourceString = streamReader.ReadLine()) != null)
            {
                List <byte> byteList = new List <byte>();
                string      message  = Masking.DecryptString(sourceString, "sasanasi");
                string[]    strArray = message.Split('_');
                int         num2     = int.Parse(strArray[1]);
                if (!File.Exists(path))
                {
                    return;
                }
                int num3 = num2;
                Textures.texSizeList.Add(strArray[0], new int[2]
                {
                    num1,
                    int.Parse(strArray[1])
                });
                num1 += num3;
                this.ProgressUpdated?.Invoke(this, new TextureLoadProgressUpdatedEventArgs(strArray[0], (double)num1 / fileStream.Length));
            }
            fileStream.Close();
            streamReader.Close();
            for (int index = 0; index < this.parent.KeepTexList.Length; ++index)
            {
                this.ReadTex(this.parent.KeepTexList[index]);
            }
            this.ProgressUpdated?.Invoke(this, null);
        }
Exemple #2
0
        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);
        }