public override string ToString() { return(string.Format("JniValueMarshalerState({0}, ReferenceValue={1}, PeerableValue=0x{2}, Extra={3})", JniArgumentValue.ToString(), ReferenceValue.ToString(), RuntimeHelpers.GetHashCode(PeerableValue).ToString("x"), Extra)); }
private bool AreDNsEqual(ReferenceValue dn1, ReferenceValue dn2, ManagementAgent ma, bool strictCompare) { if (strictCompare) { Tracer.TraceInformation("performing-strict-DN-comparison"); return(dn1.ToString() == dn2.ToString()); } else { Tracer.TraceInformation("performing-RFC-compliant-DN-comparison"); return(dn1.Equals(dn2)); } }
private void ConditionalRenameConnector(ConnectedMA ma, CSEntry csentry, MVEntry mventry, Rule connectorRule) { Tracer.TraceInformation("enter-conditionalrenameconnector"); try { if (connectorRule.ConditionalRename == null) { return; } string escapedCN = null; string replacedValue = null; if (string.IsNullOrEmpty(connectorRule.ConditionalRename.EscapedCN)) { Tracer.TraceInformation("no-cn-to-escape"); replacedValue = connectorRule.ConditionalRename.NewDNValue.ReplaceWithMVValueOrBlank(mventry); } else { escapedCN = ma.EscapeDNComponent(connectorRule.ConditionalRename.EscapedCN.ReplaceWithMVValueOrBlank(mventry, "")).ToString(); Tracer.TraceInformation("escaped-cn {0}", escapedCN); replacedValue = connectorRule.ConditionalRename.NewDNValue.ReplaceWithMVValueOrBlank(mventry, escapedCN); } ReferenceValue newdn = ma.CreateDN(replacedValue); ReferenceValue olddn = ma.CreateDN(csentry.DN.ToString()); Tracer.TraceInformation("old-dn '{0}'", olddn.ToString()); Tracer.TraceInformation("new-dn '{0}'", newdn.ToString()); if (this.AreDNsEqual(olddn, newdn, ma, connectorRule.ConditionalRename.StrictDNCompare)) { Tracer.TraceInformation("no-renaming-necessary"); } else { Tracer.TraceInformation("dn-rename-required"); csentry.DN = newdn; } } catch (Exception ex) { Tracer.TraceError("error {0}", ex.GetBaseException()); throw; } finally { Tracer.TraceInformation("exit-conditionalrenameconnector"); } }
public override string ToString() { string valueString = ""; if (ReferenceValue == null) { valueString = "null"; } else if (ReferenceValue.ToString().Contains("BH.oM") && !(ReferenceValue is Type)) { valueString = ReferenceValue.GetType().GetProperty("Name").GetValue(ReferenceValue) as string; } valueString = string.IsNullOrWhiteSpace(valueString) ? ReferenceValue.ToString() : valueString; // Make the text in the ValueComparisons more readable (remove camelCase and add spaces) string comparisonText = Comparison.ToString(); var builder = new System.Text.StringBuilder(); foreach (char c in comparisonText) { if (Char.IsUpper(c) && builder.Length > 0) { builder.Append(' '); } builder.Append(Char.ToLower(c)); } comparisonText = builder.ToString(); if (string.IsNullOrWhiteSpace(PropertyName) && ReferenceValue is System.Type) { return($"must be of type `{(ReferenceValue as Type).Name}`"); } return($"{PropertyName} {comparisonText} {valueString}"); }