Beispiel #1
0
        /// <summary>
        /// 复制更新文件
        /// </summary>
        private void CopyUpdateFileAndCheckout()
        {
            //Tfs帮助类
            TFSHelper tfsHelper = new TFSHelper(Directory.GetParent(customizePath).FullName, customizeSlnFileName);

            //判断产品TFS是否全部签入
            if (tfsHelper.GetPendingChange().Count > 0)
            {
                _updateFiles = null;
                MessageBox.Show("二开有未签入的数据,不可以再次签入二开,请先签入二开!");
                return;
            }

            //先复制新的文件
            if (!CopyNewFile(tfsHelper))
            {
                return;
            }
            //签出编辑
            if (!Checkout(tfsHelper))
            {
                return;
            }
            //复制文件
            if (!CopyUpdateFile(tfsHelper))
            {
                return;
            }
            //判断是否有编辑签入文件
            if (this._updateFiles.Count == 0)
            {
                MessageBox.Show("没有要编辑签出的文件夹!");
                return;
            }
            MessageBox.Show("复制成功并签出编辑成功!");

            if (CustomizeFileIsTrue() && this._customizeFilePath.Count > 0)
            {
                MessageBox.Show("有二开文件,请点击“显示二开元数据”查看详情信息!");
            }
            JoeyLog.Logging.WriteLog("完成编辑签出");
        }
Beispiel #2
0
        private void ConfigureTreeView(string path, string customizeSlnFileName)
        {
            this.updateTriSatateTreeView.Nodes.Clear();

            try
            {
                //Tfs帮助类
                tfsHelper = new TFSHelper(Directory.GetParent(path).FullName, customizeSlnFileName);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }
            List <FileInfo> fileInfos = tfsHelper.GetPendingChange();

            if (fileInfos != null && fileInfos.Count > 0)
            {
                IEnumerable <IGrouping <string, FileInfo> > dictionarys = fileInfos.GroupBy(n => n.DirectoryName);

                foreach (var dictionary in dictionarys)
                {
                    TriStateTreeNode treeNode1 = new TriStateTreeNode();
                    treeNode1.Text            = dictionary.Key.Replace(path + "\\", "");
                    treeNode1.Text            = dictionary.Key.Replace(path, "");
                    treeNode1.CheckboxVisible = true;
                    treeNode1.Checked         = true;
                    treeNode1.IsContainer     = true;//文件夹
                    foreach (var metadataFile in dictionary)
                    {
                        TriStateTreeNode treeNode2 = new TriStateTreeNode(metadataFile.Name, 2, 2);
                        treeNode2.Checked = true;
                        treeNode2.Tag     = metadataFile;
                        treeNode1.Nodes.Add(treeNode2);
                    }
                    this.updateTriSatateTreeView.Nodes.Add(treeNode1);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 打开更新的文件目录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RootFileBtn_Click(object sender, EventArgs e)
        {
            this._updateFiles = new List <FileInfo>();
            this.updateTriSatateTreeView.Nodes.Clear();
            string rootPath = this.pathTBx.Text;

            //获取修改当前日期
            _dt = DateTime.Parse(DateTime.Parse(this.updateDateTimePicker.Text).ToString("yyyy/MM/dd"));
            if (string.IsNullOrEmpty(this.pathTBx.Text))
            {
                //选择文件夹
                FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
                folderBrowserDialog.SelectedPath = rootProductPath;
                if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                {
                    //选择的文件夹
                    this.pathTBx.Text = folderBrowserDialog.SelectedPath;
                }
            }
            if (!File.Exists(rootPath + "\\Web.config"))
            {
                MessageBox.Show("请选择产品根目录!");
            }
            else
            {
                //产品TFS
                TFSHelper tfs = new TFSHelper(Directory.GetParent(rootPath).FullName, productSlnFileName);
                _updateFiles.AddRange(GetRootFileName(rootPath));
                _updateFiles.AddRange(GetMetadataFiles(rootPath));
                var pendingFiles = tfs.GetPendingChange();
                //判断产品TFS是否全部签入
                if (pendingFiles.Count > 0)
                {
                    _updateFiles = null;
                    foreach (var item in pendingFiles)
                    {
                        Logging.WriteLog("没有签入的产品文件:", item.FullName);
                    }
                    MessageBox.Show("产品有未签入的数据,不可以迁移二开!");
                    return;
                }
                if (isTip)
                {
                    _updateFiles = null;
                    MessageBox.Show("产品有未签入的元数据,请在建模平台签入后迁移二开!");
                    return;
                }

                _updateFiles.AddRange(GetBinFiles(rootPath));
                _updateFiles.AddRange(GetAppDataFiles(rootPath));
                //获取需要更新的文件夹信息
                foreach (var updateDirectory in _updateDirectorys)
                {
                    openFileName = Path.Combine(rootPath, updateDirectory);
                    _updateFiles.AddRange(GetUpdateFiles(openFileName));
                }


                IEnumerable <IGrouping <string, FileInfo> > dictionarys = _updateFiles.GroupBy(n => n.DirectoryName);
                if (_updateFiles != null && _updateFiles.Count > 0)
                {
                    foreach (var dictionary in dictionarys)
                    {
                        TriStateTreeNode treeNode1 = new TriStateTreeNode();
                        treeNode1.Text            = dictionary.Key.Replace(this.pathTBx.Text + "\\", "");
                        treeNode1.Text            = treeNode1.Text.Replace(this.pathTBx.Text.Replace("00_根目录", ""), "");
                        treeNode1.CheckboxVisible = true;
                        treeNode1.Checked         = true;
                        treeNode1.IsContainer     = true;//文件夹
                        var list = dictionary.OrderBy(n => n.Name);
                        foreach (var metadataFile in list)
                        {
                            TriStateTreeNode treeNode2 = new TriStateTreeNode(metadataFile.Name, 2, 2);
                            treeNode2.Checked = true;
                            treeNode2.Tag     = metadataFile;
                            treeNode1.Nodes.Add(treeNode2);
                        }
                        this.updateTriSatateTreeView.Nodes.Add(treeNode1);
                    }

                    if (this.isTrueCopyRadioBtn.Checked)
                    {
                        this._updateFiles = TriStateTreeNodeHelper.GetTreeNodeChecked(this.updateTriSatateTreeView.Nodes);
                        if (this._updateFiles == null)
                        {
                            MessageBox.Show("请选择产品修改的信息!");
                            return;
                        }
                        if (this._updateFiles.Count == 0)
                        {
                            MessageBox.Show("没有要复制编辑签出的文件!");
                            return;
                        }
                        progressValue = 0;
                        customizePath = this.customizePathCBX.Text;
                        this.worker.RunWorkerAsync();                    // 运行 backgroundWorker 组件
                        ProgressBar form = new ProgressBar(this.worker); // 显示进度条窗体
                        form.ShowDialog(this);
                    }
                }
            }
        }