hytos / DTI_PID / SPPIDConverter / BaseModel / Document.cs @ 29392b1a
이력 | 보기 | 이력해설 | 다운로드 (47.8 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using System.IO; |
7 |
using System.Xml.Linq; |
8 |
using System.Windows.Forms; |
9 |
using Converter.SPPID.Util; |
10 |
|
11 |
namespace Converter.BaseModel |
12 |
{ |
13 |
public class Document |
14 |
{ |
15 |
private string _DWGNAME; |
16 |
private string _SIZE; |
17 |
private double _SIZE_WIDTH; |
18 |
private double _SIZE_HEIGHT; |
19 |
private string _UID; |
20 |
private List<Symbol> _SYMBOLS = new List<Symbol>(); |
21 |
private List<Text> _TEXTINFOS = new List<Text>(); |
22 |
private List<Note> _NOTES = new List<Note>(); |
23 |
private List<Line> _LINES = new List<Line>(); |
24 |
private List<LineNumber> _LINENUMBERS = new List<LineNumber>(); |
25 |
private List<TrimLine> _TRIMLINES = new List<TrimLine>(); |
26 |
private List<EndBreak> _EndBreaks = new List<EndBreak>(); |
27 |
private List<SpecBreak> _SpecBreaks = new List<SpecBreak>(); |
28 |
private List<Equipment> _Equipments = new List<Equipment>(); |
29 |
private bool _Enable; |
30 |
private bool _Validation; |
31 |
private bool _MappingValidation; |
32 |
private string _ValidationMessage = string.Empty; |
33 |
bool validationResult = false; |
34 |
|
35 |
public string ValidationMessage { get => _ValidationMessage; set => _ValidationMessage = value; } |
36 |
|
37 |
public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; } |
38 |
public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; } |
39 |
public List<Note> NOTES { get => _NOTES; set => _NOTES = value; } |
40 |
public List<Line> LINES { get => _LINES; set => _LINES = value; } |
41 |
public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; } |
42 |
public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; } |
43 |
public List<SpecBreak> SpecBreaks { get => _SpecBreaks; set => _SpecBreaks = value; } |
44 |
public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; } |
45 |
public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; } |
46 |
public string SIZE |
47 |
{ |
48 |
get |
49 |
{ |
50 |
return _SIZE; |
51 |
} |
52 |
set |
53 |
{ |
54 |
_SIZE = value; |
55 |
string[] pointArr = _SIZE.Split(new char[] { ',' }); |
56 |
if (pointArr.Length == 2) |
57 |
{ |
58 |
_SIZE_WIDTH = Convert.ToDouble(pointArr[0]); |
59 |
_SIZE_HEIGHT = Convert.ToDouble(pointArr[1]); |
60 |
} |
61 |
} |
62 |
} |
63 |
public double SIZE_WIDTH { get => _SIZE_WIDTH; } |
64 |
public double SIZE_HEIGHT { get => _SIZE_HEIGHT; } |
65 |
public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; } |
66 |
public string PATH { get; set; } |
67 |
public bool Enable { get => _Enable; set => _Enable = value; } |
68 |
public bool Validation { get => _Validation; set => _Validation = value; } |
69 |
public bool MappingValidation { get => _MappingValidation; set => _MappingValidation = value; } |
70 |
public string UID { get => _UID; set => _UID = value; } |
71 |
|
72 |
StringBuilder validationStringBuilder = new StringBuilder(); |
73 |
|
74 |
public Document(string xmlPath) |
75 |
{ |
76 |
validationStringBuilder.AppendLine("Document Path : " + xmlPath); |
77 |
validationStringBuilder.AppendLine(""); |
78 |
try |
79 |
{ |
80 |
if (xmlPath != null) |
81 |
{ |
82 |
PATH = xmlPath; |
83 |
XElement xml = XElement.Load(xmlPath); |
84 |
DWGNAME = xml.Element("DWGNAME").Value; |
85 |
SIZE = xml.Element("SIZE").Value; |
86 |
|
87 |
validationStringBuilder.AppendLine("Drawing Name : " + DWGNAME); |
88 |
validationStringBuilder.AppendLine(""); |
89 |
|
90 |
SetText(xml.Element("TEXTINFOS")); |
91 |
SetNote(xml.Element("NOTES")); |
92 |
SetSymbol(xml.Element("SYMBOLS")); |
93 |
SetLine(xml.Element("LINEINFOS")); |
94 |
SetLineNumber(xml.Element("LINENOS")); |
95 |
SetTrimLine(xml.Element("TRIMLINENOS")); |
96 |
|
97 |
SetAllConnectors(); |
98 |
Enable = true; |
99 |
ValidationCheck(); |
100 |
} |
101 |
} |
102 |
catch (Exception ex) |
103 |
{ |
104 |
Enable = false; |
105 |
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
106 |
} |
107 |
} |
108 |
|
109 |
#region READ XML |
110 |
private void SetSymbol(XElement node) |
111 |
{ |
112 |
foreach (XElement item in node.Elements("SYMBOL")) |
113 |
{ |
114 |
string sType = item.Element("TYPE").Value; |
115 |
if (sType == "Segment Breaks") |
116 |
{ |
117 |
SpecBreak specBreak = new SpecBreak() |
118 |
{ |
119 |
UID = item.Element("UID").Value, |
120 |
DBUID = item.Element("DBUID").Value, |
121 |
NAME = item.Element("NAME").Value, |
122 |
TYPE = item.Element("TYPE").Value, |
123 |
OWNER = item.Element("OWNER").Value, |
124 |
ORIGINALPOINT = item.Element("ORIGINALPOINT").Value, |
125 |
CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value, |
126 |
LOCATION = item.Element("LOCATION").Value, |
127 |
SIZE = item.Element("SIZE").Value, |
128 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
129 |
PARENT = item.Element("PARENT").Value, |
130 |
CHILD = item.Element("CHILD").Value, |
131 |
HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value, |
132 |
AREA = item.Element("AREA").Value, |
133 |
FLIP = Convert.ToInt32(item.Element("FLIP").Value), |
134 |
CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value) |
135 |
}; |
136 |
SetAssociations(item.Element("ASSOCIATIONS"), specBreak.ASSOCIATIONS); |
137 |
SetSymbolConnectors(item.Element("CONNECTORS"), specBreak.CONNECTORS, specBreak.CONNECTIONPOINT); |
138 |
SetProperties(item.Element("PROPERTIES"), specBreak.PROPERTIES); |
139 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), specBreak.ATTRIBUTES); |
140 |
SetSpecBreakAttribute(specBreak); |
141 |
|
142 |
SpecBreaks.Add(specBreak); |
143 |
} |
144 |
else if (sType == "End Break") |
145 |
{ |
146 |
EndBreak endBreak = new EndBreak() |
147 |
{ |
148 |
UID = item.Element("UID").Value, |
149 |
DBUID = item.Element("DBUID").Value, |
150 |
NAME = item.Element("NAME").Value, |
151 |
TYPE = item.Element("TYPE").Value, |
152 |
OWNER = item.Element("OWNER").Value, |
153 |
ORIGINALPOINT = item.Element("ORIGINALPOINT").Value, |
154 |
CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value, |
155 |
LOCATION = item.Element("LOCATION").Value, |
156 |
SIZE = item.Element("SIZE").Value, |
157 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
158 |
PARENT = item.Element("PARENT").Value, |
159 |
CHILD = item.Element("CHILD").Value, |
160 |
HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value, |
161 |
AREA = item.Element("AREA").Value, |
162 |
FLIP = Convert.ToInt32(item.Element("FLIP").Value), |
163 |
CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value) |
164 |
}; |
165 |
SetAssociations(item.Element("ASSOCIATIONS"), endBreak.ASSOCIATIONS); |
166 |
SetSymbolConnectors(item.Element("CONNECTORS"), endBreak.CONNECTORS, endBreak.CONNECTIONPOINT); |
167 |
SetProperties(item.Element("PROPERTIES"), endBreak.PROPERTIES); |
168 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), endBreak.ATTRIBUTES); |
169 |
|
170 |
EndBreaks.Add(endBreak); |
171 |
} |
172 |
else if (sType == "Black Box System" || |
173 |
sType == "GGO_Equipment" || |
174 |
sType == "Heat Transfer Equipment" || |
175 |
sType == "Mechanical" || |
176 |
sType == "Other Equipment" || |
177 |
sType == "Vessels") |
178 |
{ |
179 |
Equipment equipment = new Equipment() |
180 |
{ |
181 |
UID = item.Element("UID").Value, |
182 |
DBUID = item.Element("DBUID").Value, |
183 |
NAME = item.Element("NAME").Value, |
184 |
TYPE = item.Element("TYPE").Value, |
185 |
OWNER = item.Element("OWNER").Value, |
186 |
ORIGINALPOINT = item.Element("ORIGINALPOINT").Value, |
187 |
CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value, |
188 |
LOCATION = item.Element("LOCATION").Value, |
189 |
SIZE = item.Element("SIZE").Value, |
190 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
191 |
PARENT = item.Element("PARENT").Value, |
192 |
CHILD = item.Element("CHILD").Value, |
193 |
HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value, |
194 |
AREA = item.Element("AREA").Value, |
195 |
FLIP = Convert.ToInt32(item.Element("FLIP").Value), |
196 |
CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value) |
197 |
}; |
198 |
SetAssociations(item.Element("ASSOCIATIONS"), equipment.ASSOCIATIONS); |
199 |
SetSymbolConnectors(item.Element("CONNECTORS"), equipment.CONNECTORS, equipment.CONNECTIONPOINT); |
200 |
SetProperties(item.Element("PROPERTIES"), equipment.PROPERTIES); |
201 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), equipment.ATTRIBUTES); |
202 |
|
203 |
Equipments.Add(equipment); |
204 |
} |
205 |
else |
206 |
{ |
207 |
Symbol symbol = new Symbol() |
208 |
{ |
209 |
UID = item.Element("UID").Value, |
210 |
DBUID = item.Element("DBUID").Value, |
211 |
NAME = item.Element("NAME").Value, |
212 |
TYPE = item.Element("TYPE").Value, |
213 |
OWNER = item.Element("OWNER").Value, |
214 |
ORIGINALPOINT = item.Element("ORIGINALPOINT").Value, |
215 |
CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value, |
216 |
LOCATION = item.Element("LOCATION").Value, |
217 |
SIZE = item.Element("SIZE").Value, |
218 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
219 |
PARENT = item.Element("PARENT").Value, |
220 |
CHILD = item.Element("CHILD").Value, |
221 |
HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value, |
222 |
AREA = item.Element("AREA").Value, |
223 |
FLIP = Convert.ToInt32(item.Element("FLIP").Value), |
224 |
CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value) |
225 |
}; |
226 |
|
227 |
SetAssociations(item.Element("ASSOCIATIONS"), symbol.ASSOCIATIONS); |
228 |
SetSymbolConnectors(item.Element("CONNECTORS"), symbol.CONNECTORS, symbol.CONNECTIONPOINT); |
229 |
SetProperties(item.Element("PROPERTIES"), symbol.PROPERTIES); |
230 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), symbol.ATTRIBUTES); |
231 |
SetChildSymbol(symbol); |
232 |
|
233 |
SYMBOLS.Add(symbol); |
234 |
} |
235 |
} |
236 |
} |
237 |
|
238 |
private void SetLine(XElement node) |
239 |
{ |
240 |
foreach (XElement item in node.Elements("LINE")) |
241 |
{ |
242 |
Line line = new Line() |
243 |
{ |
244 |
OWNER = item.Attribute("OWNER").Value, |
245 |
UID = item.Element("UID").Value, |
246 |
STARTPOINT = item.Element("STARTPOINT").Value, |
247 |
ENDPOINT = item.Element("ENDPOINT").Value, |
248 |
TYPE = item.Element("TYPE").Value, |
249 |
TYPEUID = item.Element("TYPE").Attribute("TYPEUID").Value, |
250 |
AREA = item.Element("AREA").Value, |
251 |
THICKNESS = item.Element("THICKNESS").Value, |
252 |
}; |
253 |
int flowMarkPercent = 0; |
254 |
if (int.TryParse(item.Element("FLOWMARK").Value, out flowMarkPercent)) |
255 |
{ |
256 |
line.FLOWMARK = true; |
257 |
line.FLOWMARK_PERCENT = flowMarkPercent; |
258 |
} |
259 |
else |
260 |
line.FLOWMARK = false; |
261 |
|
262 |
SetAssociations(item.Element("ASSOCIATIONS"), line.ASSOCIATIONS); |
263 |
SetConnectors(item.Element("CONNECTORS"), line.CONNECTORS); |
264 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), line.ATTRIBUTES); |
265 |
LINES.Add(line); |
266 |
} |
267 |
} |
268 |
|
269 |
private void SetLineNumber(XElement node) |
270 |
{ |
271 |
foreach (XElement item in node.Elements("LINE_NO")) |
272 |
{ |
273 |
LineNumber lineNumber = new LineNumber() |
274 |
{ |
275 |
UID = item.Element("UID").Value, |
276 |
TEXT = item.Element("TEXT").Value, |
277 |
LOCATION = item.Element("LOCATION").Value, |
278 |
WIDTH = item.Element("WIDTH").Value, |
279 |
HEIGHT = item.Element("HEIGHT").Value, |
280 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
281 |
AREA = item.Element("AREA").Value, |
282 |
SCENE = item.Element("SCENE").Value |
283 |
}; |
284 |
if (item.Element("CONNLINE") != null) |
285 |
lineNumber.CONNLINE = item.Element("CONNLINE").Value; |
286 |
else |
287 |
{ |
288 |
validationStringBuilder.AppendLine("Not exist CONNLINE!" + "\r\nLineNumber UID : " + lineNumber.UID); |
289 |
validationStringBuilder.AppendLine(); |
290 |
validationResult = true; |
291 |
} |
292 |
|
293 |
SetLineNumberRuns(item, lineNumber.RUNS); |
294 |
SetProperties(item.Element("PROPERTIES"), lineNumber.PROPERTIES); |
295 |
SetAttributes(item, lineNumber.ATTRIBUTES); |
296 |
LINENUMBERS.Add(lineNumber); |
297 |
} |
298 |
} |
299 |
|
300 |
private void SetText(XElement node) |
301 |
{ |
302 |
foreach (XElement item in node.Elements("ATTRIBUTE")) |
303 |
{ |
304 |
Text text = new Text() |
305 |
{ |
306 |
UID = item.Element("UID").Value, |
307 |
OWNER = item.Element("OWNER").Value, |
308 |
ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value, |
309 |
NAME = item.Element("NAME").Value, |
310 |
LOCATION = item.Element("LOCATION").Value, |
311 |
VALUE = item.Element("VALUE").Value, |
312 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
313 |
WIDTH = item.Element("WIDTH").Value, |
314 |
HEIGHT = item.Element("HEIGHT").Value, |
315 |
AREA = item.Element("AREA").Value, |
316 |
SCENE = item.Element("SCENE").Value |
317 |
}; |
318 |
|
319 |
TEXTINFOS.Add(text); |
320 |
} |
321 |
} |
322 |
|
323 |
private void SetNote(XElement node) |
324 |
{ |
325 |
foreach (XElement item in node.Elements("ATTRIBUTE")) |
326 |
{ |
327 |
Note note = new Note() |
328 |
{ |
329 |
UID = item.Element("UID").Value, |
330 |
ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value, |
331 |
NAME = item.Element("NAME").Value, |
332 |
LOCATION = item.Element("LOCATION").Value, |
333 |
VALUE = item.Element("VALUE").Value, |
334 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
335 |
WIDTH = item.Element("WIDTH").Value, |
336 |
HEIGHT = item.Element("HEIGHT").Value, |
337 |
AREA = item.Element("AREA").Value, |
338 |
SCENE = item.Element("SCENE").Value, |
339 |
OWNER = item.Element("OWNER").Value |
340 |
}; |
341 |
|
342 |
NOTES.Add(note); |
343 |
} |
344 |
} |
345 |
|
346 |
private void SetTrimLine(XElement node) |
347 |
{ |
348 |
foreach (XElement item in node.Elements("TRIM_LINE_NO")) |
349 |
{ |
350 |
TrimLine trimLine = new TrimLine() |
351 |
{ |
352 |
UID = item.Element("UID").Value, |
353 |
}; |
354 |
SetLineNumberRuns(item, trimLine.RUNS); |
355 |
TRIMLINES.Add(trimLine); |
356 |
} |
357 |
} |
358 |
|
359 |
private void SetAssociations(XElement node, List<Association> associations) |
360 |
{ |
361 |
foreach (XElement item in node.Elements("ASSOCIATION")) |
362 |
{ |
363 |
Association association = new Association() |
364 |
{ |
365 |
TYPE = item.Attribute("TYPE").Value, |
366 |
VALUE = item.Value |
367 |
}; |
368 |
|
369 |
associations.Add(association); |
370 |
} |
371 |
} |
372 |
|
373 |
private void SetConnectors(XElement node, List<Connector> connectors) |
374 |
{ |
375 |
foreach (XElement item in node.Elements("CONNECTOR")) |
376 |
{ |
377 |
connectors.Add(new Connector() |
378 |
{ |
379 |
UID = item.Attribute("UID").Value, |
380 |
CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value), |
381 |
CONNECTEDITEM = item.Element("CONNECTEDITEM").Value, |
382 |
CONNECTPOINT = item.Element("CONNECTPOINT").Value, |
383 |
SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value, |
384 |
}); |
385 |
} |
386 |
} |
387 |
|
388 |
private void SetSymbolConnectors(XElement node, List<Connector> connectors, string CONNECTIONPOINT) |
389 |
{ |
390 |
foreach (XElement item in node.Elements("CONNECTOR")) |
391 |
{ |
392 |
connectors.Add(new Connector() |
393 |
{ |
394 |
UID = item.Attribute("UID").Value, |
395 |
CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value), |
396 |
CONNECTEDITEM = item.Element("CONNECTEDITEM").Value, |
397 |
CONNECTPOINT = item.Element("CONNECTPOINT").Value, |
398 |
SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value, |
399 |
}); |
400 |
} |
401 |
} |
402 |
|
403 |
private void SetProperties(XElement node, List<Property> properties) |
404 |
{ |
405 |
foreach (XElement item in node.Elements("PROPERTY")) |
406 |
{ |
407 |
properties.Add(new Property() |
408 |
{ |
409 |
UID = item.Attribute("UID").Value, |
410 |
LENGTH = item.Attribute("Length").Value, |
411 |
EXPRESSION = item.Attribute("Expression").Value, |
412 |
DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value, |
413 |
ATTRIBUTETYPE = item.Attribute("AttributeType").Value, |
414 |
ATTRIBUTE = item.Attribute("Attribute").Value, |
415 |
VALUE = item.Value |
416 |
}); |
417 |
} |
418 |
} |
419 |
|
420 |
private void SetAttributes(XElement node, List<Attribute> attributes) |
421 |
{ |
422 |
foreach (XElement item in node.Elements("ATTRIBUTE")) |
423 |
{ |
424 |
Attribute attribute = new Attribute() |
425 |
{ |
426 |
UID = item.Attribute("UID").Value, |
427 |
LENGTH = item.Attribute("Length").Value, |
428 |
EXPRESSION = item.Attribute("Expression").Value, |
429 |
DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value, |
430 |
ATTRIBUTETYPE = item.Attribute("AttributeType").Value, |
431 |
ATTRIBUTE = item.Attribute("Attribute").Value, |
432 |
ATTRAT = item.Attribute("AttrAt").Value, |
433 |
ASSOCITEM = item.Attribute("AssocItem").Value, |
434 |
VALUE = item.Value |
435 |
}; |
436 |
|
437 |
attributes.Add(attribute); |
438 |
|
439 |
if (!string.IsNullOrEmpty(attribute.ASSOCITEM) && attribute.ASSOCITEM != "None") |
440 |
{ |
441 |
Text text = _TEXTINFOS.Find(x => x.UID == attribute.ASSOCITEM); |
442 |
if (text != null) |
443 |
text.ASSOCIATION = true; |
444 |
} |
445 |
} |
446 |
} |
447 |
|
448 |
private void SetSpecBreakAttribute(SpecBreak specBreak) |
449 |
{ |
450 |
string upStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "UpStream").VALUE; |
451 |
string downStream = specBreak.ATTRIBUTES.Find(x => x.ATTRIBUTE == "DownStream").VALUE; |
452 |
|
453 |
specBreak.UpStreamUID = upStream; |
454 |
specBreak.DownStreamUID = downStream; |
455 |
} |
456 |
|
457 |
private void SetLineNumberRuns(XElement node, List<LineRun> lineNumberRuns) |
458 |
{ |
459 |
foreach (XElement item in node.Elements("RUN")) |
460 |
{ |
461 |
LineRun run = new LineRun() |
462 |
{ |
463 |
TYPE = item.Attribute("TYPE").Value |
464 |
}; |
465 |
|
466 |
foreach (XElement element in item.Elements()) |
467 |
{ |
468 |
if (element.Name == "SYMBOL") |
469 |
{ |
470 |
Symbol symbol = GetSymbolByUID(element.Element("UID").Value); |
471 |
if (symbol == null) |
472 |
{ |
473 |
validationStringBuilder.AppendLine("Missing Item!" + "\r\nUID : " + element.Element("UID").Value); |
474 |
validationStringBuilder.AppendLine(); |
475 |
validationResult = true; |
476 |
} |
477 |
run.RUNITEMS.Add(symbol); |
478 |
} |
479 |
else if (element.Name == "LINE") |
480 |
{ |
481 |
Line line = GetLineByUID(element.Element("UID").Value); |
482 |
if (line == null) |
483 |
{ |
484 |
validationStringBuilder.AppendLine("Missing Item!" + "\r\nUID : " + element.Element("UID").Value); |
485 |
validationStringBuilder.AppendLine(); |
486 |
validationResult = true; |
487 |
} |
488 |
run.RUNITEMS.Add(line); |
489 |
} |
490 |
} |
491 |
lineNumberRuns.Add(run); |
492 |
} |
493 |
} |
494 |
|
495 |
private void SetChildSymbol(Symbol symbol) |
496 |
{ |
497 |
List<ChildSymbol> childList = new List<ChildSymbol>(); |
498 |
if (!string.IsNullOrEmpty(symbol.CHILD) && symbol.CHILD != "None") |
499 |
{ |
500 |
string[] childArray = symbol.CHILD.Split(new char[] { '/' }); |
501 |
foreach (string sChild in childArray) |
502 |
{ |
503 |
string[] sChildInfo = sChild.Split(new char[] { ',' }); |
504 |
childList.Add(new ChildSymbol() |
505 |
{ |
506 |
ParentAt = Convert.ToInt32(sChildInfo[0]), |
507 |
Direction = sChildInfo[1], |
508 |
NAME = sChildInfo[2] |
509 |
}); |
510 |
} |
511 |
|
512 |
foreach (ChildSymbol child in childList) |
513 |
{ |
514 |
if (child.ParentAt == 0) |
515 |
symbol.ChildSymbols.Add(child); |
516 |
else |
517 |
childList[child.ParentAt - 1].ChildSymbols.Add(child); |
518 |
} |
519 |
} |
520 |
if (!string.IsNullOrEmpty(symbol.CONNECTIONPOINT) && symbol.CONNECTIONPOINT != "None") |
521 |
{ |
522 |
// 현재 부모 Symbol에 자식 Connector까지 들어가 있음 |
523 |
string[] connectionArray = symbol.CONNECTIONPOINT.Split(new char[] { '/' }); |
524 |
string[] array = symbol.CONNECTIONPOINT.Split(new char[] { '/' }); |
525 |
for (int i = 0; i < array.Length; i++) |
526 |
{ |
527 |
string[] arrConn = array[i].Split(new char[] { ',' }); |
528 |
int connIndex = Convert.ToInt32(arrConn[3]); |
529 |
if (connIndex != 0) |
530 |
{ |
531 |
childList[connIndex - 1].Connectors.Add(symbol.CONNECTORS[i]); |
532 |
symbol.CONNECTORS[i].Index = connIndex; |
533 |
} |
534 |
} |
535 |
} |
536 |
} |
537 |
#endregion |
538 |
|
539 |
public Symbol GetSymbolByUID(string uid) |
540 |
{ |
541 |
return SYMBOLS.Find(x => x.UID == uid); |
542 |
} |
543 |
|
544 |
public Line GetLineByUID(string uid) |
545 |
{ |
546 |
return LINES.Find(x => x.UID == uid); |
547 |
} |
548 |
|
549 |
public void SetAllConnectors() |
550 |
{ |
551 |
foreach (var item in SYMBOLS) |
552 |
foreach (var connector in item.CONNECTORS) |
553 |
connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
554 |
|
555 |
foreach (var item in LINES) |
556 |
foreach (var connector in item.CONNECTORS) |
557 |
connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
558 |
|
559 |
foreach (var item in Equipments) |
560 |
foreach (var connector in item.CONNECTORS) |
561 |
connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
562 |
} |
563 |
|
564 |
|
565 |
|
566 |
public void ValidationCheck() |
567 |
{ |
568 |
|
569 |
#region Connection Check / Symbol의 SceneConnectPoint Check |
570 |
foreach (var item in _SYMBOLS) |
571 |
{ |
572 |
foreach (var connector in item.CONNECTORS) |
573 |
{ |
574 |
if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Line)) |
575 |
{ |
576 |
Line line = connector.ConnectedObject as Line; |
577 |
if (line.CONNECTORS.Find(x => x.ConnectedObject == item) == null) |
578 |
{ |
579 |
validationStringBuilder.AppendLine("Check connection!"); |
580 |
validationStringBuilder.AppendLine("Symbol UID : " + item.UID); |
581 |
validationStringBuilder.AppendLine("Line UID : " + line.UID); |
582 |
validationStringBuilder.AppendLine(); |
583 |
validationResult = true; |
584 |
} |
585 |
} |
586 |
|
587 |
if (connector.SCENECONNECTPOINT == connector.CONNECTPOINT) |
588 |
{ |
589 |
validationStringBuilder.AppendLine("Check Symbol SceneConnectPoint!"); |
590 |
validationStringBuilder.AppendLine("Symbol UID : " + item.UID); |
591 |
validationStringBuilder.AppendLine(); |
592 |
validationResult = true; |
593 |
} |
594 |
} |
595 |
} |
596 |
|
597 |
foreach (var item in _LINES) |
598 |
{ |
599 |
foreach (var connector in item.CONNECTORS) |
600 |
{ |
601 |
if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Symbol)) |
602 |
{ |
603 |
Symbol symbol = connector.ConnectedObject as Symbol; |
604 |
if (symbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null) |
605 |
{ |
606 |
validationStringBuilder.AppendLine("Check connection!"); |
607 |
validationStringBuilder.AppendLine("Symbol UID : " + symbol.UID); |
608 |
validationStringBuilder.AppendLine("Line UID : " + item.UID); |
609 |
validationStringBuilder.AppendLine(); |
610 |
validationResult = true; |
611 |
} |
612 |
} |
613 |
} |
614 |
} |
615 |
#endregion |
616 |
|
617 |
#region Symbol Size Check |
618 |
foreach (var item in _SYMBOLS) |
619 |
{ |
620 |
if (item.SIZE == "0,0") |
621 |
{ |
622 |
validationStringBuilder.AppendLine("Check symbol size!"); |
623 |
validationStringBuilder.AppendLine("Symbol UID : " + item.UID); |
624 |
validationStringBuilder.AppendLine(); |
625 |
validationResult = true; |
626 |
} |
627 |
} |
628 |
#endregion |
629 |
|
630 |
#region SpecBreak, EndBreak Check |
631 |
foreach (var item in SpecBreaks) |
632 |
{ |
633 |
object obj1 = SPPIDUtil.FindObjectByUID(this, item.UpStreamUID); |
634 |
object obj2 = SPPIDUtil.FindObjectByUID(this, item.DownStreamUID); |
635 |
if (obj1 == null || obj2 == null) |
636 |
{ |
637 |
validationStringBuilder.AppendLine("Check SpecBreak UpStream, DownStream!"); |
638 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
639 |
validationStringBuilder.AppendLine(); |
640 |
validationResult = true; |
641 |
} |
642 |
else |
643 |
{ |
644 |
|
645 |
bool result = false; |
646 |
if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Symbol)) |
647 |
{ |
648 |
Symbol symbol1 = obj1 as Symbol; |
649 |
Symbol symbol2 = obj2 as Symbol; |
650 |
if (symbol1.CONNECTORS.Find(x => x.ConnectedObject == symbol2) == null || symbol2.CONNECTORS.Find(x => x.ConnectedObject == symbol1) == null) |
651 |
result = true; |
652 |
} |
653 |
else if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Line)) |
654 |
{ |
655 |
Symbol symbol = obj1 as Symbol; |
656 |
Line line = obj2 as Line; |
657 |
if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null) |
658 |
result = true; |
659 |
} |
660 |
else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Symbol)) |
661 |
{ |
662 |
Symbol symbol = obj2 as Symbol; |
663 |
Line line = obj1 as Line; |
664 |
if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null) |
665 |
result = true; |
666 |
} |
667 |
else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line)) |
668 |
{ |
669 |
Line line1 = obj2 as Line; |
670 |
Line line2 = obj1 as Line; |
671 |
Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2); |
672 |
Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1); |
673 |
if (connector1 == null && connector2 == null) |
674 |
result = true; |
675 |
} |
676 |
|
677 |
if (result) |
678 |
{ |
679 |
validationStringBuilder.AppendLine("Check SpecBreak UpStream, DownStream!"); |
680 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
681 |
validationStringBuilder.AppendLine(); |
682 |
validationResult = true; |
683 |
} |
684 |
|
685 |
// Rule |
686 |
if (!result) |
687 |
{ |
688 |
if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line)) |
689 |
{ |
690 |
Line line1 = obj1 as Line; |
691 |
Line line2 = obj2 as Line; |
692 |
|
693 |
Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2); |
694 |
Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1); |
695 |
|
696 |
if (connector1 != null && connector2 != null) |
697 |
{ |
698 |
int connectorIndex = line1.CONNECTORS.IndexOf(connector1); |
699 |
if (connectorIndex != 0 && !SPPIDUtil.IsBranchLine(line1)) |
700 |
result = true; |
701 |
else if (connectorIndex != 0 && SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2)) |
702 |
result = true; |
703 |
else if (connectorIndex == 0 && !SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2)) |
704 |
result = true; |
705 |
} |
706 |
else if (SPPIDUtil.IsBranchLine(line1, line2)) |
707 |
{ |
708 |
if (connector1 == null) |
709 |
result = true; |
710 |
} |
711 |
|
712 |
if (result) |
713 |
{ |
714 |
validationStringBuilder.AppendLine("Check Segment Rule!"); |
715 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
716 |
validationStringBuilder.AppendLine(); |
717 |
validationResult = true; |
718 |
} |
719 |
} |
720 |
} |
721 |
} |
722 |
} |
723 |
|
724 |
foreach (var item in EndBreaks) |
725 |
{ |
726 |
object obj1 = SPPIDUtil.FindObjectByUID(this, item.OWNER); |
727 |
object obj2 = SPPIDUtil.FindObjectByUID(this, item.PROPERTIES.Find(x => x.ATTRIBUTE == "Connected Item").VALUE); |
728 |
if (obj1 == null || obj2 == null) |
729 |
{ |
730 |
validationStringBuilder.AppendLine("Check EndBreak Owner, Connected Item!"); |
731 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
732 |
validationStringBuilder.AppendLine(); |
733 |
validationResult = true; |
734 |
} |
735 |
else |
736 |
{ |
737 |
bool result = false; |
738 |
if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Symbol)) |
739 |
{ |
740 |
Symbol symbol1 = obj1 as Symbol; |
741 |
Symbol symbol2 = obj2 as Symbol; |
742 |
if (symbol1.CONNECTORS.Find(x => x.ConnectedObject == symbol2) == null || symbol2.CONNECTORS.Find(x => x.ConnectedObject == symbol1) == null) |
743 |
result = true; |
744 |
} |
745 |
else if (obj1.GetType() == typeof(Symbol) && obj2.GetType() == typeof(Line)) |
746 |
{ |
747 |
Symbol symbol = obj1 as Symbol; |
748 |
Line line = obj2 as Line; |
749 |
if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null) |
750 |
result = true; |
751 |
} |
752 |
else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Symbol)) |
753 |
{ |
754 |
Symbol symbol = obj2 as Symbol; |
755 |
Line line = obj1 as Line; |
756 |
if (symbol.CONNECTORS.Find(x => x.ConnectedObject == line) == null || line.CONNECTORS.Find(x => x.ConnectedObject == symbol) == null) |
757 |
result = true; |
758 |
} |
759 |
else if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line)) |
760 |
{ |
761 |
Line line1 = obj2 as Line; |
762 |
Line line2 = obj1 as Line; |
763 |
Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2); |
764 |
Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1); |
765 |
if (connector1 == null && connector2 == null) |
766 |
result = true; |
767 |
} |
768 |
|
769 |
if (result) |
770 |
{ |
771 |
validationStringBuilder.AppendLine("Check EndBreak Owner, Connected Item!"); |
772 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
773 |
validationStringBuilder.AppendLine(); |
774 |
validationResult = true; |
775 |
} |
776 |
|
777 |
// Rule |
778 |
if (!result) |
779 |
{ |
780 |
if (obj1.GetType() == typeof(Line) && obj2.GetType() == typeof(Line)) |
781 |
{ |
782 |
Line line1 = obj1 as Line; |
783 |
Line line2 = obj2 as Line; |
784 |
|
785 |
Connector connector1 = line1.CONNECTORS.Find(x => x.ConnectedObject == line2); |
786 |
Connector connector2 = line2.CONNECTORS.Find(x => x.ConnectedObject == line1); |
787 |
|
788 |
if (connector1 != null && connector2 != null) |
789 |
{ |
790 |
int connectorIndex = line1.CONNECTORS.IndexOf(connector1); |
791 |
if (connectorIndex != 0 && !SPPIDUtil.IsBranchLine(line1)) |
792 |
result = true; |
793 |
else if (connectorIndex != 0 && SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2)) |
794 |
result = true; |
795 |
else if (connectorIndex == 0 && !SPPIDUtil.IsBranchLine(line1) && SPPIDUtil.IsBranchLine(line2)) |
796 |
result = true; |
797 |
} |
798 |
else if (SPPIDUtil.IsBranchLine(line1, line2)) |
799 |
{ |
800 |
if (connector1 == null) |
801 |
result = true; |
802 |
} |
803 |
|
804 |
if (result) |
805 |
{ |
806 |
validationStringBuilder.AppendLine("Check Segment Rule!"); |
807 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
808 |
validationStringBuilder.AppendLine(); |
809 |
validationResult = true; |
810 |
} |
811 |
} |
812 |
} |
813 |
} |
814 |
} |
815 |
|
816 |
#endregion |
817 |
|
818 |
#region Check Flow Direction |
819 |
List<string[]> flowDirectionCheck = new List<string[]>(); |
820 |
foreach (var line in LINES) |
821 |
{ |
822 |
foreach (var connector in line.CONNECTORS) |
823 |
{ |
824 |
if (connector.ConnectedObject != null && |
825 |
connector.ConnectedObject.GetType() == typeof(Line) && |
826 |
!SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line)) |
827 |
{ |
828 |
Line connLine = connector.ConnectedObject as Line; |
829 |
int lineIndex1 = line.CONNECTORS.IndexOf(connector); |
830 |
int lineIndex2 = connLine.CONNECTORS.IndexOf(connLine.CONNECTORS.Find(x => x.ConnectedObject == line)); |
831 |
if (lineIndex1 == lineIndex2 && flowDirectionCheck.Find(x => (x[0] == line.UID || x[1] == connLine.UID) || (x[1] == line.UID || x[0] == connLine.UID)) == null) |
832 |
{ |
833 |
validationStringBuilder.AppendLine("Check line flow direction!"); |
834 |
validationStringBuilder.AppendLine("UID : " + line.UID); |
835 |
validationStringBuilder.AppendLine("UID : " + connLine.UID); |
836 |
validationStringBuilder.AppendLine(); |
837 |
validationResult = true; |
838 |
flowDirectionCheck.Add(new string[] { line.UID, connLine.UID }); |
839 |
} |
840 |
} |
841 |
} |
842 |
} |
843 |
|
844 |
foreach (var item in SYMBOLS.FindAll(x => x.CONNECTORS.Count == 2 && |
845 |
x.CONNECTORS[0].ConnectedObject != null && x.CONNECTORS[0].ConnectedObject.GetType() == typeof(Line) && |
846 |
x.CONNECTORS[1].ConnectedObject != null && x.CONNECTORS[1].ConnectedObject.GetType() == typeof(Line))) |
847 |
{ |
848 |
Line line1 = item.CONNECTORS[0].ConnectedObject as Line; |
849 |
Line line2 = item.CONNECTORS[1].ConnectedObject as Line; |
850 |
if (line1.TYPE == line2.TYPE) |
851 |
{ |
852 |
int index1 = line1.CONNECTORS.IndexOf(line1.CONNECTORS.Find(x => x.ConnectedObject == item)); |
853 |
int index2 = line2.CONNECTORS.IndexOf(line2.CONNECTORS.Find(x => x.ConnectedObject == item)); |
854 |
if (index1 == index2) |
855 |
{ |
856 |
validationStringBuilder.AppendLine("Check line flow direction!"); |
857 |
validationStringBuilder.AppendLine("UID : " + line1.UID); |
858 |
validationStringBuilder.AppendLine("UID : " + line2.UID); |
859 |
validationStringBuilder.AppendLine(); |
860 |
validationResult = true; |
861 |
} |
862 |
} |
863 |
} |
864 |
#endregion |
865 |
|
866 |
#region Association Check |
867 |
foreach (var item in TEXTINFOS) |
868 |
{ |
869 |
if (item.ASSOCIATION) |
870 |
{ |
871 |
object owner = SPPIDUtil.FindObjectByUID(this, item.OWNER); |
872 |
if (owner == null) |
873 |
{ |
874 |
validationStringBuilder.AppendLine("Check text owner!"); |
875 |
validationStringBuilder.AppendLine("Text UID : " + item.UID); |
876 |
foreach (var associationItem in SYMBOLS.FindAll(x => x.ATTRIBUTES.Find(y => y.ASSOCITEM == item.UID) != null)) |
877 |
validationStringBuilder.AppendLine("Association UID : " + associationItem.UID); |
878 |
|
879 |
validationStringBuilder.AppendLine(); |
880 |
validationResult = true; |
881 |
} |
882 |
} |
883 |
} |
884 |
#endregion |
885 |
|
886 |
#region Line To Line Type Check |
887 |
List<string[]> typeCheck = new List<string[]>(); |
888 |
foreach (var item in LINES) |
889 |
{ |
890 |
foreach (var connector in item.CONNECTORS) |
891 |
{ |
892 |
Line connLine = connector.ConnectedObject as Line; |
893 |
if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) != null && |
894 |
connLine.TYPE != item.TYPE && |
895 |
typeCheck.Find(x => (x[0] == item.UID || x[1] == connLine.UID) || (x[1] == item.UID || x[0] == connLine.UID)) == null) |
896 |
{ |
897 |
validationStringBuilder.AppendLine("Check line type!"); |
898 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
899 |
validationStringBuilder.AppendLine("UID : " + connLine.UID); |
900 |
validationStringBuilder.AppendLine(); |
901 |
validationResult = true; |
902 |
typeCheck.Add(new string[] { item.UID, connLine.UID }); |
903 |
} |
904 |
} |
905 |
} |
906 |
#endregion |
907 |
|
908 |
#region ConnenctionCheck |
909 |
List<string[]> connectionCheck = new List<string[]>(); |
910 |
foreach (var item in _LINES) |
911 |
{ |
912 |
List<string> connectedItem = new List<string>(); |
913 |
foreach (var connector in item.CONNECTORS) |
914 |
{ |
915 |
if (connector.ConnectedObject != null) |
916 |
{ |
917 |
Symbol connSymbol = connector.ConnectedObject as Symbol; |
918 |
Line connLine = connector.ConnectedObject as Line; |
919 |
string connUID = string.Empty; |
920 |
bool result = false; |
921 |
if (connSymbol != null && connSymbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null) |
922 |
{ |
923 |
result = true; |
924 |
connUID = connSymbol.UID; |
925 |
} |
926 |
else if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) == null && !SPPIDUtil.IsBranchLine(connLine, item)) |
927 |
{ |
928 |
result = true; |
929 |
connUID = connLine.UID; |
930 |
} |
931 |
|
932 |
if (result && connectionCheck.Find(x => (x[0] == item.UID || x[1] == connUID) || (x[1] == item.UID || x[0] == connUID)) == null) |
933 |
{ |
934 |
validationStringBuilder.AppendLine("Check connection!"); |
935 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
936 |
validationStringBuilder.AppendLine("UID : " + connUID); |
937 |
validationStringBuilder.AppendLine(); |
938 |
validationResult = true; |
939 |
connectionCheck.Add(new string[] { item.UID, connUID }); |
940 |
} |
941 |
|
942 |
if (!connectedItem.Contains(connector.CONNECTEDITEM)) |
943 |
connectedItem.Add(connector.CONNECTEDITEM); |
944 |
else |
945 |
{ |
946 |
validationStringBuilder.AppendLine("Check connection!"); |
947 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
948 |
validationStringBuilder.AppendLine(); |
949 |
} |
950 |
} |
951 |
} |
952 |
|
953 |
if (item.CONNECTORS.Find(x => x.CONNECTEDITEM == item.UID) != null) |
954 |
{ |
955 |
validationStringBuilder.AppendLine("Check connection!"); |
956 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
957 |
validationStringBuilder.AppendLine(); |
958 |
validationResult = true; |
959 |
} |
960 |
} |
961 |
foreach (var item in _SYMBOLS) |
962 |
{ |
963 |
List<string> connectedItem = new List<string>(); |
964 |
foreach (var connector in item.CONNECTORS) |
965 |
{ |
966 |
if (connector.ConnectedObject != null) |
967 |
{ |
968 |
Symbol connSymbol = connector.ConnectedObject as Symbol; |
969 |
Line connLine = connector.ConnectedObject as Line; |
970 |
string connUID = string.Empty; |
971 |
bool result = false; |
972 |
if (connSymbol != null && connSymbol.CONNECTORS.Find(x => x.ConnectedObject == item) == null) |
973 |
{ |
974 |
result = true; |
975 |
connUID = connSymbol.UID; |
976 |
} |
977 |
else if (connLine != null && connLine.CONNECTORS.Find(x => x.ConnectedObject == item) == null) |
978 |
{ |
979 |
result = true; |
980 |
connUID = connLine.UID; |
981 |
} |
982 |
|
983 |
if (result && connectionCheck.Find(x => (x[0] == item.UID || x[1] == connUID) || (x[1] == item.UID || x[0] == connUID)) == null) |
984 |
{ |
985 |
validationStringBuilder.AppendLine("Check connection!"); |
986 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
987 |
validationStringBuilder.AppendLine("UID : " + connUID); |
988 |
validationStringBuilder.AppendLine(); |
989 |
validationResult = true; |
990 |
connectionCheck.Add(new string[] { item.UID, connUID }); |
991 |
} |
992 |
|
993 |
if (!connectedItem.Contains(connector.CONNECTEDITEM)) |
994 |
connectedItem.Add(connector.CONNECTEDITEM); |
995 |
else |
996 |
{ |
997 |
validationStringBuilder.AppendLine("Check connection!"); |
998 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
999 |
validationStringBuilder.AppendLine(); |
1000 |
} |
1001 |
} |
1002 |
} |
1003 |
|
1004 |
if (item.CONNECTORS.Find(x => x.CONNECTEDITEM == item.UID) != null) |
1005 |
{ |
1006 |
validationStringBuilder.AppendLine("Check connection!"); |
1007 |
validationStringBuilder.AppendLine("UID : " + item.UID); |
1008 |
validationStringBuilder.AppendLine(); |
1009 |
validationResult = true; |
1010 |
} |
1011 |
} |
1012 |
#endregion |
1013 |
|
1014 |
if (validationResult) |
1015 |
{ |
1016 |
Validation = false; |
1017 |
Enable = false; |
1018 |
_ValidationMessage += validationStringBuilder.ToString(); |
1019 |
} |
1020 |
else |
1021 |
{ |
1022 |
Validation = true; |
1023 |
Enable = true; |
1024 |
} |
1025 |
} |
1026 |
} |
1027 |
} |