//The ToNative() method is in the new schema conversion folder hierarchy public static SpeckleObject ToSpeckle(this GSALoadCase dummyObject) { var newLines = ToSpeckleBase <GSALoadCase>(); var typeName = dummyObject.GetType().Name; var loadCases = new SortedDictionary <int, GSALoadCase>(); foreach (var k in newLines.Keys) { var p = newLines[k]; var loadCase = new GSALoadCase() { GWACommand = p, GSAId = k }; try { loadCase.ParseGWACommand(); } catch (Exception ex) { Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.Display, MessageLevel.Error, typeName, k.ToString()); Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.TechnicalLog, MessageLevel.Error, ex, typeName, k.ToString()); } loadCases.Add(k, loadCase); } Initialiser.GsaKit.GSASenderObjects.AddRange(loadCases.Values.ToList()); return((loadCases.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull()); }
public static SpeckleObject ToSpeckle(this GSALoadCase dummyObject) { var newLines = ToSpeckleBase <GSALoadCase>(); var loadCases = new List <GSALoadCase>(); foreach (var p in newLines.Values) { var loadCase = new GSALoadCase() { GWACommand = p }; loadCase.ParseGWACommand(); loadCases.Add(loadCase); } Initialiser.GSASenderObjects[typeof(GSALoadCase)].AddRange(loadCases); return((loadCases.Count() > 0) ? new SpeckleObject() : new SpeckleNull()); }