0
我有要求必须更改此'if'结构。由于目前编码,代理版本仅在 RM发送的策略GUID与服务器上策略的GUID匹配时才设置。我们总是要设置的版本无论的GUID匹配的。(什么都可以的情况)设置条件时的逻辑问题
这里是编码
ResourcePolicy rp = null;
try
{
int rpindex = allObjects.Find(new Guid(policyGuid));
if (rpindex != -1)
{
rp = (ResourcePolicy)allObjects.GetAt(rpindex);
}
}
catch (System.Exception err)
{
SpoDebug.DebugTraceSevere(func, "Bad GUID: " + policyGuid + " Exception: " + err.Message);
rp = null;
}
if (rp == null) // this the if loop we need to concentrate
{
SpoDebug.DebugTraceSevere(func, "Unable to find ResourcePolicy with GUID: " + policyGuid);
}
else
{
// Search for the specified host
foreach (DataModelObject dmo in allObjects)
{
if (dmo is IResourcePolicy)
{
if (string.Compare(dmo.Name, hostName, true) == 0)
{
IResourcePolicy irp = (IResourcePolicy)dmo;
irp.ResourcePolicy = rp;
irp.AgentPolicyVersion.Version = Convert.ToInt64(policyVersion);
irp.ResourcePolicyEnabled = Convert.ToBoolean(enabled);
irp.AgentVersion = agentVersion;
所以我做了什么我完成了任务(irp.AgentVersion = agentVersion;)外,如果循环(如果(RP == NULL))
像这样但我没有得到版本值
foreach (DataModelObject dmo in allObjects)
{
if (dmo is IResourcePolicy)
{
if (string.Compare(dmo.Name, hostName, true) == 0)
{
irp.AgentVersion = agentVersion;
}
任何一个可以建议我什么,我要在这里做
根据逻辑,这将工作,但那段时间也无法看到版本,只有在分配资源政策版本后即将到来 – peter 2010-01-08 10:03:21