refactor writePackageNamesAndVersionToFile
This commit is contained in:
parent
dc811d7462
commit
5018856aab
@ -63,7 +63,10 @@ public class PacserverUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writePackageNamesAndVersionToFile(string filePath) {
|
public void writePackageNamesAndVersionToFile(string filePath) {
|
||||||
if (!File.Exists(filePath)) {
|
if (File.Exists(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 (StreamWriter sw = new StreamWriter(filePath)) {
|
using (StreamWriter sw = new StreamWriter(filePath)) {
|
||||||
foreach (string package in packageNamesAndVersion) {
|
foreach (string package in packageNamesAndVersion) {
|
||||||
@ -71,16 +74,6 @@ public class PacserverUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (File.Exists(filePath)) {
|
|
||||||
File.Delete(filePath);
|
|
||||||
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
|
||||||
using (var sw = new StreamWriter(filePath)) {
|
|
||||||
foreach (string package in packageNamesAndVersion) {
|
|
||||||
sw.WriteLine(package);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> diffOfPackagesOrDatabases = new List<String>();
|
public List<String> diffOfPackagesOrDatabases = new List<String>();
|
||||||
|
Loading…
Reference in New Issue
Block a user