zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package PbuliClass;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import Method.MiMi;
 
/**¸ÃÀàÓÃÓÚ»ñÈ¡Îı¾ÎĵµÖеÄÄÚÈÝ*/
public class GetTxt {
 
    public static String getTxt(String title,String pathName) {
        String name=null;
        String path="systemFiles/"+pathName+".txt";
        String txt;
        try {
            txt = ReadFiles.readFiletxt(path);
            String[] message=txt.split("\\n");//ÒÔ¡°£¬¡±·Ö¸î×Ö·û´®
            for(int i=0;i<message.length;i++) {
                String me=message[i];    
                String[] txtn=me.split("\\:");//ÒÔ¡°£¬¡±·Ö¸î×Ö·û´®
                if(me.startsWith(title)) {
                    name=replace(txtn[1]);
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "¼ì²ésystem.txtÎļþ£¡");// ²¶»ñÒì³£ºó£¬µ¯³öÌáʾ¿ò
            System.exit(-1);// ÏµÍ³Í£Ö¹ÔËÐÐ
        }
 
        return name;
    }
    
    /**»ñÈ¡Èí¼þÊÔÓÃÌìÊý*/
    public static int get_regis() {
        int regis=0;
        String path="systemFiles/regis.txt";
        String txt;
        try {
            txt = ReadFiles.readFiletxt(path);
            String mimi=MiMi.DecodePasswd(txt);//½âÃÜ
            String[] message=mimi.split("\\n");//ÒÔ¡°\n¡±·Ö¸î×Ö·û´®
            for(int i=0;i<message.length;i++) {
                String me=message[i];    
                String[] txtn=me.split("\\:");//ÒÔ¡°:¡±·Ö¸î×Ö·û´®                
                if(me.startsWith("day")) {
                    String day=txtn[1];                    
                    regis=Integer.parseInt(day);
                    
                    break;
                }
 
            }
        } catch (IOException e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "¶ÁÎļþ³ö´í£¡");// ²¶»ñÒì³£ºó£¬µ¯³öÌáʾ¿ò
            System.exit(-1);// ÏµÍ³Í£Ö¹ÔËÐÐ
        }
        return regis;
    }
    
    /**È¥µô×Ö·û´®ÖеĻ»Ðпոñ»Ø³µ*/
    public static String replace(String str) {
        String destination = "";
        if (str!=null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            destination = m.replaceAll("");
        }
        return destination;
    }    
    
    
}