Exemplo n.º 1
0
 public ProjectForm()
 {
     InitializeComponent();
     loadExtend();
     instance = new Project();
     instance.ConfigFiles = new List<string>();
     instance.DeployServers = new List<string>();
 }
Exemplo n.º 2
0
 public bool Deploy(Project project)
 {
     foreach (var serverId in project.DeployServers)
     {
         var server = Dal.GetServerById(serverId);
         if (!string.IsNullOrEmpty(server.UserName))
         {
             AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
             WindowsIdentity idnt = new WindowsIdentity(server.UserName, server.Password);
             WindowsImpersonationContext context = idnt.Impersonate();
         }
         File.Copy(DeployUtil.TransferFolder, server.Uri, true);
     }
     //TODO config files
     return true;
 }
Exemplo n.º 3
0
 public bool Deploy(Project project)
 {
     foreach (var serverId in project.DeployServers)
     {
         var server = Dal.GetServerById(serverId);
         using (SftpClient client = new SftpClient(server.Uri, server.UserName, server.Password))
         {
             client.Connect();
             UploadDirectory(client, DeployUtil.TransferFolder, server.FileLocation);
         }
     }
     return true;
 }
Exemplo n.º 4
0
 public bool Deploy(Project project)
 {
     throw new Exception("no no no, not a svn server");
 }
Exemplo n.º 5
0
 public void SetInstance(Project deploy)
 {
     instance = deploy;
 }
Exemplo n.º 6
0
        void getData()
        {
            if (instance == null)
            {
                instance = new Project();
                instance.ConfigFiles = new List<string>();
                instance.DeployServers = new List<string>();
            }
            instance.Name = txtProjectName.Text.Trim();
            instance.PredeployScript = rtbPredeployScript.Text;
            instance.PostdeployScript = rtbPostdeployScript.Text;

            if (instance.ConfigFiles != null)
            {
                instance.ConfigFiles.Clear();
            }
            else
            {
                instance.ConfigFiles = new List<string>();
            }
            instance.ConfigFiles.Clear();
            foreach (var item in lbConfigFiles.SelectedItems)
            {
                var selected = item as ComboboxItem;
                instance.ConfigFiles.Add(selected.ObjectId);
            }

            instance.DeployServers.Clear();
            foreach (var item in lbDeployServer.SelectedItems)
            {
                var selectedItem = item as ComboboxItem;
                instance.DeployServers.Add(selectedItem.ObjectId);
            }

            instance.Source = servers[cmbSourceServer.SelectedIndex].Id;
            instance.Remarks = txtRemarks.Text;
        }
Exemplo n.º 7
0
        static void CreateDeploy(Project deploy)
        {
            if (Data.Projects == null)
            {
                Data.Projects = new List<Project>();
            }

            if (string.IsNullOrEmpty(deploy.Id))
                deploy.Id = Guid.NewGuid().ToString();
            Data.Projects.Add(deploy);
            save();
        }
Exemplo n.º 8
0
        public static void UpdateDeploy(Project deploy)
        {
            if (Data.Projects == null || Data.Projects.Count == 0)
            {
                CreateDeploy(deploy);
                return;
            }

            var old = Data.Projects.FirstOrDefault(x => x.Id == deploy.Id);
            if (old == null)
            {
                CreateDeploy(deploy);
                return;
            }
            else
            {
                old = deploy;
                save();
            }
        }