示例#1
0
        private void Export_Shown(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = sfdExport.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }

                mpb.Init("Export assembly...", (int)s3sa.Assembly.BaseStream.Length);
                byte[] data = new byte[s3sa.Assembly.BaseStream.Length];
                s3sa.Assembly.BaseStream.Read(data, 0, data.Length);

                using (FileStream fs = new FileStream(sfdExport.FileName, FileMode.Create, FileAccess.Write))
                {
                    fs.Write(data, 0, data.Length);
                }

                mpb.Done();
            }
            finally { this.Close(); }
        }
示例#2
0
        private void Import_Shown(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = ofdImport.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }

                using (FileStream fs = new FileStream(ofdImport.FileName, FileMode.Open, FileAccess.Read))
                {
                    mpb.Init("Import assembly...", (int)fs.Length);
                    s3sa.Assembly = new BinaryReader(fs);
                }

                result = (byte[])s3sa.AsBytes.Clone();
                Environment.ExitCode = 0;

                mpb.Done();
            }
            finally { this.Close(); }
        }