// Token: 0x060028F8 RID: 10488 RVA: 0x0009AECC File Offset: 0x000990CC
 public void method_7()
 {
     foreach (KeyValuePair <string, Class143.Class144> keyValuePair in this.dictionary_0)
     {
         keyValuePair.Value.Dispose();
     }
     this.dictionary_0.Clear();
     this.stream_0 = File.Open(Class291.string_14, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
     using (Stream3 stream = new Stream3(this.stream_0))
     {
         using (BinaryReader binaryReader = new BinaryReader(stream))
         {
             byte[] array  = Class143.byte_0;
             byte[] array2 = binaryReader.ReadBytes(array.Length);
             if (!array2.smethod_9(array))
             {
                 throw new InvalidFileType(array, array2);
             }
             int num = binaryReader.ReadInt32();
             if (num < this.MinimumVersion || num > this.MaximumVersion)
             {
                 throw new InvalidFileVersion <int>(this.MinimumVersion, this.MaximumVersion, num);
             }
             this.method_9(this.stream_0, binaryReader, num);
         }
     }
     foreach (string filePath in Class234.smethod_1(this.class112_0.ScreenshotSaveDirectory, "*.jpg", ".jpg"))
     {
         this.method_6(filePath);
     }
     if (this.int_0 > 10)
     {
         this.method_8();
     }
 }
 // Token: 0x060020A6 RID: 8358 RVA: 0x0006DCD8 File Offset: 0x0006BED8
 public static void smethod_2(Class321 pd, BinaryWriter write_stream, uint offset_orig, uint offset_new, Stream stream_orig, Stream stream_new)
 {
     using (Stream3 stream = new Stream3(stream_orig))
     {
         using (Stream3 stream2 = new Stream3(stream_new))
         {
             uint num;
             uint num2;
             Class132.smethod_3(stream, out num, out num2);
             uint num3;
             uint num4;
             Class132.smethod_3(stream2, out num3, out num4);
             using (Stream3 stream3 = new Stream3(stream, 0L, (long)((ulong)num)))
             {
                 using (Stream3 stream4 = new Stream3(stream2, 0L, (long)((ulong)num3)))
                 {
                     Class292.smethod_12(pd, Enum81.const_0, write_stream, offset_orig, offset_new, stream3, stream4);
                 }
             }
             using (Stream3 stream5 = new Stream3(stream, (long)((ulong)num), (long)((ulong)(num + num2))))
             {
                 using (Stream3 stream6 = new Stream3(stream2, (long)((ulong)num3), (long)((ulong)(num3 + num4))))
                 {
                     Class136.smethod_0(pd, write_stream, offset_orig + num, offset_new + num3, stream5, stream6);
                 }
             }
         }
     }
 }
예제 #3
0
    private void method_0(int A_0)
    {
        if (A_0 >= 0)
        {
            Class297 class2 = this.class1004_0.Interface51.imethod_1().method_0()[A_0];
            int      num    = class2.method_6();
            string   key    = class2.method_0();
            this.method_0(num);
            switch (class2.method_2())
            {
            case Class297.EntryType.Storage:
                this.sortedList_0.Add(key, new Class1069(this.class1004_0, class2));
                this.list_0.Add(key);
                break;

            case Class297.EntryType.Stream:
                if (!this.list_1.Contains(key))
                {
                    Stream3 stream = new Stream3(this.class1004_0, class2);
                    this.sortedList_0.Add(key, stream);
                    this.list_1.Add(key);
                }
                break;

            default:
                throw new NotImplementedException();
            }
            int num2 = class2.method_8();
            this.method_0(num2);
        }
    }
        // Token: 0x060020A8 RID: 8360 RVA: 0x0006DF14 File Offset: 0x0006C114
        private void method_6(Stream file_stream, BinaryReader reader, bool loadIcon, bool populateData)
        {
            this.ID             = reader.smethod_29();
            this.DataHash       = reader.smethod_24();
            this.LoaderPack     = Struct43.smethod_5(this.DataHash, Struct43.struct43_0);
            this.UpdateUri      = reader.smethod_32();
            this.Name           = reader.ReadString();
            this.Author         = reader.ReadString();
            this.Description    = reader.ReadString();
            this.Version        = reader.smethod_27();
            this.MinimumVersion = reader.smethod_27();
            this.PasswordHash   = reader.smethod_24();
            int num = reader.ReadInt32();

            if (num > 0)
            {
                if (loadIcon)
                {
                    using (Stream3 stream = new Stream3(file_stream, file_stream.Position, (long)num + file_stream.Position))
                    {
                        this.memoryStream_0 = new MemoryStream();
                        stream.CopyTo(this.memoryStream_0);
                        this.Icon = (Bitmap)Image.FromStream(this.memoryStream_0);
                        goto IL_EE;
                    }
                }
                file_stream.Position += (long)num;
            }
IL_EE:
            if (this.LoaderPack)
            {
                if (populateData)
                {
                    this.Data = new Class136();
                    return;
                }
            }
            else
            {
                int num2 = reader.ReadInt32();
                for (int i = 0; i < num2; i++)
                {
                    this.ItemIndex.Add(reader.ReadString(), reader.smethod_24());
                }
                int num3 = reader.ReadInt32();
                if (populateData)
                {
                    using (Stream3 stream2 = new Stream3(file_stream, file_stream.Position, (long)num3 + file_stream.Position))
                    {
                        this.Data = new Class136(stream2);
                        this.Data.method_12();
                        return;
                    }
                }
                file_stream.Position += (long)num3;
            }
        }
예제 #5
0
 // Token: 0x060026CB RID: 9931 RVA: 0x0008B08C File Offset: 0x0008928C
 public static void smethod_12(Stream stream)
 {
     lock (Struct40.object_0)
     {
         using (Stream3 stream2 = new Stream3(stream))
         {
             using (BinaryWriter binaryWriter = new BinaryWriter(stream2))
             {
                 binaryWriter.Write(Struct40.byte_0);
                 binaryWriter.Write(Struct40.dictionary_2.Count);
                 using (Dictionary <Class177, Dictionary <Class464, Dictionary <uint, List <uint> > > > .Enumerator enumerator = Struct40.dictionary_2.GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         BinaryWriter binaryWriter2 = binaryWriter;
                         KeyValuePair <Class177, Dictionary <Class464, Dictionary <uint, List <uint> > > > keyValuePair = enumerator.Current;
                         binaryWriter2.Write(keyValuePair.Key.uint_0);
                         BinaryWriter binaryWriter3 = binaryWriter;
                         KeyValuePair <Class177, Dictionary <Class464, Dictionary <uint, List <uint> > > > keyValuePair2 = enumerator.Current;
                         binaryWriter3.Write(keyValuePair2.Value.Count);
                         KeyValuePair <Class177, Dictionary <Class464, Dictionary <uint, List <uint> > > > keyValuePair3 = enumerator.Current;
                         using (Dictionary <Class464, Dictionary <uint, List <uint> > > .Enumerator enumerator2 = keyValuePair3.Value.GetEnumerator())
                         {
                             while (enumerator2.MoveNext())
                             {
                                 BinaryWriter binaryWriter4 = binaryWriter;
                                 KeyValuePair <Class464, Dictionary <uint, List <uint> > > keyValuePair4 = enumerator2.Current;
                                 binaryWriter4.Write(keyValuePair4.Key.string_1);
                                 BinaryWriter binaryWriter5 = binaryWriter;
                                 KeyValuePair <Class464, Dictionary <uint, List <uint> > > keyValuePair5 = enumerator2.Current;
                                 binaryWriter5.Write(keyValuePair5.Value.Count);
                                 KeyValuePair <Class464, Dictionary <uint, List <uint> > > keyValuePair6 = enumerator2.Current;
                                 using (Dictionary <uint, List <uint> > .Enumerator enumerator3 = keyValuePair6.Value.GetEnumerator())
                                 {
                                     while (enumerator3.MoveNext())
                                     {
                                         BinaryWriter binaryWriter6 = binaryWriter;
                                         KeyValuePair <uint, List <uint> > keyValuePair7 = enumerator3.Current;
                                         binaryWriter6.Write(keyValuePair7.Key);
                                         BinaryWriter binaryWriter7 = binaryWriter;
                                         KeyValuePair <uint, List <uint> > keyValuePair8 = enumerator3.Current;
                                         binaryWriter7.Write(keyValuePair8.Value.Count);
                                         KeyValuePair <uint, List <uint> > keyValuePair9 = enumerator3.Current;
                                         foreach (uint value in keyValuePair9.Value)
                                         {
                                             binaryWriter.Write(value);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 // Token: 0x06001556 RID: 5462 RVA: 0x000319F0 File Offset: 0x0002FBF0
 public Class86(Stream stream)
 {
     using (Stream3 stream2 = new Stream3(stream))
     {
         using (BinaryReader binaryReader = new BinaryReader(stream2))
         {
             this.method_0(binaryReader);
         }
     }
 }
예제 #7
0
    Stream1 Interface61.imethod_0(string A_0)
    {
        Stream3 stream = this.sortedList_0[A_0] as Stream3;

        if (stream != null)
        {
            stream.vmethod_1();
        }
        return(new Stream2(stream));
    }
 // Token: 0x0600155A RID: 5466 RVA: 0x00031B8C File Offset: 0x0002FD8C
 public void method_2(Stream stream)
 {
     using (Stream3 stream2 = new Stream3(stream))
     {
         using (BinaryWriter binaryWriter = new BinaryWriter(stream2))
         {
             this.method_3(binaryWriter);
         }
     }
 }
예제 #9
0
    void Interface61.imethod_1(string A_0)
    {
        Stream3 stream = this.sortedList_0[A_0] as Stream3;

        if (stream != null)
        {
            this.class1004_0.method_18(stream.Interface59.imethod_0());
            stream.Dispose();
            this.sortedList_0.Remove(A_0);
        }
    }
예제 #10
0
    public Stream1 imethod_2(string A_0)
    {
        int num = 11;

        if (this.Interface61.imethod_3(A_0) || this.imethod_7(A_0))
        {
            throw new ArgumentOutOfRangeException(BookmarkStart.b("䈰䜲䜴制堸嘺猼帾ⱀ♂", num), BookmarkStart.b("縰儲弴制娸伺ᴼ䠾⡀㝂ⵄ杆㩈㹊⹌❎煐㵒㑔㩖㱘筚㱜㍞፠٢Ѥͦၨ䭪࡬ᝮᡰrŴѶ", num));
        }
        Class297 class2 = this.class1004_0.method_17(A_0, Class297.EntryType.Stream);
        Stream3  stream = this.class1004_0.method_5() ? new Stream4(this.class1004_0, class2) : new Stream3(this.class1004_0, class2);

        this.list_1.Add(A_0);
        this.sortedList_0.Add(A_0, stream);
        stream.vmethod_1();
        return(new Stream2(stream));
    }
예제 #11
0
        // Token: 0x0600243F RID: 9279 RVA: 0x0007AE64 File Offset: 0x00079064
        private static void smethod_1(Class321 pd, BinaryWriter write_stream, uint offset_orig, uint offset_new, string filename, Stream stream_orig, uint orig_start, uint orig_end, Stream stream_new, uint new_start, uint new_end)
        {
            uint num  = new_end - new_start;
            uint num2 = orig_end - orig_start;

            using (Stream3 stream = new Stream3(stream_orig, (long)((ulong)orig_start), (long)((ulong)orig_end)))
            {
                using (Stream3 stream2 = new Stream3(stream_new, (long)((ulong)new_start), (long)((ulong)new_end)))
                {
                    if (num == num2 && Struct43.smethod_5(stream.smethod_2(), stream2.smethod_2()))
                    {
                        Class292.smethod_4(pd, write_stream, 0U, null, 0U, num2, offset_orig + orig_start);
                    }
                    else
                    {
                        Class292.smethod_12(pd, Class292.smethod_15(filename), write_stream, offset_orig + orig_start, offset_new + new_start, stream, stream2);
                    }
                }
            }
        }
예제 #12
0
 // Token: 0x0600243E RID: 9278 RVA: 0x0007AC18 File Offset: 0x00078E18
 public static void smethod_0(Class321 pd, BinaryWriter write_stream, uint offset_orig, uint offset_new, Stream stream_orig, Stream stream_new)
 {
     using (Stream3 stream = new Stream3(stream_orig))
     {
         using (Stream3 stream2 = new Stream3(stream_new))
         {
             using (Class136 @class = new Class136(stream))
             {
                 using (Class136 class2 = new Class136(stream2))
                 {
                     List <KeyValuePair <string, Class136.Class339> > list  = new List <KeyValuePair <string, Class136.Class339> >();
                     List <KeyValuePair <string, Class136.Class339> > list2 = null;
                     long endPosition;
                     class2.method_9(ref list, out endPosition);
                     long endPosition2;
                     @class.method_9(ref list2, out endPosition2);
                     using (Stream3 stream3 = new Stream3(stream, 0L, endPosition2))
                     {
                         using (Stream3 stream4 = new Stream3(stream2, 0L, endPosition))
                         {
                             Class292.smethod_12(pd, Enum81.const_0, write_stream, offset_orig, offset_new, stream3, stream4);
                         }
                     }
                     foreach (KeyValuePair <string, Class136.Class339> keyValuePair in list)
                     {
                         if (@class.method_6(keyValuePair.Key))
                         {
                             Class136.Class339 class3 = @class[keyValuePair.Key] as Class136.Class339;
                             Class136.smethod_1(pd, write_stream, offset_orig, offset_new, keyValuePair.Key, stream, class3.uint_4, class3.uint_4 + class3.DataLength, stream2, keyValuePair.Value.uint_4, keyValuePair.Value.uint_4 + keyValuePair.Value.DataLength);
                         }
                         else
                         {
                             class2.method_15(keyValuePair.Value);
                             Class292.smethod_4(pd, write_stream, keyValuePair.Value.DataLength, keyValuePair.Value.Data, 0U, 0U, 0U);
                         }
                     }
                 }
             }
         }
     }
 }
 // Token: 0x06001E48 RID: 7752 RVA: 0x000623E0 File Offset: 0x000605E0
 private static void smethod_16(Stream stream_orig, Stream stream_new, Stream stream_patch, Enum81 type)
 {
     using (Stream3 stream = new Stream3(stream_orig))
     {
         using (Stream3 stream2 = new Stream3(stream_new))
         {
             using (Stream3 stream3 = new Stream3(stream_patch))
             {
                 using (BinaryWriter binaryWriter = new BinaryWriter(stream3))
                 {
                     Class292.smethod_7(binaryWriter, stream, stream2);
                     Class321 @class = new Class321();
                     Class292.smethod_12(@class, type, binaryWriter, 0U, 0U, stream, stream2);
                     Class292.smethod_8(@class, binaryWriter);
                     @class.queue_0 = null;
                     @class.uint_6  = null;
                 }
             }
         }
     }
 }
예제 #14
0
    private void method_2(Class1157 A_0)
    {
        object obj2 = A_0.method_12();

        if (obj2 != null)
        {
            Class297 class2 = (obj2 as Interface59).imethod_0();
            class2.method_5((byte)A_0.method_6());
            class2.method_7(this.method_3(A_0.method_0()));
            class2.method_9(this.method_3(A_0.method_2()));
            if (this.class297_0.method_10() < 0)
            {
                this.class297_0.method_11(class2.method_26());
            }
            Stream3 stream = obj2 as Stream3;
            if (stream != null)
            {
                class2.method_23((uint)stream.Length);
            }
        }
    }
 // Token: 0x060020A7 RID: 8359 RVA: 0x0006DE08 File Offset: 0x0006C008
 private static void smethod_3(Stream stream, out uint index, out uint data_length)
 {
     using (Stream3 stream2 = new Stream3(stream))
     {
         using (BinaryReader binaryReader = new BinaryReader(stream2))
         {
             binaryReader.ReadBytes(Class132.byte_0.Length);
             binaryReader.ReadInt32();
             binaryReader.smethod_29();
             Struct43 val = binaryReader.smethod_24();
             if (Struct43.smethod_5(val, Struct43.struct43_0))
             {
                 throw new LoaderPackNotSupported();
             }
             if (binaryReader.ReadBoolean())
             {
                 binaryReader.ReadString();
             }
             binaryReader.ReadString();
             binaryReader.ReadString();
             binaryReader.ReadString();
             binaryReader.smethod_27();
             binaryReader.smethod_27();
             binaryReader.smethod_24();
             int num = binaryReader.ReadInt32();
             stream.Position += (long)num;
             int num2 = binaryReader.ReadInt32();
             for (int i = 0; i < num2; i++)
             {
                 binaryReader.ReadString();
                 binaryReader.smethod_24();
             }
             data_length = (uint)binaryReader.ReadInt32();
             index       = (uint)stream.Position;
         }
     }
 }
        // Token: 0x06001E4A RID: 7754 RVA: 0x000624D8 File Offset: 0x000606D8
        public void method_1(Stream stream_orig, Stream stream_patch, Stream stream_dest, uint?overrideExpectedStartingFileLength, Struct43 overrideExpectedStartingHash, uint?overrideExpectedResultingFileLength, Struct43 overrideExpectedResultingHash, bool validate_expected, bool validate_result)
        {
            using (Stream3 stream = new Stream3(stream_orig))
            {
                using (Stream3 stream2 = new Stream3(stream_patch))
                {
                    using (Stream3 stream3 = new Stream3(stream_dest))
                    {
                        using (BinaryReader binaryReader = new BinaryReader(stream))
                        {
                            using (BinaryReader binaryReader2 = new BinaryReader(stream2))
                            {
                                using (BinaryWriter binaryWriter = new BinaryWriter(stream3))
                                {
                                    binaryReader2.ReadUInt32();
                                    ushort   num     = binaryReader2.ReadUInt16();
                                    uint     num2    = binaryReader2.ReadUInt32();
                                    Struct43 @struct = binaryReader2.BaseStream.smethod_22();
                                    uint     num3    = binaryReader2.ReadUInt32();
                                    Struct43 struct2 = binaryReader2.BaseStream.smethod_22();
                                    uint     num4    = 0U;
                                    if (validate_expected)
                                    {
                                        if (stream.Length != (long)((ulong)num2) && (overrideExpectedStartingFileLength == null || overrideExpectedStartingFileLength.Value != num2))
                                        {
                                            throw new InvalidDataException(string.Format("The starting file size: '{0}' does not match the expected file size: '{1}'.", stream.Length, num2));
                                        }
                                        Struct43 struct3 = stream_orig.smethod_2();
                                        if (Struct43.smethod_6(struct3, @struct) && (Struct43.smethod_5(overrideExpectedStartingHash, Struct43.struct43_0) || Struct43.smethod_6(overrideExpectedStartingHash, struct3)))
                                        {
                                            throw new InvalidDataException(string.Format("The actual starting hash: '{0}' does not match the expected hash: '{1}'.", struct3, @struct));
                                        }
                                    }
                                    byte[] buffer = new byte[4096];
                                    int    num5   = 0;
                                    uint   num7;
                                    uint   num10;
                                    do
                                    {
                                        ushort num6 = (ushort)(num7 = (uint)binaryReader2.ReadUInt16());
                                        while (num6 > 0 && !binaryReader2.smethod_3())
                                        {
                                            int num8 = binaryReader2.Read(buffer, 0, (int)((num6 > 4096) ? 4096 : num6));
                                            binaryWriter.Write(buffer, 0, num8);
                                            num6 -= (ushort)num8;
                                            num4 += (uint)((ushort)num8);
                                            if (this.eventHandler_0 != null)
                                            {
                                                int num9 = EventArgs9.smethod_0((long)((ulong)num4), (long)((ulong)num3));
                                                if (num5 != num9)
                                                {
                                                    num5 = num9;
                                                    this.eventHandler_0(this, new EventArgs9((long)((ulong)num4), (long)((ulong)num3)));
                                                }
                                            }
                                        }
                                        num6 = (ushort)(num10 = (uint)binaryReader2.ReadUInt16());
                                        if (num6 > 0)
                                        {
                                            int num11 = binaryReader2.ReadInt32();
                                            if (num < 2)
                                            {
                                                binaryReader.BaseStream.Seek((long)num11, SeekOrigin.Begin);
                                            }
                                            else
                                            {
                                                binaryReader.BaseStream.Seek((long)num11, SeekOrigin.Current);
                                            }
                                            while (num6 > 0 && !binaryReader2.smethod_3())
                                            {
                                                int num8 = binaryReader.Read(buffer, 0, (int)((num6 > 4096) ? 4096 : num6));
                                                binaryWriter.Write(buffer, 0, num8);
                                                num6 -= (ushort)num8;
                                                num4 += (uint)((ushort)num8);
                                                if (this.eventHandler_0 != null)
                                                {
                                                    int num9 = EventArgs9.smethod_0((long)((ulong)num4), (long)((ulong)num3));
                                                    if (num5 != num9)
                                                    {
                                                        num5 = num9;
                                                        this.eventHandler_0(this, new EventArgs9((long)((ulong)num4), (long)((ulong)num3)));
                                                    }
                                                }
                                            }
                                        }
                                    }while (num10 != 0U || num7 != 0U);
                                    if (validate_result)
                                    {
                                        if (stream3.Length != (long)((ulong)num3))
                                        {
                                            if (overrideExpectedResultingFileLength != null)
                                            {
                                                uint?num12  = overrideExpectedResultingFileLength;
                                                long length = stream3.Length;
                                                if ((ulong)num12.GetValueOrDefault() == (ulong)length && num12 != null)
                                                {
                                                    goto IL_2D7;
                                                }
                                            }
                                            throw new InvalidDataException(string.Format("The resulting file length: '{0}' does not match the expected data length: '{1}'.", stream3.Length, num3));
                                        }
IL_2D7:
                                        Struct43 struct4 = stream3.smethod_2();
                                        if (Struct43.smethod_6(struct4, struct2) && (Struct43.smethod_5(overrideExpectedResultingHash, Struct43.struct43_0) || Struct43.smethod_6(overrideExpectedResultingHash, struct4)))
                                        {
                                            throw new InvalidDataException(string.Format("The resulting hash: '{0}' does not match the expected hash: '{1}'.", struct4, struct2));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #17
0
파일: Class248.cs 프로젝트: uwx/Open-GHTCP
 public override void vmethod_0()
 {
     if (_class3230 != null)
     {
         KeyGenerator.WriteAllBytes(_string2 + "music\\" + String1 + ".dat.xen", _class3230.Data);
         KeyGenerator.smethod_19(_string3, _string2 + "music\\" + String1 + ".fsb.xen", true);
     }
     else
     {
         var list  = new List <string>();
         var list2 = new List <Stream>();
         GenericAudioStream stream3;
         if (_string0.Length == 1)
         {
             Stream stream;
             if (!Bool3 && AudioManager.smethod_1(_string0[0]) == AudioTypeEnum.Const1)
             {
                 stream = File.OpenRead(_string0[0]);
             }
             else
             {
                 stream = new Stream27();
                 Stream16.smethod_0(AudioManager.GetAudioStream(_string0[0]), stream, 44100, 128);
             }
             stream.Position = 0L;
             list.Add(String1 + "_song");
             list2.Add(stream);
             list.Add(String1 + "_guitar");
             if (Bool2)
             {
                 Stream stream2 = new Stream27();
                 Stream16.smethod_1(stream2, AudioManager.smethod_2(_string0[0]), 128);
                 list2.Add(stream2);
             }
             else
             {
                 list2.Add(stream);
             }
             stream3 = AudioManager.smethod_5(stream);
         }
         else
         {
             var      list3 = new List <GenericAudioStream>();
             string[] array =
             {
                 "_song",
                 "_guitar",
                 "_rhythm",
                 "_coop_song",
                 "_coop_guitar",
                 "_coop_rhythm"
             };
             for (var i = 0; i < _string0.Length; i++)
             {
                 if (_string0[i] != null && !_string0[i].Equals("") && File.Exists(_string0[i]))
                 {
                     Stream stream4;
                     if (!Bool3 && AudioManager.smethod_1(_string0[i]) == AudioTypeEnum.Const1)
                     {
                         stream4 = File.OpenRead(_string0[i]);
                     }
                     else
                     {
                         stream4 = new Stream27();
                         Stream16.smethod_0(AudioManager.GetAudioStream(_string0[i]), stream4, 44100, 128);
                     }
                     stream4.Position = 0L;
                     list.Add(String1 + array[i]);
                     list2.Add(stream4);
                     if ((_string0.Length == 6) ? (i >= 3) : (i < 3))
                     {
                         list3.Add(AudioManager.smethod_5(stream4));
                     }
                 }
             }
             stream3 = new Stream2(list3.ToArray());
             var num     = 0f;
             var stream5 = new Stream3(stream3, _timeSpan0, _timeSpan1);
             var array2  = stream5.vmethod_5(100);
             while (array2 != null && array2.Length > 0)
             {
                 var array3 = array2;
                 for (var j = 0; j < array3.Length; j++)
                 {
                     var array4 = array3[j];
                     var array5 = array4;
                     for (var k = 0; k < array5.Length; k++)
                     {
                         var value = array5[k];
                         var num2  = Math.Abs(value);
                         if (num2 > num)
                         {
                             num = num2;
                         }
                     }
                 }
                 array2 = stream5.vmethod_5(100);
             }
             (stream3 as Stream2).method_0(new INterface5[]
             {
                 new Class174(3, 1f / num)
             });
         }
         var    waveFormat = stream3.vmethod_0();
         var    t          = new TimeSpan(0, 0, 1);
         Stream stream6    = new Stream27();
         Stream16.smethod_0(new Stream2(new Stream3(stream3, _timeSpan0, _timeSpan1), new INterface5[]
         {
             new Class173(Class173.Enum26.Const0, new[]
             {
                 new Struct11(0, waveFormat.method_1(t))
             }),
             new Class173(Class173.Enum26.Const1, new[]
             {
                 new Struct11(waveFormat.method_1(_timeSpan1 - _timeSpan0 - t),
                              waveFormat.method_1(_timeSpan1 - _timeSpan0))
             })
         }), stream6, 44100, 128);
         list.Add(String1 + "_preview");
         list2.Add(stream6);
         new ZzQbSongObject(
             (int)FsbClass3.smethod_0(_string2 + "music\\" + String1 + ".fsb.xen", list2.ToArray()),
             list.ToArray()).method_2(_string2 + "music\\" + String1 + ".dat.xen");
     }
     GC.Collect();
 }
예제 #18
0
 public override void vmethod_0()
 {
     if (this.class323_0 != null)
     {
         KeyGenerator.smethod_9(this.string_2 + "music\\" + this.string_1 + ".dat.xen", this.class323_0.data);
         KeyGenerator.smethod_19(this.string_3, this.string_2 + "music\\" + this.string_1 + ".fsb.xen", true);
     }
     else
     {
         List <string>      list  = new List <string>();
         List <Stream>      list2 = new List <Stream>();
         GenericAudioStream stream3;
         if (this.string_0.Length == 1)
         {
             Stream stream;
             if (!Class248.bool_3 && AudioManager.smethod_1(this.string_0[0]) == AudioTypeEnum.const_1)
             {
                 stream = File.OpenRead(this.string_0[0]);
             }
             else
             {
                 stream = new Stream27();
                 Stream16.smethod_0(AudioManager.getAudioStream(this.string_0[0]), stream, 44100, 128);
             }
             stream.Position = 0L;
             list.Add(this.string_1 + "_song");
             list2.Add(stream);
             list.Add(this.string_1 + "_guitar");
             if (Class248.bool_2)
             {
                 Stream stream2 = new Stream27();
                 Stream16.smethod_1(stream2, AudioManager.smethod_2(this.string_0[0]), 128);
                 list2.Add(stream2);
             }
             else
             {
                 list2.Add(stream);
             }
             stream3 = AudioManager.smethod_5(stream);
         }
         else
         {
             List <GenericAudioStream> list3 = new List <GenericAudioStream>();
             string[] array = new string[]
             {
                 "_song",
                 "_guitar",
                 "_rhythm",
                 "_coop_song",
                 "_coop_guitar",
                 "_coop_rhythm"
             };
             for (int i = 0; i < this.string_0.Length; i++)
             {
                 if (this.string_0[i] != null && !this.string_0[i].Equals("") && File.Exists(this.string_0[i]))
                 {
                     Stream stream4;
                     if (!Class248.bool_3 && AudioManager.smethod_1(this.string_0[i]) == AudioTypeEnum.const_1)
                     {
                         stream4 = File.OpenRead(this.string_0[i]);
                     }
                     else
                     {
                         stream4 = new Stream27();
                         Stream16.smethod_0(AudioManager.getAudioStream(this.string_0[i]), stream4, 44100, 128);
                     }
                     stream4.Position = 0L;
                     list.Add(this.string_1 + array[i]);
                     list2.Add(stream4);
                     if ((this.string_0.Length == 6) ? (i >= 3) : (i < 3))
                     {
                         list3.Add(AudioManager.smethod_5(stream4));
                     }
                 }
             }
             stream3 = new Stream2(list3.ToArray());
             float     num     = 0f;
             Stream3   stream5 = new Stream3(stream3, this.timeSpan_0, this.timeSpan_1);
             float[][] array2  = stream5.vmethod_5(100);
             while (array2 != null && array2.Length > 0)
             {
                 float[][] array3 = array2;
                 for (int j = 0; j < array3.Length; j++)
                 {
                     float[] array4 = array3[j];
                     float[] array5 = array4;
                     for (int k = 0; k < array5.Length; k++)
                     {
                         float value = array5[k];
                         float num2  = Math.Abs(value);
                         if (num2 > num)
                         {
                             num = num2;
                         }
                     }
                 }
                 array2 = stream5.vmethod_5(100);
             }
             (stream3 as Stream2).method_0(new Interface5[]
             {
                 new Class174(3, 1f / num)
             });
         }
         WaveFormat waveFormat = stream3.vmethod_0();
         TimeSpan   t          = new TimeSpan(0, 0, 1);
         Stream     stream6    = new Stream27();
         Stream16.smethod_0(new Stream2(new Stream3(stream3, this.timeSpan_0, this.timeSpan_1), new Interface5[]
         {
             new Class173(Class173.Enum26.const_0, new Struct11[]
             {
                 new Struct11(0, waveFormat.method_1(t))
             }),
             new Class173(Class173.Enum26.const_1, new Struct11[]
             {
                 new Struct11(waveFormat.method_1(this.timeSpan_1 - this.timeSpan_0 - t), waveFormat.method_1(this.timeSpan_1 - this.timeSpan_0))
             })
         }), stream6, 44100, 128);
         list.Add(this.string_1 + "_preview");
         list2.Add(stream6);
         new zzQbSongObject((int)ns20.FSBClass2.smethod_0(this.string_2 + "music\\" + this.string_1 + ".fsb.xen", list2.ToArray()), list.ToArray()).method_2(this.string_2 + "music\\" + this.string_1 + ".dat.xen");
     }
     GC.Collect();
 }
예제 #19
0
 // Token: 0x060026CC RID: 9932 RVA: 0x0008B31C File Offset: 0x0008951C
 public static void smethod_13(Stream stream)
 {
     lock (Struct40.object_0)
     {
         Struct40.smethod_11();
         try
         {
             using (Stream3 stream2 = new Stream3(stream))
             {
                 using (BinaryReader binaryReader = new BinaryReader(stream2))
                 {
                     byte[] array = binaryReader.ReadBytes(Struct40.byte_0.Length);
                     if (!array.smethod_9(Struct40.byte_0))
                     {
                         throw new InvalidFileType(Struct40.byte_0, array);
                     }
                     int num = binaryReader.ReadInt32();
                     for (int i = 0; i < num; i++)
                     {
                         Class177 @class = Class177.smethod_0(binaryReader.ReadUInt32());
                         int      num2   = binaryReader.ReadInt32();
                         Dictionary <Class464, Dictionary <uint, uint> > dictionary;
                         if (Struct40.dictionary_0.ContainsKey(@class))
                         {
                             dictionary = Struct40.dictionary_0[@class];
                         }
                         else
                         {
                             Struct40.dictionary_0.Add(@class, dictionary = new Dictionary <Class464, Dictionary <uint, uint> >());
                         }
                         Dictionary <Class464, Dictionary <uint, List <uint> > > dictionary2;
                         if (Struct40.dictionary_2.ContainsKey(@class))
                         {
                             dictionary2 = Struct40.dictionary_2[@class];
                         }
                         else
                         {
                             Struct40.dictionary_2.Add(@class, dictionary2 = new Dictionary <Class464, Dictionary <uint, List <uint> > >());
                         }
                         Dictionary <uint, uint> dictionary3;
                         if (Struct40.dictionary_1.ContainsKey(@class))
                         {
                             dictionary3 = Struct40.dictionary_1[@class];
                         }
                         else
                         {
                             Struct40.dictionary_1.Add(@class, dictionary3 = new Dictionary <uint, uint>());
                         }
                         for (int j = 0; j < num2; j++)
                         {
                             Class464 key  = Class464.Cogs[binaryReader.ReadString()];
                             int      num3 = binaryReader.ReadInt32();
                             Dictionary <uint, uint> dictionary4;
                             if (dictionary.ContainsKey(key))
                             {
                                 dictionary4 = dictionary[key];
                             }
                             else
                             {
                                 dictionary.Add(key, dictionary4 = new Dictionary <uint, uint>());
                             }
                             Dictionary <uint, List <uint> > dictionary5;
                             if (dictionary2.ContainsKey(key))
                             {
                                 dictionary5 = dictionary2[key];
                             }
                             else
                             {
                                 dictionary2.Add(key, dictionary5 = new Dictionary <uint, List <uint> >());
                             }
                             for (int k = 0; k < num3; k++)
                             {
                                 uint        key2 = binaryReader.ReadUInt32();
                                 int         num4 = binaryReader.ReadInt32();
                                 List <uint> list;
                                 if (dictionary5.ContainsKey(key2))
                                 {
                                     list = dictionary5[key2];
                                 }
                                 else
                                 {
                                     dictionary5.Add(key2, list = new List <uint>());
                                 }
                                 uint num5 = 0U;
                                 for (int l = 0; l < num4; l++)
                                 {
                                     uint num6 = binaryReader.ReadUInt32();
                                     list.Add(num6);
                                     num5 += num6;
                                 }
                                 num5 /= (uint)num4;
                                 dictionary4.Add(key2, num5);
                             }
                             foreach (uint num7 in dictionary5.Keys)
                             {
                                 if (dictionary3.ContainsKey(num7))
                                 {
                                     dictionary3[num7] = Struct40.smethod_6(@class, num7);
                                 }
                                 else
                                 {
                                     dictionary3.Add(num7, Struct40.smethod_6(@class, num7));
                                 }
                             }
                         }
                     }
                 }
             }
         }
         catch
         {
             Struct40.smethod_11();
             throw;
         }
     }
 }
        // Token: 0x060028F6 RID: 10486 RVA: 0x0009AB60 File Offset: 0x00098D60
        private Class143.Class144 method_6(string filePath)
        {
            string fileName = Path.GetFileName(filePath);

            if (this.dictionary_0.ContainsKey(fileName))
            {
                long     num;
                DateTime d;
                Class234.smethod_13(filePath, out num, out d);
                Class143.Class144 @class = this.dictionary_0[fileName];
                if (@class.long_0 == num && @class.class140_0.DateCreated == d)
                {
                    return(@class);
                }
                @class.Dispose();
                this.dictionary_0.Remove(fileName);
                this.int_0++;
            }
            Class143.Class144 class2 = null;
            Class143.Class144 result;
            try
            {
                class2            = new Class143.Class144();
                class2.struct43_0 = Class513.smethod_0(filePath);
                DateTime dateCreated;
                Class234.smethod_13(filePath, out class2.long_0, out dateCreated);
                class2.class140_0 = new Class140(fileName, filePath, dateCreated);
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
                    {
                        using (Bitmap bitmap = (Bitmap)Image.FromFile(filePath))
                        {
                            binaryWriter.Write(fileName);
                            binaryWriter.smethod_25(class2.struct43_0);
                            binaryWriter.Write(class2.long_0);
                            binaryWriter.Write(class2.class140_0.DateCreated.ToBinary());
                            using (MemoryStream memoryStream2 = new MemoryStream())
                            {
                                Class157.smethod_9(bitmap, memoryStream2, 100, this.ThumbnailSize.Width, this.ThumbnailSize.Height);
                                binaryWriter.Write(memoryStream2.Length);
                                class2.long_1 = memoryStream2.Length;
                                memoryStream2.Seek(0L, SeekOrigin.Begin);
                                memoryStream2.CopyTo(memoryStream);
                            }
                            this.stream_0.Seek(0L, SeekOrigin.End);
                            memoryStream.Seek(0L, SeekOrigin.Begin);
                            memoryStream.CopyTo(this.stream_0);
                        }
                    }
                }
                this.stream_0.Seek(-class2.long_1, SeekOrigin.Current);
                class2.stream3_0 = new Stream3(this.stream_0, this.stream_0.Position, this.stream_0.Position + class2.long_1);
                this.dictionary_0.Add(fileName, class2);
                this.stream_0.Seek((long)(Class143.byte_0.Length + 4), SeekOrigin.Begin);
                using (Stream3 stream = new Stream3(this.stream_0))
                {
                    using (BinaryWriter binaryWriter2 = new BinaryWriter(stream))
                    {
                        binaryWriter2.Write(this.dictionary_0.Count);
                    }
                }
                result = class2;
            }
            catch (Exception ex)
            {
                if (class2 != null)
                {
                    class2.Dispose();
                }
                ex.smethod_1(new object[]
                {
                    filePath
                });
                result = null;
            }
            return(result);
        }
        // Token: 0x060020A9 RID: 8361 RVA: 0x0006E0CC File Offset: 0x0006C2CC
        private void method_7(Stream file_stream, BinaryReader reader, bool loadIcon, bool populateData)
        {
            Encoding encoding = Encoding.GetEncoding(1252);
            int      num      = reader.ReadInt32();

            if (num != 1)
            {
                throw new InvalidFileVersion <int>(1, 1, num);
            }
            decimal num2 = reader.ReadDecimal();
            decimal d    = reader.ReadDecimal();
            int     num3 = (int)Math.Floor(num2);

            this.MinimumVersion = new Version(num3, (int)((num2 - num3) * 100m), (int)(d * 100m), 0);
            this.Name           = Class132.smethod_4(reader, encoding);
            this.Description    = Class132.smethod_4(reader, encoding);
            this.Author         = Class132.smethod_4(reader, encoding);
            this.PasswordHash   = new Struct43(Class132.smethod_4(reader, encoding));
            if (Struct43.smethod_5(this.PasswordHash, Class132.struct43_0))
            {
                this.PasswordHash = Struct43.struct43_0;
            }
            Class132.smethod_4(reader, encoding);
            string text = Class132.smethod_4(reader, encoding);

            if (!string.IsNullOrEmpty(text))
            {
                this.ObsoleteDownloadURL = new Uri(text);
            }
            string text2 = Class132.smethod_4(reader, encoding);

            if (!string.IsNullOrEmpty(text2))
            {
                this.UpdateUri = new Uri(text2);
            }
            this.ID       = new Guid(Class132.smethod_4(reader, encoding));
            this.DataHash = new Struct43(Class132.smethod_4(reader, encoding));
            int num4 = reader.ReadInt32();

            if (num4 > 0)
            {
                if (loadIcon)
                {
                    using (Stream3 stream = new Stream3(file_stream, file_stream.Position, file_stream.Position + (long)num4))
                    {
                        this.memoryStream_0 = new MemoryStream();
                        stream.CopyTo(this.memoryStream_0);
                        this.Icon = (Bitmap)Image.FromStream(this.memoryStream_0);
                        goto IL_1AC;
                    }
                }
                file_stream.Position += (long)num4;
            }
IL_1AC:
            this.LoaderPack = reader.ReadBoolean();
            if (this.LoaderPack)
            {
                this.DataHash = Struct43.struct43_0;
            }
            if (this.LoaderPack)
            {
                if (populateData)
                {
                    this.Data = new Class136();
                    return;
                }
            }
            else
            {
                int num5 = reader.ReadInt32();
                for (int i = 0; i < num5; i++)
                {
                    this.ItemIndex.Add(Class132.smethod_4(reader, encoding), new Struct43(Class132.smethod_4(reader, encoding)));
                }
                int num6 = reader.ReadInt32();
                if (populateData)
                {
                    using (Stream3 stream2 = new Stream3(file_stream, file_stream.Position, file_stream.Position + (long)num6))
                    {
                        this.Data = new Class136(stream2);
                        this.Data.method_12();
                        return;
                    }
                }
                file_stream.Position += (long)num6;
            }
        }
 // Token: 0x060020AB RID: 8363 RVA: 0x0006E398 File Offset: 0x0006C598
 public void method_8(string filename, Struct43?passwordHash = null)
 {
     using (Stream stream = File.Open(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
     {
         using (BinaryWriter binaryWriter = new BinaryWriter(stream))
         {
             binaryWriter.Write(Class132.byte_0);
             binaryWriter.Write(Class132.int_0);
             binaryWriter.smethod_28(this.ID);
             long position = stream.Position;
             binaryWriter.smethod_25(Struct43.struct43_0);
             binaryWriter.smethod_33(this.UpdateUri);
             binaryWriter.Write(this.Name);
             binaryWriter.Write(this.Author);
             binaryWriter.Write(this.Description);
             binaryWriter.smethod_26(this.Version);
             binaryWriter.smethod_26(this.MinimumVersion);
             if (passwordHash != null)
             {
                 binaryWriter.smethod_25(passwordHash.Value);
             }
             else if (string.IsNullOrEmpty(this.Password))
             {
                 binaryWriter.smethod_25(Struct43.struct43_0);
             }
             else
             {
                 binaryWriter.smethod_25(Encoding.Unicode.GetBytes(this.Password).smethod_0());
             }
             long position2 = stream.Position;
             binaryWriter.Write(0);
             if (this.Icon != null)
             {
                 Class157.smethod_11(this.Icon, stream, Color.Black, 100);
                 long position3 = stream.Position;
                 stream.Position = position2;
                 binaryWriter.Write((int)(position3 - position2 - 4L));
                 stream.Position = position3;
             }
             if (!this.LoaderPack)
             {
                 binaryWriter.Write(this.Data.MultiFileData.Count);
                 foreach (KeyValuePair <string, Class338> keyValuePair in ((IEnumerable <KeyValuePair <string, Class338> >) this.Data.MultiFileData))
                 {
                     binaryWriter.Write(keyValuePair.Key);
                     binaryWriter.smethod_25(keyValuePair.Value.Data.smethod_0());
                 }
                 position2 = stream.Position;
                 binaryWriter.Write(0);
                 using (Stream3 stream2 = new Stream3(stream, stream.Position))
                 {
                     using (BinaryWriter binaryWriter2 = new BinaryWriter(stream2))
                     {
                         this.Data.method_17(stream2, binaryWriter2);
                         this.DataHash = stream2.smethod_2();
                     }
                 }
                 long position3 = stream.Position;
                 stream.Position = position2;
                 binaryWriter.Write((int)(position3 - position2 - 4L));
                 stream.Position = position3;
                 position3       = stream.Position;
                 stream.Position = position;
                 binaryWriter.smethod_25(this.DataHash);
                 stream.Position = position3;
             }
         }
     }
 }