Compare commits
No commits in common. "99df9a9dfd838603e5b47016f29c1b58d6ce9be9" and "3b9d4a6735ac75a95e89a29c446f25703d9b44f1" have entirely different histories.
99df9a9dfd
...
3b9d4a6735
@ -208,6 +208,7 @@ public partial class Server : GlobalBase, IDisposable
|
|||||||
response.ContentType = "image/jpeg";
|
response.ContentType = "image/jpeg";
|
||||||
response.AddHeader("Cache-Control", "max-age=600");
|
response.AddHeader("Cache-Control", "max-age=600");
|
||||||
stream.CopyTo(response.OutputStream);
|
stream.CopyTo(response.OutputStream);
|
||||||
|
response.OutputStream.Close();
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -98,12 +98,13 @@ public static class TrangaSettings
|
|||||||
public static void UpdateDownloadLocation(string newPath, bool moveFiles = true)
|
public static void UpdateDownloadLocation(string newPath, bool moveFiles = true)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
Directory.CreateDirectory(newPath, GroupRead | GroupWrite | None | OtherRead | OtherWrite | UserRead | UserWrite);
|
Directory.CreateDirectory(newPath,
|
||||||
|
GroupRead | GroupWrite | None | OtherRead | OtherWrite | UserRead | UserWrite);
|
||||||
else
|
else
|
||||||
Directory.CreateDirectory(newPath);
|
Directory.CreateDirectory(newPath);
|
||||||
|
|
||||||
if (moveFiles)
|
if (moveFiles && Directory.Exists(TrangaSettings.downloadLocation))
|
||||||
MoveContentsOfDirectoryTo(TrangaSettings.downloadLocation, newPath);
|
Directory.Move(TrangaSettings.downloadLocation, newPath);
|
||||||
|
|
||||||
TrangaSettings.downloadLocation = newPath;
|
TrangaSettings.downloadLocation = newPath;
|
||||||
ExportSettings();
|
ExportSettings();
|
||||||
@ -112,38 +113,15 @@ public static class TrangaSettings
|
|||||||
public static void UpdateWorkingDirectory(string newPath)
|
public static void UpdateWorkingDirectory(string newPath)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
Directory.CreateDirectory(newPath, GroupRead | GroupWrite | None | OtherRead | OtherWrite | UserRead | UserWrite);
|
Directory.CreateDirectory(newPath,
|
||||||
|
GroupRead | GroupWrite | None | OtherRead | OtherWrite | UserRead | UserWrite);
|
||||||
else
|
else
|
||||||
Directory.CreateDirectory(newPath);
|
Directory.CreateDirectory(newPath);
|
||||||
|
Directory.Move(TrangaSettings.workingDirectory, newPath);
|
||||||
MoveContentsOfDirectoryTo(TrangaSettings.workingDirectory, newPath);
|
|
||||||
|
|
||||||
TrangaSettings.workingDirectory = newPath;
|
TrangaSettings.workingDirectory = newPath;
|
||||||
ExportSettings();
|
ExportSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MoveContentsOfDirectoryTo(string oldDir, string newDir)
|
|
||||||
{
|
|
||||||
string[] directoryPaths = Directory.GetDirectories(oldDir);
|
|
||||||
string[] filePaths = Directory.GetFiles(oldDir);
|
|
||||||
foreach (string file in filePaths)
|
|
||||||
{
|
|
||||||
string newPath = Path.Join(newDir, Path.GetFileName(file));
|
|
||||||
File.Move(file, newPath, true);
|
|
||||||
}
|
|
||||||
foreach(string directory in directoryPaths)
|
|
||||||
{
|
|
||||||
string? dirName = Path.GetDirectoryName(directory);
|
|
||||||
if(dirName is null)
|
|
||||||
continue;
|
|
||||||
string newPath = Path.Join(newDir, dirName);
|
|
||||||
if(Directory.Exists(newPath))
|
|
||||||
MoveContentsOfDirectoryTo(directory, newPath);
|
|
||||||
else
|
|
||||||
Directory.Move(directory, newPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateUserAgent(string? customUserAgent)
|
public static void UpdateUserAgent(string? customUserAgent)
|
||||||
{
|
{
|
||||||
TrangaSettings.userAgent = customUserAgent ?? DefaultUserAgent;
|
TrangaSettings.userAgent = customUserAgent ?? DefaultUserAgent;
|
||||||
|
Loading…
Reference in New Issue
Block a user