0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

cscの作法 その155

Last updated at Posted at 2022-04-28

概要

cscの作法、調べてみた。
sevenzipsharp.dll使ってみた。
圧縮してみた。

参考にしたページ

コンパイル手順

  • sevenzipsharp.dll(0.64)をダウンロード。
  • 7z.dllをダウンロード。
  • コンパイル
>csc 7z0.cs /platform:x86 /reference:sevenzipsharp.dll

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;
using SevenZip;

namespace seven
{
	public class Form1 : Form {
		public Button button1;
		public Form1() {
			Text = "7z";
			button1 = new Button();
			button1.Location = new System.Drawing.Point(50, 50);
			button1.Size = new System.Drawing.Size(100, 30);
			button1.Text = "test";
			Controls.Add(button1);
			button1.Click += new EventHandler(button1_Click);
		}
		private void button1_Click(object sender, EventArgs e) {
			SevenZipBase.SetLibraryPath("7z.dll");
			SevenZipCompressor compressor = new SevenZipCompressor();
			compressor.CompressDirectory(Environment.CurrentDirectory + "\\archive", "archive.7z");
		}
		[STAThread]
		static void Main() {
			Application.Run(new Form1());
		}
	}
}





以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?