Beispiel #1
0
        public async Task InvokeAsync(BaseContext context, MiddlewareStack stack)
        {
            Exception exception = null;

            try
            {
                context.OnProgressEventAction(this, ProgressType.Updatefile, "In the unzipped file ...");
                var  version = context.Version;
                bool isUnzip = UnZip(context);
                if (!isUnzip)
                {
                    throw exception = new Exception($"Unzip file failed , Version-{ version.Version }  MD5-{ version.MD5 } !");
                }

                await ConfigFactory.Instance.Scan(context.SourcePath, context.TargetPath);

                var node = stack.Pop();
                if (node != null)
                {
                    await node.Next.Invoke(context, stack);
                }
            }
            catch (Exception ex)
            {
                exception = exception ?? ex;
                context.OnExceptionEventAction(this, exception);
                throw exception;
            }
        }
        public async Task InvokeAsync(BaseContext context, MiddlewareStack stack)
        {
            Exception exception = null;

            try
            {
                context.OnProgressEventAction(this, ProgressType.MD5, "Verify file MD5 code ...");
                var  version  = context.Version;
                bool isVerify = VerifyFileMd5(context.ZipfilePath, version.MD5);
                if (!isVerify)
                {
                    throw exception = new Exception($"The update package MD5 code is inconsistent ! version-{ version.Version }  MD5-{ version.MD5 } .");
                }
                var node = stack.Pop();
                if (node != null)
                {
                    await node.Next.Invoke(context, stack);
                }
            }
            catch (Exception ex)
            {
                context.OnExceptionEventAction(this, exception ?? ex);
                throw exception;
            }
        }
        public async Task InvokeAsync(BaseContext context, MiddlewareStack stack)
        {
            try
            {
                context.OnProgressEventAction(this, ProgressType.Patch, "Update patch file ...");
                await DifferentialCore.Instance.Drity(context.SourcePath, context.TargetPath);

                var node = stack.Pop();
                if (node != null)
                {
                    await node.Next.Invoke(context, stack);
                }
            }
            catch (Exception ex)
            {
                var exception = new Exception($"{ ex.Message } !", ex.InnerException);
                context.OnExceptionEventAction(this, exception);
                throw exception;
            }
        }
        public async Task InvokeAsync(BaseContext context, MiddlewareStack stack)
        {
            try
            {
                context.OnProgressEventAction(this, ProgressType.Config, "Update configuration file ...");
                await ConfigFactory.Instance.Deploy();

                var node = stack.Pop();
                if (node != null)
                {
                    await node.Next.Invoke(context, stack);
                }
            }
            catch (Exception ex)
            {
                var exception = new Exception($"{ ex.Message } !", ex.InnerException);
                context.OnExceptionEventAction(this, exception);
                throw exception;
            }
        }