42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.IO;
 | |
| using System.Text;
 | |
| using System.Collections;
 | |
| using UnityEngine;
 | |
| 
 | |
| namespace Touka
 | |
| {
 | |
|     public class TKGProperties
 | |
|     {
 | |
|         public static Hashtable Load(string file)
 | |
|         {
 | |
|             Hashtable ht = new Hashtable(16);
 | |
|             string content = null;
 | |
|             try
 | |
|             {
 | |
|                 content = File.ReadAllText(file, Encoding.UTF8);
 | |
|             }
 | |
|             catch (Exception e)
 | |
|             {
 | |
|                 return null;
 | |
|             }
 | |
|             string[] rows = content.Split('\n');
 | |
|             string[] kv = null;
 | |
|             foreach (string c in rows)
 | |
|             {
 | |
|                 if (c.Trim().Length == 0)
 | |
|                     continue;
 | |
|                 kv = c.Split('=');
 | |
|                 if (kv.Length == 1)
 | |
|                 {
 | |
|                     ht[kv[0].Trim()] = "";
 | |
|                 }
 | |
|                 else if (kv.Length == 2)
 | |
|                 {
 | |
|                     ht[kv[0].Trim()] = kv[1].Trim();
 | |
|                 }
 | |
|             }
 | |
|             return ht;
 | |
|         }
 | |
|     }
 | |
| } |