Example #1
0
        private ExportSvnParameters ExportZentaoBug(string svnRepository, string targetDirectory)
        {
            var bugs = new List <int>();

            foreach (var rawBug in txtZentaoBug.Lines)
            {
                if (string.IsNullOrWhiteSpace(rawBug))
                {
                    continue;
                }

                var rawBugs = rawBug.Split(',');
                foreach (var raw in rawBugs)
                {
                    if (!int.TryParse(raw.Trim(), out var bug))
                    {
                        MessageBox.Show(string.Format("{0} 不是有效的数字", rawBug.Trim()), "错误", MessageBoxButtons.OK);
                        return(null);
                    }

                    bugs.Add(bug);
                }
            }

            if (bugs.Count <= 0)
            {
                MessageBox.Show("没有输入禅道Bug号", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            var bugExporter = new ZentaoDbBugRevisionExporter();
            var bugNumbers  = bugExporter.Export(bugs);

            var filter = new HashSet <uint>();

            foreach (var rawBugNumber in bugNumbers)
            {
                if (!filter.Contains(rawBugNumber))
                {
                    filter.Add(rawBugNumber);
                }
            }

            var svnRoot    = new Uri(svnRepository);
            var parameters = new ExportSvnParameters
            {
                Numbers         = new List <uint>(filter),
                SvnRepository   = svnRoot,
                TargetDirectory = targetDirectory
            };

            return(parameters);
        }
Example #2
0
        private ExportSvnParameters ExportZentaoBuild(string svnRepository, string targetDirectory)
        {
            var data = cbxZentaoBuild.SelectedItem as ZentaoBuildData;

            if (data == null)
            {
                return(null);
            }

            var rawNumbers = new List <uint>();

            var storyExporter = new ZentaoDbStoryRevisionExporter();
            var storyNumbers  = storyExporter.Export(data.Stories);

            rawNumbers.AddRange(storyNumbers);

            var bugExporter = new ZentaoDbBugRevisionExporter();
            var bugNumbers  = bugExporter.Export(data.Bugs);

            rawNumbers.AddRange(bugNumbers);

            var filter = new HashSet <uint>();

            foreach (var rawNumber in rawNumbers)
            {
                if (!filter.Contains(rawNumber))
                {
                    filter.Add(rawNumber);
                }
            }

            var svnRoot    = new Uri(svnRepository);
            var parameters = new ExportSvnParameters
            {
                Numbers         = new List <uint>(filter),
                SvnRepository   = svnRoot,
                TargetDirectory = targetDirectory
            };

            return(parameters);
        }