Write package name and version into text file

This commit is contained in:
ProfessionalUwU 2023-06-18 22:55:15 +02:00
parent e609caf892
commit 07982425e0
Signed by: ProfessionalUwU
GPG Key ID: 9F28CB1645C4BFB5

View File

@ -66,14 +66,18 @@ public class PacserverUtils {
if (!File.Exists(filePath)) { if (!File.Exists(filePath)) {
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) { using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
using (StreamWriter sw = new StreamWriter(filePath)) { using (StreamWriter sw = new StreamWriter(filePath)) {
sw.WriteLine(""); foreach (string package in packageNamesAndVersion) {
sw.WriteLine(package);
}
} }
} }
} else if (File.Exists(filePath)) { } else if (File.Exists(filePath)) {
File.Delete(filePath); File.Delete(filePath);
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) { using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
using (var sw = new StreamWriter(filePath)) { using (var sw = new StreamWriter(filePath)) {
sw.WriteLine(""); foreach (string package in packageNamesAndVersion) {
sw.WriteLine(package);
}
} }
} }
} }