Exemplo n.º 1
0
 public void method351(IndexedImage indexedimage, boolean bool, int i, int i_127_) {
   try {
     i_127_ += offsetX;
     i += offsetY;
     int i_128_ = i_127_ + (i * Rasterizer.width);
     int i_129_ = 0;
     if (bool) {}
     int i_130_ = height;
     int i_131_ = width;
     int i_132_ = Rasterizer.width - i_131_;
     int i_133_ = 0;
     if (i < Rasterizer.topY) {
       int i_134_ = Rasterizer.topY - i;
       i_130_ -= i_134_;
       i = Rasterizer.topY;
       i_129_ += i_134_ * i_131_;
       i_128_ += i_134_ * Rasterizer.width;
     }
     if ((i + i_130_) > Rasterizer.bottomY) {
       i_130_ -= (i + i_130_) - Rasterizer.bottomY;
     }
     if (i_127_ < Rasterizer.topX) {
       int i_135_ = Rasterizer.topX - i_127_;
       i_131_ -= i_135_;
       i_127_ = Rasterizer.topX;
       i_129_ += i_135_;
       i_128_ += i_135_;
       i_133_ += i_135_;
       i_132_ += i_135_;
     }
     if ((i_127_ + i_131_) > Rasterizer.bottomX) {
       int i_136_ = (i_127_ + i_131_) - Rasterizer.bottomX;
       i_131_ -= i_136_;
       i_133_ += i_136_;
       i_132_ += i_136_;
     }
     if ((i_131_ > 0) && (i_130_ > 0)) {
       method352(
           pixels,
           i_131_,
           indexedimage.pixels,
           i_130_,
           Rasterizer.pixels,
           0,
           i_132_,
           i_128_,
           i_133_,
           i_129_);
     }
   } catch (RuntimeException runtimeexception) {
     SignLink.reportError(
         "70668, "
             + indexedimage
             + ", "
             + bool
             + ", "
             + i
             + ", "
             + i_127_
             + ", "
             + runtimeexception.toString());
     throw new RuntimeException();
   }
 }
Exemplo n.º 2
0
 private final void handleResp() {
   try {
     int available = inputStream.available();
     if ((toRead == 0) && (available >= 6)) {
       expectData = true;
       for (int i = 0; i < 6; i += inputStream.read(inputBuffer, i, 6 - i)) {;
       }
       int type = inputBuffer[0] & 0xff;
       int id = ((inputBuffer[1] & 0xff) << 8) + (inputBuffer[2] & 0xff);
       int size = ((inputBuffer[3] & 0xff) << 8) + (inputBuffer[4] & 0xff);
       int part = inputBuffer[5] & 0xff;
       onDemandNode = null;
       for (OnDemandNode ondemandnode = (OnDemandNode) sentRequests.getBack();
           ondemandnode != null;
           ondemandnode = (OnDemandNode) sentRequests.getPrevious()) {
         if ((ondemandnode.type == type) && (ondemandnode.id == id)) {
           onDemandNode = ondemandnode;
         }
         if (onDemandNode != null) {
           ondemandnode.cyclesSinceSend = 0;
         }
       }
       if (onDemandNode != null) {
         idleCycles = 0;
         if (size == 0) {
           SignLink.reportError("Rej: " + type + "," + id);
           onDemandNode.buffer = null;
           if (onDemandNode.immediate) {
             synchronized (completed) {
               completed.insertBack(onDemandNode);
             }
           } else {
             onDemandNode.remove();
           }
           onDemandNode = null;
         } else {
           if ((onDemandNode.buffer == null) && (part == 0)) {
             onDemandNode.buffer = new byte[size];
           }
           if ((onDemandNode.buffer == null) && (part != 0)) {
             throw new IOException("missing start of file");
           }
         }
       }
       offset = part * 500;
       toRead = 500;
       if (toRead > (size - (part * 500))) {
         toRead = size - (part * 500);
       }
     }
     if ((toRead <= 0) || (available < toRead)) {
       return;
     }
     expectData = true;
     byte[] buffer = inputBuffer;
     int bufferOffset = 0;
     if (onDemandNode != null) {
       buffer = onDemandNode.buffer;
       bufferOffset = offset;
     }
     for (int i = 0; i < toRead; i += inputStream.read(buffer, i + bufferOffset, toRead - i)) {;
     }
     if (((toRead + offset) >= buffer.length) && (onDemandNode != null)) {
       if (client.stores[0] != null) {
         client.stores[onDemandNode.type + 1].put(buffer.length, buffer, onDemandNode.id);
       }
       if (!onDemandNode.immediate && (onDemandNode.type == 3)) {
         onDemandNode.immediate = true;
         onDemandNode.type = 93;
       }
       if (onDemandNode.immediate) {
         synchronized (completed) {
           completed.insertBack(onDemandNode);
         }
       } else {
         onDemandNode.remove();
       }
     }
     toRead = 0;
   } catch (IOException ioexception) {
     try {
       socket.close();
     } catch (Exception exception) {
       /* empty */
     }
     socket = null;
     inputStream = null;
     outputStream = null;
     toRead = 0;
   }
 }
Exemplo n.º 3
0
 public void method350(
     int i,
     int i_109_,
     int i_110_,
     int i_111_,
     int i_112_,
     int i_113_,
     int i_114_,
     double d,
     int i_115_) {
   try {
     if (i_112_ == 41960) {
       try {
         int i_116_ = -i_110_ / 2;
         int i_117_ = -i_114_ / 2;
         int i_118_ = (int) (Math.sin(d) * 65536.0);
         int i_119_ = (int) (Math.cos(d) * 65536.0);
         i_118_ = (i_118_ * i_113_) >> 8;
         i_119_ = (i_119_ * i_113_) >> 8;
         int i_120_ = (i_111_ << 16) + ((i_117_ * i_118_) + (i_116_ * i_119_));
         int i_121_ = (i_109_ << 16) + ((i_117_ * i_119_) - (i_116_ * i_118_));
         int i_122_ = i_115_ + (i * Rasterizer.width);
         for (i = 0; i < i_114_; i++) {
           int i_123_ = i_122_;
           int i_124_ = i_120_;
           int i_125_ = i_121_;
           for (i_115_ = -i_110_; i_115_ < 0; i_115_++) {
             int i_126_ = pixels[(i_124_ >> 16) + ((i_125_ >> 16) * width)];
             if (i_126_ != 0) {
               Rasterizer.pixels[i_123_++] = i_126_;
             } else {
               i_123_++;
             }
             i_124_ += i_119_;
             i_125_ -= i_118_;
           }
           i_120_ += i_118_;
           i_121_ += i_119_;
           i_122_ += Rasterizer.width;
         }
       } catch (Exception exception) {
         /* empty */
       }
     }
   } catch (RuntimeException runtimeexception) {
     SignLink.reportError(
         "71953, "
             + i
             + ", "
             + i_109_
             + ", "
             + i_110_
             + ", "
             + i_111_
             + ", "
             + i_112_
             + ", "
             + i_113_
             + ", "
             + i_114_
             + ", "
             + d
             + ", "
             + i_115_
             + ", "
             + runtimeexception.toString());
     throw new RuntimeException();
   }
 }
Exemplo n.º 4
0
 @Override
 public final void run() {
   try {
     while (running) {
       cycle++;
       int toWait = 20;
       if ((highestPriority == 0) && (client.stores[0] != null)) {
         toWait = 50;
       }
       Thread.sleep(toWait);
       expectData = true;
       for (int i = 0; i < 100; i++) {
         if (!expectData) {
           break;
         }
         expectData = false;
         localComplete();
         remainingRequest();
         if ((immediateRequestsSent == 0) && (i >= 5)) {
           break;
         }
         passivesRequest();
         if (inputStream != null) {
           handleResp();
         }
       }
       boolean idle = false;
       for (OnDemandNode onDemandNode = (OnDemandNode) sentRequests.getBack();
           onDemandNode != null;
           onDemandNode = (OnDemandNode) sentRequests.getPrevious()) {
         if (onDemandNode.immediate) {
           idle = true;
           onDemandNode.cyclesSinceSend++;
           if (onDemandNode.cyclesSinceSend > 50) {
             onDemandNode.cyclesSinceSend = 0;
             sendRequest(onDemandNode);
           }
         }
       }
       if (!idle) {
         for (OnDemandNode onDemandNode = (OnDemandNode) sentRequests.getBack();
             onDemandNode != null;
             onDemandNode = (OnDemandNode) sentRequests.getPrevious()) {
           idle = true;
           onDemandNode.cyclesSinceSend++;
           if (onDemandNode.cyclesSinceSend > 50) {
             onDemandNode.cyclesSinceSend = 0;
             sendRequest(onDemandNode);
           }
         }
       }
       if (idle) {
         idleCycles++;
         if (idleCycles > 750) {
           socket.close();
           socket = null;
           inputStream = null;
           outputStream = null;
           toRead = 0;
         }
       } else {
         idleCycles = 0;
         message = "";
       }
       if (client.loggedIn
           && (socket != null)
           && (outputStream != null)
           && ((highestPriority > 0) || (client.stores[0] == null))) {
         sinceKeepAlive++;
         if (sinceKeepAlive > 500) {
           sinceKeepAlive = 0;
           inputBuffer[0] = (byte) 0;
           inputBuffer[1] = (byte) 0;
           inputBuffer[2] = (byte) 0;
           inputBuffer[3] = (byte) 10;
           try {
             outputStream.write(inputBuffer, 0, 4);
           } catch (IOException ioexception) {
             idleCycles = 5000;
           }
         }
       }
     }
   } catch (Exception exception) {
     SignLink.reportError("od_ex " + exception);
   }
 }