Clean code

v1.6
Maxson Ramon dos Anjos Medeiros 3 months ago
parent 1cda600ea1
commit 7a0070ac6b

@ -3,7 +3,6 @@ using IEC61850.SCL.DataModel;
using System;
using System.IO;
using System.Linq;
using System.Xml;
namespace DynamicModel
{

@ -9,8 +9,6 @@
using IEC61850.SCL.DataModel;
using System;
using System.IO;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Linq;
namespace IEC61850.SCL
{
@ -228,7 +226,7 @@ namespace IEC61850.SCL
else
output.Write("0 ");
if(smv.SclSMVControl.SmpRate != -1)
if (smv.SclSMVControl.SmpRate != -1)
output.Write(smv.SclSMVControl.SmpRate + " ");
else
output.Write("0 ");
@ -296,7 +294,7 @@ namespace IEC61850.SCL
}
if(lcb.SclLogControl.IntgPd is null)
if (lcb.SclLogControl.IntgPd is null)
output.Write("0 ");
else
output.Write(lcb.SclLogControl.IntgPd + " ");
@ -440,7 +438,7 @@ namespace IEC61850.SCL
{
DataObject parentObject = null;
while(!(dataAttribute.Parent is DataObject))
while (!(dataAttribute.Parent is DataObject))
{
dataAttribute = dataAttribute.Parent as DataAttribute;
}
@ -482,9 +480,9 @@ namespace IEC61850.SCL
SclDAI getDAIInternal(SclSDI sclSDI, DataAttribute dataAttribute)
{
SclDAI returnValue = null;
foreach(SclDAI sclDAI1 in sclSDI.SclDAIs)
foreach (SclDAI sclDAI1 in sclSDI.SclDAIs)
{
if(sclDAI1.Name == dataAttribute.Name)
if (sclDAI1.Name == dataAttribute.Name)
{
if (dataAttribute.ObjRef.EndsWith("." + sclSDI.Name + "." + sclDAI1.Name))
{
@ -567,7 +565,7 @@ namespace IEC61850.SCL
string getObjRef(string initialString, SclSDI sclSDI)
{
object parent = sclSDI.Parent;
while(!(parent is SclDOI))
while (!(parent is SclDOI))
{
SclSDI sclSDI1 = parent as SclSDI;
parent = sclSDI1.Parent;
@ -658,16 +656,16 @@ namespace IEC61850.SCL
foreach (SclDOI sclDOI1 in logicalNode.SclElement.DOIs)
{
foreach(SclSDI sclSDI in sclDOI1.SclSDIs)
foreach (SclSDI sclSDI in sclDOI1.SclSDIs)
{
returnSDI = getSDI(logicalNode, dataObject, sclSDI);
if(returnSDI != null)
if (returnSDI != null)
{
break;
}
}
if(returnSDI != null)
if (returnSDI != null)
{
break;
}
@ -694,7 +692,7 @@ namespace IEC61850.SCL
SclDOI sclDOI = logicalNode.SclElement.DOIs.Find(x => x.Name == dataObject.Name);
if(sclDOI == null)
if (sclDOI == null)
{
sclDOI = getSDO(logicalNode, dataObject);
}

@ -312,7 +312,7 @@ namespace StaticModelGenerator.C_Structures
public override string ToString()
{
string cText = "";
if(arrayIndex == -1)
if (arrayIndex == -1)
cText = "DataObject " + parent + "_" + name + " = {\n";
else
cText = "DataObject " + parent + "_" + name + "_" + arrayIndex + " = {\n";
@ -320,7 +320,7 @@ namespace StaticModelGenerator.C_Structures
cText += " " + ModelNodeType + ",\n";
cText += " \"" + name + "\",\n";
if(arrayIndex != -1)
if (arrayIndex != -1)
cText += " (ModelNode*) &" + parent + "_" + name + ",\n";
else
cText += " (ModelNode*) &" + parent + ",\n";
@ -337,7 +337,7 @@ namespace StaticModelGenerator.C_Structures
cText += " " + elementCount + ",\n";
if(elementCount == 0)
if (elementCount == 0)
cText += " " + arrayIndex + "\n";
else
cText += " 0" + arrayIndex + "\n";
@ -768,7 +768,7 @@ namespace StaticModelGenerator.C_Structures
cText += "SVControlBlock " + externName + " = {\n";
cText += " &" + parent + ",\n";
if(SMVControl.SclSMVControl.Name != null)
if (SMVControl.SclSMVControl.Name != null)
cText += " \"" + SMVControl.Name + index + "\",\n";
else
cText += " NULL,\n";

@ -14,7 +14,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices.ComTypes;
using DataSet = IEC61850.SCL.DataModel.DataSet;
namespace StaticModelGenerator
@ -329,7 +328,7 @@ namespace StaticModelGenerator
c_DataObjectStructure.parent = lnRef;
c_DataObjectStructure.name = dataObject.Name;
if(c_DataObjectStructure.arrayIndex != -1)
if (c_DataObjectStructure.arrayIndex != -1)
c_DataObjectStructure.name = dataObject.Name + "_" + c_DataObjectStructure.arrayIndex;
else
c_DataObjectStructure.objRef = lnRef + "_" + dataObject.Name;

@ -6,8 +6,6 @@
* All rights reserved.
*/
using StaticModelGenerator;
namespace modeGenerator_example
{

Loading…
Cancel
Save