mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
CP-36392: Refactor conditions that result in unreachable code blocks
Also tidy up surrounding code Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
cfc7bd0ef9
commit
02aa50f7a8
@ -305,8 +305,6 @@ namespace XenAdmin.Controls.NetworkingTab
|
||||
}
|
||||
NetworksGridView.Rows.AddRange(vifRowsToAdd.ToArray());
|
||||
|
||||
bool selected = true;
|
||||
|
||||
if (selectedVIF != null)
|
||||
{
|
||||
foreach (VifRow row in NetworksGridView.Rows)
|
||||
@ -319,11 +317,6 @@ namespace XenAdmin.Controls.NetworkingTab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!selected && NetworksGridView.Rows.Count > 0)
|
||||
{
|
||||
NetworksGridView.Rows[0].Selected = true;
|
||||
}
|
||||
}
|
||||
else if (XenObject is Host || XenObject is Pool)
|
||||
{
|
||||
|
@ -231,17 +231,17 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
vm.PropertyChanged -= VmPropertyChanged;
|
||||
vm.PropertyChanged += VmPropertyChanged;
|
||||
if (pvsProxy != null)
|
||||
{
|
||||
pvsProxy.PropertyChanged -= PvsProxyPropertyChanged;
|
||||
pvsProxy.PropertyChanged += PvsProxyPropertyChanged;
|
||||
PVS_site pvsSite = pvsProxy == null ? null : Connection.Resolve(pvsProxy.site);
|
||||
if (pvsSite != null)
|
||||
{
|
||||
pvsSite.PropertyChanged -= PvsSitePropertyChanged;
|
||||
pvsSite.PropertyChanged += PvsSitePropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
if (pvsProxy == null)
|
||||
return;
|
||||
pvsProxy.PropertyChanged -= PvsProxyPropertyChanged;
|
||||
pvsProxy.PropertyChanged += PvsProxyPropertyChanged;
|
||||
|
||||
var pvsSite = Connection.Resolve(pvsProxy.site);
|
||||
if (pvsSite == null)
|
||||
return;
|
||||
pvsSite.PropertyChanged -= PvsSitePropertyChanged;
|
||||
pvsSite.PropertyChanged += PvsSitePropertyChanged;
|
||||
}
|
||||
|
||||
private void UnregisterVmEventHandlers()
|
||||
|
@ -84,7 +84,6 @@ namespace XenAdmin.Actions.DR
|
||||
|
||||
internal static void DestroyVM(Session session, VM vm)
|
||||
{
|
||||
Exception caught = null;
|
||||
log.DebugFormat("Destroying VM '{0}'", vm.Name());
|
||||
|
||||
if (vm.snapshots.Count > 0)
|
||||
@ -143,9 +142,6 @@ namespace XenAdmin.Actions.DR
|
||||
}
|
||||
|
||||
log.DebugFormat("VM '{0}' destroyed", vm.Name());
|
||||
|
||||
if (caught != null)
|
||||
throw caught;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -481,27 +481,31 @@ namespace XenAdmin.XenSearch
|
||||
// item doesn't use a Server).
|
||||
public override bool? MatchProperty(List<T> list)
|
||||
{
|
||||
bool seenFalse = false;
|
||||
bool seenNull = false;
|
||||
foreach (T o in list)
|
||||
var seenFalse = false;
|
||||
var seenNull = false;
|
||||
foreach (var o in list)
|
||||
{
|
||||
if (o != null)
|
||||
{
|
||||
bool? b = subQuery.Match(o);
|
||||
if (b == true)
|
||||
return true;
|
||||
else if (b == false)
|
||||
seenFalse = true;
|
||||
else
|
||||
seenNull = true;
|
||||
var b = subQuery.Match(o);
|
||||
switch (b)
|
||||
{
|
||||
case true:
|
||||
return true;
|
||||
case false:
|
||||
seenFalse = true;
|
||||
break;
|
||||
default:
|
||||
seenNull = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (seenFalse)
|
||||
return false;
|
||||
else if (seenNull)
|
||||
if (seenNull)
|
||||
return null;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user