// Token: 0x06001AC7 RID: 6855 RVA: 0x0004F74C File Offset: 0x0004D94C
 public static void smethod_1(Stream inStream, Stream outStream, bool isStreamOwner, int level)
 {
     if (inStream == null)
     {
         throw new ArgumentNullException("inStream");
     }
     if (outStream == null)
     {
         throw new ArgumentNullException("outStream");
     }
     try
     {
         using (Stream2 stream = new Stream2(outStream, level))
         {
             stream.IsStreamOwner = isStreamOwner;
             inStream.smethod_5(stream, new byte[4096]);
         }
     }
     finally
     {
         if (isStreamOwner)
         {
             inStream.Close();
         }
     }
 }
示例#2
0
        public override long Seek(long offset, SeekOrigin origin)
        {
            switch (origin)
            {
            case SeekOrigin.Begin:
                position = offset;
                break;

            case SeekOrigin.Current:
                position += offset;
                break;

            case SeekOrigin.End:
                position  = Length;
                position += offset;
                break;
            }

            if (position >= Stream1.Length)
            {
                position = Stream1.Length + Stream2.Seek(offset - Stream1.Length, SeekOrigin.Begin);
            }
            else
            {
                position = Stream1.Seek(offset, SeekOrigin.Begin);
            }

            return(position);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryPipe"/> class.
        /// </summary>
        public MemoryPipe()
        {
            var pipe1 = new Pipe();
            var pipe2 = new Pipe();

            Stream1 = new DuplexStream(pipe1, pipe2, () => Stream2.Dispose());
            Stream2 = new DuplexStream(pipe2, pipe1, () => Stream1.Dispose());
        }
示例#4
0
 public override void Write(byte[] buffer, int offset, int count)
 {
     if (position >= Stream1.Length)
     {
         Stream2.Write(buffer, offset - (int)Stream1.Length, count);
     }
     else
     {
         Stream1.Write(buffer, offset, count);
     }
 }
示例#5
0
            public void Process(double t)
            {
                var n1 = Stream1.Process(t);
                var n2 = Stream2.Process(t);

                if (!frequency.ContainsKey(n1 + n2))
                {
                    frequency[n1 + n2] = 0;
                }
                frequency[n1 + n2]++;
            }
示例#6
0
            public void Process(double time)
            {
                var n1 = Stream1.Process(time);
                var n2 = Stream2.Process(time);

                if (!Frequency.ContainsKey(n1 + n2))
                {
                    Frequency[n1 + n2] = 0;
                }
                Frequency[n1 + n2]++;
            }
示例#7
0
        public override int ReadByte()
        {
            int value;

            if (position >= Stream1.Length)
            {
                value = Stream2.ReadByte();
            }
            else
            {
                value = Stream1.ReadByte();
            }

            position++;

            return(value);
        }
示例#8
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int bytesRead;

            if (position >= Stream1.Length)
            {
                bytesRead = Stream2.Read(buffer, offset, count);
            }
            else if (count > Stream1.Length)
            {
                bytesRead  = Stream1.Read(buffer, offset, (int)Stream1.Length);
                bytesRead += Stream2.Read(buffer, (int)Stream1.Length, count - (int)Stream1.Length);
            }
            else
            {
                bytesRead = Stream1.Read(buffer, offset, count);
            }

            position += bytesRead;

            return(bytesRead);
        }
示例#9
0
 public override void Flush()
 {
     Stream1.Flush();
     Stream2.Flush();
 }
示例#10
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();
 }
示例#11
0
 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();
 }