Ejemplo n.º 1
0
        private ExportSvnParameters ExportZentaoStory(string svnRepository, string targetDirectory)
        {
            var stories = new List <int>();

            foreach (var rawStory in txtZentaoStory.Lines)
            {
                if (string.IsNullOrWhiteSpace(rawStory))
                {
                    continue;
                }

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

                    stories.Add(story);
                }
            }

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

            var storyExporter = new ZentaoDbStoryRevisionExporter();
            var storyNumbers  = storyExporter.Export(stories);

            var filter = new HashSet <uint>();

            foreach (var rawBugNumber in storyNumbers)
            {
                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);
        }
Ejemplo n.º 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);
        }