Created
May 26, 2023 17:34
-
-
Save puppis42/b9e75b185367ac4974408abdc4a7b450 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace Zip_File_Edit_Text | |
{ | |
public partial class Frm_Main : Form | |
{ | |
public Frm_Main() | |
{ | |
InitializeComponent(); | |
} | |
string code = ""; | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
File.Copy(Application.ExecutablePath, @"C:\Users\uname\Desktop\tkk.txt"); | |
try | |
{ // Open the text file using a stream reader. | |
using (StreamReader sr = new StreamReader(@"C:\Users\uname\Desktop\tkk.txt")) | |
{ | |
// Read the stream to a string, and write the string to the console. | |
String line = sr.ReadToEnd(); | |
code = line; | |
} | |
} | |
catch | |
{ | |
} | |
using (FileStream zipToOpen = new FileStream(@"C:\Users\uname\Desktop\gg.zip", FileMode.Open)) | |
{ | |
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update)) | |
{ | |
ZipArchiveEntry readmeEntry = archive.CreateEntry("a.exe"); | |
using (StreamWriter writer = new StreamWriter(readmeEntry.Open())) | |
{ | |
writer.WriteLine(code); | |
} | |
} | |
} | |
File.Delete(@"C:\Users\uname\Desktop\tkk.txt"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment