Пример #1
0
 public static string ToNative(this StructuralLoadTask loadTask)
 {
     return(new GSALoadTask()
     {
         Value = loadTask
     }.SetGWACommand());
 }
 public static string ToNative(this StructuralLoadTask loadTask)
 {
     return(SchemaConversion.Helper.ToNativeTryCatch(loadTask, () => new GSALoadTask()
     {
         Value = loadTask
     }.SetGWACommand()));
 }
        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 = Helper.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 = Helper.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 = Helper.ParseLoadDescription(description);

                foreach (var t in desc)
                {
                    switch (t.Item1[0])
                    {
                    case 'L':
                        obj.LoadCaseRefs.Add(Helper.GetApplicationId(typeof(GSALoadCase).GetGSAKeyword(), Convert.ToInt32(t.Item1.Substring(1))));
                        obj.LoadFactors.Add(t.Item2);
                        break;
                    }
                }
            }
            catch
            {
            }

            this.Value = obj;
        }