public static string ToNative(this StructuralLoadCombo loadCombo)
 {
     return(new GSALoadCombo()
     {
         Value = loadCombo
     }.SetGWACommand());
 }
Example #2
0
 public static string ToNative(this StructuralLoadCombo loadCombo)
 {
     return(SchemaConversion.Helper.ToNativeTryCatch(loadCombo, () => new GSALoadCombo()
     {
         Value = loadCombo
     }.SetGWACommand()));
 }
        public void ParseGWACommand()
        {
            if (this.GWACommand == null)
            {
                return;
            }

            var obj = new StructuralLoadCombo();

            var pieces = this.GWACommand.ListSplit("\t");

            var counter = 1; // Skip identifier

            this.GSAId        = Convert.ToInt32(pieces[counter++]);
            obj.ApplicationId = HelperClass.GetApplicationId(this.GetGSAKeyword(), this.GSAId);
            obj.Name          = pieces[counter++];

            // Parse type
            var description = pieces[counter++];

            if (description.Contains("+"))
            {
                obj.ComboType = StructuralLoadComboType.LinearAdd;
            }
            else if (description.Contains("or"))
            {
                obj.ComboType = StructuralLoadComboType.Envelope;
            }
            else
            {
                obj.ComboType = StructuralLoadComboType.LinearAdd;
            }

            obj.LoadTaskRefs     = new List <string>();
            obj.LoadTaskFactors  = new List <double>();
            obj.LoadComboRefs    = new List <string>();
            obj.LoadComboFactors = new List <double>();

            // TODO: this only parses the super simple linear add descriptions
            try
            {
                var desc = HelperClass.ParseLoadDescription(description);

                foreach (var t in desc)
                {
                    switch (t.Item1[0])
                    {
                    case 'A':
                        obj.LoadTaskRefs.Add(HelperClass.GetApplicationId(typeof(GSALoadTask).GetGSAKeyword(), Convert.ToInt32(t.Item1.Substring(1))));
                        obj.LoadTaskFactors.Add(t.Item2);
                        break;

                    case 'C':
                        obj.LoadComboRefs.Add(HelperClass.GetApplicationId(typeof(GSALoadCombo).GetGSAKeyword(), Convert.ToInt32(t.Item1.Substring(1))));
                        obj.LoadComboFactors.Add(t.Item2);
                        break;
                    }
                }
            }
            catch
            {
            }

            this.Value = obj;
        }