Beispiel #1
0
        public DeployVersionNameEditorForm(DeployVersionContext version)
        {
            InitializeComponent();

            Version = version;

            //
            // tboxVersionName
            //
            tboxVersionName.Text         = Version.Name;
            tboxVersionName.TextChanged += (o, v) => {
                var    sender      = (TextBox)o;
                var    versionName = sender.Text;
                string message     = string.Empty;
                if (string.IsNullOrEmpty(versionName))
                {
                    message = "[版本名称不可空白]";
                }
                else
                {
                    if (versionName.Length > 20)
                    {
                        message = "[版本名称长度不可超过20个字符]";
                    }
                    else if (IntelligentDeployWorker.IsExistsVersionName(Version, versionName))
                    {
                        message = "[版本名称已存在]";
                    }
                }
                ErrorProvider.SetError(sender, message);
            };
        }
Beispiel #2
0
        /// <summary>
        /// 判断版本名称是否已存在
        /// </summary>
        /// <param name="context"></param>
        /// <param name="versionName"></param>
        /// <returns></returns>
        public static bool IsExistsVersionName(DeployVersionContext context, string versionName)
        {
            bool exists = false;

            if (!string.IsNullOrEmpty(versionName) && context.Name != versionName)
            {
                Configuration configuration            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var           intelligentDeploySection = (IntelligentDeployContextSection)configuration.GetSection("intelligentDeploySection");
                exists = intelligentDeploySection.DeploySettings.Collection.Any(_ => _.Name == versionName);
            }
            return(exists);
        }
Beispiel #3
0
 /// <summary>
 /// 保存版本信息更改设置
 /// </summary>
 /// <param name="context"></param>
 /// <param name="oldVersionName"></param>
 public static void SaveDeployVersion(DeployVersionContext context, string oldVersionName)
 {
     if (context != null)
     {
         Configuration configuration            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
         var           intelligentDeploySection = (IntelligentDeployContextSection)configuration.GetSection("intelligentDeploySection");
         var           element = intelligentDeploySection.DeploySettings[oldVersionName];
         if (element != null)
         {
             element.Name = context.Name;
             configuration.Save();
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// 删除版本信息
 /// </summary>
 /// <param name="context"></param>
 public static void DeleteDeployVersion(DeployVersionContext context)
 {
     if (context != null)
     {
         Configuration configuration            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
         var           intelligentDeploySection = (IntelligentDeployContextSection)configuration.GetSection("intelligentDeploySection");
         intelligentDeploySection.DeploySettings.Remove(context.Name);
         var firstElement = intelligentDeploySection.DeploySettings.Collection.FirstOrDefault();
         if (firstElement != null)
         {
             firstElement.IsSelected = true;
         }
         configuration.Save();
     }
 }
Beispiel #5
0
        /// <summary>
        /// 创建自动部署版本信息
        /// </summary>
        /// <param name="context"></param>
        public static void CreateDeployVersion(DeployVersionContext context)
        {
            if (context != null)
            {
                Configuration configuration            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var           intelligentDeploySection = (IntelligentDeployContextSection)configuration.GetSection("intelligentDeploySection");
                var           elements = intelligentDeploySection.DeploySettings;

                string prefix     = "Version ";
                int    maxIndexer = 0;
                var    versions   = elements.Collection.Where(_ => _ != null && _.Name.StartsWith(prefix) && _.Name.Remove(0, prefix.Length).Trim().ToArray().All(__ => Char.IsNumber(__)));
                if (versions.Count() > 0)
                {
                    maxIndexer = versions.Max(_ => Convert.ToInt32(_.Name.Remove(0, prefix.Length).Trim()));
                }
                context.Name = prefix + (maxIndexer + 1);

                elements.Add(new DeployeVersionSettingElement()
                {
                    Name                          = context.Name,
                    EnvrionmentPath               = context.EnvrionmentPath,
                    ExportPath                    = context.ExportPath,
                    TypeKey                       = context.TypeKey,
                    E10Version                    = context.E10Version,
                    IsSelected                    = context.IsSelected,
                    TargetType                    = context.TargetType,
                    DeployToClient                = context.DeployToClient,
                    DeployToServer                = context.DeployToServer,
                    DeployToWebServer             = context.DeployToWebServer,
                    DeployZhCHTResources          = context.DeployZhCHTResources,
                    DeployEnUSResources           = context.DeployEnUSResources,
                    KillEprocess                  = context.KillEprocess,
                    KillClientProcess             = context.KillClientProcess,
                    AutoDeploy                    = context.AutoDeploy,
                    ServerParamsType              = context.ServerParamsType,
                    ServerParams                  = context.ServerParams,
                    ClientParamsType              = context.ClientParamsType,
                    ClientParams                  = context.ClientParams,
                    ApplyciBeenPutInStorage       = context.ApplyciBeenPutInStorage,
                    ExcludeProgramInfo            = context.ExcludeProgramInfo,
                    BeforeDeployementKillEprocess = context.BeforeDeployementKillEprocess,
                    ApplyciDocs                   = context.ApplyciDocs,
                });

                configuration.Save();
            }
        }