예제 #1
0
        public AutoComponent(AutoData autoData)
        {
            this.active = false;

            this.autoId = autoData.autoId;

            this.name     = autoData.name;
            this.info     = autoData.info;
            this.comments = autoData.comments;

            var loadedTimelines = new List <TimelineTrack>();

            foreach (var timeline in autoData.timelines)
            {
                loadedTimelines.Add(new TimelineTrack(timeline, timelineCount));
                timelineCount = timelineCount + 1;
            }
            this.timelineTracks = loadedTimelines;
        }
예제 #2
0
        public static string Auto(string genericParams, AutoData autoData)
        {
            var autoName     = autoData.name;
            var userComments = autoData.comments;

            var commentLines = new List <string> {
                autoName, "generated Auto by Automatine."
            };

            commentLines.AddRange(userComments);

            var classDesc = new ConstructorClassDescriptor(
                new List <string> {
                "System", "System.Collections", "Automatine"
            },
                commentLines,
                "public",
                autoName,
                genericParams,
                () =>
            {
                var autoInfo = autoData.info;
                var timelineDescsSourceList = autoData.timelines;

                var timelineDescs = new List <TimelineDesc>();

                foreach (var currentTimelineDescSource in timelineDescsSourceList)
                {
                    var tlInfo        = currentTimelineDescSource.info;
                    var tlTacksSource = currentTimelineDescSource.tacks;

                    var tlTacks = new List <TackDesc>();
                    foreach (var currentTackDescSource in tlTacksSource)
                    {
                        var tackInfo           = currentTackDescSource.info;
                        var tackStart          = currentTackDescSource.start;
                        var tackSpan           = currentTackDescSource.span;
                        var tackConditionType  = currentTackDescSource.conditionType;
                        var tackConditionValue = currentTackDescSource.conditionValue;
                        var tackRoutinesSource = currentTackDescSource.routineIds;

                        var tackRoutines = new List <RoutineDesc>();
                        foreach (var routine in tackRoutinesSource)
                        {
                            var RoutineDesc = new RoutineDesc(routine);
                            tackRoutines.Add(RoutineDesc);
                        }

                        var tackDesc = new TackDesc(tackInfo, tackStart, tackSpan, tackConditionType, tackConditionValue, tackRoutines);

                        tlTacks.Add(tackDesc);
                    }

                    var t = new TimelineDesc(
                        tlInfo,
                        tlTacks
                        );
                    timelineDescs.Add(t);
                }

                var autoDesc = new AutoGeneratorMethodDesc(
                    autoName,
                    autoInfo,
                    timelineDescs
                    );

                return(autoDesc.SetIdThenReturnData());
            }
                );

            return(classDesc.data);
        }