public bool DeepCopyFrom(SWRWarningItemProfile src) { System.Diagnostics.Debug.Assert(src != null); if (src == null) { return(false); } this.meteorologicalStationCode = src.meteorologicalStationCode; this.announceTime = src.announceTime; this.sequenceNo = src.sequenceNo; this.commandCode = src.commandCode; this.title = src.title; this.targetAreas = src.targetAreas; this.effectStartInfo = src.effectStartInfo; this.contents = src.contents; this.presentConditionTime = src.presentConditionTime; this.presentConditionContents = src.presentConditionContents; this.preliminaryConditionContents = src.preliminaryConditionContents; this.other = src.other; return(true); }
/// <summary> /// Xml 데이터에서 기상특보통보문 데이터를 클래스로 파싱. /// </summary> /// <returns></returns> public SWRWarningItemProfile GetWarningItemProfile() { System.Diagnostics.Debug.Assert(this != null); System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(this.originalWarningItemReport)); SWRWarningItemProfile profile = new SWRWarningItemProfile(); try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(this.originalWarningItemReport); XmlNodeList xNodes = xmlDoc.SelectNodes("/swr/item"); if (xNodes == null || xNodes.Count <= 0) { return(null); } foreach (XmlNode item in xNodes) { foreach (XmlNode node in item.ChildNodes) { string value = node.InnerText; switch (node.Name) { case "stnId": { profile.StationID = value; } break; case "tmFc": { DateTime temp = new DateTime(); if (DateTime.TryParse(value, out temp)) { profile.AnnounceTime = temp; } } break; case "tmSeq": { int temp = 0; if (int.TryParse(value, out temp)) { profile.SequenceNo = temp; } } break; case "warFc": { profile.CommandCode = value; } break; case "t1": { profile.Title = value; } break; case "t2": { profile.TargetAreas = value; } break; case "t3": { profile.EffectStartInfo = value; } break; case "t4": { profile.Contents = value; } break; case "t5": { DateTime temp = new DateTime(); if (DateTime.TryParse(value, out temp)) { profile.PresentConditionTime = temp; } } break; case "t6": { profile.PresentConditionContents = value; } break; case "t7": { profile.PreliminaryConditionContents = value; } break; case "other": { profile.Other = value; } break; default: { // 이외에 빠진 항목은 없는지 확인하자 System.Console.WriteLine("[SpecialWeatherReportInfo] GetWarningItemProfile( Unknown Element: " + node.Name + " )"); } break; } } } } catch (Exception ex) { System.Console.WriteLine("[SpecialWeatherReportInfo] GetWarningItemProfile( Exception Occured: " + ex.ToString() + " )"); FileLogManager.GetInstance().WriteLog("[SpecialWeatherReportInfo] GetWarningItemProfile ( Exception=[" + ex.ToString() + "] )"); return(null); } return(profile); }