// Token: 0x06000453 RID: 1107 RVA: 0x00035CE4 File Offset: 0x00033EE4 public static sbyte[] readByteArray(myReader dos) { try { int num = dos.readInt(); sbyte[] result = new sbyte[num]; dos.read(ref result); return(result); } catch (Exception ex) { Cout.LogError("LOI DOC readByteArray dos NINJAUTIL"); } return(null); }
static void Main(string[] args) { Random random = new Random(); //int n = 25; for (int i = 0; i < readyToWrite.Length; i++) { readyToWrite[i] = new ManualResetEvent(true); readyToRead[i] = new ManualResetEvent(false); } readyToWrite[0].Set(); for (int i = 0; i < 5; i++) { var myWriter = new myWriter(); myWriter.ind = i; myWriter.writerReset.Set(); myWriter.priority = random.Next(0, 4); myWriters.Add(myWriter); Console.WriteLine(i + " писатель имеет приоритет" + myWriter.priority); var myReader = new myReader(); myReader.ind = i; myReader.readerReset.Set(); myReader.priority = random.Next(0, 4); myReaders.Add(myReader); //cntW[i] = 0; //cntR[i] = 0; } Task wrtMng = new Task(writerManager); Task rdMng = new Task(readerManager); wrtMng.Start(); rdMng.Start(); Task.WaitAll(wrtMng); Task.WaitAll(rdMng); foreach (var mr in myWriters) { Console.WriteLine(mr.ind + " писатель писал " + mr.writeCount + " раз"); } Console.ReadLine(); //for(int i = 0; i < n; i++) //{ // writerThreads[i] = new Thread(() => { }); // int priority = random.Next(0, 4); // switch (priority) // { // case 0: writerThreads[i].Priority = ThreadPriority.Lowest; break; // case 1: writerThreads[i].Priority = ThreadPriority.BelowNormal; break; // case 2: writerThreads[i].Priority = ThreadPriority.Normal; break; // case 3: writerThreads[i].Priority = ThreadPriority.AboveNormal; break; // case 4: writerThreads[i].Priority = ThreadPriority.Highest; break; // } // writerThreads[i].Start(); // readerThreads[i] = new Thread(() => { }); // priority = random.Next(0, 4); // switch (priority) // { // case 0: readerThreads[i].Priority = ThreadPriority.Lowest; break; // case 1: readerThreads[i].Priority = ThreadPriority.BelowNormal; break; // case 2: readerThreads[i].Priority = ThreadPriority.Normal; break; // case 3: readerThreads[i].Priority = ThreadPriority.AboveNormal; break; // case 4: readerThreads[i].Priority = ThreadPriority.Highest; break; // } // readerThreads[i].Start(); // var red = new List<int>(); //} }
// Token: 0x06000260 RID: 608 RVA: 0x0001310C File Offset: 0x0001130C public void readData(sbyte[] data) { myReader iss = new myReader(data); this.readData(iss); }
// Token: 0x0600025E RID: 606 RVA: 0x00012A54 File Offset: 0x00010C54 public void readEffect(myReader msg) { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; try { sbyte b = msg.readByte(); Res.outz("size IMG==========" + b); this.imgInfo = new ImageInfo[(int)b]; for (int i = 0; i < (int)b; i++) { this.imgInfo[i] = new ImageInfo(); this.imgInfo[i].ID = (int)msg.readByte(); this.imgInfo[i].x0 = (int)msg.readUnsignedByte(); this.imgInfo[i].y0 = (int)msg.readUnsignedByte(); this.imgInfo[i].w = (int)msg.readUnsignedByte(); this.imgInfo[i].h = (int)msg.readUnsignedByte(); } short num5 = msg.readShort(); this.frame = new Frame[(int)num5]; for (int j = 0; j < this.frame.Length; j++) { this.frame[j] = new Frame(); sbyte b2 = msg.readByte(); this.frame[j].dx = new short[(int)b2]; this.frame[j].dy = new short[(int)b2]; this.frame[j].idImg = new sbyte[(int)b2]; for (int k = 0; k < (int)b2; k++) { this.frame[j].dx[k] = msg.readShort(); this.frame[j].dy[k] = msg.readShort(); this.frame[j].idImg[k] = msg.readByte(); if (j == 0) { if (num > (int)this.frame[j].dx[k]) { num = (int)this.frame[j].dx[k]; } if (num2 > (int)this.frame[j].dy[k]) { num2 = (int)this.frame[j].dy[k]; } if (num3 < (int)this.frame[j].dx[k] + this.imgInfo[(int)this.frame[j].idImg[k]].w) { num3 = (int)this.frame[j].dx[k] + this.imgInfo[(int)this.frame[j].idImg[k]].w; } if (num4 < (int)this.frame[j].dy[k] + this.imgInfo[(int)this.frame[j].idImg[k]].h) { num4 = (int)this.frame[j].dy[k] + this.imgInfo[(int)this.frame[j].idImg[k]].h; } this.width = num3 - num; this.height = num4 - num2; } } } this.arrFrame = new short[(int)msg.readShort()]; for (int l = 0; l < this.arrFrame.Length; l++) { this.arrFrame[l] = msg.readShort(); } } catch (Exception ex) { ex.StackTrace.ToString(); Res.outz("1"); } }
// Token: 0x0600025F RID: 607 RVA: 0x00012DBC File Offset: 0x00010FBC public void readData(myReader iss) { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; try { sbyte b = iss.readByte(); this.imgInfo = new ImageInfo[(int)b]; for (int i = 0; i < (int)b; i++) { this.imgInfo[i] = new ImageInfo(); this.imgInfo[i].ID = (int)iss.readByte(); this.imgInfo[i].x0 = (int)iss.readByte(); this.imgInfo[i].y0 = (int)iss.readByte(); this.imgInfo[i].w = (int)iss.readByte(); this.imgInfo[i].h = (int)iss.readByte(); } short num5 = iss.readShort(); this.frame = new Frame[(int)num5]; for (int j = 0; j < (int)num5; j++) { this.frame[j] = new Frame(); sbyte b2 = iss.readByte(); this.frame[j].dx = new short[(int)b2]; this.frame[j].dy = new short[(int)b2]; this.frame[j].idImg = new sbyte[(int)b2]; for (int k = 0; k < (int)b2; k++) { this.frame[j].dx[k] = iss.readShort(); this.frame[j].dy[k] = iss.readShort(); this.frame[j].idImg[k] = iss.readByte(); if (j == 0) { if (num > (int)this.frame[j].dx[k]) { num = (int)this.frame[j].dx[k]; } if (num2 > (int)this.frame[j].dy[k]) { num2 = (int)this.frame[j].dy[k]; } if (num3 < (int)this.frame[j].dx[k] + this.imgInfo[(int)this.frame[j].idImg[k]].w) { num3 = (int)this.frame[j].dx[k] + this.imgInfo[(int)this.frame[j].idImg[k]].w; } if (num4 < (int)this.frame[j].dy[k] + this.imgInfo[(int)this.frame[j].idImg[k]].h) { num4 = (int)this.frame[j].dy[k] + this.imgInfo[(int)this.frame[j].idImg[k]].h; } this.width = num3 - num; this.height = num4 - num2; } } } short num6 = iss.readShort(); this.arrFrame = new short[(int)num6]; for (int l = 0; l < (int)num6; l++) { this.arrFrame[l] = iss.readShort(); } } catch (Exception ex) { Cout.LogError("LOI TAI readData cua EffectDAta" + ex.ToString()); } }