/// <summary> /// Constructs the state list from the given text file. /// /// The file should consists of lines of the form: /// name-abbr-population /// /// Expects the file "statedata.txt" in app_data. /// </summary> public USStateList(string filename) { List <string> data = FileTools.FileDataAbsolutePath(filename); foreach (string s in data) { this.Add(new USStateData(s)); } }
/* * Return the key associated with the keyidentifier. * * This is the trimmed first line in the file with name * KeyFileName. * * In particular, additional lines are ignored. * * The HttpServerUtility is needed to find the file system path. */ public static string GetKey(HttpServerUtility server, string keyidentifier) { string rootparent = FileTools.GetRootParent(server); string filename = rootparent + KeyFileName(keyidentifier); List <string> data = FileTools.FileDataAbsolutePath(filename); if (data.Count <= 0) { return(""); } else { return(data[0]); } }