{"action":"created","issue":{"url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/272","repository_url":"https://api.github.com/repos/alphaleonis/AlphaFS","labels_url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/272/comments","events_url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/272/events","html_url":"https://github.com/alphaleonis/AlphaFS/issues/272","id":180454574,"number":272,"title":"Improve methods Directory/File.CopyMoveCore()","user":{"login":"Yomodo","id":10358198,"avatar_url":"https://avatars.githubusercontent.com/u/10358198?v=3","gravatar_id":"","url":"https://api.github.com/users/Yomodo","html_url":"https://github.com/Yomodo","followers_url":"https://api.github.com/users/Yomodo/followers","following_url":"https://api.github.com/users/Yomodo/following{/other_user}","gists_url":"https://api.github.com/users/Yomodo/gists{/gist_id}","starred_url":"https://api.github.com/users/Yomodo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yomodo/subscriptions","organizations_url":"https://api.github.com/users/Yomodo/orgs","repos_url":"https://api.github.com/users/Yomodo/repos","events_url":"https://api.github.com/users/Yomodo/events{/privacy}","received_events_url":"https://api.github.com/users/Yomodo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/alphaleonis/AlphaFS/labels/Discussion","name":"Discussion","color":"d4c5f9"},{"url":"https://api.github.com/repos/alphaleonis/AlphaFS/labels/Enhancement","name":"Enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"Yomodo","id":10358198,"avatar_url":"https://avatars.githubusercontent.com/u/10358198?v=3","gravatar_id":"","url":"https://api.github.com/users/Yomodo","html_url":"https://github.com/Yomodo","followers_url":"https://api.github.com/users/Yomodo/followers","following_url":"https://api.github.com/users/Yomodo/following{/other_user}","gists_url":"https://api.github.com/users/Yomodo/gists{/gist_id}","starred_url":"https://api.github.com/users/Yomodo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yomodo/subscriptions","organizations_url":"https://api.github.com/users/Yomodo/orgs","repos_url":"https://api.github.com/users/Yomodo/repos","events_url":"https://api.github.com/users/Yomodo/events{/privacy}","received_events_url":"https://api.github.com/users/Yomodo/received_events","type":"User","site_admin":false},"assignees":[{"login":"Yomodo","id":10358198,"avatar_url":"https://avatars.githubusercontent.com/u/10358198?v=3","gravatar_id":"","url":"https://api.github.com/users/Yomodo","html_url":"https://github.com/Yomodo","followers_url":"https://api.github.com/users/Yomodo/followers","following_url":"https://api.github.com/users/Yomodo/following{/other_user}","gists_url":"https://api.github.com/users/Yomodo/gists{/gist_id}","starred_url":"https://api.github.com/users/Yomodo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yomodo/subscriptions","organizations_url":"https://api.github.com/users/Yomodo/orgs","repos_url":"https://api.github.com/users/Yomodo/repos","events_url":"https://api.github.com/users/Yomodo/events{/privacy}","received_events_url":"https://api.github.com/users/Yomodo/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/alphaleonis/AlphaFS/milestones/6","html_url":"https://github.com/alphaleonis/AlphaFS/milestones/vNext","labels_url":"https://api.github.com/repos/alphaleonis/AlphaFS/milestones/6/labels","id":2038119,"number":6,"title":"vNext","description":"The next release after 2.1. (Presumably 2.2, but we will determine the next version on release depending on the features that made it in).","creator":{"login":"alphaleonis","id":5114354,"avatar_url":"https://avatars.githubusercontent.com/u/5114354?v=3","gravatar_id":"","url":"https://api.github.com/users/alphaleonis","html_url":"https://github.com/alphaleonis","followers_url":"https://api.github.com/users/alphaleonis/followers","following_url":"https://api.github.com/users/alphaleonis/following{/other_user}","gists_url":"https://api.github.com/users/alphaleonis/gists{/gist_id}","starred_url":"https://api.github.com/users/alphaleonis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphaleonis/subscriptions","organizations_url":"https://api.github.com/users/alphaleonis/orgs","repos_url":"https://api.github.com/users/alphaleonis/repos","events_url":"https://api.github.com/users/alphaleonis/events{/privacy}","received_events_url":"https://api.github.com/users/alphaleonis/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":2,"state":"open","created_at":"2016-09-29T16:51:38Z","updated_at":"2016-10-05T11:03:48Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-10-01T12:39:28Z","updated_at":"2016-10-05T17:38:39Z","closed_at":null,"body":"Improve methods `Directory/File.CopyMoveCore()`\r\n\r\nPossible to-do's:\r\n\r\n**1. Improve detection of same volume;**\r\nApplies to moving of files/folders. `Volume.IsSameVolume()` is used to check if the source and destination paths are on the same volume. This works well, even if source is a local path and destination a UNC path.\r\nFor example: Move from source : `C:\\Temp\\testfolder1` to destination : `\\\\host\\C$\\Temp\\testfolder2`\r\nHowever, the used Win32 API: `MoveFile()` fails miserably when encountering this combination of paths; it seems that the paths are only compared as strings by this function. A working solution is to apply some additional checks like doing our own path string comparison against local <> UNC paths.\r\n\r\n**2. Eliminate recursion;**\r\n`Directory.Move()` is recursive when it needs to copy an entire folder. Deep recursion eventually leads to stack overflow exceptions. Although I haven't yet encountered this with the current version of AlphaFS.\r\nAn alternative to recursion is the use of [trampoline](http://v2matveev.blogspot.nl/2010/03/fun-with-recursion.html). This means implementing a new folder copy mechanism.\r\n\r\n**3. Make code recursive-aware, skip additional path checks and validations;**\r\nIn recursion mode, `Directory.Copy()` performs path checks and validations for all items returned from directory enumeration. By making use of `pathFormat != PathFormat.LongFullPath` these additional checks can be skipped, improving overall performance.\r\n\r\nThese enhancements are quite easy to implement and will not break anything.\r\n\r\n**4. Combine (reduce) overloaded methods or, perhaps better, remove overloads.**\r\nIncluding Transacted methods, there are currently 16 `Copy()` and 12 `Move()` methods.\r\nSome of the methods return a `CopyMoveResult` class containing some info about the action. Other methods just return nothing (void). We could reduce the number by modifying the void methods to return a `CopyMoveResult` class, of course excluding the default .NET implementation.\r\nThe `CopyMoveResult` class can also be extended with some additional properties like `TotalFiles` and `TotalFolders`, since these numbers can be gathered during the copy progress. This is a breaking change since method signatures would be modified.\r\n\r\n**5. Introduce a: `Clone()` method with a `CloneOptions` parameter class to specify copy/move actions.**\r\nWe could also opt for this new method with an options class to greatly reduce the number of overload methods."},"comment":{"url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/comments/251744908","html_url":"https://github.com/alphaleonis/AlphaFS/issues/272#issuecomment-251744908","issue_url":"https://api.github.com/repos/alphaleonis/AlphaFS/issues/272","id":251744908,"user":{"login":"alphaleonis","id":5114354,"avatar_url":"https://avatars.githubusercontent.com/u/5114354?v=3","gravatar_id":"","url":"https://api.github.com/users/alphaleonis","html_url":"https://github.com/alphaleonis","followers_url":"https://api.github.com/users/alphaleonis/followers","following_url":"https://api.github.com/users/alphaleonis/following{/other_user}","gists_url":"https://api.github.com/users/alphaleonis/gists{/gist_id}","starred_url":"https://api.github.com/users/alphaleonis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphaleonis/subscriptions","organizations_url":"https://api.github.com/users/alphaleonis/orgs","repos_url":"https://api.github.com/users/alphaleonis/repos","events_url":"https://api.github.com/users/alphaleonis/events{/privacy}","received_events_url":"https://api.github.com/users/alphaleonis/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T17:38:39Z","updated_at":"2016-10-05T17:38:39Z","body":"Okay, sounds good. Let's disregard 4/5 then. And when it comes to 2 I don't know which is best, Queue or Stack, only determines the order in which things are made I guess. :)"}}
{"actor":{"display_login":"alphaleonis"}}