天使怪盗Dick 发表于 2011-1-6 18:12:04

萌战CIP用狐狸计票器源码备份

本帖最后由 天使怪盗Dick 于 2011-1-6 18:14 编辑

import java.awt.Color;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.util.Date;
import java.util.Random;
import java.util.Vector;
import javax.imageio.ImageIO;

public class CodiacApp {
class VotingMB{
String Name,Code,Vote,DZ;
int date,time,num;
boolean fp,ck,ot;
VotingMB(){
   Name=new String();
   Code=new String();
   Vote=new String();
   DZ=new String();
   date=time=0;
   fp=ck=ot=false;
}
}
class VotingLJ{
String Name;
int rank,count;
VotingLJ(){
   Name=new String();
   rank=count=0;
}
}
int ctmp;
java.util.Date date2;
static String[][] ListA;
static int[][] ListB;
static int[][] ListC;
static int[][] ListD;
Vector vName,vCode,vVote,vDate,vTime,vString,vBname,vOther,vLJ;
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
StringBuffer sb3 = new StringBuffer();
StringBuffer sb4 = new StringBuffer();
StringBuffer sb7 = new StringBuffer();
boolean ReadInfo;
boolean ReadTotal;
int total;
boolean MayInsert;
int insert;
boolean ReadName;
boolean ReadyReadName;
boolean ReadyReadTime;
boolean ReadyToRead;
boolean ReadTime;
VotingMB vTemp=null;
VotingMB vTemp1=null;
String temp;
boolean IP;
int tot;
int dt;
String DZtemp;
int zushu;
int ketoushu;
int meizujueseshu;
String TZnum;
long ttt;
boolean cc,nc;
@SuppressWarnings("deprecation")
void bg(){
vName=new Vector();
vCode=new Vector();
vVote=new Vector();
vDate=new Vector();
vTime=new Vector();
vString=new Vector();
vOther=new Vector();
date2 = new Date();
vBname=new Vector();
vLJ=new Vector();
ttt=System.currentTimeMillis();
tot=0;
if(ReadConfig("nc").equalsIgnoreCase("true")){
   TZnum = getTzNum();
   System.out.println(TZnum);
   dt=(date2.getYear()%100*10000)+((date2.getMonth()+1)*100)+date2.getDate();
   getcharname();
   meizujueseshu=2;
   ketoushu=1;
}else{
   TZnum = ReadConfig("TZnum");
   dt=Integer.parseInt(ReadConfig("dt"));
   zushu=Integer.parseInt(ReadConfig("zushu"));
   meizujueseshu=Integer.parseInt(ReadConfig("meizujueseshu"));
   ketoushu=Integer.parseInt(ReadConfig("ketoushu"));
   ListA= new String;
   ReadCharacters();
}
if(ReadConfig("cc").equalsIgnoreCase("true")){
   cc=true;
}else{
   cc=false;
}

ListB= new int;
ListC= new int;
ListD=new int;
total=Integer.MAX_VALUE;
InputStream is = getClass().getResourceAsStream("codelist.txt");
InputStreamReader isr = new InputStreamReader(is);
int chr;
sb=new StringBuffer();
sb.delete(0, sb.length());
int fdsa=0;
try {
   while((chr=isr.read())!=-1){
    if(chr=='\n'||chr=='\r'||chr==' '){
   if(sb.length()!=0){
      vBname.addElement(sb.toString());
      System.out.println(fdsa++);
      System.out.println(sb.toString());
      sb.delete(0, sb.length());
   }
    }else{
   sb.append((char)chr);
    }
   }
} catch (IOException e1) {
   e1.printStackTrace();
}
try {
   isr.close();
   is.close();
} catch (IOException e) {
   e.printStackTrace();
}
}
void getcharname(){
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"));
InputStreamReader isr = new InputStreamReader(is);
int chr;
StringBuffer sb=new StringBuffer();
String s;
try {
   while((chr=isr.read())!=-1){
    sb.append((char)chr);
   }
   isr.close();
   is.close();
} catch (IOException e) {
   e.printStackTrace();
}
s=sb.toString();
int index=0;
int end=0;
index=s.indexOf("<cc>",s.indexOf("<cc>")+1);
end=s.indexOf("</cc>",s.indexOf("</cc>")+1)-1;
for(int i=0;index<end;index+=8,i++){
   //ListA=
   if(s.indexOf("&gt;&gt;",index)==-1||s.indexOf("&lt;&lt;",index)==-1){
    break;
   }else if(s.indexOf("&lt;&lt;",index)>s.indexOf("&gt;&gt;",index)){
    index=s.indexOf("&gt;&gt;",index)+1;
   }
   if(s.indexOf("&gt;&gt;", index)>end){
    break;
   }
   System.out.println(("<<"+s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))+">>"));
   //s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))
   zushu=i/2+1;
   System.out.println(index);
}
System.out.println(zushu);
System.out.println(end);
index=s.indexOf("<cc>",s.indexOf("<cc>")+1);
ListA=new String;
for(int i=0;index<end;index+=8,i++){
   if(s.indexOf("&gt;&gt;",index)==-1||s.indexOf("&lt;&lt;",index)==-1){
    break;
   }else if(s.indexOf("&lt;&lt;",index)>s.indexOf("&gt;&gt;",index)){
    index=s.indexOf("&gt;&gt;",index)+1;
   }
   if(s.indexOf("&gt;&gt;", index)>end){
    break;
   }
   ListA=("<<"+s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))+">>");
   //s.substring(s.indexOf("&lt;&lt;", index)+8, index=s.indexOf("&gt;&gt;", index))
}
}
public static void main(String[] args) {
CodiacApp app =new CodiacApp();
try {
   Runtime.getRuntime().exec("C:/Program Files/Internet Explorer/iexplore.exe "+"file://"+app.getAppPath(app.getClass())+"/hulizuiweida/index.html");
// Desktop.getDesktop().browse(new URI("file://"+app.getAppPath(app.getClass())+"/hulizuiweida/index.html"));
} catch (Exception e) {
   e.printStackTrace();
}
System.out.println(System.currentTimeMillis()-app.ttt);
}
CodiacApp(){
bg();
for(int i=0;i<=total;i+=30){
   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"));
}
System.out.println("------------------------");
CheckVote( dt,zushu,ketoushu);
OutPut();
}
public String getTzNum(){
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",
"s.tmp"));
InputStreamReader isr = new InputStreamReader(is);
int chr;
StringBuffer sb=new StringBuffer();
try {
   while((chr=isr.read())!=-1){
    sb.append((char)chr);
   }
   isr.close();
   is.close();
} catch (IOException e) {
   e.printStackTrace();
}
String s=sb.toString();
return s.substring(s.indexOf("z=",
    s.indexOf("/f?ct=335675392&amp;tn=baiduPostBrowser"))+2,
    s.indexOf("&amp;",
      s.indexOf("z=",
      s.indexOf("/f?ct=335675392&amp;tn=baiduPostBrowser"))));
}
public void getWord(String filename){
InputStream is = getClass().getResourceAsStream(filename);
InputStreamReader isr = new InputStreamReader(is);
int chr;
try {
   while((chr=isr.read())!=-1){
    int insertCount=0;
    if(chr=='@'){
   chr='@';
    }
    if(chr=='\"'){
   ReadyToRead=!ReadyToRead;
    }else if(chr==62){
   //System.out.println(sb);
   ReadyToRead=false;
   if (sb.toString().equalsIgnoreCase("cc")) {
      ReadInfo=true;
      sb1.delete(0, sb1.length());
   }else if (sb.toString().equalsIgnoreCase("span class=")) {
      ReadTotal=true;
      sb7.delete(0, sb7.length());
   }else if (sb.toString().equalsIgnoreCase("/span")&&ReadTotal) {
      ReadTotal=false;
      if(sb7.charAt(0)>57){
      }else{
       total = Integer.parseInt(sb7.toString());
       //System.out.println(sb7);
      }
   }else if (sb.toString().equalsIgnoreCase("/cc")) {
      ReadInfo=false;
      if(MayInsert){
       sb1.insert(insert-1, sb4.toString());
      }
      sb1.append(';');
      vString.add(sb1.toString().toUpperCase());
      System.out.println(sb1);
   }else if(sb.toString().equalsIgnoreCase("/ul")&&ReadyReadName){
      ReadyReadTime=!ReadyReadTime;
   }else if(sb.toString().equalsIgnoreCase("td align= class=")){
      ReadyReadName=true;
   }else if(sb.toString().equalsIgnoreCase("/td")&&ReadyReadName){
      ReadyReadName=false;
   }else if(sb.toString().equalsIgnoreCase("br")&&ReadInfo){
      sb1.append(';');
   }else if((sb.toString().equalsIgnoreCase("a href= target=")||sb.toString().equalsIgnoreCase("li class="))&&(ReadyReadName&&!ReadyReadTime)){
      ReadName=true;
      sb2.delete(0, sb2.length());
   }else if(ReadName){
      if( sb.toString().equalsIgnoreCase("/a")){
       ReadName=false;
       if(MayInsert){
      sb2.insert(insert-1, sb4.toString());
       }
       vName.add(sb2.toString());
       System.out.println(sb2);
      }else if(sb.toString().equalsIgnoreCase("/li")){
       ReadName=false;
       if(MayInsert){
      sb2.insert(insert-1, sb4.toString());
       }
       sb2.delete(0, 3);
       vName.add(sb2.toString());
       System.out.println(sb2);
      }
   }else if(sb.toString().equalsIgnoreCase("li class=")&&ReadyReadTime){
      ReadTime=true;
      sb3.delete(0, sb3.length());
   }else if((sb.toString().equalsIgnoreCase("/li")&&ReadTime)){///span
      ReadTime=false;
      ReadyReadName=false;
      ReadyReadTime=false;
      sb3.append(' ');
      vDate.add(Integer.toString(getDate(sb3.toString())));
      vTime.add(Integer.toString(getTime(sb3.toString())));
      // System.out.println(sb3);
   }
    }else if(chr==60){
   ReadyToRead=true;
   sb.delete(0, sb.length());
    }else if(ReadyToRead){
   sb.append(((char)chr));
    }else if(ReadInfo){
   if(chr==';'&&MayInsert){
      MayInsert=false;
      if(sb4.toString().equalsIgnoreCase("nbsp")){
       sb1.insert(insert, " ");
      }else if(sb4.toString().equalsIgnoreCase("lt")){
       sb1.insert(insert, "<");
      }else if(sb4.toString().equalsIgnoreCase("gt")){
       sb1.insert(insert, ">");
      }else if(sb4.toString().equalsIgnoreCase("quot")){
       sb1.insert(insert, "\"");
      }else if(sb4.toString().equalsIgnoreCase("#x30FB")){
      }else{
       sb1.insert(insert, "我不知道是什么号");
      }
   }else if(insertCount>5&&MayInsert){
      MayInsert=false;
      sb1.insert(insert, "&");
   }else if((chr=='&'&&MayInsert)){
      MayInsert=false;
      sb1.insert(insert,"&&");
   }else if(chr=='&'&&(!MayInsert)){
      MayInsert=true;
      sb4.delete(0, sb4.length());
      insert=sb1.length();
      insertCount=0;
   }else{
      if(MayInsert){
       insertCount++;
       sb4.append((char)chr);
      }else{
       sb1.append((char)chr);
      }
   }
   //#x30FB
    }else if (ReadName) {
   if(chr==';'&&MayInsert){
      MayInsert=false;
      if(sb4.toString().equalsIgnoreCase("nbsp")){
       sb2.insert(insert, "");
      }else if(sb4.toString().equalsIgnoreCase("lt")){
       sb2.insert(insert, "<");
      }else if(sb4.toString().equalsIgnoreCase("gt")){
       sb2.insert(insert, ">");
      }else if(sb4.toString().equalsIgnoreCase("quot")){
       sb2.insert(insert, "\"");
      }else if(sb4.toString().equalsIgnoreCase("#x30FB")){
      }else{
       sb2.insert(insert, "我不知道是什么号");
      }
      continue;
   }else if(insertCount>5&&MayInsert){
      MayInsert=false;
      sb2.insert(insert, "&");
   }else if((chr=='&'&&MayInsert)){
      MayInsert=false;
      sb2.insert(insert,"&&");
   }else if(chr=='&'&&(!MayInsert)){
      MayInsert=true;
      sb4.delete(0, sb4.length());
      insert=sb2.length();
      insertCount=0;
   }else{
      if(MayInsert){
       insertCount++;
       sb4.append((char)chr);
      }else{
       sb2.append((char)chr);
      }
   }
    }else if (ReadTime) {
   sb3.append((char)chr);
    }else if(ReadTotal){
   sb7.append(((char)chr));
    }
   }
} catch (IOException e1) {
   e1.printStackTrace();
}
try {
   isr.close();
   is.close();
} catch (IOException e) {
   e.printStackTrace();
}
}
public boolean checkCode(String s){
int vz=vBname.size();
for(int i=0;i<vz;i++){
   if(s.equalsIgnoreCase((String)vBname.elementAt(i))){
    ctmp=i;
    return true;
   };
}
return false;
}
public boolean CheckCode(String str1){
//StringBuffer s=new StringBuffer();
//for(int i=0;i<str1.length();i++){
//   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)=='('){
//    if(str.equalsIgnoreCase(s.toString())) return true;
//    else s.delete(0, s.length());;
//   }else{
//    s.append(str1.charAt(i));
//   }
//}
for(int i=0;i<str1.length();i++){
   if(str1.indexOf("]]",i)==-1||str1.indexOf("[[",i)==-1){
    return false;
   }else if(str1.indexOf("[[",i)>str1.indexOf("]]",i)){
    i=str1.indexOf("]]",i)+1;
   }else if(checkCode(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)))){
    return true;
   }else{
    i=str1.indexOf("]]",i)+1;
   }
}
return false;
}
public void CollectCode(String str1){
//StringBuffer s=new StringBuffer();
//for(int i=0;i<str1.length();i++){
//   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)=='('){
//    if(str.equalsIgnoreCase(s.toString())) return true;
//    else s.delete(0, s.length());;
//   }else{
//    s.append(str1.charAt(i));
//   }
//}
for(int i=0;i<str1.length();i++){
   if(str1.indexOf("]]",i)==-1||str1.indexOf("[[",i)==-1){
    return ;
   }else if(str1.indexOf("[[",i)>str1.indexOf("]]",i)){
    i=str1.indexOf("]]",i)+1;
   }else if(str1.indexOf("]]",i)-str1.indexOf("[[",i)+2==(date2.getDate()>9?21:20)){
    if(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("-",str1.indexOf("[[",i))+1).equalsIgnoreCase("CIP"+date2.getDate()+"-")){
   if('-'==str1.charAt(str1.indexOf("-",str1.indexOf("-",str1.indexOf("[[",i))))){
      vBname.addElement(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)).toString());
      System.out.println(str1.substring(str1.indexOf("[[",i)+2,str1.indexOf("]]",i)));
   }
    }
   }else{
    i=str1.indexOf("]]",i)+1;
   }
}
return ;
}
// public boolean CheckCode(String str1){
//StringBuffer s=new StringBuffer();
//String ttmp;
//for(int l=0;l<vCode.size();l++){
//   ttmp=(String)vCode.elementAt(l);
//   for(int i=0;i<str1.length();i++){
//    if(str1.charAt(i)==';'||str1.charAt(i)=='['||str1.charAt(i)==']'||str1.charAt(i)=='\r'||str1.charAt(i)=='\n'||str1.charAt(i)==' '){
//   if(ttmp.equalsIgnoreCase(s.toString())) {
//      System.out.println(s.toString());
//      return false;
//   }
//   else {
//      s.delete(0, s.length());;
//   }
//    }else{
//   s.append(str1.charAt(i));
//    }
//   }
//}
//for(int i=0;i<str1.length();i++){
//   if(str1.charAt(i)==';'||str1.charAt(i)=='['||str1.charAt(i)==']'||str1.charAt(i)=='\r'||str1.charAt(i)=='\n'||str1.charAt(i)==' '){
//    if(checkCode(s.toString())) {
//   System.out.println(s.toString());
//   return true;
//    }
//    else {
//   s.delete(0, s.length());;
//    }
//   }else{
//    s.append(str1.charAt(i));
//   }
//}
//return false;
// }
public String getHttpData(String url,String filename){
try   
{
   URL myURL = new URL(url);
   HttpURLConnection con =(HttpURLConnection) myURL.openConnection();
   String rm;
   while(!(rm=con.getResponseMessage()).equalsIgnoreCase("OK")){
    System.out.println(rm);
    try {
   Thread.sleep(1000);
    } catch (Exception e) {
    }
   }
   con.connect();
   BufferedReader bfr = new BufferedReader(new InputStreamReader(con.getInputStream()));
   String line = null;
   File file = new File(filename);
   if(file.exists()){
    file.delete();
   }
   file=null;
   file=new File(filename);
   FileOutputStream fos = new FileOutputStream(file);
   DataOutputStream dos = new DataOutputStream(fos);
   try {
    file.createNewFile();
   } catch (IOException e) {
   }
   while ((line = bfr.readLine())!=null)
   {
    fos.write(line.getBytes());
   }
   dos.close();
   fos.close();
   bfr.close();
}
catch(Exception exz)
{
}
return filename;
}
public String ReadConfig(String str) {
try{
   StringBuffer s=new StringBuffer();
   int chr;
   boolean b1=false;
   InputStream is = getClass().getResourceAsStream("Config.ini");
   InputStreamReader isr = new InputStreamReader(is);
   while((chr=isr.read())!=-1){
    if(chr==' '){
   continue;
    }else if(chr=='='){
   if(str.equalsIgnoreCase(s.toString())){
      b1=true;
      s.delete(0,s.length());
      continue;
   }else{
      while((chr=isr.read())!=-1)
       if(chr=='\n')      
      break;
   }
   s.delete(0,s.length());
   continue;
    }else {
   if(b1){
      if(chr=='\n'||chr=='\r'){
       isr.close();
       is.close();
       if(s.length()==0)
      return "";
       else
      return s.toString();
      }
   }
   if(chr!='\n'||chr!='\r')
      s.append((char)chr);
    }
   }
   isr.close();
   is.close();
}catch (IOException e) {
   System.out.println("READ CONFIG ERROR!");
}
return null;
}
public int getTime(String str){
int Time=0;
StringBuffer sbt=new StringBuffer();
boolean b1=false,b2=false;
for(int i=1;i<str.length();i++){
   if(b2){
    if(str.charAt(i)==' '){
   Time+=Integer.parseInt(sbt.toString());
   sbt.delete(0, sbt.length());
   return Time;
    }
    sbt.append(str.charAt(i));
   }else if(b1){
    if(str.charAt(i)==':'){
   Time+=Integer.parseInt(sbt.toString())*100;
   sbt.delete(0, sbt.length());
   b2=true;
   continue;
    }
    sbt.append(str.charAt(i));
   }else{
    if(str.charAt(i)==' '){
   sbt.delete(0, sbt.length());
   b1=true;
   continue;
    }
   }
}
return Time;
}
public int getDate(String str){
StringBuffer sbt=new StringBuffer();
int date=0;
boolean b1=false,b2=false;
for(int i=1;i<str.length();i++){
   if(b2){
    if(str.charAt(i)==' '){
   date+=Integer.parseInt(sbt.toString());
   sbt.delete(0, sbt.length());
   return date;
    }
    sbt.append(str.charAt(i));
   }else if(b1){
    if(str.charAt(i)=='-'){
   date+=Integer.parseInt(sbt.toString())*100;
   sbt.delete(0, sbt.length());
   b2=true;
   continue;
    }
    sbt.append(str.charAt(i));
   }else{
    if(str.charAt(i)=='-'){
   date+=Integer.parseInt(sbt.toString())*10000;
   sbt.delete(0, sbt.length());
   b1=true;
   continue;
    }
    sbt.append(str.charAt(i));
   }
}
return date;
}
public boolean CheckVt(String str,String str1){
//StringBuffer s=new StringBuffer();
//for(int i=0;i<str1.length();i++){
//   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)=='('){
//    if(str.equalsIgnoreCase(s.toString())) return true;
//    else s.delete(0, s.length());;
//   }else{
//    s.append(str1.charAt(i));
//   }
//}
for(int i=0;i<str1.length();i++){
   if(str1.indexOf(">>",i)==-1||str1.indexOf("<<",i)==-1){
    return false;
   }else if(str1.indexOf("<<",i)>str1.indexOf(">>",i)){
    i=str1.indexOf(">>",i)+1;
   }else if(str.equalsIgnoreCase(str1.substring(str1.indexOf("<<",i),str1.indexOf(">>",i)+2))){
    return true;
   }else{
    i=str1.indexOf(">>",i)+1;
   }
}
return false;
}
public void CheckVote(int date,int r,int u){
boolean b1,b3,othername;
b3=false;
othername=false;
StringBuffer s=new StringBuffer();
for(int i=0;i<vName.size();i++){
   int dat,tim;
   othername=false;
   b1=true;
   b3=false;
   s.delete(0, s.length());
   b1=true;
   dat=Integer.parseInt((String)vDate.elementAt(i));
   tim=Integer.parseInt((String)vTime.elementAt(i));
   if(dat>date){
    b1=false;
   }else if(dat==date&&tim>2200){
    b1=false;
   }
   temp=(String)vString.elementAt(i);
   if(cc){
    CollectCode(temp);
   }
   if(b1&&CheckCode(temp)){
    int zz=0;
    int zzzz=0;
    temp=(String)vString.elementAt(i);
    for(int z=0;z<r;z++){
   zz=0;
   for(int j=0;j<ListA.length;j++){
      if(CheckVt(ListA, temp)){
       zz++;
       zzzz++;
       s.append('1');
      }else{
       s.append('0');
      };
   }
   s.append(';');
   if(zz>u){
      b3=true;
   }
    }
    if(zzzz==0){
   othername=true;
    }
    if(!b3){
   if(othername){
      vTemp=new VotingMB();
      temp=(String)vBname.elementAt(ctmp);
      vTemp.Code=temp;
      temp=(String)vName.elementAt(i);
      vTemp.Name=temp;
      temp=(String)vDate.elementAt(i);
      vTemp.date=Integer.parseInt(temp);
      temp=(String)vTime.elementAt(i);
      vTemp.time=Integer.parseInt(temp);
      vTemp.Vote=(String)vString.elementAt(i);
      vTemp.fp=b3;
      vTemp.ot=true;
      vVote.add(vTemp);
   }else{
      vTemp=new VotingMB();
      temp=(String)vBname.elementAt(ctmp);
      vTemp.Code=temp;
      temp=(String)vName.elementAt(i);
      vTemp.Name=temp;
      temp=(String)vDate.elementAt(i);
      vTemp.date=Integer.parseInt(temp);
      temp=(String)vTime.elementAt(i);
      vTemp.time=Integer.parseInt(temp);
      vTemp.Vote=s.toString();
      vTemp.fp=b3;
      vVote.add(vTemp);
   }
    }else{
   vTemp=new VotingMB();
   temp=(String)vBname.elementAt(ctmp);
   vTemp.Code=temp;
   temp=(String)vName.elementAt(i);
   vTemp.Name=temp;
   temp=(String)vDate.elementAt(i);
   vTemp.date=Integer.parseInt(temp);
   temp=(String)vTime.elementAt(i);
   vTemp.time=Integer.parseInt(temp);
   vTemp.Vote=s.toString();
   vTemp.fp=b3;
   vVote.add(vTemp);
    }
   }
}
}
public void ReadCharacters(){
for(int z=0;z<ListA.length;z++){
   for(int i=0;i<ListA.length;i++){
    ListA=null;
   }
}
StringBuffer s=new StringBuffer();
InputStream is = getClass().getResourceAsStream("list.txt");
InputStreamReader isr = new InputStreamReader(is);
int chr=0;
try {
   int z=0;
   int i=0;
   while((chr=isr.read())!=-1){
    if(chr==';'){
   z++;
   i=0;
    }else if(chr==' '||chr=='\n'||chr=='\r'){
   if(s.length()==0){
   }else{
      ListA=s.toString();
      i++;
      s.delete(0, s.length());
   }
   continue;
    }else {
   s.append((char)(chr));
    }
   }
   isr.close();
   is.close();
} catch (IOException e) {
   e.printStackTrace();
}
for(int z=0;z<ListA.length;z++){
   for(int i=0;i<ListA.length;i++){
    if(ListA==null){
   ListA="狐狸叔叔说这个很长很长的东西是没有用的,狐狸最伟大!";
    }
   }
}
}
public void OutPut(){
String enter="\r\n";
String space=": ";
String br="------------- ";
File file;
String line;
FileOutputStream fos;
VotingMB v1,v2;
try {
   for(int i=0;i<vVote.size();i++){
    v1=(VotingMB)vVote.elementAt(i);
    for(int j=i+1;j<vVote.size();j++){
   v2=(VotingMB)vVote.elementAt(j);
   if(v1.Code.equalsIgnoreCase(v2.Code)&&v1.Name.equalsIgnoreCase(v2.Name)&&(v1.fp||v1.ot)){
      vVote.removeElementAt(i);
      i--;
      break;
   }else
      if (v1.Code.equalsIgnoreCase(v2.Code)) {
       vVote.removeElementAt(j);
       j--;
      }
    }
   }
   tot=vVote.size();
} catch (Exception e) {
}
try   
{
   file=new File("hulizuiweida/index_4.html");
   if(file.exists()){
    file.delete();
   }
   file=null;
   file=new File("hulizuiweida/index_4.html");
   fos=new FileOutputStream(file);
   //dos=new DataOutputStream(fos);
   try {
    file.createNewFile();
   } catch (IOException e) {
   }
   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>");
   fos.write(line.getBytes());
   for(int i=0;i<vVote.size();i++){
    vTemp=(VotingMB)vVote.elementAt(i);
    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>"
      +vTemp.Code+"<br>");
    fos.write(line.getBytes());
    for(int j=0,k=0,l=0;j<vTemp.Vote.length();j++){
   if(vTemp.ot){
      fos.write(vTemp.Vote.getBytes());
      fos.write("<br>".getBytes());
      break;
   }
   if (vTemp.Vote.charAt(j)=='1') {
      fos.write(ListA.getBytes());
      fos.write("<br>".getBytes());
      l++;
   }else if(vTemp.Vote.charAt(j)==';') {
      k++;
      l=0;
   }else{
      l++;
   }
    }
    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);
    fos.write(line.getBytes());
    line=("</div></td>    <td colspan=\"2\" bgcolor=\"#E5F1FF\"><div align=\"right\">"+(vTemp.fp?"废票 ":" ")+(vTemp.ot?"乱入 ":" ")+vTemp.date+" "+vTemp.time);
    fos.write(line.getBytes());
    fos.write(enter.getBytes());
    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>");
    fos.write(line.getBytes());
   }
   line=("总计有CODE:"+tot+"</body></html>");
   fos.write(line.getBytes());
   //dos.close();
   fos.close();
}
catch(Exception ex)
{
}
try   
{
   int rtmp=0;
   VotingLJ ljtemp,ljtemp1;
   for(int i=0;i<vVote.size();i++){
    vTemp=(VotingMB)vVote.elementAt(i);
    if(!vTemp.fp&&!vTemp.ot){
   sb.delete(0, sb.length());
   int k=0;
   int jj=0;
   for(int l=0;l<vTemp.Vote.length();l++){
      if(vTemp.Vote.charAt(l)==';'){
       k++;
       jj=-1;
      }else if(vTemp.Vote.charAt(l)=='1'){
       rtmp++;
       if(sb.length()!=0){
      sb.append("<br>");
       }
       sb.append(ListA);
      }
      jj++;
   }
   if(vLJ.size()==0){
      ljtemp=new VotingLJ();
      ljtemp.rank=rtmp;
      rtmp=0;
      ljtemp.Name=sb.toString();
      sb.delete(0, sb.length());
      ljtemp.count=1;
      vLJ.addElement(ljtemp);
   }else{
      int l=0;
      for(;;){
       if(l>=vLJ.size()){
      ljtemp=new VotingLJ();
      ljtemp.rank=rtmp;
      rtmp=0;
      ljtemp.Name=sb.toString();
      sb.delete(0, sb.length());
      ljtemp.count=1;
      vLJ.addElement(ljtemp);
      break;
       }else{
      ljtemp=(VotingLJ)vLJ.elementAt(l);
      if(rtmp==ljtemp.rank){
         if(sb.toString().equalsIgnoreCase(ljtemp.Name)){
          ljtemp.count++;
          rtmp=0;
          sb.delete(0, sb.length());
          break;
         }
      }
       }
       l++;
      }
   }
    }
   }
   //   for(int i=0;i<vLJ.size();i++){
   //    ljtemp=(VotingLJ)vLJ.elementAt(i);
   //    System.out.println(ljtemp.Name);
   //    System.out.println(ljtemp.count);
   //   }
   for(int i=0;i<vLJ.size();i++){
    if(i+1<vLJ.size()){
   ljtemp=(VotingLJ)vLJ.elementAt(i);
   ljtemp1=(VotingLJ)vLJ.elementAt(i+1);
   if(ljtemp.count<ljtemp1.count){
      vLJ.insertElementAt(ljtemp1, i);
      vLJ.removeElementAt(i+2);
      i=-1;
   }
    }
   }
   for(int i=0;i<vLJ.size();i++){
    if(i+1<vLJ.size()){
   ljtemp=(VotingLJ)vLJ.elementAt(i);
   ljtemp1=(VotingLJ)vLJ.elementAt(i+1);
   if(ljtemp.rank<ljtemp1.rank){
      vLJ.insertElementAt(ljtemp1, i);
      vLJ.removeElementAt(i+2);
      i=-1;
   }
    }
   }
   file=new File("hulizuiweida/index_5.html");
   if(file.exists()){
    file.delete();
   }
   file=null;
   file=new File("hulizuiweida/index_5.html");
   fos=new FileOutputStream(file);
   //dos=new DataOutputStream(fos);
   try {
    file.createNewFile();
   } catch (IOException e) {
   }
   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>");
   fos.write(line.getBytes());
   int it=0;
   for(int i=0;i<vLJ.size();i++){
    ljtemp=(VotingLJ)vLJ.elementAt(i);
    if(it!=ljtemp.rank){
   it=ljtemp.rank;
   if(it==1){
      line = ("<p>"+"单投"+"</p>");
      fos.write(line.getBytes());
   }else{
      fos.write(enter.getBytes());
      line = ("<p>"+it+"连记"+"</p>");
      fos.write(line.getBytes());
   }
    }
    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\">"+
      ljtemp.Name+
      "</div></td>    <td colspan=\"2\" bgcolor=\"#E5F1FF\"><div align=\"center\">"
      +ljtemp.count+
    "</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>");
    fos.write(line.getBytes());
    fos.write(enter.getBytes());
   }
   fos.write("</body></html>".getBytes());
   //dos.close();
   fos.close();
}
catch(Exception ex)
{
}


try   
{
   int zmax=0;
   StringBuffer tttemp=new StringBuffer();
   int iz=0;
   int i1=0;
   for(int j=0;j<=2200;j+=10){
    if(j%100>=60){
   j=((j/100)+1)*100;
   if(j>2200){
      break;
   }
    }
    tttemp.append(j);
    tttemp.append('\t');
    //    for(int z1=0;z1<zushu;z1++){
    //   for(int z2=0;z2<meizujueseshu;z2++){
    //       ListC=0;
    //   }
    //    }
    for(;iz<vVote.size();){
   vTemp=(VotingMB)vVote.elementAt(iz);
   if(vTemp.fp||vTemp.ot){
      iz++;
   }else{
      if(vTemp.time<j){
       for(int z1=0;z1<zushu;z1++){
      for(int z2=0;z2<meizujueseshu;z2++){
         if(vTemp.Vote.charAt(z1*meizujueseshu+z1+z2)=='1'){
          ListC++;
         }
      }
       }
       iz++;
      }else{
       break;
      }
   }
    }
    for(int z1=0;z1<zushu;z1++){
   for(int z2=0;z2<meizujueseshu;z2++){
      zmax=zmax>ListC?zmax:ListC;
      ListD=ListC;
      tttemp.append(ListC);
      tttemp.append('\t');
   }
    }
    tttemp.append(enter);
    i1++;
   }
   int width=560, height=340;
   BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
   Graphics g = image.getGraphics();
   Random random = new Random();
   g.setColor(new Color(0,0,0));
   g.fillRect(0, 0, width, height);
   Image image2 = null;
   try {
    image2 = ImageIO.read(new File("hulizuiweida/wssy.bfx"));
   } catch (IOException e1) {
    e1.printStackTrace();
   }
   g.drawImage(image2,0,0,null);
   g.setFont(new Font("黑体",Font.PLAIN,18));
   String sRand="狐狸最伟大";
   g.setColor(getRandColor(160,200));
   for (int i=0;i<25;i++) {
    int x = random.nextInt(width)-25;
    int y = random.nextInt(height);
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));
    g.drawString(sRand,x,y);
   }
   g.setColor(new Color(255,255,255,220));
   g.fillRect(0, 0, width, height);
   g.setColor(new Color(0,0,0));
   g.drawRect(0,0,width-1,height-1);
   g.setColor(new Color(150,150,150));
   g.drawLine(40, 10, 40, 322);
   g.drawLine(41, 10, 41, 322);
   g.drawLine(38, 320, 550, 320);
   g.drawLine(38, 321, 550, 321);
   int xMax=(zmax/10)+1;
   g.setFont(new Font("黑体",Font.BOLD,12));
   int naz=0;
   for(int i=0;i<ListA.length;i++){
    for(int j1=0;j1<ListA.length;j1++){
   g.setColor(choicColor(naz));
   g.drawLine(55, 22+(naz*15), 75, 22+(naz*15));
   g.drawString(ListA, 78, 25+(naz*15));
   naz++;
    }
   }
   for(int i=0;i<=xMax;i++){
    g.setColor(new Color(150,150,150,220));
    g.drawLine(38, ((i*310)/xMax)+10, 550, ((i*310)/xMax)+10);
   }
   int ux=0,uy=0;
   for(int i=0;i<=ListD.length;i++){
    if(i!=0){
   g.drawString(ListA[(i-1)/2][(i-1)%2].substring(2, 3), ux, uy);
    }
    if(i==ListD.length){
   break;
    }
    ux=40;
    uy=320;
    for(int j=0;j<ListD.length;j++){
   g.setColor(choicColor(i));
   g.drawLine(ux, uy,((j*510)/133)+40, 320-(ListD*310/(xMax*10)));
   uy=320-(ListD*310/(xMax*10));
   ux=((j*510)/133)+40;
    }
   }
   for(int i=0;i<=xMax;i++){
    g.setColor(new Color(150,150,150));
    g.drawLine(38, ((i*310)/xMax)+10, 43, ((i*310)/xMax)+10);
    g.setColor(new Color(0,0,0));
    g.drawString(""+(i*10), 15, 324-((i*310)/xMax));
   }
   for(int i=0;i<=22;i++){
    g.setColor(new Color(150,150,150));
    g.drawLine(((i*510)/22)+40, 318, ((i*510)/22)+40,323);
    g.setColor(new Color(0,0,0));
    g.drawString(""+i,i/10>0?((i*510)/22)+34:((i*510)/22)+38,335);
   }
   g.dispose();
   try   
   {
    file=new File("hulizuiweida/1.jpg");
    if(file.exists()){
   file.delete();
    }
    file=null;
    file=new File("hulizuiweida/1.jpg");
    ImageIO.write(image, "JPEG", file);
   }catch (Exception e) {
    System.out.println(e);
   }
}
catch(Exception ex)
{
}
try   
{
   System.out.println("输出结果");
   file=new File("hulizuiweida/index_2.html");
   if(file.exists()){
    file.delete();
   }
   file=null;
   file=new File("hulizuiweida/index_2.html");
   fos=new FileOutputStream(file);
   //dos=new DataOutputStream(fos);
   try {
    file.createNewFile();
   } catch (IOException e) {
   }
   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>");
   fos.write(line.getBytes());
   for(int i=0;i<vVote.size();i++){
    int z=0;
    int w=0;
    vTemp=(VotingMB)vVote.elementAt(i);
    if(!(vTemp.fp||vTemp.ot)){
   for(int j=0;j<vTemp.Vote.length();j++){
      if(vTemp.Vote.charAt(j)==';'){
       z++;
       w=0;
      }else if(vTemp.Vote.charAt(j)=='1'){
       ListB++;
       w++;
      }else if(vTemp.Vote.charAt(j)=='0'){
       w++;
      }
   }
    }
   }
   String tstemp;
   int sttemp;
   for(int l=0;l<ListA.length;l++){
    for(int i=0;i<ListA.length;i++){
   if(i+1<ListA.length){
      if(ListB<ListB){
       tstemp=ListA;
       ListA=ListA;
       ListA=tstemp;
       sttemp=ListB;
       ListB=ListB;
       ListB=sttemp;
       i=-1;
      }
   }
    }
   }
   for(int l=0;l<ListA.length;l++){
    line=("<tr>    <td colspan=\"2\">第"+(l+1)+"组"+"</td></tr><tr>    <td>角色名</td>    <td>得票数</td></tr>");
    fos.write(line.getBytes());
    for(int j=0;j<ListA.length;j++){
   line=("<tr>    <td width=\"450\">");
   fos.write(line.getBytes());
   fos.write(ListA.getBytes());
   line=("</td>    <td width=\"150\">");
   fos.write(line.getBytes());
   fos.write(Integer.toString(ListB).getBytes());
   line=("</td></tr>");
   fos.write(line.getBytes());
    }
   }
   line=("<tr><td colspan=\"2\"><div align=\"right\">Total:"+tot+"</div></td></tr></table><p>&nbsp;</p></body></html>");
   fos.write(line.getBytes());
   //dos.close();
   fos.close();
}
catch(Exception ex)
{
}
try   
{
   file=new File("hulizuiweida/index_3.html");
   if(file.exists()){
    file.delete();
   }
   file=null;
   file=new File("hulizuiweida/index_3.html");
   fos=new FileOutputStream(file);
   try {
    file.createNewFile();
   } catch (IOException e) {
   }
   //dos=new DataOutputStream(fos);
   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>");
   fos.write(line.getBytes());
   for(int i=0;i<vVote.size();i++){
    vTemp=(VotingMB)vVote.elementAt(i);
    if(vTemp.ot){
   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);
   fos.write(line.getBytes());
   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);
   fos.write(line.getBytes());
   fos.write(enter.getBytes());
   line=("</div></td>    <td colspan=\"2\" bgcolor=\"#E5F1FF\"><div align=\"right\">"+vTemp.date+" "+vTemp.time);
   fos.write(line.getBytes());
   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>");
   fos.write(line.getBytes());
   fos.write(enter.getBytes());
   fos.write(enter.getBytes());
    }
   }
   line=("</body></html>");
   fos.write(line.getBytes());
   fos.close();
}
catch(Exception ex)
{
}
}
Color getRandColor(int fc,int bc){//给定范围获得随机颜色
Random random = new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+random.nextInt(bc-fc);
int g=fc+random.nextInt(bc-fc);
int b=fc+random.nextInt(bc-fc);
return new Color(r,g,b);
}
Color choicColor(int i){//给定范围获得随机颜色
switch (i) {
case 0:
   return new Color(255,0,0);
case 1:
   return new Color(0,255,0);
case 2:
   return new Color(0,0,255);
case 3:
   return new Color(80,80,0);
case 4:
   return new Color(0,80,80);
case 5:
   return new Color(80,0,80);
case 6:
   return new Color(180,0,180);
case 7:
   return new Color(180,180,0);
case 8:
   return new Color(0,180,180);
case 9:
   return new Color(0,0,0);
default:
   Random random = new Random();
   int r=random.nextInt(255);
   int g=random.nextInt(255);
   int b=random.nextInt(255);
   return new Color(r,g,b);
}
}
public String getAppPath(Class cls){
//检查用户传入的参数是否为空
if(cls==null)
   throw new java.lang.IllegalArgumentException("参数不能为空!");
ClassLoader loader=cls.getClassLoader();
//获得类的全名,包括包名
String clsName=cls.getName()+".class";
//获得传入参数所在的包
Package pack=cls.getPackage();
String path="";
//如果不是匿名包,将包名转化为路径
if(pack!=null){
   String packName=pack.getName();
   //此处简单判定是否是Java基础类库,防止用户传入JDK内置的类库
   if(packName.startsWith("java.")||packName.startsWith("javax."))
    throw new java.lang.IllegalArgumentException("不要传送系统类!");
   //在类的名称中,去掉包名的部分,获得类的文件名
   clsName=clsName.substring(packName.length()+1);
   //判定包名是否是简单包名,如果是,则直接将包名转换为路径,
   if(packName.indexOf(".")<0) path=packName+"/";
   else{//否则按照包名的组成部分,将包名转换为路径
    int start=0,end=0;
    end=packName.indexOf(".");
    while(end!=-1){
   path=path+packName.substring(start,end)+"/";
   start=end+1;
   end=packName.indexOf(".",start);
    }
    path=path+packName.substring(start)+"/";
   }
}
//调用ClassLoader的getResource方法,传入包含路径信息的类文件名
java.net.URL url =loader.getResource(path+clsName);
//从URL对象中获取路径信息
String realPath=url.getPath();
//去掉路径信息中的协议名"file:"
int pos=realPath.indexOf("file:");
if(pos>-1) realPath=realPath.substring(pos+5);
//去掉路径信息最后包含类文件信息的部分,得到类所在的路径
pos=realPath.indexOf(path+clsName);
realPath=realPath.substring(0,pos-1);
//如果类文件被打包到JAR等文件中时,去掉对应的JAR等打包文件名
if(realPath.endsWith("!"))
   realPath=realPath.substring(0,realPath.lastIndexOf("/"));
/*------------------------------------------------------------
       ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径
      中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要
      的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的
      中文及空格路径
      -------------------------------------------------------------*/
try{
   realPath=java.net.URLDecoder.decode(realPath,"utf-8");
}catch(Exception e){throw new RuntimeException(e);}
return realPath;
}//getAppPath定义结束
//-----------------------------------------------------------------
}

八云橙 发表于 2011-1-6 19:15:41

代码盲表示完全看不懂...那么大致的功能是?

天使怪盗Dick 发表于 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

我想看成品界面...主要是对"狐狸"非常的有兴趣

a610181270 发表于 2011-5-20 19:40:13

java==还在学

タユタイ 发表于 2011-5-21 21:24:46

表弟有在学编程,不过我本人完全是文盲
页: [1]
查看完整版本: 萌战CIP用狐狸计票器源码备份