Compare commits
3 Commits
dc811d7462
...
65b15f657d
Author | SHA1 | Date | |
---|---|---|---|
|
65b15f657d | ||
|
82a854dd8b | ||
|
5018856aab |
@ -63,21 +63,14 @@ public class PacserverUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writePackageNamesAndVersionToFile(string filePath) {
|
public void writePackageNamesAndVersionToFile(string filePath) {
|
||||||
if (!File.Exists(filePath)) {
|
if (File.Exists(filePath)) {
|
||||||
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
|
||||||
using (StreamWriter sw = new StreamWriter(filePath)) {
|
|
||||||
foreach (string package in packageNamesAndVersion) {
|
|
||||||
sw.WriteLine(package);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (File.Exists(filePath)) {
|
|
||||||
File.Delete(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) {
|
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
||||||
sw.WriteLine(package);
|
using (StreamWriter sw = new StreamWriter(filePath)) {
|
||||||
}
|
foreach (string package in packageNamesAndVersion) {
|
||||||
|
sw.WriteLine(package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,18 +104,13 @@ public class PacserverUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeDatabaseAccessTimeToFile(string filePath, string database) {
|
public void writeDatabaseAccessTimeToFile(string filePath, string database) {
|
||||||
if (!File.Exists(filePath)) {
|
if (File.Exists(filePath)) {
|
||||||
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
|
||||||
using (StreamWriter sw = new StreamWriter(filePath)) {
|
|
||||||
sw.WriteLine(database + " " + File.GetLastAccessTime(database));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (File.Exists(filePath)) {
|
|
||||||
File.Delete(filePath);
|
File.Delete(filePath);
|
||||||
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
}
|
||||||
using (var sw = new StreamWriter(filePath)) {
|
|
||||||
sw.WriteLine(database + " " + File.GetLastAccessTime(database));
|
using (File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)) {
|
||||||
}
|
using (StreamWriter sw = new StreamWriter(filePath)) {
|
||||||
|
sw.WriteLine(database + " " + File.GetLastAccessTime(database));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,21 +118,10 @@ public class PacserverUtils {
|
|||||||
public List<String> databasesToTransfer = new List<String>();
|
public List<String> databasesToTransfer = new List<String>();
|
||||||
public void filterDiffOutputForDatabases() {
|
public void filterDiffOutputForDatabases() {
|
||||||
foreach (string database in diffOfPackagesOrDatabases) {
|
foreach (string database in diffOfPackagesOrDatabases) {
|
||||||
databasesToTransfer.Add(getDatabaseFromRegex(database, @"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/*db")); // https://regex101.com/r/Wm5M0P/1
|
databasesToTransfer.Add(Regex.Match(database, @"\/(?:[\w.-]+\/)*[\w.-]+(?:\.\w+)*\/*db").Value); // https://regex101.com/r/Wm5M0P/1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getDatabaseFromRegex(string input, string pattern) {
|
|
||||||
string match = string.Empty;
|
|
||||||
MatchCollection matchCollection = Regex.Matches(input, pattern);
|
|
||||||
|
|
||||||
foreach (Match matches in matchCollection) {
|
|
||||||
match = matches.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<String> newerPackagesAndDatabases = new List<String>();
|
private static List<String> newerPackagesAndDatabases = new List<String>();
|
||||||
public async void transferPacmanCache() {
|
public async void transferPacmanCache() {
|
||||||
HttpClient client = new HttpClient();
|
HttpClient client = new HttpClient();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user