Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions src/Microsoft.WSMan.Management/ConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ protected override void SetItem(string path, object value)
pluginConfiguration.UpdateOneConfiguration(
".",
WSManStringLiterals.ConfigRunAsPasswordName,
this.GetStringFromSecureString(runAsCredentials.Password));
GetStringFromSecureString(runAsCredentials.Password));
}
}

Expand All @@ -1050,7 +1050,7 @@ protected override void SetItem(string path, object value)
AssertError(helper.GetResourceMsgFromResourcetext("SetItemOnRunAsPasswordNoRunAsUser"), false);
}

value = this.GetStringFromSecureString(value);
value = GetStringFromSecureString(value);
}

pluginConfiguration.UpdateOneConfiguration(".", ChildName, value.ToString());
Expand Down Expand Up @@ -2290,7 +2290,7 @@ private void NewItemPluginOrPluginChild(object sessionobj, string path, string h
/// <param name="WSManElementObjectType"></param>
/// <param name="input"></param>
/// <returns></returns>
private PSObject GetItemPSObjectWithTypeName(string Name, string TypeNameOfElement, object Value, string[] keys, string ExtendedTypeName, WsManElementObjectTypes WSManElementObjectType, PSObject input = null)
private static PSObject GetItemPSObjectWithTypeName(string Name, string TypeNameOfElement, object Value, string[] keys, string ExtendedTypeName, WsManElementObjectTypes WSManElementObjectType, PSObject input = null)
{
PSObject mshObject = null;
if (WSManElementObjectType.Equals(WsManElementObjectTypes.WSManConfigElement))
Expand Down Expand Up @@ -2410,7 +2410,7 @@ private void SetItemListenerOrClientCertificate(object sessionObj, string Resour
/// <param name="value"></param>
/// <param name="host"></param>
/// <returns></returns>
private string GetInputStringForCreate(string ResourceURI, Hashtable value, string host)
private static string GetInputStringForCreate(string ResourceURI, Hashtable value, string host)
{
string putstr = string.Empty;
string nilns = string.Empty;
Expand Down Expand Up @@ -2523,7 +2523,7 @@ private string GetHostName(string path)
return sHostname;
}

private string GetRootNodeName(string ResourceURI)
private static string GetRootNodeName(string ResourceURI)
{
string tempuri = string.Empty;
if (ResourceURI.Contains('?'))
Expand All @@ -2542,7 +2542,7 @@ private string GetRootNodeName(string ResourceURI)
return tempuri;
}

private string EscapeValuesForXML(string value)
private static string EscapeValuesForXML(string value)
{
StringBuilder esc_str = new StringBuilder();
for (int i = 0; i <= value.Length - 1; i++)
Expand Down Expand Up @@ -2585,7 +2585,7 @@ private string EscapeValuesForXML(string value)
return esc_str.ToString();
}

private bool IsItemContainer(XmlNodeList nodes)
private static bool IsItemContainer(XmlNodeList nodes)
{
bool result = false;
if (nodes.Count != 0)
Expand Down Expand Up @@ -2935,7 +2935,7 @@ private bool ContainResourceValue(object sessionobj, string ResourceURI, string

#endregion "WsMan linking Operations"

private string GetURIWithFilter(string uri, Hashtable cmdlinevalues)
private static string GetURIWithFilter(string uri, Hashtable cmdlinevalues)
{
StringBuilder sburi = new StringBuilder(uri);
if (cmdlinevalues != null)
Expand All @@ -2960,7 +2960,7 @@ private string GetURIWithFilter(string uri, Hashtable cmdlinevalues)
return sburi.ToString();
}

private string GetFilterString(Hashtable cmdlinevalues, string[] pkey)
private static string GetFilterString(Hashtable cmdlinevalues, string[] pkey)
{
StringBuilder filter = new StringBuilder();
foreach (string key in pkey)
Expand All @@ -2979,7 +2979,7 @@ private string GetFilterString(Hashtable cmdlinevalues, string[] pkey)
return filter.ToString();
}

private bool IsPKey(string value, string ResourceURI)
private static bool IsPKey(string value, string ResourceURI)
{
bool result = false;
if (ResourceURI.Contains(WSManStringLiterals.containerListener))
Expand All @@ -2998,7 +2998,7 @@ private bool IsPKey(string value, string ResourceURI)
return result;
}

private bool CheckPkeysArray(Hashtable values, string value, string[] pkeys)
private static bool CheckPkeysArray(Hashtable values, string value, string[] pkeys)
{
bool result = false;
if (values != null)
Expand Down Expand Up @@ -3239,7 +3239,7 @@ private PSObject BuildHostLevelPSObjectArrayList(object objSessionObject, string
/// </summary>
/// <param name="xmlnode"></param>
/// <returns></returns>
private PSObject ConvertToPSObject(XmlNode xmlnode)
private static PSObject ConvertToPSObject(XmlNode xmlnode)
{
PSObject mshObject = new PSObject();
foreach (XmlNode node in xmlnode.ChildNodes)
Expand Down Expand Up @@ -3275,7 +3275,7 @@ private PSObject ConvertToPSObject(XmlNode xmlnode)
return mshObject;
}

private string SetXPathString(string uri)
private static string SetXPathString(string uri)
{
string parent = uri.Substring(uri.LastIndexOf(WSManStringLiterals.WinrmPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase) + 1);
if (parent.Equals(WSManStringLiterals.containerWinrs, StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -3307,7 +3307,7 @@ private string SetXPathString(string uri)
return parent;
}

private string SetSchemaPath(string uri)
private static string SetSchemaPath(string uri)
{
string schemapath = string.Empty;
uri = uri.Remove(0, WinrmRootName[0].Length);
Expand All @@ -3334,7 +3334,7 @@ private string SetSchemaPath(string uri)
/// <param name="path"></param>
/// <param name="host"></param>
/// <returns></returns>
private string NormalizePath(string path, string host)
private static string NormalizePath(string path, string host)
{
string uri = string.Empty;
if (path.StartsWith(host, StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -3660,7 +3660,7 @@ private string GetCorrectCaseOfName(string ChildName, string hostname, string pa
return result;
}

private ArrayList RemoveItemfromResourceArray(ArrayList resourceArray, string ChildName, string type, string property)
private static ArrayList RemoveItemfromResourceArray(ArrayList resourceArray, string ChildName, string type, string property)
{
if (resourceArray != null)
{
Expand Down Expand Up @@ -4519,7 +4519,7 @@ private void GetChildItemsOrNames(string path, ProviderMethods methodname, bool
/// <param name="CurrentPluginName"></param>
/// <param name="path"></param>
/// <returns></returns>
private int GetPluginNames(XmlDocument xmlPlugins, out PSObject PluginNames, out string CurrentPluginName, string path)
private static int GetPluginNames(XmlDocument xmlPlugins, out PSObject PluginNames, out string CurrentPluginName, string path)
{
PluginNames = new PSObject();
CurrentPluginName = string.Empty;
Expand Down Expand Up @@ -4627,7 +4627,7 @@ private void StartWSManService(bool force)
/// </summary>
/// <param name="host"></param>
/// <returns></returns>
private bool IsPathLocalMachine(string host)
private static bool IsPathLocalMachine(string host)
{
bool hostfound = false;
// Check is Localhost
Expand Down Expand Up @@ -4684,7 +4684,7 @@ private bool IsPathLocalMachine(string host)

#region Plugin private functions

private void GenerateObjectNameAndKeys(Hashtable InputAttributes, string ResourceURI, string ContainerItem, out string ItemName, out string[] keys)
private static void GenerateObjectNameAndKeys(Hashtable InputAttributes, string ResourceURI, string ContainerItem, out string ItemName, out string[] keys)
{
StringBuilder sbHashKey = new StringBuilder();
string keysColumns = string.Empty;
Expand Down Expand Up @@ -4717,7 +4717,7 @@ private void GenerateObjectNameAndKeys(Hashtable InputAttributes, string Resourc
keys = keysColumns.Split('|');
}

private void ProcessCertMappingObjects(XmlDocument xmlCerts, out Hashtable Certcache, out Hashtable Keyscache)
private static void ProcessCertMappingObjects(XmlDocument xmlCerts, out Hashtable Certcache, out Hashtable Keyscache)
{
Hashtable lCache = new Hashtable();
Hashtable kCache = new Hashtable();
Expand Down Expand Up @@ -4775,7 +4775,7 @@ private void ProcessCertMappingObjects(XmlDocument xmlCerts, out Hashtable Certc
Keyscache = kCache;
}

private void ProcessListenerObjects(XmlDocument xmlListeners, out Hashtable listenercache, out Hashtable Keyscache)
private static void ProcessListenerObjects(XmlDocument xmlListeners, out Hashtable listenercache, out Hashtable Keyscache)
{
Hashtable lCache = new Hashtable();
Hashtable kCache = new Hashtable();
Expand Down Expand Up @@ -4836,7 +4836,7 @@ private void ProcessListenerObjects(XmlDocument xmlListeners, out Hashtable list
Keyscache = kCache;
}

private PSObject ProcessPluginConfigurationLevel(XmlDocument xmldoc, bool setRunasPasswordAsSecureString = false)
private static PSObject ProcessPluginConfigurationLevel(XmlDocument xmldoc, bool setRunasPasswordAsSecureString = false)
{
PSObject objConfiglvl = null;

Expand Down Expand Up @@ -4877,7 +4877,7 @@ private PSObject ProcessPluginConfigurationLevel(XmlDocument xmldoc, bool setRun
return objConfiglvl;
}

private ArrayList ProcessPluginResourceLevel(XmlDocument xmldoc, out ArrayList arrSecurity)
private static ArrayList ProcessPluginResourceLevel(XmlDocument xmldoc, out ArrayList arrSecurity)
{
ArrayList Resources = null;
ArrayList nSecurity = null;
Expand Down Expand Up @@ -4963,7 +4963,7 @@ private ArrayList ProcessPluginResourceLevel(XmlDocument xmldoc, out ArrayList a
return Resources;
}

private ArrayList ProcessPluginInitParamLevel(XmlDocument xmldoc)
private static ArrayList ProcessPluginInitParamLevel(XmlDocument xmldoc)
{
ArrayList InitParamLvl = null;
if (xmldoc != null)
Expand Down Expand Up @@ -5001,7 +5001,7 @@ private ArrayList ProcessPluginInitParamLevel(XmlDocument xmldoc)
return InitParamLvl;
}

private ArrayList ProcessPluginSecurityLevel(ArrayList arrSecurity, XmlDocument xmlSecurity, string UniqueResourceID, string ParentResourceUri)
private static ArrayList ProcessPluginSecurityLevel(ArrayList arrSecurity, XmlDocument xmlSecurity, string UniqueResourceID, string ParentResourceUri)
{
// ArrayList SecurityLvl = null;
if (xmlSecurity != null)
Expand Down Expand Up @@ -5063,7 +5063,7 @@ private ArrayList ProcessPluginSecurityLevel(ArrayList arrSecurity, XmlDocument
///<param name="securities">List of Securities</param>
///<param name="initParams">List of initialization parameters.</param>
/// <returns>An Configuration XML, ready to send to server.</returns>
private string ConstructPluginXml(PSObject objinputparam, string ResourceURI, string host, string Operation, ArrayList resources, ArrayList securities, ArrayList initParams)
private static string ConstructPluginXml(PSObject objinputparam, string ResourceURI, string host, string Operation, ArrayList resources, ArrayList securities, ArrayList initParams)
{
StringBuilder sbvalues = new StringBuilder();
sbvalues.Append("<PlugInConfiguration ");
Expand All @@ -5089,7 +5089,7 @@ private string ConstructPluginXml(PSObject objinputparam, string ResourceURI, st

if (WSManStringLiterals.ConfigRunAsPasswordName.Equals(prop.Name, StringComparison.OrdinalIgnoreCase))
{
prop.Value = this.GetStringFromSecureString(prop.Value);
prop.Value = GetStringFromSecureString(prop.Value);
}

// ... Name="Value"
Expand Down Expand Up @@ -5191,7 +5191,7 @@ private object ValidateAndGetUserObject(string configurationName, object value)
/// if the propertyValue provided is not SecureString appends empty string.
/// </summary>
/// <param name="propertyValue">Value to append.</param>
private string GetStringFromSecureString(object propertyValue)
private static string GetStringFromSecureString(object propertyValue)
{
SecureString value = propertyValue as SecureString;
string passwordValueToAdd = string.Empty;
Expand All @@ -5206,7 +5206,7 @@ private string GetStringFromSecureString(object propertyValue)
return passwordValueToAdd;
}

private string ConstructResourceXml(PSObject objinputparams, ArrayList resources, ArrayList securities)
private static string ConstructResourceXml(PSObject objinputparams, ArrayList resources, ArrayList securities)
{
StringBuilder sbvalues = new StringBuilder(string.Empty);
if (objinputparams == null && resources == null)
Expand Down Expand Up @@ -5293,7 +5293,7 @@ private string ConstructResourceXml(PSObject objinputparams, ArrayList resources
return sbvalues.ToString();
}

private string ConstructSecurityXml(PSObject objinputparams, ArrayList securities, string strResourceIdentity)
private static string ConstructSecurityXml(PSObject objinputparams, ArrayList securities, string strResourceIdentity)
{
// <Security Uri="" ExactMatch="false" Sddl="O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;ER)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)"/>
StringBuilder sbvalues = new StringBuilder(string.Empty);
Expand All @@ -5320,7 +5320,7 @@ private string ConstructSecurityXml(PSObject objinputparams, ArrayList securitie
return sbvalues.ToString();
}

private void AddSecurityProperties(
private static void AddSecurityProperties(
PSMemberInfoCollection<PSPropertyInfo> properties,
StringBuilder sbValues)
{
Expand All @@ -5345,7 +5345,7 @@ private void AddSecurityProperties(
sbValues.Append("</Security>");
}

private string ConstructInitParamsXml(PSObject objinputparams, ArrayList initparams)
private static string ConstructInitParamsXml(PSObject objinputparams, ArrayList initparams)
{
// <InitializationParameters>
// <Param Name="Param1" Value="Value1" />
Expand Down Expand Up @@ -5397,7 +5397,7 @@ private string ConstructInitParamsXml(PSObject objinputparams, ArrayList initpar
return sbvalues.ToString();
}

private string ConstructCapabilityXml(object[] capabilities)
private static string ConstructCapabilityXml(object[] capabilities)
{
StringBuilder sbvalues = new StringBuilder(string.Empty);
foreach (object cap in capabilities)
Expand All @@ -5413,7 +5413,7 @@ private string ConstructCapabilityXml(object[] capabilities)
return sbvalues.ToString();
}

private bool IsValueOfParamList(string name, string[] paramcontainer)
private static bool IsValueOfParamList(string name, string[] paramcontainer)
{
bool result = false;
foreach (string value in paramcontainer)
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.WSMan.Management/CurrentConfigurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void RemoveOneConfiguration(string pathToNodeFromRoot)
{
if (nodeToRemove is XmlAttribute)
{
this.RemoveAttribute(nodeToRemove as XmlAttribute);
RemoveAttribute(nodeToRemove as XmlAttribute);
}
}
else
Expand Down Expand Up @@ -217,7 +217,7 @@ public string GetOneConfiguration(string pathFromRoot)
/// Removes the attribute from OwnerNode.
/// </summary>
/// <param name="attributeToRemove">Attribute to Remove.</param>
private void RemoveAttribute(XmlAttribute attributeToRemove)
private static void RemoveAttribute(XmlAttribute attributeToRemove)
{
XmlElement ownerElement = attributeToRemove.OwnerElement;
ownerElement.RemoveAttribute(attributeToRemove.Name);
Expand Down