Пример #1
0
    // Token: 0x06001E42 RID: 7746 RVA: 0x000F9A14 File Offset: 0x000F7C14
    public static bool smethod_12(string string_4)
    {
        if (string_4 != null && string_4.Length != 0)
        {
            string path = Path.Combine(GClass12.string_0, string_4) + "GHLive Bass - ";
            GClass12.bool_0 = false;
            bool result;
            try
            {
                using (BinaryWriter binaryWriter = new BinaryWriter(File.Open(path, FileMode.OpenOrCreate)))
                {
                    binaryWriter.Write(51);
                    binaryWriter.Write(SongDirectory.setlistSongEntries.Count);
                    for (int i = 0; i < SongDirectory.setlistSongEntries.Count; i++)
                    {
                        binaryWriter.Write(SongDirectory.setlistSongEntries[i].checksum);
                        binaryWriter.Write((short)SongDirectory.setlistSongSpeeds[i]);
                    }
                }
                goto IL_B0;
            }
            catch (Exception ex)
            {
                Debug.Log(ex.Message);
                result = true;
            }
            return(result);

IL_B0:
            if (GClass12.string_3 != null)
            {
                GClass12.smethod_21(GClass12.string_3);
                GClass12.string_3 = null;
            }
            return(false);
        }
        return(true);
    }
Пример #2
0
        // Token: 0x06000164 RID: 356 RVA: 0x0000C948 File Offset: 0x0000AB48
        public static GClass12 smethod_0(byte[] byte_0)
        {
            GClass12 gclass = new GClass12();

            for (int i = 0; i < byte_0.Length; i++)
            {
                GEnum1 genum = (GEnum1)byte_0[i];
                switch (genum)
                {
                case GEnum1.Integer:
                {
                    gclass.List_0.Add(new GClass12
                        {
                            GEnum1_0 = GEnum1.Integer,
                            Int32_0  = (int)byte_0[i + 1]
                        });
                    byte[] array  = new byte[(int)byte_0[i + 1]];
                    int    length = (i + 2 + (int)byte_0[i + 1] > byte_0.Length) ? (byte_0.Length - (i + 2)) : ((int)byte_0[i + 1]);
                    Array.Copy(byte_0, i + 2, array, 0, length);
                    gclass.List_0[gclass.List_0.Count - 1].Byte_0 = array;
                    i = i + 1 + gclass.List_0[gclass.List_0.Count - 1].Int32_0;
                    break;
                }

                case GEnum1.BitString:
                case GEnum1.Null:
                    break;

                case GEnum1.OctetString:
                {
                    gclass.List_0.Add(new GClass12
                        {
                            GEnum1_0 = GEnum1.OctetString,
                            Int32_0  = (int)byte_0[i + 1]
                        });
                    byte[] array2 = new byte[(int)byte_0[i + 1]];
                    int    length = (i + 2 + (int)byte_0[i + 1] > byte_0.Length) ? (byte_0.Length - (i + 2)) : ((int)byte_0[i + 1]);
                    Array.Copy(byte_0, i + 2, array2, 0, length);
                    gclass.List_0[gclass.List_0.Count - 1].Byte_0 = array2;
                    i = i + 1 + gclass.List_0[gclass.List_0.Count - 1].Int32_0;
                    break;
                }

                case GEnum1.ObjectIdentifier:
                {
                    gclass.List_0.Add(new GClass12
                        {
                            GEnum1_0 = GEnum1.ObjectIdentifier,
                            Int32_0  = (int)byte_0[i + 1]
                        });
                    byte[] array3 = new byte[(int)byte_0[i + 1]];
                    int    length = (i + 2 + (int)byte_0[i + 1] > byte_0.Length) ? (byte_0.Length - (i + 2)) : ((int)byte_0[i + 1]);
                    Array.Copy(byte_0, i + 2, array3, 0, length);
                    gclass.List_0[gclass.List_0.Count - 1].Byte_0 = array3;
                    i = i + 1 + gclass.List_0[gclass.List_0.Count - 1].Int32_0;
                    break;
                }

                default:
                    if (genum == GEnum1.Sequence)
                    {
                        byte[] array4;
                        if (gclass.Int32_0 == 0)
                        {
                            gclass.GEnum1_0 = GEnum1.Sequence;
                            gclass.Int32_0  = byte_0.Length - (i + 2);
                            array4          = new byte[gclass.Int32_0];
                        }
                        else
                        {
                            gclass.List_0.Add(new GClass12
                            {
                                GEnum1_0 = GEnum1.Sequence,
                                Int32_0  = (int)byte_0[i + 1]
                            });
                            array4 = new byte[(int)byte_0[i + 1]];
                        }
                        int num = (array4.Length > byte_0.Length - (i + 2)) ? (byte_0.Length - (i + 2)) : array4.Length;
                        Array.Copy(byte_0, i + 2, array4, 0, array4.Length);
                        gclass.List_0.Add(GClass10.smethod_0(array4));
                        i = i + 1 + (int)byte_0[i + 1];
                    }
                    break;
                }
            }
            return(gclass);
        }
        // Token: 0x06000425 RID: 1061 RVA: 0x001D37D4 File Offset: 0x001D1BD4
        public void b_read(IAsyncResult ar)
        {
            bool flag = !this.CN | this.bool_1;

            if (!flag)
            {
                bool flag2;
                try
                {
                    int num = 0;
                    try
                    {
                        num = this.Client.Client.EndReceive(ar);
                    }
                    catch (SocketException ex)
                    {
                        SocketException ex2 = ex;
                        this.string_1 = ex2.SocketErrorCode.ToString();
                        goto IL_422;
                    }
                    flag = (num <= 0);
                    if (flag)
                    {
                        goto IL_422;
                    }
                    Class7.long_1 += (long)num;
                    flag           = (this.Length == -1L);
                    if (flag)
                    {
                        flag2 = (this.b[0] == 0);
                        if (flag2)
                        {
                            byte[] array = this.M.ToArray();
                            this.Length = Conversions.ToLong(Class6.smethod_12(ref array));
                            this.M.Dispose();
                            this.M = new MemoryStream();
                            flag2  = (this.Length == 0L);
                            if (flag2)
                            {
                                this.Length = -1L;
                                flag2       = (this.L == null & !this.isPL);
                                if (flag2)
                                {
                                    this.string_1 = "LTimeOut";
                                    goto IL_422;
                                }
                                int num2 = (int)Math.Round(Math.Round((DateAndTime.Now.Subtract(this.lastPing).TotalMilliseconds - 10.0) / 1.5));
                                flag2 = (num2 < 0);
                                if (flag2)
                                {
                                    num2 = 0;
                                }
                                flag2 = (num2 > 999);
                                if (flag2)
                                {
                                    num2 = 999;
                                }
                                this.lastPing = DateAndTime.Now;
                                this.IsPNGED  = false;
                                string          text   = "P" + Class7.string_1 + num2.ToString("000");
                                GClass12        gclass = new GClass12(this, Class6.smethod_11(ref text));
                                List <GClass12> req    = this.SK.REQ;
                                List <GClass12> obj    = req;
                                lock (obj)
                                {
                                    this.SK.REQ.Add(gclass);
                                }
                                while (!gclass.bool_0)
                                {
                                    Thread.Sleep(1);
                                }
                                goto IL_39E;
                            }
                            else
                            {
                                this.b = new byte[(int)(this.Length - 1L) + 1 - 1 + 1];
                            }
                        }
                        else
                        {
                            this.M.WriteByte(this.b[0]);
                        }
                    }
                    else
                    {
                        this.M.Write(this.b, 0, num);
                        flag2 = (this.M.Length == this.Length);
                        if (flag2)
                        {
                            this.Length = -1L;
                            GClass12        gclass2 = new GClass12(this, this.M.ToArray());
                            List <GClass12> req2    = this.SK.REQ;
                            List <GClass12> obj2    = req2;
                            lock (obj2)
                            {
                                this.SK.REQ.Add(gclass2);
                            }
                            while (!gclass2.bool_0)
                            {
                                Thread.Sleep(1);
                            }
                            this.M.Dispose();
                            this.M = new MemoryStream();
                            this.b = new byte[1];
                        }
                        else
                        {
                            this.b = new byte[(int)(this.Length - this.M.Length - 1L) + 1 - 1 + 1];
                        }
                    }
                    Thread.Sleep(1);
                }
                catch (Exception ex3)
                {
                    this.string_1 = "RError";
                    goto IL_422;
                }
IL_39E:
                flag2 = !this.CN;
                if (flag2)
                {
                    return;
                }
                try
                {
                    this.Client.Client.BeginReceive(this.b, 0, this.b.Length, SocketFlags.None, new AsyncCallback(this.b_read), null);
                    return;
                }
                catch (SocketException ex4)
                {
                    SocketException ex5 = ex4;
                    this.string_1 = ex5.SocketErrorCode.ToString();
                }
            }
IL_422:
            this.CN = false;
        }