예제 #1
0
        private void miExtractBooks_Click(object sender, System.EventArgs e)
        {
            SelectBook selection = new SelectBook(new ArrayList(m_PacketRecorder.Books.Values));

            if (selection.ShowDialog() == DialogResult.OK)
            {
                BookInfo book = selection.GetSelectedBook();

                if (book != null && sfdExtractBook.ShowDialog() == DialogResult.OK)
                {
                    StreamWriter writer = null;
                    try
                    {
                        writer = File.CreateText(sfdExtractBook.FileName);
                        book.WriteRunUOClass(writer);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    finally
                    {
                        if (writer != null)
                        {
                            writer.Close();
                        }
                    }
                }
            }
        }
예제 #2
0
		private void miExtractBooks_Click( object sender, System.EventArgs e )
		{
			SelectBook selection = new SelectBook( new ArrayList( m_PacketRecorder.Books.Values ) );
			if ( selection.ShowDialog() == DialogResult.OK )
			{
				BookInfo book = selection.GetSelectedBook();

				if ( book != null && sfdExtractBook.ShowDialog() == DialogResult.OK )
				{
					StreamWriter writer = null;
					try
					{
						writer = File.CreateText( sfdExtractBook.FileName );
						book.WriteRunUOClass( writer );
					}
					catch ( Exception ex )
					{
						MessageBox.Show( ex.ToString(), "Save error", MessageBoxButtons.OK, MessageBoxIcon.Error );
					}
					finally
					{
						if ( writer != null )
							writer.Close();
					}
				}
			}
		}