Пример #1
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     try
     {
         var enumerable = pivotal.GetIteration(
             (Project) cboPivotalProjects.SelectedItem,
             (Pivotal.IterationVersion) cboPivotalIteration.SelectedItem);
         using (var stream = File.OpenWrite(@"c:\stories.csv"))
         {
             var serializer2 = new StorySerializer();
             serializer2.RowDelimiter = '\n';
             serializer2.ColumnDelimiter = '\t';
             serializer2.EncapsulateAllFieldsWith = '"';
             var serializer = serializer2;
             foreach (var iteration in enumerable)
             {
                 WriteStoriesToStream(iteration, iteration.Stories.stories, serializer, stream);
             }
             if (((Pivotal.IterationVersion) cboPivotalIteration.SelectedItem) ==
                 Pivotal.IterationVersion.All)
             {
                 var storiesByFilter =
                     pivotal.GetStoriesByFilter(
                         (Project) cboPivotalProjects.SelectedItem, "state:unscheduled");
                 WriteStoriesToStream(null, storiesByFilter, serializer, stream);
             }
             stream.Close();
         }
     }
     catch (Exception exception)
     {
         LogError(exception);
     }
     Cursor = Cursors.Arrow;
 }
Пример #2
0
 private static void WriteStoriesToStream(Iteration iteration, IEnumerable<Story> stories,
     StorySerializer serializer, FileStream tempFileStream)
 {
     int num;
     serializer.Iteration = iteration;
     var stream = serializer.Serialize(stories);
     var buffer = new byte[0x1000];
     while ((num = stream.Read(buffer, 0, buffer.Length)) > 0)
     {
         tempFileStream.Write(buffer, 0, num);
     }
 }