static MSConfig() { var path = MSUtils.GetMapPath(filename); ini = Helpers.IniHelper.Open(path); db_server = read("DB", "SERVER", "localhost"); db_port = read("DB", "PORT", 3306); db_name = read("DB", "NAME", "lw_mlpen"); db_user = read("DB", "USER", "root"); db_pwd = read("DB", "PWD", string.Empty); port = read("PEN", "PORT", 3389); server_port = read("PEN", "SERVER_PORT", 8486); client_port = read("PEN", "CLIENT_PORT", 1234); mq_host = read("MQSERVER", "HOST", "127.0.0.1"); mq_username = read("MQSERVER", "USERNAME", "admin"); mq_password = read("MQSERVER", "PASSWORD", "admin"); host_lw_tpk_server = read("HOST", "LW_TPK_SERVER", string.Empty); host_lw_class_interaction_server = read("HOST", "LW_CLASS_INTERACTION_SERVER", string.Empty); host_lw_authz_server = read("HOST", "LW_AUTHZ_SERVER", string.Empty); host_lw_garden_server = read("HOST", "LW_GARDEN_SERVER", string.Empty); host_lw_face_server = read("HOST", "LW_FACE_SERVER", string.Empty); host_lw_file_server_download = read("HOST", "LW_FILE_SERVER_DOWNLOAD", string.Empty); link_address_lw_practice_record = read("LINKADDRESS", "LW_PRACTICE_RECORD", string.Empty); link_address_lw_paper_manager = read("LINKADDRESS", "LW_PAPER_MANAGER", string.Empty); link_address_lw_select_paper = read("LINKADDRESS", "LW_SELECT_PAPER", string.Empty); link_address_lw_record_single = read("LINKADDRESS", "LW_RECORD_SINGLE", string.Empty); link_address_lw_record_all = read("LINKADDRESS", "LW_RECORD_ALL", string.Empty); link_address_lw_record_small_single = read("LINKADDRESS", "LW_RECORD_SMALL_SINGLE", string.Empty); link_address_lw_record_small_all = read("LINKADDRESS", "LW_RECORD_SMALL_ALL", string.Empty); }
/// <summary> /// 打开文件 /// </summary> /// <param name="filename">真实文件路径</param> /// <returns></returns> public static IniHelper Open(string filename) { var helper = new IniHelper(); if (!FileHelper.IsFileExists(filename)) { var folder = FileHelper.GetFolderName(filename); if (!FileHelper.IsFolderExists(folder)) { FileHelper.CreateFolder(folder); } FileHelper.White(filename, null); } helper.FileName = filename; return(helper); }