コード例 #1
0
        protected override void CustomProcessRequest(HttpContext context)
        {
            UpdateFactory   factory        = new UpdateFactory(context);
            IUpdateBehavior updateBehavior = factory.Create();

            updateBehavior.Update();
        }
コード例 #2
0
        /// <summary>
        /// Apply downloaded updates. Method will execute behavior method after files are unpacked.
        /// </summary>
        /// <param name="behavior">Defines behavior of update method after files are unpacked. For example you can backup your database etc.</param>
        /// <param name="publicToken">Public token is used to unpack files in UpdatePackage. Public token can be obtained while using BitsUpdatePacker app and creating package.</param>
        /// <returns>True if everything went well.</returns>
        public bool Update(IUpdateBehavior behavior, string publicToken)
        {
            if (_status.NextVersion > Assembly.GetEntryAssembly().GetName().Version&& File.Exists(GetUpdateSaveLocation()))
            {
                UpdatePackage.Extract(new DirectoryInfo(string.Format(_updateDirectory, _status.NextVersion)), _status.NextVersion, publicToken);

                if (behavior != null)
                {
                    behavior.Execute();
                }

                return(true);
            }

            return(false);
        }
コード例 #3
0
 public TipoItem(IUpdateBehavior ibehavior)
 {
     this.ibehavior = ibehavior;
 }
コード例 #4
0
ファイル: BitsUpdater.cs プロジェクト: andyhebear/BitsUpdater
        /// <summary>
        /// Apply downloaded updates. Method will execute behavior method after files are unpacked.
        /// </summary>
        /// <param name="behavior">Defines behavior of update method after files are unpacked. For example you can backup your database etc.</param>
        /// <param name="publicToken">Public token is used to unpack files in UpdatePackage. Public token can be obtained while using BitsUpdatePacker app and creating package.</param>
        /// <returns>True if everything went well.</returns>
        public bool Update(IUpdateBehavior behavior, string publicToken)
        {
            if (_status.NextVersion > Assembly.GetEntryAssembly().GetName().Version && File.Exists(GetUpdateSaveLocation()))
            {
                UpdatePackage.Extract(new DirectoryInfo(string.Format(_updateDirectory, _status.NextVersion)), _status.NextVersion, publicToken);

                if (behavior != null)
                {
                    behavior.Execute();
                }

                return true;
            }

            return false;
        }