• 大小: 0.20M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-25
  • 语言: C#
  • 标签: 源码  刻录  C#  

资源简介

C#光盘刻录源码

资源截图

代码片段和文件信息

using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Windows.Forms;
using IMAPI2.Interop;
using IMAPI2.MediaItem;


namespace BurnMedia
{

    public partial class MainForm : Form
    {
        private const string ClientName = “BurnMedia“;

        Int64 _totalDiscSize;

        private bool _isBurning;
        private bool _isFormatting;
        private IMAPI_BURN_VERIFICATION_LEVEL _verificationLevel = 
            IMAPI_BURN_VERIFICATION_LEVEL.IMAPI_BURN_VERIFICATION_NONE;
        private bool _closeMedia;
        private bool _ejectMedia;

        private BurnData _burnData = new BurnData();

        public MainForm()
        {
            InitializeComponent();
        }

        /// 
        /// Initialize the form
        /// 

        /// 
        /// 
        private void MainForm_Load(object sender EventArgs e)
        {
            //
            // Determine the current recording devices
            //
            MsftDiscMaster2 discMaster = null;
            try
            {
                discMaster = new MsftDiscMaster2();

                if (!discMaster.IsSupportedEnvironment)
                    return;
                foreach (string uniqueRecorderId in discMaster)
                {
                    var discRecorder2 = new MsftDiscRecorder2();
                    discRecorder2.InitializeDiscRecorder(uniqueRecorderId);

                    devicesComboBox.Items.Add(discRecorder2);
                }
                if (devicesComboBox.Items.Count > 0)
                {
                    devicesComboBox.SelectedIndex = 0;
                }
            }
            catch (COMException ex)
            {
                MessageBox.Show(ex.Message
                    string.Format(“Error:{0} - Please install IMAPI2“ ex.ErrorCode)
                    MessageBoxButtons.OK MessageBoxIcon.Stop);
                return;
            }
            finally
            {
                if (discMaster != null)
                {
                    Marshal.ReleaseComobject(discMaster);
                }
            }


            //
            // Create the volume label based on the current date
            //
            DateTime now = DateTime.Now;
            textBoxLabel.Text = now.Year + “_“ + now.Month + “_“ + now.Day;

            labelStatusText.Text = string.Empty;
            labelFormatStatusText.Text = string.Empty;

            //
            // Select no verification by default
            //
            comboBoxVerification.SelectedIndex = 0;

            UpdateCapacity();
        }

        private void MainForm_FormClosing(object sender FormClosingEventArgs e)
        {
            //
            /

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        5487  2010-03-22 08:23  BurnMedia.csproj
     文件        1813  2010-03-22 08:23  BurnMedia.sln
     文件       41470  2010-03-22 10:13  MainForm.cs
     文件       27097  2010-03-22 08:23  MainForm.Designer.cs
     文件      144150  2010-03-22 08:23  MainForm.resx
     文件         484  2010-03-22 08:23  Program.cs
     文件        1231  2010-03-22 08:23  Interop\BurnData.cs
     文件      139083  2010-03-22 08:46  Interop\Imapi2Interop.cs
     文件        4255  2010-03-22 08:23  MediaItem\DirectoryItem.cs
     文件        3748  2010-03-22 08:23  MediaItem\FileItem.cs
     文件         769  2010-03-22 08:23  MediaItem\IMediaItem.cs
     文件        1570  2010-03-22 08:23  MediaItem\Win32.cs
     文件         725  2010-03-22 08:23  Properties\app.manifest
     文件        1916  2010-03-22 08:23  Properties\AssemblyInfo.cs
     文件        2847  2010-03-22 08:23  Properties\Resources.Designer.cs
     文件        5612  2010-03-22 08:23  Properties\Resources.resx
     文件        1094  2010-03-22 08:23  Properties\Settings.Designer.cs
     文件         249  2010-03-22 08:23  Properties\Settings.settings
     文件       91468  2010-03-22 08:23  app.ico

评论

共有 条评论