namespace Yw.BIMFace
{
///
/// 返回结果辅助类
///
internal class ResponseHelper
{
//结果与描述的对应关系字典
private static readonly 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 eResponseCode GetResponseCode(string code)
{
switch (code)
{
case "system.error": return eResponseCode.SystemError;
case "authentication.failed": return eResponseCode.AuthenticationFailed;
case "file.has.not.translated": return eResponseCode.FileHasNotTranslated;
case "file.translate.failed": return eResponseCode.FileTranslateFailed;
case "file.is.translating": return eResponseCode.FileIsTranslating;
case "integration.not.found": return eResponseCode.IntegrationNotFound;
case "files.is.integrating": return eResponseCode.FileIsIntegrating;
case "files.integrate.failed": return eResponseCode.FilesIntegrateFailed;
case "model.compare.not.found": return eResponseCode.ModelCompareNotFound;
case "model.compare.not.finished": return eResponseCode.ModelCompareNotFinished;
case "model.compare.failed": return eResponseCode.ModelCompareFailed;
case "file.not.found": return eResponseCode.FileNotFound;
case "success": return eResponseCode.Success;
default: return eResponseCode.UnKnown;
}
}
///
/// 获取响应信息
///
internal static string GetResponseMessage(string code)
{
if (_dic.ContainsKey(code))
{
return _dic[code];
}
return null;
}
}
}