Exemplo n.º 1
0
        public void ParseGWACommand()
        {
            if (this.GWACommand == null)
            {
                return;
            }

            var obj = new StructuralLoadTask();

            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++];

            //Find task type
            int.TryParse(pieces[counter++], out int taskRef);
            var taskRec = Initialiser.Cache.GetGwa("TASK.1", taskRef).First();

            obj.TaskType = HelperClass.GetLoadTaskType(taskRec);
            this.SubGWACommand.Add(taskRec);

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

            obj.LoadCaseRefs = new List <string>();
            obj.LoadFactors  = 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 'L':
                        obj.LoadCaseRefs.Add(HelperClass.GetApplicationId(typeof(GSALoadCase).GetGSAKeyword(), Convert.ToInt32(t.Item1.Substring(1))));
                        obj.LoadFactors.Add(t.Item2);
                        break;
                    }
                }
            }
            catch
            {
            }

            this.Value = obj;
        }