Пример #1
0
        /// <param name="type">The type of step.</param>
        /// <returns></returns>
        protected IStep getStep(StepsType type)
        {
            if (steps.ContainsKey(type))
            {
                return(steps[type]);
            }

            switch (type)
            {
            case StepsType.Gen: {
                steps[type] = new StepGen();
                return(steps[type]);
            }

            case StepsType.Struct: {
                steps[type] = new StepStruct(new MSBuild.Parser(env))
                {
                    fnumber = StepStruct.NumberType.NativeStruct
                };
                return(steps[type]);
            }

            case StepsType.DirectRepl: {
                steps[type] = new StepRepl();
                return(steps[type]);
            }

            case StepsType.CfgData: {
                steps[type] = new StepCfgData();
                return(steps[type]);
            }

            case StepsType.Fields: {
                steps[type] = new StepFields();
                return(steps[type]);
            }

            case StepsType.Final:
            {
                steps[type] = new StepFinal(this);
                return(steps[type]);
            }
            }
            throw new NotFoundException("getStep: the type - `{0}` is not found.", type);
        }
Пример #2
0
        /// <param name="type">The type of step.</param>
        /// <returns></returns>
        protected IStep getStep(StepsType type)
        {
            if(steps.ContainsKey(type)) {
                return steps[type];
            }

            switch(type)
            {
                case StepsType.Gen: {
                    steps[type] = new StepGen();
                    return steps[type];
                }
                case StepsType.Struct: {
                    steps[type] = new StepStruct(new MSBuild.Parser(env)) {
                        fnumber = StepStruct.NumberType.NativeStruct
                    };
                    return steps[type];
                }
                case StepsType.DirectRepl: {
                    steps[type] = new StepRepl();
                    return steps[type];
                }
                case StepsType.CfgData: {
                    steps[type] = new StepCfgData();
                    return steps[type];
                }
                case StepsType.Fields: {
                    steps[type] = new StepFields();
                    return steps[type];
                }
                case StepsType.Final:
                {
                    steps[type] = new StepFinal(this);
                    return steps[type];
                }
            }
            throw new NotFoundException("getStep: the type - `{0}` is not found.", type);
        }
Пример #3
0
 private void save(StepStruct s)
 {
     s.namspace  = tbNamespace.Text;
     s.name      = tbClassName.Text;
     s.upperCase = chkUpperCase.Checked;
     s.fnumber   = s.NumbersList[cbNumberType.SelectedIndex].Key;
 }
Пример #4
0
        private void render(StepStruct s)
        {
            tbNamespace.Text        = s.namspace;
            tbClassName.Text        = s.name;
            chkUpperCase.Checked    = s.upperCase;

            cbNumberType.Items.Clear();
            if(manager.StepGen.gtype == GenType.CSharpStruct) {
                cbNumberType.Enabled = false; // support only System.Version
                s.fnumber = StepStruct.NumberType.SystemVersion;
            }
            else {
                cbNumberType.Enabled = true;
                if(manager.StepGen.gtype == GenType.CppStruct) {
                    s.fnumber = StepStruct.NumberType.NativeStruct; // to start with native
                }
            }

            cbNumberType.Items.AddRange(s.NumbersList.Select(i => i.Value).ToArray());
            cbNumberType.SelectedIndex = s.NumbersList.FindIndex(i => i.Key == s.fnumber);
        }