Examples of ClientBlock


Examples of omschaub.stuffer.containers.ClientBlock

          });

          FileUtilities.readClientList();
          Iterator it = Plugin.clientBlock_set.getIterator();
          while(it.hasNext()){
            ClientBlock cb = (ClientBlock)it.next();
            addTableElement(String.valueOf(cb.getIndex()),
                cb.getClientName(),
                (cb.get_isRegEx() ? "1" : "0"),
                (cb.get_isDownloading() ? "1" : "0"),
                (cb.get_isUploading() ? "1" : "0"),
                (cb.get_isSuperseeding() ? "1" : "0"),
                cb.getColor(),
                cb.getHitsThisSession());
          }

          Plugin.getDisplay().syncExec(new Runnable (){
            public void run () {
              if (Plugin.getTab2().getClientTable() !=null && !Plugin.getTab2().getClientTable().isDisposed()){
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

               
                int rule_index = line.indexOf("|rules|") + 7;
                int client_index = line.indexOf("|client|");
               
                //the Container
                ClientBlock cb = new ClientBlock();
               
                //write the results to the array
               
                //[0] is the number of the rule
          //      clientList[counter][0] = line.substring(0,client_index);
                cb.setIndex(Integer.parseInt(line.substring(0,client_index)));
               
                //[1] is the client's name
                //clientList[counter][1] = line.substring(client_index+8,rule_index-7);
                cb.setClientName(line.substring(client_index+8,rule_index-7));
               
                //[2] isRegEx
                //clientList[counter][2] = line.substring(rule_index,rule_index + 1);
                cb.set_isRegEx(line.substring(rule_index,rule_index + 1).equalsIgnoreCase("0") ? false : true);
               
                //[3] isDownload
                //clientList[counter][3] = line.substring(rule_index+1, rule_index+2);
                cb.set_isDownloading(line.substring(rule_index+1, rule_index+2).equalsIgnoreCase("0") ? false : true);
               
                //[4] isUploading
                //clientList[counter][4] = line.substring(rule_index+2, rule_index+3);
                cb.set_isUploading(line.substring(rule_index+2, rule_index+3).equalsIgnoreCase("0") ? false : true);
               
                //[5] isSuperSeeding
                //clientList[counter][5] = line.substring(rule_index+3, rule_index+4);
                cb.set_isSuperseeding(line.substring(rule_index+3, rule_index+4).equalsIgnoreCase("0") ? false : true);
               
                //[6] is the color (not yet in readable format)
                //clientList[counter][6] = line.substring(rule_index+4, line.length());
                cb.setColor(line.substring(rule_index+4, line.length()));
               
                if(!Plugin.clientBlock_set.contains(cb))
                    Plugin.clientBlock_set.addToSet(cb);
               
               
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

     */
    public static void changeClientName(final String number, final String newName){

        try{
           
            ClientBlock cb = Plugin.clientBlock_set.getClientBlockByIndex(Integer.parseInt(number));
            cb.setClientName(newName);
            writeClientBlockSetToFile(Plugin.clientBlock_set);
            reNumberFile();
            readClientList();
           
           
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

        try{
           
           
            //get ClientBlock
            ClientBlock cb = Plugin.clientBlock_set.getClientBlockByIndex(Integer.valueOf(numberString).intValue());
           
            //Replace Rules
            cb.setClientName(clientName);
            cb.set_isRegEx(isRegEx.equalsIgnoreCase("0") ? false : true);
            cb.set_isDownloading(isDownloading.equalsIgnoreCase("0") ? false : true);
            cb.set_isUploading(isUploading.equalsIgnoreCase("0") ? false : true );
            cb.set_isSuperseeding(isSuperseeding.equalsIgnoreCase("0") ? false : true);
            cb.setColor(color);
           
            writeClientBlockSetToFile(Plugin.clientBlock_set);
            readClientList();
           
            //get the old rule set
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

     * @return String[] ruleSet
     */
    public static String[] getRules(final String number){
        String[] ruleSet = new String[6];
        try{
            ClientBlock cb = Plugin.clientBlock_set.getClientBlockByIndex(Integer.parseInt(number));
                 
            ruleSet[0] = (cb.get_isRegEx() ? "1" : "0")
            ruleSet[1] = (cb.get_isDownloading() ? "1" : "0")
            ruleSet[2] = (cb.get_isUploading() ? "1" : "0");
            ruleSet[3] = (cb.get_isSuperseeding() ? "1" : "0")
            ruleSet[4] = cb.getColor();
           
            /*
            String[][] holder = getClientList(true);
            for(int i = 0; i < holder.length; i++){
                if(holder[i][0] != null){
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

            File configFile = getConfigFile();
            BufferedWriter bufWriter = new BufferedWriter(new FileWriter(configFile,false));
            Iterator it = cbs.getIterator();
            while (it.hasNext()){
                //Pull the current ClientBlock
                ClientBlock cb = (ClientBlock)it.next();
               
                //Write the rule
                bufWriter.write(cb.getIndex() +
                        "|client|" +
                        cb.getClientName() +
                        "|rules|" +
                        (cb.get_isRegEx() ? "1" : "0") +
                        (cb.get_isDownloading() ? "1" : "0") +
                        (cb.get_isUploading() ? "1" : "0") +
                        (cb.get_isSuperseeding() ? "1" : "0") +
                        cb.getColor());
                bufWriter.newLine();       
               
            }
           
            bufWriter.close();
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

        try{
          int i = 0
         
          Iterator it = Plugin.clientBlock_set.getIterator();
          while(it.hasNext()){
              ClientBlock cb = (ClientBlock)it.next();
              cb.setIndex(i);
              i++;
          }
           
          writeClientBlockSetToFile(Plugin.clientBlock_set);
           
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

     * @param up (boolean)
     */
    public static boolean moveRule(String ruleNum, boolean up, boolean down, boolean top, boolean bottom){
        try{
            int index = Integer.parseInt(ruleNum) - 1;                       
            ClientBlock cb_to_move = Plugin.clientBlock_set.getClientBlockByIndex(index);
            if(top){
                if(index == 0) return false; // already at top   
                Plugin.clientBlock_set.removeFromSet(cb_to_move);
                Iterator it = Plugin.clientBlock_set.getIterator();
                while(it.hasNext()){
                    ClientBlock cb = (ClientBlock)it.next();
                    cb.setIndex(cb.getIndex() + 1);
                }
                cb_to_move.setIndex(0);
                Plugin.clientBlock_set.addToSet(cb_to_move);               
                writeClientBlockSetToFile(Plugin.clientBlock_set);               
                reNumberFile();
                readClientList();
                return true;               
            }else if(up){
                if(index == 0) return false; // already at top
                ClientBlock cb_bumped = Plugin.clientBlock_set.getClientBlockByIndex(index -1);
                Plugin.clientBlock_set.removeFromSet(cb_bumped);
                cb_bumped.setIndex(index);
                cb_to_move.setIndex(index-1);
                Plugin.clientBlock_set.addToSet(cb_bumped);
                writeClientBlockSetToFile(Plugin.clientBlock_set);               
                reNumberFile();
                readClientList();
                return true;                  
            }else if(down){
                int size = Plugin.clientBlock_set.getSize();
                if(index+1 >= size) return false; //already at bottom
                ClientBlock cb_bumped = Plugin.clientBlock_set.getClientBlockByIndex(index + 1);
                Plugin.clientBlock_set.removeFromSet(cb_bumped);
                cb_bumped.setIndex(index);
                cb_to_move.setIndex(index+1);
                Plugin.clientBlock_set.addToSet(cb_bumped);
                writeClientBlockSetToFile(Plugin.clientBlock_set);               
                reNumberFile();
                readClientList();
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

   * @param index
   * @param state (0 for Change to 0, 1 for increase, 2 for decrease)
   */
  public static void changeHits(final int index, final int state){

      final ClientBlock cb = Plugin.clientBlock_set.getClientBlockByIndex(index);
      if(state == 0) cb.setHitsThisSession(0);
      else if(state == 1) cb.setHitsThisSession(cb.getHitsThisSession() + 1);
      else cb.setHitsThisSession(cb.getHitsThisSession() - 1);

      //Try to change the hits on the Tab2 if it is open
      try{
        if(Plugin.getTab2Utilities() != null){
          Plugin.getTab2Utilities().changeHits(index, state, cb);
View Full Code Here

Examples of omschaub.stuffer.containers.ClientBlock

    try{
      Iterator it = Plugin.clientBlock_set.getIterator();
      //System.out.println(Plugin.clientBlock_set.getSize());
      while(it.hasNext()){
        ClientBlock cb = (ClientBlock)it.next();

        //check if the clientName is RegEx or not
        if(!cb.get_isRegEx()){
          //is Regular String
          if(stringContains(peerClient.toLowerCase(),cb.getClientName().toLowerCase())){
            //match.. so block according to the rules

            //check for superseeding block
            if(cb.get_isSuperseeding()){
              //positive for superseeding only.. now check if torrent is superseeding
              if(isSuperSeeding){
                Utils.changeHits(cb.getIndex(), 1);
                return cb.getColor();
                //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
              }
              return "null";
            }else{
              //check for rule for download/upload

              //first see if both are postive, and if so, block the peer out right
              if(cb.get_isDownloading() && cb.get_isUploading()){
                //both positive, so block away
                //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                Utils.changeHits(cb.getIndex(), 1);
                return cb.getColor();
              }else{
                //both are not positve.. so need to step through and see which one is

                try {

                  if(downloadState == Download.ST_DOWNLOADING){
                    //torrent of peer is downloading
                    //now see if the rule is there to block it
                    if(cb.get_isDownloading()){
                      //positive for the rule, so block
                      //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                      Utils.changeHits(cb.getIndex(), 1);
                      return cb.getColor();
                    }
                    return "null";
                  }else if(downloadState == Download.ST_SEEDING){
                    //torrent of peer is seeding
                    //now see if the rule is there to block it
                    if(cb.get_isUploading()){
                      //positve for the rule,so block
                      //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                      Utils.changeHits(cb.getIndex(), 1);
                      return cb.getColor();
                    }
                    return "null";
                  }else{
                    return "null";
                  }



                } catch (Exception e) {
                  e.printStackTrace();
                  return "null";
                }//end of single upload or download check

              }//end of upload/download check


            }//end of major superseed vs up/down check

          }//end of regular string match
        }else{
          //isRegEx
          Pattern p = Pattern.compile(cb.getClientName());
          Matcher m = p.matcher(peerClient);
          //System.out.println("INPUT: " + peer.getClient() + " : " + "Regex: " + p.pattern() + " : " + m.matches());
          if(m.find()){
            //check for superseeding block
            if(cb.get_isSuperseeding()){
              //positive for superseeding only.. now check if torrent is superseeding
              if(isSuperSeeding){
                //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                Utils.changeHits(cb.getIndex(), 1);
                return cb.getColor();
              }
              return "null";
            }else{
              //check for rule for download/upload

              //first see if both are postive, and if so, block the peer out right
              if(cb.get_isDownloading() && cb.get_isUploading()){
                //both positive, so block away
                //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                Utils.changeHits(cb.getIndex(), 1);
                return cb.getColor();
              }else{
                //both are not positve.. so need to step through and see which one is

                try {

                  if(downloadState == Download.ST_DOWNLOADING){
                    //torrent of peer is downloading
                    //now see if the rule is there to block it
                    if(cb.get_isDownloading()){
                      //positive for the rule, so block
                      //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                      Utils.changeHits(cb.getIndex(), 1);
                      return cb.getColor();
                    }else{
                      return "null";
                    }

                  }else if(downloadState == Download.ST_SEEDING){
                    //torrent of peer is seeding
                    //now see if the rule is there to block it
                    if(cb.get_isUploading()){
                      //positve for the rule,so block
                      //makeIPFilterRule(peerIP,peerID,peerClient,downloadName,clientList[i][6]);
                      Utils.changeHits(cb.getIndex(), 1);
                      return cb.getColor();
                    }else{
                      return "null";
                    }

                  }else{
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.