private MfModel(Model model, Vault vault) { _model = model; _name = model.Name; _filePath = model.Filepath; _vault = vault; if (vault != null) { _clientVault = false; } if (vault != null) { _aliases = VaultAliases.GetAliases(_vault); } }
private void Initialize() { if (_inited) { return; } if (_clientVault) { if (!ClientUtils.IsInMf(_filePath)) { throw new Exception("文件未在云系统中!"); } if (_vault == null) { var obj = ClientUtils.GetObjectFromURL(_filePath); _vault = obj.Vault; _obj = obj.VersionData; } } else { if (_vault == null) { throw new Exception("服务端必须指定文档库"); } var objID = new ObjID(); objID.SetIDs((int)MFBuiltInObjectType.MFBuiltInObjectTypeDocument, _model.Id); var objAndProps = _vault.ObjectOperations.GetLatestObjectVersionAndProperties(objID, true); _obj = objAndProps.VersionData; } _name = _obj.Title; if (_aliases == null) { _aliases = VaultAliases.GetAliases(_vault); } if (!_aliases.IsValid) { throw new Exception("文档库缺少必须的元数据!"); } _inited = true; }