-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added '.NET Transactional File Manager' support, removed our implementation #166
Closed
AlexanderDzhoganov
wants to merge
4
commits into
KSP-CKAN:master
from
AlexanderDzhoganov:161_transactional_file_
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
06bbff5
Fixed a small bug with resetting the auto-start instance from GUI
AlexanderDzhoganov c2b2acc
Added '.NET TransactionalFileManager' to packages
AlexanderDzhoganov 17df16d
This should work now :)
AlexanderDzhoganov 4520272
Well.. with a few minor tweaks
AlexanderDzhoganov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ public struct NetAsyncDownloaderDownloadPart | |
public long bytesLeft; | ||
public int bytesPerSecond; | ||
public Exception error; | ||
public TransactionalFileWriter fileWriter; | ||
public FileStream fileStream; | ||
public int lastProgressUpdateSize; | ||
public DateTime lastProgressUpdateTime; | ||
public string path; | ||
|
@@ -57,7 +57,7 @@ public NetAsyncDownloader(Uri[] urls, string[] filenames = null) | |
public string[] StartDownload() | ||
{ | ||
var filePaths = new string[downloads.Length]; | ||
transaction = new FilesystemTransaction(KSPManager.CurrentInstance.TempDir()); | ||
transaction = new FilesystemTransaction(); | ||
|
||
for (int i = 0; i < downloads.Length; i++) | ||
{ | ||
|
@@ -87,8 +87,8 @@ public string[] StartDownload() | |
|
||
downloads[i].agent.DownloadFileCompleted += (sender, args) => FileDownloadComplete(index, args.Error); | ||
|
||
downloads[i].fileWriter = transaction.OpenFileWrite(downloads[i].path, false); | ||
downloads[i].agent.DownloadFileAsync(downloads[i].url, downloads[i].fileWriter.TemporaryPath); | ||
transaction.Snapshot(downloads[i].path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, is this snap-shotting the location that we're going to download to? (Presumably so we can remove a failed download if something goes wrong?) |
||
downloads[i].agent.DownloadFileAsync(downloads[i].url, downloads[i].path); | ||
} | ||
|
||
return filePaths; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh, we already have a method for doing this.
GenerateDefaultInstall()
. It's not the same as all the files in the archive; instead, we look for the top-most directory that has the same name as the module identifier, and install that.This is really my fault for not factoring out all the code into something which lets you supply a module and a zipfile, and get back the files which would be installed. (That was kinda what
FindInstallableFiles()
was meant to do, but it existed before we had default installs).I'll be sending you a PR on your PR, but it should be a pretty straightforward one. :)
FindInstallableFiles(Module, Zipfile)
or analogue thereof.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a terrible person, I didn't write something that gives back all the installable files from a Module and its Zipfile. I did patch it so it doesn't need FindAllFiles, and does match what would be installed. I also added a TODO. :)