예제 #1
0
    public static void TestList()
    {
        string FILE_NAME="student.xml";

        List<Student> students=new List<Student>();

        students.Add(new Student("ken", 27, Sex.Male));
        students.Add(new Student("tony", 27, Sex.Male));
        students.Add(new Student("albert", 37, Sex.Male));

        KZXML<List<Student>> xml=new KZXML<List<Student>>();

        try {
            xml.Save(students, FILE_NAME);
            List<Student> t=xml.Load(FILE_NAME);
            foreach(Student s in t) {
                Debug.Log(s);
            }
        } catch(Exception) {
            Debug.LogError("Failed to Save or Load!");
        }
    }
예제 #2
0
    public static void TestSingle()
    {
        string FILE_NAME="student.xml";

        Student s=new Student("ken", 27, Sex.Male);

        KZXML<Student> xml=new KZXML<Student>();

        try {
            xml.Save(s, FILE_NAME);
        } catch(Exception) {
            Debug.LogError("Failed to Save!");
        }

        Student t=null;
        try {
            t=xml.Load(FILE_NAME);
        } catch(Exception) {
            Debug.LogError("Failed to Load!");
        }

        if(t==null || t.ToString() != "ken (27), Male") {
            Debug.LogError(t);
        } else {
            Debug.Log("OK!");
        }
    }
예제 #3
0
 public static void TestString()
 {
     string input="hello, <§A¦nworld";
     KZXML<string> xml=new KZXML<string>();
     try {
         xml.Save(input, "hello.xml");
     } catch(Exception) {
         Debug.LogError("Failed to Save!");
     }
 }