コード例 #1
0
        internal StringVersion Increment(StringVersion currentVersion,
                                         DateTime buildStartDate,
                                         DateTime projectStartDate,
                                         SolutionItem solutionItem)
        {
            var context = new IncrementContext(currentVersion,
                                               buildStartDate,
                                               projectStartDate,
                                               solutionItem.Filename);

            var incrementors = new[] { Major, Minor, Build, Revision };

            for (var i = 0; i < 4; i++)
            {
                var incrementor = incrementors[i];

                if (incrementor == null)
                {
                    continue;
                }

                var component = (VersionComponent)i;

                incrementor.Execute(context, component);

                if (!context.Continue)
                {
                    break;
                }
            }

            return(context.NewVersion);
        }
コード例 #2
0
        /// <summary>
        /// Increments the specified version.
        /// </summary>
        /// <param name="currentVersion">The current version.</param>
        /// <param name="buildStartDate">The build start date.</param>
        /// <param name="projectStartDate">The project start date.</param>
        /// <returns>The incremented version.</returns>
        internal StringVersion Increment(StringVersion currentVersion, DateTime buildStartDate, DateTime projectStartDate, SolutionItem solutionItem)
        {
            IncrementContext context = new IncrementContext(currentVersion, buildStartDate, projectStartDate, solutionItem.Filename);

            BaseIncrementor[] incrementors = new BaseIncrementor[] { Major, Minor, Build, Revision };

            for (int i = 0; i < 4; i++)
            {
                BaseIncrementor incrementor = incrementors[i];

                if (incrementor == null)
                {
                    continue;
                }

                VersionComponent component = (VersionComponent)i;

                incrementor.Increment(context, component);

                if (!context.Continue)
                {
                    break;
                }
            }

            return(context.NewVersion);

            /*int major = Major == null ? currentVersion.Major : Major.Increment(currentVersion.Major, buildStartDate, projectStartDate, solutionItem.Filename);
             * int minor = Minor == null ? currentVersion.Minor : Minor.Increment(currentVersion.Minor, buildStartDate, projectStartDate, solutionItem.Filename);
             * int build = Build == null ? currentVersion.Build : Build.Increment(currentVersion.Build, buildStartDate, projectStartDate, solutionItem.Filename);
             * int revision = Revision == null ? currentVersion.Revision : Revision.Increment(currentVersion.Revision, buildStartDate, projectStartDate, solutionItem.Filename);
             *
             * return new Version(major, minor, build, revision);*/
        }
コード例 #3
0
        internal StringVersion Increment(StringVersion currentVersion, DateTime buildStartDate, DateTime projectStartDate, SolutionItem solutionItem)
        {
            IncrementContext incrementContext = new IncrementContext(currentVersion, buildStartDate, projectStartDate, solutionItem.Filename);

            BaseIncrementor[] array = new BaseIncrementor[]
            {
                this.Major,
                this.Minor,
                this.Build,
                this.Revision
            };
            for (int i = 0; i < 4; i++)
            {
                BaseIncrementor baseIncrementor = array[i];
                if (baseIncrementor != null)
                {
                    VersionComponent versionComponent = (VersionComponent)i;
                    baseIncrementor.Increment(incrementContext, versionComponent);
                    if (!incrementContext.Continue)
                    {
                        break;
                    }
                }
            }
            return(incrementContext.NewVersion);
        }
コード例 #4
0
        /// <summary>
        /// Executes the increment.
        /// </summary>
        /// <param name="context">The context of the increment.</param>
        /// <param name="versionComponent">The version component that needs to be incremented.</param>
        /// <remarks>
        /// Use the method <see cref="IncrementContext.SetNewVersionComponentValue"/> to set the new version component value.
        /// Set the  <see cref="IncrementContext.Continue"/> property to <c>false</c> to skip updating the other component values.
        /// </remarks>
        public override void Increment(IncrementContext context, VersionComponent versionComponent)
        {
            Logger.Write("Setting a random version number.", LogLevel.Debug);

            // Set the requested version component of the IncrementContext to a random number

            context.SetNewVersionComponentValue(versionComponent, _rnd.Next((int)short.MaxValue).ToString());
        }
コード例 #5
0
        /// <summary>
        /// Executes the increment.
        /// </summary>
        /// <param name="context">The context of the increment.</param>
        /// <param name="versionComponent">The version component that needs to be incremented.</param>
        /// <remarks>
        /// Use the method <see cref="IncrementContext.SetNewVersionComponentValue"/> to set the new version component value.
        /// Set the  <see cref="IncrementContext.Continue"/> property to <c>false</c> to skip updating the other component values.
        /// </remarks>
        public override void Increment(IncrementContext context, VersionComponent versionComponent)
        {
            Logger.Write("Ah! I always thought something was fundamentally wrong with the universe.", LogLevel.Info);

            // Set the requested version component of the IncrementContext to the number 42

            context.SetNewVersionComponentValue(versionComponent, "42");
        }
コード例 #6
0
        /// <summary>
        /// Executes the increment.
        /// </summary>
        /// <param name="context">The context of the increment.</param>
        /// <param name="versionComponent">The version component that needs to be incremented.</param>
        /// <remarks>
        /// Use the method <see cref="IncrementContext.SetNewVersionComponentValue"/> to set the new version component value.
        /// Set the  <see cref="IncrementContext.Continue"/> property to <c>false</c> to skip updating the other component values.
        /// </remarks>
        public override void Increment(IncrementContext context, VersionComponent versionComponent)
        {
            Logger.Write("Resetting version number to 1.0.0.0", LogLevel.Debug);

            // Set all the version components

            context.SetNewVersionComponentValue(versionComponent,
                                                versionComponent == VersionComponent.Major ? "1" : "0");

            // Tell the addin to stop incrementing the other version components
            // context.Continue = false;
        }
コード例 #7
0
ファイル: Startup.cs プロジェクト: superechnik/Incrementer
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IncrementContext ctx)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Incrementer v1"));
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            ctx.Database.Migrate();
        }
コード例 #8
0
ファイル: BFParser.cs プロジェクト: Gota7/BFCompiler
    public InstructionContext instruction()
    {
        InstructionContext _localctx = new InstructionContext(Context, State);

        EnterRule(_localctx, 2, RULE_instruction);
        try {
            State = 19;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case LOOP_CHECK:
                _localctx = new Do_LoopContext(_localctx);
                EnterOuterAlt(_localctx, 1);
                {
                    State = 12;
                    loop();
                }
                break;

            case MV_RIGHT:
                _localctx = new Move_RightContext(_localctx);
                EnterOuterAlt(_localctx, 2);
                {
                    State = 13;
                    Match(MV_RIGHT);
                }
                break;

            case MV_LEFT:
                _localctx = new Move_LeftContext(_localctx);
                EnterOuterAlt(_localctx, 3);
                {
                    State = 14;
                    Match(MV_LEFT);
                }
                break;

            case INC:
                _localctx = new IncrementContext(_localctx);
                EnterOuterAlt(_localctx, 4);
                {
                    State = 15;
                    Match(INC);
                }
                break;

            case DEC:
                _localctx = new DecrementContext(_localctx);
                EnterOuterAlt(_localctx, 5);
                {
                    State = 16;
                    Match(DEC);
                }
                break;

            case OUTPUT:
                _localctx = new OutputContext(_localctx);
                EnterOuterAlt(_localctx, 6);
                {
                    State = 17;
                    Match(OUTPUT);
                }
                break;

            case INPUT:
                _localctx = new InputContext(_localctx);
                EnterOuterAlt(_localctx, 7);
                {
                    State = 18;
                    Match(INPUT);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
コード例 #9
0
ファイル: Repo.cs プロジェクト: superechnik/Incrementer
 public Repo(IncrementContext ctx)
 {
     _ctx = ctx;
 }
コード例 #10
0
 public IncrementModel(IncrementContext context)
 {
     _context = context;
 }