public static L3.Cargo.Common.ProfileObject Translate (L3.Cargo.Common.Xml.Profile_1_0.Profile commProfile, int capacity) { L3.Cargo.Common.ProfileObject profile = new L3.Cargo.Common.ProfileObject(capacity); try { if (commProfile != null) { if (commProfile.Macro != null) { foreach (L3.Cargo.Common.Xml.Profile_1_0.ProfileMacro commMacro in commProfile.Macro) { L3.Cargo.Common.Macro macro = new L3.Cargo.Common.Macro(commMacro.id); macro.Buffer.name = commMacro.Buffer.parameter; macro.PseudoColor.name = commMacro.PseudoColor.parameter; L3.Cargo.Common.Xml.History_1_0.HistoryHistogram histogram = new L3.Cargo.Common.Xml.History_1_0.HistoryHistogram(); histogram.effecttype = commMacro.Histogram.effectType; histogram.start = commMacro.Histogram.start; histogram.end = commMacro.Histogram.end; macro.Histogram = histogram; foreach (L3.Cargo.Common.Xml.Profile_1_0.ProfileMacroFilter filter in commMacro.Filters) { L3.Cargo.Common.Xml.History_1_0.HistoryFilter filterHistory = new L3.Cargo.Common.Xml.History_1_0.HistoryFilter(); filterHistory.name = filter.id; filterHistory.parameter = filter.parameter; macro.Filter.Add(filterHistory); } profile.UserMacros.Add(macro); } } if (commProfile.DensityAlarm != null) { profile.DensityAlarmValue = commProfile.DensityAlarm.value; } } } catch (Exception ex) { //TODO: Log exception here } return profile; }
public static L3.Cargo.Common.ProfileObject Translate(L3.Cargo.Common.Xml.Profile_1_0.Profile commProfile, int capacity) { L3.Cargo.Common.ProfileObject profile = new L3.Cargo.Common.ProfileObject(capacity); try { if (commProfile != null) { if (commProfile.Macro != null) { foreach (L3.Cargo.Common.Xml.Profile_1_0.ProfileMacro commMacro in commProfile.Macro) { L3.Cargo.Common.Macro macro = new L3.Cargo.Common.Macro(commMacro.id); macro.Buffer.name = commMacro.Buffer.parameter; macro.PseudoColor.name = commMacro.PseudoColor.parameter; L3.Cargo.Common.Xml.History_1_0.HistoryHistogram histogram = new L3.Cargo.Common.Xml.History_1_0.HistoryHistogram(); histogram.effecttype = commMacro.Histogram.effectType; histogram.start = commMacro.Histogram.start; histogram.end = commMacro.Histogram.end; macro.Histogram = histogram; foreach (L3.Cargo.Common.Xml.Profile_1_0.ProfileMacroFilter filter in commMacro.Filters) { L3.Cargo.Common.Xml.History_1_0.HistoryFilter filterHistory = new L3.Cargo.Common.Xml.History_1_0.HistoryFilter(); filterHistory.name = filter.id; filterHistory.parameter = filter.parameter; macro.Filter.Add(filterHistory); } profile.UserMacros.Add(macro); } } if (commProfile.DensityAlarm != null) { profile.DensityAlarmValue = commProfile.DensityAlarm.value; } } } catch (Exception ex) { //TODO: Log exception here } return(profile); }