设为首页收藏本站喵玉殿官方微博

 找回密码
 少女注册中
搜索
查看: 6882|回复: 7

[编程算法] 萌战CIP用狐狸计票器源码备份

  [复制链接]
发表于 2011-1-6 18:12:04 | 显示全部楼层 |阅读模式
本帖最后由 天使怪盗Dick 于 2011-1-6 18:14 编辑
  1. import java.awt.Color;
  2. import java.awt.Desktop;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Image;
  6. import java.awt.image.BufferedImage;
  7. import java.io.BufferedReader;
  8. import java.io.DataOutputStream;
  9. import java.io.File;
  10. import java.io.FileOutputStream;
  11. import java.io.IOException;
  12. import java.io.InputStream;
  13. import java.io.InputStreamReader;
  14. import java.net.HttpURLConnection;
  15. import java.net.URI;
  16. import java.net.URL;
  17. import java.util.Date;
  18. import java.util.Random;
  19. import java.util.Vector;
  20. import javax.imageio.ImageIO;

  21. public class CodiacApp {
  22. class VotingMB{
  23.   String Name,Code,Vote,DZ;
  24.   int date,time,num;
  25.   boolean fp,ck,ot;
  26.   VotingMB(){
  27.    Name=new String();
  28.    Code=new String();
  29.    Vote=new String();
  30.    DZ=new String();
  31.    date=time=0;
  32.    fp=ck=ot=false;
  33.   }
  34. }
  35. class VotingLJ{
  36.   String Name;
  37.   int rank,count;
  38.   VotingLJ(){
  39.    Name=new String();
  40.    rank=count=0;
  41.   }
  42. }
  43. int ctmp;
  44. java.util.Date date2;
  45. static String[][] ListA;
  46. static int[][] ListB;
  47. static int[][] ListC;
  48. static int[][] ListD;
  49. Vector vName,vCode,vVote,vDate,vTime,vString,vBname,vOther,vLJ;
  50. StringBuffer sb = new StringBuffer();
  51. StringBuffer sb1 = new StringBuffer();
  52. StringBuffer sb2 = new StringBuffer();
  53. StringBuffer sb3 = new StringBuffer();
  54. StringBuffer sb4 = new StringBuffer();
  55. StringBuffer sb7 = new StringBuffer();
  56. boolean ReadInfo;
  57. boolean ReadTotal;
  58. int total;
  59. boolean MayInsert;
  60. int insert;
  61. boolean ReadName;
  62. boolean ReadyReadName;
  63. boolean ReadyReadTime;
  64. boolean ReadyToRead;
  65. boolean ReadTime;
  66. VotingMB vTemp=null;
  67. VotingMB vTemp1=null;
  68. String temp;
  69. boolean IP;
  70. int tot;
  71. int dt;
  72. String DZtemp;
  73. int zushu;
  74. int ketoushu;
  75. int meizujueseshu;
  76. String TZnum;
  77. long ttt;
  78. boolean cc,nc;
  79. @SuppressWarnings("deprecation")
  80. void bg(){
  81.   vName=new Vector();
  82.   vCode=new Vector();
  83.   vVote=new Vector();
  84.   vDate=new Vector();
  85.   vTime=new Vector();
  86.   vString=new Vector();
  87.   vOther=new Vector();
  88.   date2 = new Date();
  89.   vBname=new Vector();
  90.   vLJ=new Vector();
  91.   ttt=System.currentTimeMillis();
  92.   tot=0;
  93.   if(ReadConfig("nc").equalsIgnoreCase("true")){
  94.    TZnum = getTzNum();
  95.    System.out.println(TZnum);
  96.    dt=(date2.getYear()%100*10000)+((date2.getMonth()+1)*100)+date2.getDate();
  97.    getcharname();
  98.    meizujueseshu=2;
  99.    ketoushu=1;
  100.   }else{
  101.    TZnum = ReadConfig("TZnum");
  102.    dt=Integer.parseInt(ReadConfig("dt"));
  103.    zushu=Integer.parseInt(ReadConfig("zushu"));
  104.    meizujueseshu=Integer.parseInt(ReadConfig("meizujueseshu"));
  105.    ketoushu=Integer.parseInt(ReadConfig("ketoushu"));
  106.    ListA= new String[zushu][meizujueseshu];
  107.    ReadCharacters();
  108.   }
  109.   if(ReadConfig("cc").equalsIgnoreCase("true")){
  110.    cc=true;
  111.   }else{
  112.    cc=false;
  113.   }
  114.   
  115.   ListB= new int[zushu][meizujueseshu];
  116.   ListC= new int[zushu][meizujueseshu];
  117.   ListD=new int[zushu*meizujueseshu][133];
  118.   total=Integer.MAX_VALUE;
  119.   InputStream is = getClass().getResourceAsStream("codelist.txt");
  120.   InputStreamReader isr = new InputStreamReader(is);
  121.   int chr;
  122.   sb=new StringBuffer();
  123.   sb.delete(0, sb.length());
  124.   int fdsa=0;
  125.   try {
  126.    while((chr=isr.read())!=-1){
  127.     if(chr=='\n'||chr=='\r'||chr==' '){
  128.      if(sb.length()!=0){
  129.       vBname.addElement(sb.toString());
  130.       System.out.println(fdsa++);
  131.       System.out.println(sb.toString());
  132.       sb.delete(0, sb.length());
  133.      }
  134.     }else{
  135.      sb.append((char)chr);
  136.     }
  137.    }
  138.   } catch (IOException e1) {
  139.    e1.printStackTrace();
  140.   }
  141.   try {
  142.    isr.close();
  143.    is.close();
  144.   } catch (IOException e) {
  145.    e.printStackTrace();
  146.   }
  147. }
  148. void getcharname(){
  149.   InputStream is = getClass().getResourceAsStream(getHttpData("http://tieba.baidu.com/f?ct=335544320&lm=0&rn=30&tn=postBrowserN&sc=0&z="+TZnum+"&pn="+0+"&rs1=2", "httptemp.txt"));
  150.   InputStreamReader isr = new InputStreamReader(is);
  151.   int chr;
  152.   StringBuffer sb=new StringBuffer();
  153.   String s;
  154.   try {
  155.    while((chr=isr.read())!=-1){
  156.     sb.append((char)chr);
  157.    }
  158.    isr.close();
  159.    is.close();
  160.   } catch (IOException e) {
  161.    e.printStackTrace();
  162.   }
  163.   s=sb.toString();
  164.   int index=0;
  165.   int end=0;
  166.   index=s.indexOf("<cc>",s.indexOf("<cc>")+1);
  167.   end=s.indexOf("</cc>",s.indexOf("</cc>")+1)-1;
  168.   for(int i=0;index<end;index+=8,i++){
  169.    //ListA[i/2][i%2]=
  170.    if(s.indexOf("&gt;&gt;",index)==-1||s.indexOf("&lt;&lt;",index)==-1){
  171.     break;
  172.    }else if(s.indexOf("&lt;&lt;",index)>s.indexOf("&gt;&gt;",index)){
  173.     index=s.indexOf("&gt;&gt;",index)+1;
  174.    }
  175.    if(s.indexOf("&gt;&gt;", index)>end){
  176.     break;
  177.    }
  178.    System.out.println(("<<"+s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))+">>"));
  179.    //s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))
  180.    zushu=i/2+1;
  181.    System.out.println(index);
  182.   }
  183.   System.out.println(zushu);
  184.   System.out.println(end);
  185.   index=s.indexOf("<cc>",s.indexOf("<cc>")+1);
  186.   ListA=new String[zushu][2];
  187.   for(int i=0;index<end;index+=8,i++){
  188.    if(s.indexOf("&gt;&gt;",index)==-1||s.indexOf("&lt;&lt;",index)==-1){
  189.     break;
  190.    }else if(s.indexOf("&lt;&lt;",index)>s.indexOf("&gt;&gt;",index)){
  191.     index=s.indexOf("&gt;&gt;",index)+1;
  192.    }
  193.    if(s.indexOf("&gt;&gt;", index)>end){
  194.     break;
  195.    }
  196.    ListA[i/2][i%2]=("<<"+s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))+">>");
  197.    //s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))
  198.   }
  199. }
  200. public static void main(String[] args) {
  201.   CodiacApp app =new CodiacApp();
  202.   try {
  203.    Runtime.getRuntime().exec("C:/Program Files/Internet Explorer/iexplore.exe "+"file://"+app.getAppPath(app.getClass())+"/hulizuiweida/index.html");
  204.   // Desktop.getDesktop().browse(new URI("file://"+app.getAppPath(app.getClass())+"/hulizuiweida/index.html"));
  205.   } catch (Exception e) {
  206.    e.printStackTrace();
  207.   }
  208.   System.out.println(System.currentTimeMillis()-app.ttt);
  209. }
  210. CodiacApp(){
  211.   bg();
  212.   for(int i=0;i<=total;i+=30){
  213.    getWord(getHttpData("http://tieba.baidu.com/f?ct=335544320&lm=0&rn=30&tn=postBrowserN&sc=0&z="+TZnum+"&pn="+i+"&rs1=2", "httptemp.txt"));
  214.   }
  215.   System.out.println("------------------------");
  216.   CheckVote( dt,zushu,ketoushu);
  217.   OutPut();
  218. }
  219. public String getTzNum(){
  220.   InputStream is = getClass().getResourceAsStream(getHttpData("http://tieba.baidu.com/f?tn=bdAdvResult&kw=&ct=352321536&lm=65541&rs5=1&rs2=2&sn=%C3%C8%D5%BD&word=%CD%B6%C6%B1%C2%A5&un=CIP%B1%AD%C3%C8%D5%BD%D4%CB%D3%AA&rs1=0&rn=10",
  221.   "s.tmp"));
  222.   InputStreamReader isr = new InputStreamReader(is);
  223.   int chr;
  224.   StringBuffer sb=new StringBuffer();
  225.   try {
  226.    while((chr=isr.read())!=-1){
  227.     sb.append((char)chr);
  228.    }
  229.    isr.close();
  230.    is.close();
  231.   } catch (IOException e) {
  232.    e.printStackTrace();
  233.   }
  234.   String s=sb.toString();
  235.   return s.substring(s.indexOf("z=",
  236.     s.indexOf("/f?ct=335675392&amp;tn=baiduPostBrowser"))+2,
  237.     s.indexOf("&amp;",
  238.       s.indexOf("z=",
  239.         s.indexOf("/f?ct=335675392&amp;tn=baiduPostBrowser"))));
  240. }
  241. public void getWord(String filename){
  242.   InputStream is = getClass().getResourceAsStream(filename);
  243.   InputStreamReader isr = new InputStreamReader(is);
  244.   int chr;
  245.   try {
  246.    while((chr=isr.read())!=-1){
  247.     int insertCount=0;
  248.     if(chr=='@'){
  249.      chr='@';
  250.     }
  251.     if(chr=='"'){
  252.      ReadyToRead=!ReadyToRead;
  253.     }else if(chr==62){
  254.      //System.out.println(sb);
  255.      ReadyToRead=false;
  256.      if (sb.toString().equalsIgnoreCase("cc")) {
  257.       ReadInfo=true;
  258.       sb1.delete(0, sb1.length());
  259.      }else if (sb.toString().equalsIgnoreCase("span class=")) {
  260.       ReadTotal=true;
  261.       sb7.delete(0, sb7.length());
  262.      }else if (sb.toString().equalsIgnoreCase("/span")&&ReadTotal) {
  263.       ReadTotal=false;
  264.       if(sb7.charAt(0)>57){
  265.       }else{
  266.        total = Integer.parseInt(sb7.toString());
  267.        //System.out.println(sb7);
  268.       }
  269.      }else if (sb.toString().equalsIgnoreCase("/cc")) {
  270.       ReadInfo=false;
  271.       if(MayInsert){
  272.        sb1.insert(insert-1, sb4.toString());
  273.       }
  274.       sb1.append(';');
  275.       vString.add(sb1.toString().toUpperCase());
  276.       System.out.println(sb1);
  277.      }else if(sb.toString().equalsIgnoreCase("/ul")&&ReadyReadName){
  278.       ReadyReadTime=!ReadyReadTime;
  279.      }else if(sb.toString().equalsIgnoreCase("td align= class=")){
  280.       ReadyReadName=true;
  281.      }else if(sb.toString().equalsIgnoreCase("/td")&&ReadyReadName){
  282.       ReadyReadName=false;
  283.      }else if(sb.toString().equalsIgnoreCase("br")&&ReadInfo){
  284.       sb1.append(';');
  285.      }else if((sb.toString().equalsIgnoreCase("a href= target=")||sb.toString().equalsIgnoreCase("li class="))&&(ReadyReadName&&!ReadyReadTime)){
  286.       ReadName=true;
  287.       sb2.delete(0, sb2.length());
  288.      }else if(ReadName){
  289.       if( sb.toString().equalsIgnoreCase("/a")){
  290.        ReadName=false;
  291.        if(MayInsert){
  292.         sb2.insert(insert-1, sb4.toString());
  293.        }
  294.        vName.add(sb2.toString());
  295.        System.out.println(sb2);
  296.       }else if(sb.toString().equalsIgnoreCase("/li")){
  297.        ReadName=false;
  298.        if(MayInsert){
  299.         sb2.insert(insert-1, sb4.toString());
  300.        }
  301.        sb2.delete(0, 3);
  302.        vName.add(sb2.toString());
  303.        System.out.println(sb2);
  304.       }
  305.      }else if(sb.toString().equalsIgnoreCase("li class=")&&ReadyReadTime){
  306.       ReadTime=true;
  307.       sb3.delete(0, sb3.length());
  308.      }else if((sb.toString().equalsIgnoreCase("/li")&&ReadTime)){///span
  309.       ReadTime=false;
  310.       ReadyReadName=false;
  311.       ReadyReadTime=false;
  312.       sb3.append(' ');
  313.       vDate.add(Integer.toString(getDate(sb3.toString())));
  314.       vTime.add(Integer.toString(getTime(sb3.toString())));
  315.       // System.out.println(sb3);
  316.      }
  317.     }else if(chr==60){
  318.      ReadyToRead=true;
  319.      sb.delete(0, sb.length());
  320.     }else if(ReadyToRead){
  321.      sb.append(((char)chr));
  322.     }else if(ReadInfo){
  323.      if(chr==';'&&MayInsert){
  324.       MayInsert=false;
  325.       if(sb4.toString().equalsIgnoreCase("nbsp")){
  326.        sb1.insert(insert, " ");
  327.       }else if(sb4.toString().equalsIgnoreCase("lt")){
  328.        sb1.insert(insert, "<");
  329.       }else if(sb4.toString().equalsIgnoreCase("gt")){
  330.        sb1.insert(insert, ">");
  331.       }else if(sb4.toString().equalsIgnoreCase("quot")){
  332.        sb1.insert(insert, """);
  333.       }else if(sb4.toString().equalsIgnoreCase("#x30FB")){
  334.       }else{
  335.        sb1.insert(insert, "我不知道是什么号");
  336.       }
  337.      }else if(insertCount>5&&MayInsert){
  338.       MayInsert=false;
  339.       sb1.insert(insert, "&");
  340.      }else if((chr=='&'&&MayInsert)){
  341.       MayInsert=false;
  342.       sb1.insert(insert,"&&");
  343.      }else if(chr=='&'&&(!MayInsert)){
  344.       MayInsert=true;
  345.       sb4.delete(0, sb4.length());
  346.       insert=sb1.length();
  347.       insertCount=0;
  348.      }else{
  349.       if(MayInsert){
  350.        insertCount++;
  351.        sb4.append((char)chr);
  352.       }else{
  353.        sb1.append((char)chr);
  354.       }
  355.      }
  356.      //#x30FB
  357.     }else if (ReadName) {
  358.      if(chr==';'&&MayInsert){
  359.       MayInsert=false;
  360.       if(sb4.toString().equalsIgnoreCase("nbsp")){
  361.        sb2.insert(insert, "");
  362.       }else if(sb4.toString().equalsIgnoreCase("lt")){
  363.        sb2.insert(insert, "<");
  364.       }else if(sb4.toString().equalsIgnoreCase("gt")){
  365.        sb2.insert(insert, ">");
  366.       }else if(sb4.toString().equalsIgnoreCase("quot")){
  367.        sb2.insert(insert, """);
  368.       }else if(sb4.toString().equalsIgnoreCase("#x30FB")){
  369.       }else{
  370.        sb2.insert(insert, "我不知道是什么号");
  371.       }
  372.       continue;
  373.      }else if(insertCount>5&&MayInsert){
  374.       MayInsert=false;
  375.       sb2.insert(insert, "&");
  376.      }else if((chr=='&'&&MayInsert)){
  377.       MayInsert=false;
  378.       sb2.insert(insert,"&&");
  379.      }else if(chr=='&'&&(!MayInsert)){
  380.       MayInsert=true;
  381.       sb4.delete(0, sb4.length());
  382.       insert=sb2.length();
  383.       insertCount=0;
  384.      }else{
  385.       if(MayInsert){
  386.        insertCount++;
  387.        sb4.append((char)chr);
  388.       }else{
  389.        sb2.append((char)chr);
  390.       }
  391.      }
  392.     }else if (ReadTime) {
  393.      sb3.append((char)chr);
  394.     }else if(ReadTotal){
  395.      sb7.append(((char)chr));
  396.     }
  397.    }
  398.   } catch (IOException e1) {
  399.    e1.printStackTrace();
  400.   }
  401.   try {
  402.    isr.close();
  403.    is.close();
  404.   } catch (IOException e) {
  405.    e.printStackTrace();
  406.   }
  407. }
  408. public boolean checkCode(String s){
  409.   int vz=vBname.size();
  410.   for(int i=0;i<vz;i++){
  411.    if(s.equalsIgnoreCase((String)vBname.elementAt(i))){
  412.     ctmp=i;
  413.     return true;
  414.    };
  415.   }
  416.   return false;
  417. }
  418. public boolean CheckCode(String str1){
  419.   //  StringBuffer s=new StringBuffer();
  420.   //  for(int i=0;i<str1.length();i++){
  421.   //   if(str1.charAt(i)=='@'||str1.charAt(i)=='<'||str1.charAt(i)==';'||str1.charAt(i)<45||(str1.charAt(i)>65281&&str1.charAt(i)>65295)||str1.charAt(i)==12288||str1.charAt(i)=='('){
  422.   //    if(str.equalsIgnoreCase(s.toString())) return true;
  423.   //    else s.delete(0, s.length());;
  424.   //   }else{
  425.   //    s.append(str1.charAt(i));
  426.   //   }
  427.   //  }
  428.   for(int i=0;i<str1.length();i++){
  429.    if(str1.indexOf("]]",i)==-1||str1.indexOf("[[",i)==-1){
  430.     return false;
  431.    }else if(str1.indexOf("[[",i)>str1.indexOf("]]",i)){
  432.     i=str1.indexOf("]]",i)+1;
  433.    }else if(checkCode(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)))){
  434.     return true;
  435.    }else{
  436.     i=str1.indexOf("]]",i)+1;
  437.    }
  438.   }
  439.   return false;
  440. }
  441. public void CollectCode(String str1){
  442.   //  StringBuffer s=new StringBuffer();
  443.   //  for(int i=0;i<str1.length();i++){
  444.   //   if(str1.charAt(i)=='@'||str1.charAt(i)=='<'||str1.charAt(i)==';'||str1.charAt(i)<45||(str1.charAt(i)>65281&&str1.charAt(i)>65295)||str1.charAt(i)==12288||str1.charAt(i)=='('){
  445.   //    if(str.equalsIgnoreCase(s.toString())) return true;
  446.   //    else s.delete(0, s.length());;
  447.   //   }else{
  448.   //    s.append(str1.charAt(i));
  449.   //   }
  450.   //  }
  451.   for(int i=0;i<str1.length();i++){
  452.    if(str1.indexOf("]]",i)==-1||str1.indexOf("[[",i)==-1){
  453.     return ;
  454.    }else if(str1.indexOf("[[",i)>str1.indexOf("]]",i)){
  455.     i=str1.indexOf("]]",i)+1;
  456.    }else if(str1.indexOf("]]",i)-str1.indexOf("[[",i)+2==(date2.getDate()>9?21:20)){
  457.     if(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("-",str1.indexOf("[[",i))+1).equalsIgnoreCase("CIP"+date2.getDate()+"-")){
  458.      if('-'==str1.charAt(str1.indexOf("-",str1.indexOf("-",str1.indexOf("[[",i))))){
  459.       vBname.addElement(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)).toString());
  460.       System.out.println(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)));
  461.      }
  462.     }
  463.    }else{
  464.     i=str1.indexOf("]]",i)+1;
  465.    }
  466.   }
  467.   return ;
  468. }
  469. // public boolean CheckCode(String str1){
  470. //  StringBuffer s=new StringBuffer();
  471. //  String ttmp;
  472. //  for(int l=0;l<vCode.size();l++){
  473. //   ttmp=(String)vCode.elementAt(l);
  474. //   for(int i=0;i<str1.length();i++){
  475. //    if(str1.charAt(i)==';'||str1.charAt(i)=='['||str1.charAt(i)==']'||str1.charAt(i)=='\r'||str1.charAt(i)=='\n'||str1.charAt(i)==' '){
  476. //     if(ttmp.equalsIgnoreCase(s.toString())) {
  477. //      System.out.println(s.toString());
  478. //      return false;
  479. //     }
  480. //     else {
  481. //      s.delete(0, s.length());;
  482. //     }
  483. //    }else{
  484. //     s.append(str1.charAt(i));
  485. //    }
  486. //   }
  487. //  }
  488. //  for(int i=0;i<str1.length();i++){
  489. //   if(str1.charAt(i)==';'||str1.charAt(i)=='['||str1.charAt(i)==']'||str1.charAt(i)=='\r'||str1.charAt(i)=='\n'||str1.charAt(i)==' '){
  490. //    if(checkCode(s.toString())) {
  491. //     System.out.println(s.toString());
  492. //     return true;
  493. //    }
  494. //    else {
  495. //     s.delete(0, s.length());;
  496. //    }
  497. //   }else{
  498. //    s.append(str1.charAt(i));
  499. //   }
  500. //  }
  501. //  return false;
  502. // }
  503. public String getHttpData(String url,String filename){
  504.   try   
  505.   {
  506.    URL myURL = new URL(url);
  507.    HttpURLConnection con =(HttpURLConnection) myURL.openConnection();
  508.    String rm;
  509.    while(!(rm=con.getResponseMessage()).equalsIgnoreCase("OK")){
  510.     System.out.println(rm);
  511.     try {
  512.      Thread.sleep(1000);
  513.     } catch (Exception e) {
  514.     }
  515.    }
  516.    con.connect();
  517.    BufferedReader bfr = new BufferedReader(new InputStreamReader(con.getInputStream()));
  518.    String line = null;
  519.    File file = new File(filename);
  520.    if(file.exists()){
  521.     file.delete();
  522.    }
  523.    file=null;
  524.    file=new File(filename);
  525.    FileOutputStream fos = new FileOutputStream(file);
  526.    DataOutputStream dos = new DataOutputStream(fos);
  527.    try {
  528.     file.createNewFile();
  529.    } catch (IOException e) {
  530.    }
  531.    while ((line = bfr.readLine())!=null)
  532.    {
  533.     fos.write(line.getBytes());
  534.    }
  535.    dos.close();
  536.    fos.close();
  537.    bfr.close();
  538.   }
  539.   catch(Exception exz)
  540.   {
  541.   }
  542.   return filename;
  543. }
  544. public String ReadConfig(String str) {
  545.   try{
  546.    StringBuffer s=new StringBuffer();
  547.    int chr;
  548.    boolean b1=false;
  549.    InputStream is = getClass().getResourceAsStream("Config.ini");
  550.    InputStreamReader isr = new InputStreamReader(is);
  551.    while((chr=isr.read())!=-1){
  552.     if(chr==' '){
  553.      continue;
  554.     }else if(chr=='='){
  555.      if(str.equalsIgnoreCase(s.toString())){
  556.       b1=true;
  557.       s.delete(0,s.length());
  558.       continue;
  559.      }else{
  560.       while((chr=isr.read())!=-1)
  561.        if(chr=='\n')        
  562.         break;
  563.      }
  564.      s.delete(0,s.length());
  565.      continue;
  566.     }else {
  567.      if(b1){
  568.       if(chr=='\n'||chr=='\r'){
  569.        isr.close();
  570.        is.close();
  571.        if(s.length()==0)
  572.         return "";
  573.        else
  574.         return s.toString();
  575.       }
  576.      }
  577.      if(chr!='\n'||chr!='\r')
  578.       s.append((char)chr);
  579.     }
  580.    }
  581.    isr.close();
  582.    is.close();
  583.   }catch (IOException e) {
  584.    System.out.println("READ CONFIG ERROR!");
  585.   }
  586.   return null;
  587. }
  588. public int getTime(String str){
  589.   int Time=0;
  590.   StringBuffer sbt=new StringBuffer();
  591.   boolean b1=false,b2=false;
  592.   for(int i=1;i<str.length();i++){
  593.    if(b2){
  594.     if(str.charAt(i)==' '){
  595.      Time+=Integer.parseInt(sbt.toString());
  596.      sbt.delete(0, sbt.length());
  597.      return Time;
  598.     }
  599.     sbt.append(str.charAt(i));
  600.    }else if(b1){
  601.     if(str.charAt(i)==':'){
  602.      Time+=Integer.parseInt(sbt.toString())*100;
  603.      sbt.delete(0, sbt.length());
  604.      b2=true;
  605.      continue;
  606.     }
  607.     sbt.append(str.charAt(i));
  608.    }else{
  609.     if(str.charAt(i)==' '){
  610.      sbt.delete(0, sbt.length());
  611.      b1=true;
  612.      continue;
  613.     }
  614.    }
  615.   }
  616.   return Time;
  617. }
  618. public int getDate(String str){
  619.   StringBuffer sbt=new StringBuffer();
  620.   int date=0;
  621.   boolean b1=false,b2=false;
  622.   for(int i=1;i<str.length();i++){
  623.    if(b2){
  624.     if(str.charAt(i)==' '){
  625.      date+=Integer.parseInt(sbt.toString());
  626.      sbt.delete(0, sbt.length());
  627.      return date;
  628.     }
  629.     sbt.append(str.charAt(i));
  630.    }else if(b1){
  631.     if(str.charAt(i)=='-'){
  632.      date+=Integer.parseInt(sbt.toString())*100;
  633.      sbt.delete(0, sbt.length());
  634.      b2=true;
  635.      continue;
  636.     }
  637.     sbt.append(str.charAt(i));
  638.    }else{
  639.     if(str.charAt(i)=='-'){
  640.      date+=Integer.parseInt(sbt.toString())*10000;
  641.      sbt.delete(0, sbt.length());
  642.      b1=true;
  643.      continue;
  644.     }
  645.     sbt.append(str.charAt(i));
  646.    }
  647.   }
  648.   return date;
  649. }
  650. public boolean CheckVt(String str,String str1){
  651.   //  StringBuffer s=new StringBuffer();
  652.   //  for(int i=0;i<str1.length();i++){
  653.   //   if(str1.charAt(i)=='@'||str1.charAt(i)=='<'||str1.charAt(i)==';'||str1.charAt(i)<45||(str1.charAt(i)>65281&&str1.charAt(i)>65295)||str1.charAt(i)==12288||str1.charAt(i)=='('){
  654.   //    if(str.equalsIgnoreCase(s.toString())) return true;
  655.   //    else s.delete(0, s.length());;
  656.   //   }else{
  657.   //    s.append(str1.charAt(i));
  658.   //   }
  659.   //  }
  660.   for(int i=0;i<str1.length();i++){
  661.    if(str1.indexOf(">>",i)==-1||str1.indexOf("<<",i)==-1){
  662.     return false;
  663.    }else if(str1.indexOf("<<",i)>str1.indexOf(">>",i)){
  664.     i=str1.indexOf(">>",i)+1;
  665.    }else if(str.equalsIgnoreCase(str1.substring(str1.indexOf("<<",i),str1.indexOf(">>",i)+2))){
  666.     return true;
  667.    }else{
  668.     i=str1.indexOf(">>",i)+1;
  669.    }
  670.   }
  671.   return false;
  672. }
  673. public void CheckVote(int date,int r,int u){
  674.   boolean b1,b3,othername;
  675.   b3=false;
  676.   othername=false;
  677.   StringBuffer s=new StringBuffer();
  678.   for(int i=0;i<vName.size();i++){
  679.    int dat,tim;
  680.    othername=false;
  681.    b1=true;
  682.    b3=false;
  683.    s.delete(0, s.length());
  684.    b1=true;
  685.    dat=Integer.parseInt((String)vDate.elementAt(i));
  686.    tim=Integer.parseInt((String)vTime.elementAt(i));
  687.    if(dat>date){
  688.     b1=false;
  689.    }else if(dat==date&&tim>2200){
  690.     b1=false;
  691.    }
  692.    temp=(String)vString.elementAt(i);
  693.    if(cc){
  694.     CollectCode(temp);
  695.    }
  696.    if(b1&&CheckCode(temp)){
  697.     int zz=0;
  698.     int zzzz=0;
  699.     temp=(String)vString.elementAt(i);
  700.     for(int z=0;z<r;z++){
  701.      zz=0;
  702.      for(int j=0;j<ListA[z].length;j++){
  703.       if(CheckVt(ListA[z][j], temp)){
  704.        zz++;
  705.        zzzz++;
  706.        s.append('1');
  707.       }else{
  708.        s.append('0');
  709.       };
  710.      }
  711.      s.append(';');
  712.      if(zz>u){
  713.       b3=true;
  714.      }
  715.     }
  716.     if(zzzz==0){
  717.      othername=true;
  718.     }
  719.     if(!b3){
  720.      if(othername){
  721.       vTemp=new VotingMB();
  722.       temp=(String)vBname.elementAt(ctmp);
  723.       vTemp.Code=temp;
  724.       temp=(String)vName.elementAt(i);
  725.       vTemp.Name=temp;
  726.       temp=(String)vDate.elementAt(i);
  727.       vTemp.date=Integer.parseInt(temp);
  728.       temp=(String)vTime.elementAt(i);
  729.       vTemp.time=Integer.parseInt(temp);
  730.       vTemp.Vote=(String)vString.elementAt(i);
  731.       vTemp.fp=b3;
  732.       vTemp.ot=true;
  733.       vVote.add(vTemp);
  734.      }else{
  735.       vTemp=new VotingMB();
  736.       temp=(String)vBname.elementAt(ctmp);
  737.       vTemp.Code=temp;
  738.       temp=(String)vName.elementAt(i);
  739.       vTemp.Name=temp;
  740.       temp=(String)vDate.elementAt(i);
  741.       vTemp.date=Integer.parseInt(temp);
  742.       temp=(String)vTime.elementAt(i);
  743.       vTemp.time=Integer.parseInt(temp);
  744.       vTemp.Vote=s.toString();
  745.       vTemp.fp=b3;
  746.       vVote.add(vTemp);
  747.      }
  748.     }else{
  749.      vTemp=new VotingMB();
  750.      temp=(String)vBname.elementAt(ctmp);
  751.      vTemp.Code=temp;
  752.      temp=(String)vName.elementAt(i);
  753.      vTemp.Name=temp;
  754.      temp=(String)vDate.elementAt(i);
  755.      vTemp.date=Integer.parseInt(temp);
  756.      temp=(String)vTime.elementAt(i);
  757.      vTemp.time=Integer.parseInt(temp);
  758.      vTemp.Vote=s.toString();
  759.      vTemp.fp=b3;
  760.      vVote.add(vTemp);
  761.     }
  762.    }
  763.   }
  764. }
  765. public void ReadCharacters(){
  766.   for(int z=0;z<ListA.length;z++){
  767.    for(int i=0;i<ListA[z].length;i++){
  768.     ListA[z][i]=null;
  769.    }
  770.   }
  771.   StringBuffer s=new StringBuffer();
  772.   InputStream is = getClass().getResourceAsStream("list.txt");
  773.   InputStreamReader isr = new InputStreamReader(is);
  774.   int chr=0;
  775.   try {
  776.    int z=0;
  777.    int i=0;
  778.    while((chr=isr.read())!=-1){
  779.     if(chr==';'){
  780.      z++;
  781.      i=0;
  782.     }else if(chr==' '||chr=='\n'||chr=='\r'){
  783.      if(s.length()==0){
  784.      }else{
  785.       ListA[z][i]=s.toString();
  786.       i++;
  787.       s.delete(0, s.length());
  788.      }
  789.      continue;
  790.     }else {
  791.      s.append((char)(chr));
  792.     }
  793.    }
  794.    isr.close();
  795.    is.close();
  796.   } catch (IOException e) {
  797.    e.printStackTrace();
  798.   }
  799.   for(int z=0;z<ListA.length;z++){
  800.    for(int i=0;i<ListA[z].length;i++){
  801.     if(ListA[z][i]==null){
  802.      ListA[z][i]="狐狸叔叔说这个很长很长的东西是没有用的,狐狸最伟大!";
  803.     }
  804.    }
  805.   }
  806. }
  807. public void OutPut(){
  808.   String enter="\r\n";
  809.   String space=": ";
  810.   String br="------------- ";
  811.   File file;
  812.   String line;
  813.   FileOutputStream fos;
  814.   VotingMB v1,v2;
  815.   try {
  816.    for(int i=0;i<vVote.size();i++){
  817.     v1=(VotingMB)vVote.elementAt(i);
  818.     for(int j=i+1;j<vVote.size();j++){
  819.      v2=(VotingMB)vVote.elementAt(j);
  820.      if(v1.Code.equalsIgnoreCase(v2.Code)&&v1.Name.equalsIgnoreCase(v2.Name)&&(v1.fp||v1.ot)){
  821.       vVote.removeElementAt(i);
  822.       i--;
  823.       break;
  824.      }else
  825.       if (v1.Code.equalsIgnoreCase(v2.Code)) {
  826.        vVote.removeElementAt(j);
  827.        j--;
  828.       }
  829.     }
  830.    }
  831.    tot=vVote.size();
  832.   } catch (Exception e) {
  833.   }
  834.   try   
  835.   {
  836.    file=new File("hulizuiweida/index_4.html");
  837.    if(file.exists()){
  838.     file.delete();
  839.    }
  840.    file=null;
  841.    file=new File("hulizuiweida/index_4.html");
  842.    fos=new FileOutputStream(file);
  843.    //dos=new DataOutputStream(fos);
  844.    try {
  845.     file.createNewFile();
  846.    } catch (IOException e) {
  847.    }
  848.    line = ("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>狐狸最伟大</title><style type="text/css"><!--body { background-image: url(background.JPG);}--></style></head><body>");
  849.    fos.write(line.getBytes());
  850.    for(int i=0;i<vVote.size();i++){
  851.     vTemp=(VotingMB)vVote.elementAt(i);
  852.     line = ("<table width="616" height="202" border="0" cellpadding="0" cellspacing="0" bgcolor="#E5F1FF">  <tr>    <td width="17" height="17" background="lt.jpg">&nbsp;</td>    <td height="17" colspan="3" background="t.jpg">&nbsp;</td>    <td width="19" height="17" background="rt.jpg">&nbsp;</td>  </tr>  <tr>    <td width="17" rowspan="2" background="l.jpg">&nbsp;</td>    <td width="140" height="140" bgcolor="#E5F1FF"><div align="center"><img src="wssy.JPG" width="141" height="131" /></div></td>    <td colspan="2" bgcolor="#E5F1FF"><div align="left"><p>"
  853.       +vTemp.Code+"<br>");
  854.     fos.write(line.getBytes());
  855.     for(int j=0,k=0,l=0;j<vTemp.Vote.length();j++){
  856.      if(vTemp.ot){
  857.       fos.write(vTemp.Vote.getBytes());
  858.       fos.write("<br>".getBytes());
  859.       break;
  860.      }
  861.      if (vTemp.Vote.charAt(j)=='1') {
  862.       fos.write(ListA[k][l].getBytes());
  863.       fos.write("<br>".getBytes());
  864.       l++;
  865.      }else if(vTemp.Vote.charAt(j)==';') {
  866.       k++;
  867.       l=0;
  868.      }else{
  869.       l++;
  870.      }
  871.     }
  872.     line=("</p>      </div></td>    <td width="19" rowspan="2" background="r.jpg">&nbsp;</td>  </tr>  <tr>    <td height="28" bgcolor="#E5F1FF"><div align="center">"+vTemp.Name);
  873.     fos.write(line.getBytes());
  874.     line=("</div></td>    <td colspan="2" bgcolor="#E5F1FF"><div align="right">"+(vTemp.fp?"废票 ":" ")+(vTemp.ot?"乱入 ":" ")+vTemp.date+" "+vTemp.time);
  875.     fos.write(line.getBytes());
  876.     fos.write(enter.getBytes());
  877.     line=("</div></td>  </tr>  <tr>    <td width="17" height="17" background="lb.jpg">&nbsp;</td>    <td height="17" colspan="3" background="b.jpg">&nbsp;</td>    <td width="17" height="17" background="rb.jpg">&nbsp;</td>  </tr></table><br>");
  878.     fos.write(line.getBytes());
  879.    }
  880.    line=("总计有CODE:"+tot+"</body></html>");
  881.    fos.write(line.getBytes());
  882.    //dos.close();
  883.    fos.close();
  884.   }
  885.   catch(Exception ex)
  886.   {
  887.   }  
  888.   try   
  889.   {
  890.    int rtmp=0;
  891.    VotingLJ ljtemp,ljtemp1;
  892.    for(int i=0;i<vVote.size();i++){
  893.     vTemp=(VotingMB)vVote.elementAt(i);
  894.     if(!vTemp.fp&&!vTemp.ot){
  895.      sb.delete(0, sb.length());
  896.      int k=0;
  897.      int jj=0;
  898.      for(int l=0;l<vTemp.Vote.length();l++){
  899.       if(vTemp.Vote.charAt(l)==';'){
  900.        k++;
  901.        jj=-1;
  902.       }else if(vTemp.Vote.charAt(l)=='1'){
  903.        rtmp++;
  904.        if(sb.length()!=0){
  905.         sb.append("<br>");
  906.        }
  907.        sb.append(ListA[k][jj]);
  908.       }
  909.       jj++;
  910.      }
  911.      if(vLJ.size()==0){
  912.       ljtemp=new VotingLJ();
  913.       ljtemp.rank=rtmp;
  914.       rtmp=0;
  915.       ljtemp.Name=sb.toString();
  916.       sb.delete(0, sb.length());
  917.       ljtemp.count=1;
  918.       vLJ.addElement(ljtemp);
  919.      }else{
  920.       int l=0;
  921.       for(;;){
  922.        if(l>=vLJ.size()){
  923.         ljtemp=new VotingLJ();
  924.         ljtemp.rank=rtmp;
  925.         rtmp=0;
  926.         ljtemp.Name=sb.toString();
  927.         sb.delete(0, sb.length());
  928.         ljtemp.count=1;
  929.         vLJ.addElement(ljtemp);
  930.         break;
  931.        }else{
  932.         ljtemp=(VotingLJ)vLJ.elementAt(l);
  933.         if(rtmp==ljtemp.rank){
  934.          if(sb.toString().equalsIgnoreCase(ljtemp.Name)){
  935.           ljtemp.count++;
  936.           rtmp=0;
  937.           sb.delete(0, sb.length());
  938.           break;
  939.          }
  940.         }
  941.        }
  942.        l++;
  943.       }
  944.      }
  945.     }
  946.    }
  947.    //   for(int i=0;i<vLJ.size();i++){
  948.    //    ljtemp=(VotingLJ)vLJ.elementAt(i);
  949.    //    System.out.println(ljtemp.Name);
  950.    //    System.out.println(ljtemp.count);
  951.    //   }
  952.    for(int i=0;i<vLJ.size();i++){
  953.     if(i+1<vLJ.size()){
  954.      ljtemp=(VotingLJ)vLJ.elementAt(i);
  955.      ljtemp1=(VotingLJ)vLJ.elementAt(i+1);
  956.      if(ljtemp.count<ljtemp1.count){
  957.       vLJ.insertElementAt(ljtemp1, i);
  958.       vLJ.removeElementAt(i+2);
  959.       i=-1;
  960.      }
  961.     }
  962.    }
  963.    for(int i=0;i<vLJ.size();i++){
  964.     if(i+1<vLJ.size()){
  965.      ljtemp=(VotingLJ)vLJ.elementAt(i);
  966.      ljtemp1=(VotingLJ)vLJ.elementAt(i+1);
  967.      if(ljtemp.rank<ljtemp1.rank){
  968.       vLJ.insertElementAt(ljtemp1, i);
  969.       vLJ.removeElementAt(i+2);
  970.       i=-1;
  971.      }
  972.     }
  973.    }
  974.    file=new File("hulizuiweida/index_5.html");
  975.    if(file.exists()){
  976.     file.delete();
  977.    }
  978.    file=null;
  979.    file=new File("hulizuiweida/index_5.html");
  980.    fos=new FileOutputStream(file);
  981.    //dos=new DataOutputStream(fos);
  982.    try {
  983.     file.createNewFile();
  984.    } catch (IOException e) {
  985.    }
  986.    line = ("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>狐狸最伟大</title><style type="text/css"><!--body { background-image: url(background.JPG);}--></style></head><body>");
  987.    fos.write(line.getBytes());
  988.    int it=0;
  989.    for(int i=0;i<vLJ.size();i++){
  990.     ljtemp=(VotingLJ)vLJ.elementAt(i);
  991.     if(it!=ljtemp.rank){
  992.      it=ljtemp.rank;
  993.      if(it==1){
  994.       line = ("<p>"+"单投"+"</p>");
  995.       fos.write(line.getBytes());
  996.      }else{
  997.       fos.write(enter.getBytes());
  998.       line = ("<p>"+it+"连记"+"</p>");
  999.       fos.write(line.getBytes());
  1000.      }
  1001.     }
  1002.     line = ("<table width="616" height="202" border="0" cellpadding="0" cellspacing="0" bgcolor="#E5F1FF">  <tr>    <td width="17" height="17" background="lt.jpg">&nbsp;</td>    <td height="17" colspan="3" background="t.jpg">&nbsp;</td>    <td width="17" height="17" background="rt.jpg">&nbsp;</td>  </tr>  <tr>    <td width="17" background="l.jpg">&nbsp;</td>    <td width="420" bgcolor="#E5F1FF"><div align="center">"+
  1003.       ljtemp.Name+
  1004.       "</div></td>    <td colspan="2" bgcolor="#E5F1FF"><div align="center">"
  1005.       +ljtemp.count+
  1006.     "</div></td>    <td width="17" background="r.jpg">&nbsp;</td>  </tr>    <tr>    <td width="17" height="17" background="lb.jpg">&nbsp;</td>    <td height="17" colspan="3" background="b.jpg">&nbsp;</td>    <td width="17" height="17" background="rb.jpg">&nbsp;</td>  </tr></table>");
  1007.     fos.write(line.getBytes());
  1008.     fos.write(enter.getBytes());
  1009.    }
  1010.    fos.write("</body></html>".getBytes());
  1011.    //dos.close();
  1012.    fos.close();
  1013.   }
  1014.   catch(Exception ex)
  1015.   {
  1016.   }


  1017.   try   
  1018.   {
  1019.    int zmax=0;
  1020.    StringBuffer tttemp=new StringBuffer();
  1021.    int iz=0;
  1022.    int i1=0;
  1023.    for(int j=0;j<=2200;j+=10){
  1024.     if(j%100>=60){
  1025.      j=((j/100)+1)*100;
  1026.      if(j>2200){
  1027.       break;
  1028.      }
  1029.     }
  1030.     tttemp.append(j);
  1031.     tttemp.append('\t');
  1032.     //    for(int z1=0;z1<zushu;z1++){
  1033.     //     for(int z2=0;z2<meizujueseshu;z2++){
  1034.     //       ListC[z1][z2]=0;
  1035.     //     }
  1036.     //    }
  1037.     for(;iz<vVote.size();){
  1038.      vTemp=(VotingMB)vVote.elementAt(iz);
  1039.      if(vTemp.fp||vTemp.ot){
  1040.       iz++;
  1041.      }else{
  1042.       if(vTemp.time<j){
  1043.        for(int z1=0;z1<zushu;z1++){
  1044.         for(int z2=0;z2<meizujueseshu;z2++){
  1045.          if(vTemp.Vote.charAt(z1*meizujueseshu+z1+z2)=='1'){
  1046.           ListC[z1][z2]++;
  1047.          }
  1048.         }
  1049.        }
  1050.        iz++;
  1051.       }else{
  1052.        break;
  1053.       }
  1054.      }
  1055.     }
  1056.     for(int z1=0;z1<zushu;z1++){
  1057.      for(int z2=0;z2<meizujueseshu;z2++){
  1058.       zmax=zmax>ListC[z1][z2]?zmax:ListC[z1][z2];
  1059.       ListD[z1*meizujueseshu+z2][i1]=ListC[z1][z2];
  1060.       tttemp.append(ListC[z1][z2]);
  1061.       tttemp.append('\t');
  1062.      }
  1063.     }
  1064.     tttemp.append(enter);
  1065.     i1++;
  1066.    }
  1067.    int width=560, height=340;
  1068.    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
  1069.    Graphics g = image.getGraphics();
  1070.    Random random = new Random();
  1071.    g.setColor(new Color(0,0,0));
  1072.    g.fillRect(0, 0, width, height);
  1073.    Image image2 = null;
  1074.    try {
  1075.     image2 = ImageIO.read(new File("hulizuiweida/wssy.bfx"));
  1076.    } catch (IOException e1) {
  1077.     e1.printStackTrace();
  1078.    }
  1079.    g.drawImage(image2,0,0,null);
  1080.    g.setFont(new Font("黑体",Font.PLAIN,18));
  1081.    String sRand="狐狸最伟大";
  1082.    g.setColor(getRandColor(160,200));
  1083.    for (int i=0;i<25;i++) {
  1084.     int x = random.nextInt(width)-25;
  1085.     int y = random.nextInt(height);
  1086.     g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));
  1087.     g.drawString(sRand,x,y);
  1088.    }
  1089.    g.setColor(new Color(255,255,255,220));
  1090.    g.fillRect(0, 0, width, height);
  1091.    g.setColor(new Color(0,0,0));
  1092.    g.drawRect(0,0,width-1,height-1);
  1093.    g.setColor(new Color(150,150,150));
  1094.    g.drawLine(40, 10, 40, 322);
  1095.    g.drawLine(41, 10, 41, 322);
  1096.    g.drawLine(38, 320, 550, 320);
  1097.    g.drawLine(38, 321, 550, 321);
  1098.    int xMax=(zmax/10)+1;
  1099.    g.setFont(new Font("黑体",Font.BOLD,12));
  1100.    int naz=0;
  1101.    for(int i=0;i<ListA.length;i++){
  1102.     for(int j1=0;j1<ListA[i].length;j1++){
  1103.      g.setColor(choicColor(naz));
  1104.      g.drawLine(55, 22+(naz*15), 75, 22+(naz*15));
  1105.      g.drawString(ListA[i][j1], 78, 25+(naz*15));
  1106.      naz++;
  1107.     }
  1108.    }
  1109.    for(int i=0;i<=xMax;i++){
  1110.     g.setColor(new Color(150,150,150,220));
  1111.     g.drawLine(38, ((i*310)/xMax)+10, 550, ((i*310)/xMax)+10);
  1112.    }
  1113.    int ux=0,uy=0;
  1114.    for(int i=0;i<=ListD.length;i++){
  1115.     if(i!=0){
  1116.      g.drawString(ListA[(i-1)/2][(i-1)%2].substring(2, 3), ux, uy);
  1117.     }
  1118.     if(i==ListD.length){
  1119.      break;
  1120.     }
  1121.     ux=40;
  1122.     uy=320;
  1123.     for(int j=0;j<ListD[0].length;j++){
  1124.      g.setColor(choicColor(i));
  1125.      g.drawLine(ux, uy,((j*510)/133)+40, 320-(ListD[i][j]*310/(xMax*10)));
  1126.      uy=320-(ListD[i][j]*310/(xMax*10));
  1127.      ux=((j*510)/133)+40;
  1128.     }
  1129.    }
  1130.    for(int i=0;i<=xMax;i++){
  1131.     g.setColor(new Color(150,150,150));
  1132.     g.drawLine(38, ((i*310)/xMax)+10, 43, ((i*310)/xMax)+10);
  1133.     g.setColor(new Color(0,0,0));
  1134.     g.drawString(""+(i*10), 15, 324-((i*310)/xMax));
  1135.    }
  1136.    for(int i=0;i<=22;i++){
  1137.     g.setColor(new Color(150,150,150));
  1138.     g.drawLine(((i*510)/22)+40, 318, ((i*510)/22)+40,323);
  1139.     g.setColor(new Color(0,0,0));
  1140.     g.drawString(""+i,i/10>0?((i*510)/22)+34:((i*510)/22)+38,335);
  1141.    }
  1142.    g.dispose();
  1143.    try   
  1144.    {
  1145.     file=new File("hulizuiweida/1.jpg");
  1146.     if(file.exists()){
  1147.      file.delete();
  1148.     }
  1149.     file=null;
  1150.     file=new File("hulizuiweida/1.jpg");
  1151.     ImageIO.write(image, "JPEG", file);
  1152.    }catch (Exception e) {
  1153.     System.out.println(e);
  1154.    }
  1155.   }
  1156.   catch(Exception ex)
  1157.   {
  1158.   }  
  1159.   try   
  1160.   {
  1161.    System.out.println("输出结果");
  1162.    file=new File("hulizuiweida/index_2.html");
  1163.    if(file.exists()){
  1164.     file.delete();
  1165.    }
  1166.    file=null;
  1167.    file=new File("hulizuiweida/index_2.html");
  1168.    fos=new FileOutputStream(file);
  1169.    //dos=new DataOutputStream(fos);
  1170.    try {
  1171.     file.createNewFile();
  1172.    } catch (IOException e) {
  1173.    }
  1174.    line = ("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><style type="text/css"><!--body{ background-image: url(background.JPG);}.STYLE1 {font-family: "微软雅黑"}--></style></head><body><table width="200" border="0" cellpadding="0" cellspacing="0">  <tr>    <td width="560">曲线图</td>  </tr>  <tr>    <td><img src="1.jpg" width="560" height="340" /></td>  </tr></table><p>&nbsp;</p><table width="544" border="1">  <tr>    <td colspan="2">统计结果</td>  </tr>  ");
  1175.    fos.write(line.getBytes());
  1176.    for(int i=0;i<vVote.size();i++){
  1177.     int z=0;
  1178.     int w=0;
  1179.     vTemp=(VotingMB)vVote.elementAt(i);
  1180.     if(!(vTemp.fp||vTemp.ot)){
  1181.      for(int j=0;j<vTemp.Vote.length();j++){
  1182.       if(vTemp.Vote.charAt(j)==';'){
  1183.        z++;
  1184.        w=0;
  1185.       }else if(vTemp.Vote.charAt(j)=='1'){
  1186.        ListB[z][w]++;
  1187.        w++;
  1188.       }else if(vTemp.Vote.charAt(j)=='0'){
  1189.        w++;
  1190.       }
  1191.      }
  1192.     }
  1193.    }
  1194.    String tstemp;
  1195.    int sttemp;
  1196.    for(int l=0;l<ListA.length;l++){
  1197.     for(int i=0;i<ListA[0].length;i++){
  1198.      if(i+1<ListA[0].length){
  1199.       if(ListB[l][i]<ListB[l][i+1]){
  1200.        tstemp=ListA[l][i];
  1201.        ListA[l][i]=ListA[l][i+1];
  1202.        ListA[l][i+1]=tstemp;
  1203.        sttemp=ListB[l][i];
  1204.        ListB[l][i]=ListB[l][i+1];
  1205.        ListB[l][i+1]=sttemp;
  1206.        i=-1;
  1207.       }
  1208.      }
  1209.     }
  1210.    }
  1211.    for(int l=0;l<ListA.length;l++){
  1212.     line=("<tr>    <td colspan="2">第"+(l+1)+"组"+"</td>  </tr>  <tr>    <td>角色名</td>    <td>得票数</td>  </tr>");
  1213.     fos.write(line.getBytes());
  1214.     for(int j=0;j<ListA[0].length;j++){
  1215.      line=("  <tr>    <td width="450">");
  1216.      fos.write(line.getBytes());
  1217.      fos.write(ListA[l][j].getBytes());
  1218.      line=("</td>    <td width="150">");
  1219.      fos.write(line.getBytes());
  1220.      fos.write(Integer.toString(ListB[l][j]).getBytes());
  1221.      line=("</td>  </tr>");
  1222.      fos.write(line.getBytes());
  1223.     }
  1224.    }
  1225.    line=("<tr>  <td colspan="2"><div align="right">Total:"+tot+"</div></td>  </tr></table><p>&nbsp;</p></body></html>");
  1226.    fos.write(line.getBytes());
  1227.    //dos.close();
  1228.    fos.close();
  1229.   }
  1230.   catch(Exception ex)
  1231.   {
  1232.   }
  1233.   try   
  1234.   {
  1235.    file=new File("hulizuiweida/index_3.html");
  1236.    if(file.exists()){
  1237.     file.delete();
  1238.    }
  1239.    file=null;
  1240.    file=new File("hulizuiweida/index_3.html");
  1241.    fos=new FileOutputStream(file);
  1242.    try {
  1243.     file.createNewFile();
  1244.    } catch (IOException e) {
  1245.    }
  1246.    //dos=new DataOutputStream(fos);
  1247.    line = ("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>乱入-狐狸最伟大</title><style type="text/css"><!--body { background-image: url(background.JPG);}--></style></head><body>");
  1248.    fos.write(line.getBytes());
  1249.    for(int i=0;i<vVote.size();i++){
  1250.     vTemp=(VotingMB)vVote.elementAt(i);
  1251.     if(vTemp.ot){
  1252.      line = ("<table width="616" height="202" border="0" cellpadding="0" cellspacing="0" bgcolor="#E5F1FF">  <tr>    <td width="17" height="17" background="lt.jpg">&nbsp;</td>    <td height="17" colspan="3" background="t.jpg">&nbsp;</td>    <td width="17" height="17" background="rt.jpg">&nbsp;</td>  </tr>  <tr>    <td width="17" rowspan="2" background="l.jpg">&nbsp;</td>    <td width="140" height="140" bgcolor="#E5F1FF"><div align="center"><img src="wssy.JPG" width="141" height="131" /></div></td>    <td colspan="2" bgcolor="#E5F1FF"><div align="left">"+vTemp.Vote);
  1253.      fos.write(line.getBytes());
  1254.      line=("</div></td>    <td width="17" rowspan="2" background="r.jpg">&nbsp;</td>  </tr>      <tr>    <td height="28" bgcolor="#E5F1FF"><div align="center">"+vTemp.Name);
  1255.      fos.write(line.getBytes());
  1256.      fos.write(enter.getBytes());
  1257.      line=("</div></td>    <td colspan="2" bgcolor="#E5F1FF"><div align="right">"+vTemp.date+" "+vTemp.time);
  1258.      fos.write(line.getBytes());
  1259.      line=("</div></td>  </tr>    <tr>    <td width="17" height="17" background="lb.jpg">&nbsp;</td>    <td height="17" colspan="3" background="b.jpg">&nbsp;</td>    <td width="17" height="17" background="rb.jpg">&nbsp;</td>  </tr></table>");
  1260.      fos.write(line.getBytes());
  1261.      fos.write(enter.getBytes());
  1262.      fos.write(enter.getBytes());
  1263.     }
  1264.    }
  1265.    line=("</body></html>");
  1266.    fos.write(line.getBytes());
  1267.    fos.close();
  1268.   }
  1269.   catch(Exception ex)
  1270.   {
  1271.   }
  1272. }
  1273. Color getRandColor(int fc,int bc){//给定范围获得随机颜色
  1274.   Random random = new Random();
  1275.   if(fc>255) fc=255;
  1276.   if(bc>255) bc=255;
  1277.   int r=fc+random.nextInt(bc-fc);
  1278.   int g=fc+random.nextInt(bc-fc);
  1279.   int b=fc+random.nextInt(bc-fc);
  1280.   return new Color(r,g,b);
  1281. }
  1282. Color choicColor(int i){//给定范围获得随机颜色
  1283.   switch (i) {
  1284.   case 0:
  1285.    return new Color(255,0,0);
  1286.   case 1:
  1287.    return new Color(0,255,0);
  1288.   case 2:
  1289.    return new Color(0,0,255);
  1290.   case 3:
  1291.    return new Color(80,80,0);
  1292.   case 4:
  1293.    return new Color(0,80,80);
  1294.   case 5:
  1295.    return new Color(80,0,80);
  1296.   case 6:
  1297.    return new Color(180,0,180);
  1298.   case 7:
  1299.    return new Color(180,180,0);
  1300.   case 8:
  1301.    return new Color(0,180,180);
  1302.   case 9:
  1303.    return new Color(0,0,0);
  1304.   default:
  1305.    Random random = new Random();
  1306.    int r=random.nextInt(255);
  1307.    int g=random.nextInt(255);
  1308.    int b=random.nextInt(255);
  1309.    return new Color(r,g,b);
  1310.   }
  1311. }
  1312. public String getAppPath(Class cls){
  1313.   //检查用户传入的参数是否为空
  1314.   if(cls==null)
  1315.    throw new java.lang.IllegalArgumentException("参数不能为空!");
  1316.   ClassLoader loader=cls.getClassLoader();
  1317.   //获得类的全名,包括包名
  1318.   String clsName=cls.getName()+".class";
  1319.   //获得传入参数所在的包
  1320.   Package pack=cls.getPackage();
  1321.   String path="";
  1322.   //如果不是匿名包,将包名转化为路径
  1323.   if(pack!=null){
  1324.    String packName=pack.getName();
  1325.    //此处简单判定是否是Java基础类库,防止用户传入JDK内置的类库
  1326.    if(packName.startsWith("java.")||packName.startsWith("javax."))
  1327.     throw new java.lang.IllegalArgumentException("不要传送系统类!");
  1328.    //在类的名称中,去掉包名的部分,获得类的文件名
  1329.    clsName=clsName.substring(packName.length()+1);
  1330.    //判定包名是否是简单包名,如果是,则直接将包名转换为路径,
  1331.    if(packName.indexOf(".")<0) path=packName+"/";
  1332.    else{//否则按照包名的组成部分,将包名转换为路径
  1333.     int start=0,end=0;
  1334.     end=packName.indexOf(".");
  1335.     while(end!=-1){
  1336.      path=path+packName.substring(start,end)+"/";
  1337.      start=end+1;
  1338.      end=packName.indexOf(".",start);
  1339.     }
  1340.     path=path+packName.substring(start)+"/";
  1341.    }
  1342.   }
  1343.   //调用ClassLoader的getResource方法,传入包含路径信息的类文件名
  1344.   java.net.URL url =loader.getResource(path+clsName);
  1345.   //从URL对象中获取路径信息
  1346.   String realPath=url.getPath();
  1347.   //去掉路径信息中的协议名"file:"
  1348.   int pos=realPath.indexOf("file:");
  1349.   if(pos>-1) realPath=realPath.substring(pos+5);
  1350.   //去掉路径信息最后包含类文件信息的部分,得到类所在的路径
  1351.   pos=realPath.indexOf(path+clsName);
  1352.   realPath=realPath.substring(0,pos-1);
  1353.   //如果类文件被打包到JAR等文件中时,去掉对应的JAR等打包文件名
  1354.   if(realPath.endsWith("!"))
  1355.    realPath=realPath.substring(0,realPath.lastIndexOf("/"));
  1356.   /*------------------------------------------------------------
  1357.        ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径
  1358.         中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要
  1359.         的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的
  1360.         中文及空格路径
  1361.       -------------------------------------------------------------*/
  1362.   try{
  1363.    realPath=java.net.URLDecoder.decode(realPath,"utf-8");
  1364.   }catch(Exception e){throw new RuntimeException(e);}
  1365.   return realPath;
  1366. }//getAppPath定义结束
  1367. //-----------------------------------------------------------------
  1368. }
复制代码
发表于 2011-1-6 19:15:41 | 显示全部楼层
代码盲表示完全看不懂...那么大致的功能是?
回复

使用道具 举报

 楼主| 发表于 2011-1-6 20:03:59 | 显示全部楼层
结合CODE防伪票功能计票用~
回复

使用道具 举报

发表于 2011-1-6 20:24:21 | 显示全部楼层
防刷票的么?太好了~~
回复

使用道具 举报

发表于 2011-3-16 13:26:10 | 显示全部楼层
……好觸……(跪地
回复

使用道具 举报

发表于 2011-5-19 21:34:42 | 显示全部楼层
我想看成品界面...主要是对"狐狸"非常的有兴趣
回复

使用道具 举报

发表于 2011-5-20 19:40:13 | 显示全部楼层
java==还在学
回复

使用道具 举报

发表于 2011-5-21 21:24:46 | 显示全部楼层
表弟有在学编程,不过我本人完全是文盲
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 少女注册中

本版积分规则

合作与事务联系|无图版|手机版|小黑屋|喵玉殿

GMT+8, 2025-10-31 07:16

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表