using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace IStation.Bimface { /// /// 返回结果辅助类 /// internal class ResultHelper { //结果与描述的对应关系字典 private static Dictionary _dic = new Dictionary() { {"system.error","BIMFACE系统异常"}, {"authentication.failed","API访问合法性校验失败"}, {"file.has.not.translated","文件未转换,不能获取viewToken"}, {"file.translate.failed","文件转换失败,不能获取viewToken"}, {"file.is.translating","文件转换中,不能获取viewToken"}, {"integration.not.found","集成模型不存在,不能获取viewToken"}, {"files.is.integrating","集成中,不能获取viewToken"}, {"files.integrate.failed","集成失败,不能获取viewToken"}, {"model.compare.not.found","对比模型不存在,不能获取viewToken"}, {"model.compare.not.finished","对比未完成,不能获取viewToken"}, {"model.compare.failed","对比失败,不能获取viewToken"}, {"file.not.found","文件不存在"}, {"success","成功"} }; /// /// 获取枚举描述 /// /// /// internal static string GetResultDescription(string Code) { if (_dic.ContainsKey(Code)) return _dic[Code]; return null; } /// /// 获取结果枚举项 /// /// /// internal static eResultCode GetResultCode(string Code) { switch (Code) { case "system.error": return eResultCode.SystemError; case "authentication.failed": return eResultCode.AuthenticationFailed; case "file.has.not.translated": return eResultCode.FileHasNotTranslated; case "file.translate.failed": return eResultCode.FileTranslateFailed; case "file.is.translating": return eResultCode.FileIsTranslating; case "integration.not.found": return eResultCode.IntegrationNotFound; case "files.is.integrating": return eResultCode.FileIsIntegrating; case "files.integrate.failed": return eResultCode.FilesIntegrateFailed; case "model.compare.not.found": return eResultCode.ModelCompareNotFound; case "model.compare.not.finished": return eResultCode.ModelCompareNotFinished; case "model.compare.failed": return eResultCode.ModelCompareFailed; case "file.not.found": return eResultCode.FileNotFound; case "success": return eResultCode.Success; default: return eResultCode.UnKnown; } } } }