Public static string getlanguage (int filetype, string key) // fileType divided by two: users, admin {int Cache = 0; // 1 = Open Cache String path = "language / zh-cn / user.xml"; if (FileType == 1) // Administrator {path = "language / zH-cn / admin.xml";} Object o = null; hashtable hash = new hashtable (); if (system.web.httpContext.current.cache [path] == null || cache == 0) // Never load {xmldocument d = new xmldocument (); D.Load (System.Web.httpContext.current.server.mAppath (PATH)); Foreach XMLNode XN in D.selectsinglenode ("root"). ChildNodes) {if (xn.nodetype! = Xmlnodetype.comment) Hash.Add (xn.attributes ["name"]. Value, xn.innertext);} o = hash System.Web.httpContext.current.cache.insert (Path, O);} else {o = system.Web.httpContext.current.cache.get (path);}
// ------------------------------------ha = (Hashtable) O; IF ( Hash.contains (key)) {Return hash [key] .tostring ();} return null;}
XML Version = "1.0" encoding = "utf-8"?>