示例#1
0
        /// <summary>
        /// Performs a deployment.
        /// </summary>
        /// <param name="context">The deployment context.</param>
        public void Deploy(DeploymentContext context)
        {
            if (string.IsNullOrEmpty(Filename))
                return;
            var normalPath = Filename.Replace('/', Path.DirectorySeparatorChar);
            var destination = Path.Combine(context.DestinationPath, normalPath);

            Directory.CreateDirectory(Path.GetDirectoryName(destination));
            if (File.Exists(destination))
            {
                try
                {
                    File.Delete(destination);
                }
                catch
                {
                    return;
                }
            }

            try
            {
                context.ExtractFile(Filename, destination);
            }
            catch
            {
                return;
            }
        }