From 4d5f7c429e8903e0151a6446c495a6f682fd51eb Mon Sep 17 00:00:00 2001 From: "GLOBAL\\ddemeyer" Date: Sun, 27 Jan 2019 17:44:07 +0100 Subject: [PATCH] #4 Reduce warning count in solution by replacing ArgumentNullException with ArgumentException, add readonly list, added globalsuppressions.cs, wrapped ShouldProcess, refactored using statements --- .../Cmdlets/Baseline/RemoveIshBaselineItem.cs | 5 ++-- .../Cmdlets/Baseline/SetIshBaselineItem.cs | 5 ++-- .../Cmdlets/DocumentObj/AddIshDocumentObj.cs | 15 +++++----- .../Cmdlets/DocumentObj/MoveIshDocumentObj.cs | 2 +- .../Cmdlets/DocumentObj/SetIshDocumentObj.cs | 6 ++-- .../Cmdlets/EDT/AddIshEDT.cs | 2 +- .../Cmdlets/EDT/FindIshEDT.cs | 2 +- .../Cmdlets/EDT/GetIshEDT.cs | 2 +- .../Cmdlets/EDT/SetIshEDT.cs | 2 +- .../Cmdlets/FileProcessor/TestIshValidXml.cs | 2 +- .../PublishIshPublicationOutput.cs | 21 +++++++------- .../Cmdlets/Settings/GetIshSetting.cs | 12 ++++++-- .../Cmdlets/TrisoftCmdlet.cs | 11 ++++---- .../Trisoft.ISHRemote/GlobalSuppressions.cs | 28 +++++++++++++++++++ .../Trisoft.ISHRemote/ISHRemote.csproj | 1 + .../Objects/IshTypeFieldSetup.cs | 12 ++++---- .../Objects/Public/IshFolder.cs | 6 ++-- .../Objects/Public/IshObject.cs | 6 ++-- 18 files changed, 87 insertions(+), 53 deletions(-) create mode 100644 Source/ISHRemote/Trisoft.ISHRemote/GlobalSuppressions.cs diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.cs index 0f5ee81b..039402b6 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/RemoveIshBaselineItem.cs @@ -115,8 +115,7 @@ protected override void EndProcessing() WriteDebug($"Id[{baselineId}] {++current}/{_baselineItemsToProcess.Keys.Count}"); if (ShouldProcess(baselineId)) { - StringWriter stringWriter; - using (stringWriter = new StringWriter()) + using (StringWriter stringWriter = new StringWriter()) { using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter)) { @@ -132,8 +131,8 @@ protected override void EndProcessing() } xmlWriter.WriteEndElement(); } + IshSession.Baseline25.Update(baselineId, stringWriter.ToString()); } - IshSession.Baseline25.Update(baselineId, stringWriter.ToString()); } } WriteObject(IshObject, true); // Incoming IshObject is not altered, already contains optional PSNoteProperty, so continuing the pipeline diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.cs index f846b4c2..80c9398b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Baseline/SetIshBaselineItem.cs @@ -149,8 +149,7 @@ protected override void EndProcessing() WriteDebug($"Id[{baselineId}] {++current}/{_baselineItemsToProcess.Keys.Count}"); if (ShouldProcess(baselineId)) { - StringWriter stringWriter; - using (stringWriter = new StringWriter()) + using (StringWriter stringWriter = new StringWriter()) { using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter)) { @@ -166,8 +165,8 @@ protected override void EndProcessing() } xmlWriter.WriteEndElement(); } + IshSession.Baseline25.Update(baselineId, stringWriter.ToString()); } - IshSession.Baseline25.Update(baselineId, stringWriter.ToString()); } } WriteObject(IshObject, true); // Incoming IshObject is not altered, already contains optional PSNoteProperty, so continuing the pipeline diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.cs index 358c12ea..2f235979 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/AddIshDocumentObj.cs @@ -372,15 +372,14 @@ protected override void ProcessRecord() metadata.ToXml(), _ishData.Edt, _ishData.ByteArray)); + IshFields requestedMetadata = IshSession.IshTypeFieldSetup.ToIshRequestedMetadataFields(IshSession.DefaultRequestedMetadata, ISHType, metadata, Enumerations.ActionMode.Read); + var response2 = IshSession.DocumentObj25.GetMetadata(new DocumentObj25ServiceReference.GetMetadataRequest( + response.logicalId, response.version, Lng, resolution, + requestedMetadata.ToXml())); + string xmlIshObjects = response2.xmlObjectList; + IshObjects retrievedObjects = new IshObjects(ISHType, xmlIshObjects); + returnIshObjects.AddRange(retrievedObjects.Objects); } - - IshFields requestedMetadata = IshSession.IshTypeFieldSetup.ToIshRequestedMetadataFields(IshSession.DefaultRequestedMetadata, ISHType, metadata, Enumerations.ActionMode.Read); - var response2 = IshSession.DocumentObj25.GetMetadata(new DocumentObj25ServiceReference.GetMetadataRequest( - response.logicalId, response.version, Lng, resolution, - requestedMetadata.ToXml())); - string xmlIshObjects = response2.xmlObjectList; - IshObjects retrievedObjects = new IshObjects(ISHType, xmlIshObjects); - returnIshObjects.AddRange(retrievedObjects.Objects); } WriteVerbose("returned object count[" + returnIshObjects.Count + "]"); diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/MoveIshDocumentObj.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/MoveIshDocumentObj.cs index 933c7125..0a0331e9 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/MoveIshDocumentObj.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/MoveIshDocumentObj.cs @@ -123,7 +123,7 @@ public IshFolder ToIshFolder /// /// Initially holds incoming IshObject entries from the pipeline to correct the incorrect array-objects from Trisoft.Automation /// - private List _retrievedIshObjects = new List(); + private readonly List _retrievedIshObjects = new List(); #endregion protected override void BeginProcessing() diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.cs index 69263f97..a335b5ec 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/SetIshDocumentObj.cs @@ -202,7 +202,7 @@ protected override void ProcessRecord() string resolution = Resolution ?? ""; var metadata = IshSession.IshTypeFieldSetup.ToIshMetadataFields(ISHType, new IshFields(Metadata), Enumerations.ActionMode.Update); - string version; + string version = "-1"; if (Edt != null && FilePath != null) { IshData ishData = new IshData(Edt, FilePath); @@ -219,8 +219,8 @@ protected override void ProcessRecord() requiredCurrentMetadata.ToXml(), ishData.Edt, ishData.ByteArray)); + version = response.version; } - version = response.version; } else { @@ -235,8 +235,8 @@ protected override void ProcessRecord() resolution, metadata.ToXml(), requiredCurrentMetadata.ToXml())); + version = response.version; } - version = response.version; } IshFields requestedMetadata = IshSession.IshTypeFieldSetup.ToIshRequestedMetadataFields(IshSession.DefaultRequestedMetadata, ISHType, metadata, Enumerations.ActionMode.Read); var response2 = IshSession.DocumentObj25.GetMetadata(new GetMetadataRequest(LogicalId, diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/AddIshEDT.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/AddIshEDT.cs index 33da563d..19ec01b1 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/AddIshEDT.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/AddIshEDT.cs @@ -41,7 +41,7 @@ namespace Trisoft.ISHRemote.Cmdlets.EDT /// [Cmdlet(VerbsCommon.Add, "IshEDT", SupportsShouldProcess = true)] [OutputType(typeof(IshEDT))] - public sealed class AddIshEDT : EDTCmdlet + public sealed class AddIshEdt : EDTCmdlet { /// diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/FindIshEDT.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/FindIshEDT.cs index da97e4b0..6c3946f4 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/FindIshEDT.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/FindIshEDT.cs @@ -42,7 +42,7 @@ namespace Trisoft.ISHRemote.Cmdlets.EDT /// [Cmdlet(VerbsCommon.Find, "IshEDT", SupportsShouldProcess = false)] [OutputType(typeof(IshEDT))] - public sealed class FindIshEDT : EDTCmdlet + public sealed class FindIshEdt : EDTCmdlet { /// /// The IshSession variable holds the authentication and contract information. This object can be initialized using the New-IshSession cmdlet. diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/GetIshEDT.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/GetIshEDT.cs index 98cdcbaa..d3fa46a0 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/GetIshEDT.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/GetIshEDT.cs @@ -50,7 +50,7 @@ namespace Trisoft.ISHRemote.Cmdlets.EDT /// [Cmdlet(VerbsCommon.Get, "IshEDT", SupportsShouldProcess = false)] [OutputType(typeof(IshEDT))] - public sealed class GetIshEDT : EDTCmdlet + public sealed class GetIshEdt : EDTCmdlet { /// /// The IshSession variable holds the authentication and contract information. This object can be initialized using the New-IshSession cmdlet. diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/SetIshEDT.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/SetIshEDT.cs index 09238ef8..d4ed2865 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/SetIshEDT.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EDT/SetIshEDT.cs @@ -52,7 +52,7 @@ namespace Trisoft.ISHRemote.Cmdlets.EDT /// [Cmdlet(VerbsCommon.Set, "IshEDT", SupportsShouldProcess = true)] [OutputType(typeof(IshEDT))] - public sealed class SetIshEDT : EDTCmdlet + public sealed class SetIshEdt : EDTCmdlet { /// diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.cs index 93413bce..e146191a 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/FileProcessor/TestIshValidXml.cs @@ -152,7 +152,7 @@ protected override void EndProcessing() { using (XmlReader xmlReader = XmlReader.Create(streamReader, _xmlReaderSettings)) { - while (xmlReader.Read()) { } + while (xmlReader.Read()); } } WriteObject(true); diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/PublishIshPublicationOutput.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/PublishIshPublicationOutput.cs index adda3095..56aff52b 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/PublishIshPublicationOutput.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/PublicationOutput/PublishIshPublicationOutput.cs @@ -167,18 +167,17 @@ protected override void ProcessRecord() LanguageCombination, metadata.ToXml(), requiredCurrentMetadata.ToXml())); + // Get the metadata of the object + IshFields requestedMetadata = IshSession.IshTypeFieldSetup.ToIshRequestedMetadataFields(IshSession.DefaultRequestedMetadata, ISHType, publishMetadata, Enumerations.ActionMode.Read); + var response2 = + IshSession.PublicationOutput25.GetMetadata(new PublicationOutput25ServiceReference. + GetMetadataRequest( + LogicalId, response.version, OutputFormat, LanguageCombination, + requestedMetadata.ToXml())); + string xmlIshObjects = response2.xmlObjectList; + IshObjects retrievedObjects = new IshObjects(ISHType, xmlIshObjects); + returnedObjects.AddRange(retrievedObjects.Objects); } - - // Get the metadata of the object - IshFields requestedMetadata = IshSession.IshTypeFieldSetup.ToIshRequestedMetadataFields(IshSession.DefaultRequestedMetadata, ISHType, publishMetadata, Enumerations.ActionMode.Read); - var response2 = - IshSession.PublicationOutput25.GetMetadata(new PublicationOutput25ServiceReference. - GetMetadataRequest( - LogicalId, response.version, OutputFormat, LanguageCombination, - requestedMetadata.ToXml())); - string xmlIshObjects = response2.xmlObjectList; - IshObjects retrievedObjects = new IshObjects(ISHType, xmlIshObjects); - returnedObjects.AddRange(retrievedObjects.Objects); } } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.cs index 5f31ed33..2495ddc7 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/Settings/GetIshSetting.cs @@ -184,13 +184,21 @@ protected override void ProcessRecord() File.SetAttributes(FilePath, FileAttributes.Normal); } // Write it as a text file - using (var stream = new FileStream(FilePath, fileMode, FileAccess.ReadWrite)) + Stream stream = null; + try { - using (System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, Encoding.UTF8)) + stream = new FileStream(FilePath, fileMode, FileAccess.ReadWrite); + using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8)) { + stream = null; writer.Write(value); } } + finally + { + if (stream != null) + stream.Dispose(); + } } } WriteVerbose("returned object count[1]"); diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdlet.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdlet.cs index dde8dcb6..b88be984 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdlet.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/TrisoftCmdlet.cs @@ -25,7 +25,9 @@ using System.Xml; using Trisoft.ISHRemote.Interfaces; using Trisoft.ISHRemote.Folder25ServiceReference; +using System.Runtime.InteropServices; +[assembly: ComVisible(false)] namespace Trisoft.ISHRemote.Cmdlets { /// @@ -44,13 +46,13 @@ public abstract class TrisoftCmdlet : PSCmdlet public readonly ILogger Logger; - private string _levelNameValueTypeSeparator = "--"; // consider removing and get from IshSession.NameHelper + private readonly string _levelNameValueTypeSeparator = "--"; // consider removing and get from IshSession.NameHelper private int _tickCountStart; - private ProgressRecord _parentProgressRecord; + private readonly ProgressRecord _parentProgressRecord; protected int _parentCurrent; protected int _parentTotal; - private ProgressRecord _childProgressRecord; + private readonly ProgressRecord _childProgressRecord; /// /// Name of the PSVariable so you don't have to specify '-IshSession $ishSession' anymore, should be set by New-IshSession @@ -69,7 +71,7 @@ public string LevelNameValueTypeSeparator get { return _levelNameValueTypeSeparator; } } - public TrisoftCmdlet() + protected TrisoftCmdlet() { Logger = TrisoftCmdletLogger.Instance(); TrisoftCmdletLogger.Initialize(this); @@ -239,7 +241,6 @@ internal virtual Folder25ServiceReference.BaseFolder BaseFolderLabelToEnum(IshSe BaseFolder.System, new string[] { "'" + baseFolderLabel + "'" }, // Use faulty folder path with quotes added, so we can throw the expected exception with errorcode=102001 ""); - return BaseFolder.Data; } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/GlobalSuppressions.cs b/Source/ISHRemote/Trisoft.ISHRemote/GlobalSuppressions.cs new file mode 100644 index 00000000..0fe09f87 --- /dev/null +++ b/Source/ISHRemote/Trisoft.ISHRemote/GlobalSuppressions.cs @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2014 All Rights Reserved by the SDL Group. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Major Code Smell", "S1751:Jump statements should not be used unconditionally", Justification = "", Scope = "member", Target = "~M:Trisoft.ISHRemote.HelperClasses.NameHelper.GetPSNoteProperty(Trisoft.ISHRemote.Objects.Enumerations.ISHType[],Trisoft.ISHRemote.Objects.Public.IshMetadataField)~System.Management.Automation.PSNoteProperty")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S1481:Unused local variables should be removed", Justification = "", Scope = "member", Target = "~M:Trisoft.ISHRemote.Cmdlets.Session.NewIshSession.ProcessRecord")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S1481:Unused local variables should be removed", Justification = "", Scope = "member", Target = "~M:Trisoft.ISHRemote.Cmdlets.TrisoftCmdlet.BaseFolderLabelToEnum(Trisoft.ISHRemote.Objects.Public.IshSession,System.String)~Trisoft.ISHRemote.Folder25ServiceReference.BaseFolder")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2342:Enumeration types should comply with a naming convention", Justification = "", Scope = "type", Target = "~T:Trisoft.ISHRemote.Objects.Enumerations.ISHType")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in camel case", Justification = "", Scope = "type", Target = "~T:Trisoft.ISHRemote.Objects.Public.IshEDT")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Critical Code Smell", "S2365:Properties should not make collection or array copies", Justification = "", Scope = "member", Target = "~P:Trisoft.ISHRemote.Objects.IshTypeFieldSetup.IshTypeFieldDefinition")] + diff --git a/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.csproj b/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.csproj index f00be07d..e26da8cc 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.csproj +++ b/Source/ISHRemote/Trisoft.ISHRemote/ISHRemote.csproj @@ -176,6 +176,7 @@ + diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs index d07ce31a..dc7d2790 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs @@ -182,7 +182,7 @@ private IshFields RemoveDuplicateFields(IshFields ishFields) /// Reverse lookup for all fields that are marked descriptive for the incoming ishTypes; then add them to ishFields. /// Descriptive fields are fields who are database-object-wise consired primary key, so to uniquely identify an object. /// - private IshFields AddDescriptiveFields(Enumerations.ISHType[] ishTypes, IshFields ishFields, Enumerations.ActionMode actionMode) + private IshFields AddDescriptiveFields(Enumerations.ISHType[] ishTypes, IshFields ishFields) { foreach (Enumerations.ISHType ishType in ishTypes) { @@ -203,7 +203,7 @@ private IshFields AddDescriptiveFields(Enumerations.ISHType[] ishTypes, IshField /// Reverse lookup for all fields that are marked basic for the incoming ishTypes; then add them to ishFields. /// Basic fields are fields who offer user-friendly business logic. /// - private IshFields AddBasicFields(Enumerations.ISHType[] ishTypes, IshFields ishFields, Enumerations.ActionMode actionMode) + private IshFields AddBasicFields(Enumerations.ISHType[] ishTypes, IshFields ishFields) { foreach (Enumerations.ISHType ishType in ishTypes) { @@ -224,7 +224,7 @@ private IshFields AddBasicFields(Enumerations.ISHType[] ishTypes, IshFields ishF /// Reverse lookup for all fields that are marked basic for the incoming ishTypes; then add them to ishFields. /// All fields of the specified object ISHType, so all descriptive, basic, system fields. /// - private IshFields AddAllFields(Enumerations.ISHType[] ishTypes, IshFields ishFields, Enumerations.ActionMode actionMode) + private IshFields AddAllFields(Enumerations.ISHType[] ishTypes, IshFields ishFields) { foreach (Enumerations.ISHType ishType in ishTypes) { @@ -275,10 +275,10 @@ public IshFields ToIshRequestedMetadataFields(Enumerations.RequestedMetadataGrou switch (requestedMetadataGroup) { case Enumerations.RequestedMetadataGroup.All: - requestedMetadataFields = AddAllFields(ishTypes, requestedMetadataFields, actionMode); + requestedMetadataFields = AddAllFields(ishTypes, requestedMetadataFields); break; case Enumerations.RequestedMetadataGroup.Basic: - requestedMetadataFields = AddBasicFields(ishTypes, requestedMetadataFields, actionMode); + requestedMetadataFields = AddBasicFields(ishTypes, requestedMetadataFields); break; case Enumerations.RequestedMetadataGroup.Descriptive: // always required, AddDescriptiveFields is called at the end of this function @@ -355,7 +355,7 @@ public IshFields ToIshRequestedMetadataFields(Enumerations.RequestedMetadataGrou } } //Add IsDescriptive fields for the incoming IshType to allow basic descriptive/minimal object initialization - requestedMetadataFields = AddDescriptiveFields(ishTypes, requestedMetadataFields, actionMode); + requestedMetadataFields = AddDescriptiveFields(ishTypes, requestedMetadataFields); //TODO [Should] Merges in IsDescriptive for all ValueTypes (for LOV/Card)... we cannot do IMetadataBinding fields yet. Server-side they are retrieved anyway, so the only penalty is xml transfer size. return requestedMetadataFields; } diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshFolder.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshFolder.cs index 89f1cbd7..eb56300d 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshFolder.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshFolder.cs @@ -43,9 +43,9 @@ public class IshFolder : IshBaseObject */ - private long _ishFolderRef; - private Enumerations.ISHType _ishType = Enumerations.ISHType.ISHFolder; - private Enumerations.IshFolderType _ishFolderType; + private readonly long _ishFolderRef; + private readonly Enumerations.ISHType _ishType = Enumerations.ISHType.ISHFolder; + private readonly Enumerations.IshFolderType _ishFolderType; private IshFields _ishFields; /// diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshObject.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshObject.cs index b2782ee2..6758d0cf 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshObject.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshObject.cs @@ -40,9 +40,9 @@ public class IshObject : IshBaseObject // - private string _ishRef; - private Enumerations.ISHType _ishType; - private Dictionary _objectRef; + private readonly string _ishRef; + private readonly Enumerations.ISHType _ishType; + private readonly Dictionary _objectRef; private IshFields _ishFields; private IshData _ishData;