├── StrongSign.pfx ├── Tools ├── StrongSign.pfx ├── IBackgroundWorker.cs ├── packages.config ├── app.config ├── BackgroundWorker.cs ├── BackgroundWorker{TParam}.cs ├── UniqueBackgroundWorker.cs ├── UniqueBackgroundWorker{TParam}.cs ├── PipeExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── Processes.cs ├── HttpWebRequestExtensions.cs └── Tools.csproj ├── images ├── Uploadhere.png ├── ContextMenu.png └── AmazonCloudDrive.png ├── Cloud.DokanNet.IntegrationTests ├── Cloud.DokanNet.IntegrationTests.h ├── App.config ├── stdafx.cpp ├── targetver.h ├── Program.cs ├── stdafx.h ├── Properties │ └── AssemblyInfo.cs ├── Cloud.DokanNet.IntegrationTests.vcxproj.filters ├── ReadMe.txt ├── Cloud.DokanNet.IntegrationTests.cpp └── Cloud.DokanNet.IntegrationTests.csproj ├── ACD.DokanNet.Gui ├── app_all.ico ├── StrongSign.pfx ├── images │ ├── app_all.ico │ ├── ErrorMark.png │ └── lib_load_error.png ├── AvailableCloud.cs ├── StatusToolTip.xaml.cs ├── FileItem.xaml.cs ├── TaskbarIcon Commands │ ├── OpenAppSettingsCommand.cs │ ├── DownloadUpdateCommand.cs │ └── ModelBasedCommand.cs ├── BoolToVisibility.cs ├── AvailableCloudsList.xaml.cs ├── packages.config ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs ├── CloudItemControl.xaml.cs ├── AvailableCloudsList.xaml ├── App.xaml ├── FileItem.xaml ├── StatusToolTip.xaml ├── App.config ├── CloudItemControl.xaml └── UpdateChecker.cs ├── ACDDokanNetInstaller ├── srm.exe ├── mykey.pfx └── ModifyMsiToEnableLaunchApplication.js ├── Cloud.Common ├── StrongSign.pfx ├── NodeShareType.cs ├── NodeExtendedInfo.cs ├── INodeExtendedInfoTempLink.cs ├── INodeExtendedInfoWebLink.cs ├── IAuthUpdateListener.cs ├── CloudDokanNetAssetInfoImage.cs ├── INodeExtendedInfo.cs ├── packages.config ├── CloudDokanNetUploadHereInfo.cs ├── CloudDokanNetItemInfo.cs ├── CloudException.cs ├── CloudInfoCollection.cs ├── CloudDokanNetAssetInfo.cs ├── Properties │ └── AssemblyInfo.cs ├── IHttpCloud.cs ├── CloudInfo.cs ├── Cloud.Common.csproj └── FSItem.cs ├── AmazonCloudDrive ├── StrongSign.pfx ├── images │ └── cd_icon.png ├── packages.config ├── AuthInfo.cs ├── app.config ├── MountWaitBox.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ └── Resources.Designer.cs ├── MountWaitBox.xaml └── AmazonCloudDrive.csproj ├── ShellExtension ├── StrongSign.pfx ├── packages.config ├── GlobalSuppressions.cs ├── Common.cs ├── Properties │ └── AssemblyInfo.cs └── NativeMethods.cs ├── MicrosoftOneDrive ├── StrongSign.pfx ├── images │ └── cd_icon.png ├── HttpWebException.cs ├── packages.config ├── app.config └── Properties │ └── AssemblyInfo.cs ├── Cloud.DokanNet.Console ├── StrongSign.pfx ├── App.config ├── Properties │ └── AssemblyInfo.cs ├── Program.cs └── Cloud.DokanNet.Console.csproj ├── amazon-clouddrive-dokan ├── StrongSign.pfx ├── Properties │ ├── Settings.settings │ └── AssemblyInfo.cs ├── MainWindow.xaml.cs ├── IBlockStream.cs ├── MainWindow.xaml ├── DownloadStatisticInfo.cs ├── Block.cs ├── DummyBlockStream.cs ├── UploadStatisticInfo.cs ├── packages.config ├── NativeMethods.cs ├── AStatisticFileInfo.cs ├── AbstractBlockStream.cs ├── ByteArrayBlockWriter.cs ├── CacheEntry.cs ├── DokanLogger.cs ├── App.config ├── ByteArrayBlockReader.cs ├── IFSProvider.cs ├── UploadInfo.cs ├── VirtualDriveWrapper.cs ├── Downloader.cs ├── NewFileBlockWriter.cs └── RootFolderFSProvider.cs ├── ShellExtension.Tests ├── ContextMenuTest.cs ├── Properties │ ├── AssemblyInfo.cs │ └── PexAssemblyInfo.cs └── packages.config ├── .gitmodules ├── PrivacyNotice.txt ├── Cloud.DokanNet ├── IAbsoluteCacheItem.cs ├── DokanLogger.cs ├── BlockingQueue.cs └── Block.cs ├── amazon-clouddrive-dokan.sln.DotSettings ├── amazon-clouddrive-dokanTests ├── GlobalSuppressions.cs ├── packages.config ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs ├── NewFileBlockWriterTests.cs ├── app.config └── FSProviderTestsBase.cs ├── Build.md ├── licence.txt ├── Cloud.DokanNetTests ├── app.config ├── BlockTests.cs └── Properties │ └── Settings.Designer.cs ├── .gitattributes ├── Cloud.DokanNet.ruleset └── .gitignore /StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/StrongSign.pfx -------------------------------------------------------------------------------- /Tools/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/Tools/StrongSign.pfx -------------------------------------------------------------------------------- /images/Uploadhere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/images/Uploadhere.png -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/Cloud.DokanNet.IntegrationTests.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int main(); 4 | -------------------------------------------------------------------------------- /images/ContextMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/images/ContextMenu.png -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/app_all.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACD.DokanNet.Gui/app_all.ico -------------------------------------------------------------------------------- /ACDDokanNetInstaller/srm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACDDokanNetInstaller/srm.exe -------------------------------------------------------------------------------- /Cloud.Common/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/Cloud.Common/StrongSign.pfx -------------------------------------------------------------------------------- /images/AmazonCloudDrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/images/AmazonCloudDrive.png -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACD.DokanNet.Gui/StrongSign.pfx -------------------------------------------------------------------------------- /ACDDokanNetInstaller/mykey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACDDokanNetInstaller/mykey.pfx -------------------------------------------------------------------------------- /AmazonCloudDrive/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/AmazonCloudDrive/StrongSign.pfx -------------------------------------------------------------------------------- /ShellExtension/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ShellExtension/StrongSign.pfx -------------------------------------------------------------------------------- /MicrosoftOneDrive/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/MicrosoftOneDrive/StrongSign.pfx -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/images/app_all.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACD.DokanNet.Gui/images/app_all.ico -------------------------------------------------------------------------------- /AmazonCloudDrive/images/cd_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/AmazonCloudDrive/images/cd_icon.png -------------------------------------------------------------------------------- /MicrosoftOneDrive/images/cd_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/MicrosoftOneDrive/images/cd_icon.png -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/images/ErrorMark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACD.DokanNet.Gui/images/ErrorMark.png -------------------------------------------------------------------------------- /Cloud.DokanNet.Console/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/Cloud.DokanNet.Console/StrongSign.pfx -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/StrongSign.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/amazon-clouddrive-dokan/StrongSign.pfx -------------------------------------------------------------------------------- /ShellExtension.Tests/ContextMenuTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ShellExtension.Tests/ContextMenuTest.cs -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/images/lib_load_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ACD.DokanNet.Gui/images/lib_load_error.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "AmazonCloudDriveApi"] 2 | path = AmazonCloudDriveApi 3 | url = https://github.com/Rambalac/AmazonCloudDriveApi.git 4 | -------------------------------------------------------------------------------- /MicrosoftOneDrive/HttpWebException.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.MicrosoftOneDrive 2 | { 3 | internal class HttpWebException 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /ShellExtension.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ShellExtension.Tests/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /ShellExtension.Tests/Properties/PexAssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rambalac/ACDDokanNet/HEAD/ShellExtension.Tests/Properties/PexAssemblyInfo.cs -------------------------------------------------------------------------------- /Cloud.Common/NodeShareType.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public enum NodeShareType 4 | { 5 | ReadOnly, 6 | ReadWrite 7 | } 8 | } -------------------------------------------------------------------------------- /Cloud.Common/NodeExtendedInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public class NodeExtendedInfo 4 | { 5 | public string Type { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /Cloud.Common/INodeExtendedInfoTempLink.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public interface INodeExtendedInfoTempLink 4 | { 5 | string TempLink { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /Cloud.Common/INodeExtendedInfoWebLink.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public interface INodeExtendedInfoWebLink 4 | { 5 | string WebLink { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /Cloud.Common/IAuthUpdateListener.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public interface IAuthUpdateListener 4 | { 5 | void OnAuthUpdated(IHttpCloud sender, string authinfo); 6 | } 7 | } -------------------------------------------------------------------------------- /Cloud.DokanNet.Console/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Cloud.Common/CloudDokanNetAssetInfoImage.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public class CloudDokanNetAssetInfoImage 4 | { 5 | public int Height { get; set; } 6 | 7 | public int Width { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /PrivacyNotice.txt: -------------------------------------------------------------------------------- 1 | All your files are yours. 2 | App is not using any intermediate server and only your PC will have access to your files. 3 | No cookies are saved and saved information is used only to reconnect you to your cloud account. 4 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Cloud.Common/INodeExtendedInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public interface INodeExtendedInfo 4 | { 5 | string Id { get; } 6 | 7 | bool CanShareReadOnly { get; } 8 | 9 | bool CanShareReadWrite { get; } 10 | } 11 | } -------------------------------------------------------------------------------- /AmazonCloudDrive/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Cloud.Common/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Tools/IBackgroundWorker.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public interface IBackgroundWorker 6 | { 7 | Task Run(TParam param); 8 | } 9 | 10 | public interface IBackgroundWorker 11 | { 12 | Task Run(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Cloud.Common/CloudDokanNetUploadHereInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class CloudDokanNetUploadHereInfo 6 | { 7 | public const string StreamName = "UploadHere"; 8 | 9 | public List Files { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /AmazonCloudDrive/AuthInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.AmazonCloudDrive 2 | { 3 | using System; 4 | 5 | public class AuthInfo 6 | { 7 | public string AuthRenewToken { get; set; } 8 | 9 | public string AuthToken { get; set; } 10 | 11 | public DateTime AuthTokenExpiration { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/AvailableCloud.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | public class AvailableCloud 4 | { 5 | public string ClassName { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public string Icon { get; set; } 10 | 11 | public string AssemblyFileName { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/StatusToolTip.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | /// 4 | /// Interaction logic for StatusToolTip.xaml 5 | /// 6 | public partial class StatusToolTip 7 | { 8 | public StatusToolTip() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Cloud.DokanNet.IntegrationTests.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Azi.ACDDokanNet 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Cloud.DokanNet.IntegrationTests 8 | { 9 | class Program 10 | { 11 | 12 | 13 | static void Main(string[] args) 14 | { 15 | 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Cloud.DokanNet/IAbsoluteCacheItem.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System.Threading.Tasks; 4 | using Azi.Cloud.Common; 5 | 6 | public interface IAbsoluteCacheItem 7 | { 8 | FSItem FSItem { get; } 9 | 10 | void Dispose(); 11 | 12 | Task GetBlock(long blockIndex); 13 | 14 | void ReleaseBlock(Block block); 15 | } 16 | } -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | // TODO: reference additional headers your program requires here 14 | -------------------------------------------------------------------------------- /Cloud.Common/CloudDokanNetItemInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class CloudDokanNetItemInfo : CloudDokanNetAssetInfo 6 | { 7 | public const string StreamName = "CloudDokanNetInfo"; 8 | 9 | public IList Assets { get; set; } 10 | 11 | public string Type => nameof(CloudDokanNetItemInfo); 12 | } 13 | } -------------------------------------------------------------------------------- /Tools/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Cloud.Common/CloudException.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | using System; 4 | using System.Net; 5 | 6 | [Serializable] 7 | public class CloudException : Exception 8 | { 9 | public CloudException(HttpStatusCode error, Exception ex) 10 | : base($"{ex.Message} ({(int)error})", ex) 11 | { 12 | Error = error; 13 | } 14 | 15 | public HttpStatusCode Error { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /Tools/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Cloud.Common/CloudInfoCollection.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | using System.Collections.Generic; 4 | using System.Configuration; 5 | 6 | [SettingsSerializeAs(SettingsSerializeAs.Xml)] 7 | public class CloudInfoCollection : List 8 | { 9 | public CloudInfoCollection() 10 | { 11 | } 12 | 13 | public CloudInfoCollection(IEnumerable clouds) 14 | : base(clouds) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ShellExtension/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/BackgroundWorker.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public class BackgroundWorker : IBackgroundWorker 7 | { 8 | public BackgroundWorker(Action action) 9 | { 10 | Action = action; 11 | } 12 | 13 | public Action Action { get; set; } 14 | 15 | public virtual Task Run() 16 | { 17 | return Task.Factory.StartNew(Action, TaskCreationOptions.LongRunning); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Tools/BackgroundWorker{TParam}.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public class BackgroundWorker : IBackgroundWorker 7 | { 8 | public BackgroundWorker(Action action) 9 | { 10 | Action = action; 11 | } 12 | 13 | public Action Action { get; set; } 14 | 15 | public virtual Task Run(TParam param) 16 | { 17 | return Task.Run(() => Action(param)); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /AmazonCloudDrive/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/IBlockStream.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public interface IBlockStream : IDisposable 7 | { 8 | Func OnClose { get; set; } 9 | 10 | Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000); 11 | 12 | Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000); 13 | 14 | void Close(); 15 | 16 | void Flush(); 17 | 18 | void SetLength(long len); 19 | } 20 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/DownloadStatisticInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using Common; 4 | 5 | public class DownloadStatisticInfo : AStatisticFileInfo 6 | { 7 | private readonly FSItem info; 8 | 9 | public DownloadStatisticInfo(FSItem info) 10 | { 11 | this.info = info; 12 | } 13 | 14 | public override long Total => info.Length; 15 | 16 | public override string Id => info.Id; 17 | 18 | public override string FileName => info.Name; 19 | 20 | public override string Path => info.Path; 21 | } 22 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/FileItem.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System.Windows; 4 | 5 | /// 6 | /// Interaction logic for FileItem.xaml 7 | /// 8 | public partial class FileItem 9 | { 10 | public FileItem() 11 | { 12 | InitializeComponent(); 13 | } 14 | 15 | private FileItemInfo Item => (FileItemInfo)DataContext; 16 | 17 | private void DismissButton_Click(object sender, RoutedEventArgs e) 18 | { 19 | App.MyApp.Model.UploadFiles.Remove(Item); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/Block.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | 5 | internal class Block 6 | { 7 | public Block(string itemid, long n, byte[] d) 8 | { 9 | Key = GetKey(itemid, n); 10 | Data = d; 11 | } 12 | 13 | public string Key { get; private set; } 14 | 15 | public DateTime Access { get; set; } = DateTime.UtcNow; 16 | 17 | public byte[] Data { get; private set; } 18 | 19 | internal static string GetKey(string id, long intervalStart) 20 | { 21 | return id + '\0' + intervalStart; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/TaskbarIcon Commands/OpenAppSettingsCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System; 4 | using System.Windows.Input; 5 | 6 | public class OpenAppSettingsCommand : ICommand 7 | { 8 | public event EventHandler CanExecuteChanged; 9 | 10 | public bool CanExecute(object parameter) => true; 11 | 12 | public void Execute(object parameter) 13 | { 14 | App.MyApp.OpenSettings(); 15 | } 16 | 17 | protected virtual void OnCanExecuteChanged() 18 | { 19 | CanExecuteChanged?.Invoke(this, EventArgs.Empty); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MicrosoftOneDrive/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ShellExtension.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | MD 4 | STA -------------------------------------------------------------------------------- /ShellExtension/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Annoying")] 7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "Pending")] 8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "Pending")] -------------------------------------------------------------------------------- /amazon-clouddrive-dokanTests/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Annoying")] 7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "Pending")] 8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "Pending")] -------------------------------------------------------------------------------- /Cloud.Common/CloudDokanNetAssetInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | public class CloudDokanNetAssetInfo : INodeExtendedInfoTempLink, INodeExtendedInfoWebLink, INodeExtendedInfo 4 | { 5 | public const string StreamNameShareReadOnly = "ShareReadOnly"; 6 | public const string StreamNameShareReadWrite = "ShareReadWrite"; 7 | 8 | public bool CanShareReadOnly { get; set; } = false; 9 | 10 | public bool CanShareReadWrite { get; set; } = false; 11 | 12 | public string Id { get; set; } 13 | 14 | public CloudDokanNetAssetInfoImage Image { get; set; } 15 | 16 | public string TempLink { get; set; } 17 | 18 | public CloudDokanNetAssetInfoImage Video { get; set; } 19 | 20 | public string WebLink { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/BoolToVisibility.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | public class BoolToVisibility : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (!(value is bool)) 13 | { 14 | return Visibility.Hidden; 15 | } 16 | 17 | return (bool)value ? Visibility.Visible : Visibility.Hidden; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Tools/UniqueBackgroundWorker.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public class UniqueBackgroundWorker : BackgroundWorker 7 | { 8 | private readonly object lockObject = new object(); 9 | 10 | public UniqueBackgroundWorker(Action action) 11 | : base(action) 12 | { 13 | } 14 | 15 | public Task Task { get; private set; } 16 | 17 | public override Task Run() 18 | { 19 | lock (lockObject) 20 | { 21 | if (Task != null && !Task.IsCompleted) 22 | { 23 | return Task; 24 | } 25 | 26 | Task = base.Run(); 27 | return Task; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/DummyBlockStream.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public class DummyBlockStream : AbstractBlockStream 6 | { 7 | public override void Flush() 8 | { 9 | } 10 | 11 | public override Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000) 12 | { 13 | return Task.FromResult(0); 14 | } 15 | 16 | public override void SetLength(long len) 17 | { 18 | } 19 | 20 | public override Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000) 21 | { 22 | return Task.FromResult(0); 23 | } 24 | 25 | protected override void Dispose(bool disposing) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/UploadStatisticInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | public class UploadStatisticInfo : AStatisticFileInfo 4 | { 5 | private readonly UploadInfo info; 6 | 7 | public UploadStatisticInfo(UploadInfo info) 8 | { 9 | this.info = info; 10 | } 11 | 12 | public UploadStatisticInfo(UploadInfo info, string message) 13 | { 14 | this.info = info; 15 | ErrorMessage = message; 16 | } 17 | 18 | public override long Total => info.Length; 19 | 20 | public override string Id => info.Id; 21 | 22 | public override string FileName => System.IO.Path.GetFileName(info.Path); 23 | 24 | public override string Path => info.Path; 25 | 26 | public UploadState State { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/AvailableCloudsList.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// Interaction logic for AvailableCloudsList.xaml 9 | /// 10 | public partial class AvailableCloudsList 11 | { 12 | public AvailableCloudsList() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | public event EventHandler Clicked; 18 | 19 | private ViewModel Model => (ViewModel)DataContext; 20 | 21 | private void ListBox_Selected(object sender, RoutedEventArgs e) 22 | { 23 | var button = (Button)sender; 24 | 25 | Model.AddCloud((AvailableCloud)button.DataContext); 26 | 27 | Clicked?.Invoke(this, null); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Tools/UniqueBackgroundWorker{TParam}.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public class UniqueBackgroundWorker : BackgroundWorker 7 | { 8 | private readonly object lockObject = new object(); 9 | 10 | public UniqueBackgroundWorker(Action action) 11 | : base(action) 12 | { 13 | } 14 | 15 | public Task Task { get; private set; } 16 | 17 | public override Task Run(TParam param) 18 | { 19 | lock (lockObject) 20 | { 21 | if (Task != null && !Task.IsCompleted) 22 | { 23 | return Task; 24 | } 25 | 26 | Task = base.Run(param); 27 | return Task; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | public static class NativeMethods 7 | { 8 | public enum SymbolicLink 9 | { 10 | File = 0, 11 | Directory = 1 12 | } 13 | 14 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 15 | internal static extern bool CreateSymbolicLink( 16 | string lpSymlinkFileName, 17 | string lpTargetFileName, 18 | SymbolicLink dwFlags); 19 | 20 | [DllImport("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 21 | internal static extern bool CreateHardLink( 22 | string lpFileName, 23 | string lpExistingFileName, 24 | IntPtr lpSecurityAttributes); 25 | } 26 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/TaskbarIcon Commands/DownloadUpdateCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text.RegularExpressions; 7 | using Tools; 8 | 9 | public class DownloadUpdateCommand : ModelBasedCommand 10 | { 11 | private static readonly Regex Msifile = new Regex("ACDDokanNet.*\\.msi"); 12 | 13 | public override void Execute(object parameter) 14 | { 15 | try 16 | { 17 | Process.Start(Model.UpdateAvailable.Assets.First(a => Msifile.IsMatch(a.Name)).BrowserUrl); 18 | } 19 | catch (Exception ex) 20 | { 21 | Log.Error(ex); 22 | } 23 | } 24 | 25 | public override bool CanExecute(object parameter) => Model.UpdateAvailable != null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Build.md: -------------------------------------------------------------------------------- 1 | Building 2 | ======== 3 | 4 | AmazonSecret.cs 5 | --------------- 6 | To connect to Amazon CLoud Drive you need to register your application and get app secret keys. 7 | Create AmazonSecret.cs in ACD.DokanNet.Gui project and replace values with your app secrets 8 | ```C# 9 | namespace Azi.Cloud.DokanNet.Gui 10 | { 11 | public static class AmazonSecret 12 | { 13 | public static string clientId = "amzn1.application-oa2-client.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 14 | public static string clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 15 | } 16 | } 17 | ``` 18 | 19 | This file is already ignored on commit, just in case. 20 | 21 | Strong Names 22 | ------------ 23 | 24 | All projects are signed. It's required for Windows Explorer Extension. You still can run the main Gui app if you remove signing from Project Properties and remove Strong Namer Nuget addon. -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/AStatisticFileInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | public abstract class AStatisticFileInfo 4 | { 5 | public abstract long Total { get; } 6 | 7 | public abstract string Id { get; } 8 | 9 | public abstract string FileName { get; } 10 | 11 | public abstract string Path { get; } 12 | 13 | public string ErrorMessage { get; set; } 14 | 15 | public bool HasError => ErrorMessage != null; 16 | 17 | public long Done { get; set; } 18 | 19 | public override bool Equals(object obj) 20 | { 21 | if (obj == null || GetType() != obj.GetType()) 22 | { 23 | return false; 24 | } 25 | 26 | return Id == ((AStatisticFileInfo)obj).Id; 27 | } 28 | 29 | public override int GetHashCode() 30 | { 31 | return Id.GetHashCode(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Tools/PipeExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.IO.Pipes; 5 | using System.Threading.Tasks; 6 | 7 | public static class PipeExtensions 8 | { 9 | public static async Task WaitForConnectionAsync(this NamedPipeServerStream server) 10 | { 11 | var completition = new TaskCompletionSource(); 12 | server.BeginWaitForConnection( 13 | ar => 14 | { 15 | try 16 | { 17 | var pipeServer = (NamedPipeServerStream)ar.AsyncState; 18 | pipeServer.EndWaitForConnection(ar); 19 | completition.SetResult(0); 20 | } 21 | catch (Exception ex) 22 | { 23 | completition.SetException(ex); 24 | } 25 | }, 26 | server); 27 | await completition.Task; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokanTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /licence.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /AmazonCloudDrive/MountWaitBox.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.AmazonCloudDrive 2 | { 3 | using System.Threading; 4 | using System.Windows; 5 | using System.Windows.Input; 6 | 7 | /// 8 | /// Interaction logic for MountWaitBox.xaml 9 | /// 10 | public partial class MountWaitBox 11 | { 12 | public MountWaitBox() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | public MountWaitBox(Window owner) 18 | : this() 19 | { 20 | Owner = owner; 21 | } 22 | 23 | public CancellationTokenSource Cancellation { get; internal set; } 24 | 25 | private void CancelButton_Click(object sender, RoutedEventArgs e) 26 | { 27 | Cancellation.Cancel(); 28 | } 29 | 30 | private void Window_MouseDown(object sender, MouseButtonEventArgs e) 31 | { 32 | if (e.ChangedButton == MouseButton.Left) 33 | { 34 | DragMove(); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /MicrosoftOneDrive/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Cloud.DokanNet/DokanLogger.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics.Contracts; 6 | using System.Linq; 7 | using global::DokanNet; 8 | using global::DokanNet.Logging; 9 | using Tools; 10 | 11 | internal class DokanLogger : ILogger 12 | { 13 | public void Debug(string format, params object[] args) 14 | { 15 | Log.Trace(string.Format(format, args)); 16 | } 17 | 18 | public void Error(string format, params object[] args) 19 | { 20 | Log.Error(string.Format(format, args)); 21 | } 22 | 23 | public void Fatal(string format, params object[] args) 24 | { 25 | Log.Error(string.Format(format, args)); 26 | } 27 | 28 | public void Info(string format, params object[] args) 29 | { 30 | Log.Trace(string.Format(format, args)); 31 | } 32 | 33 | public void Warn(string format, params object[] args) 34 | { 35 | Log.Warn(string.Format(format, args)); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/AbstractBlockStream.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using Tools; 6 | 7 | public abstract class AbstractBlockStream : IBlockStream 8 | { 9 | public Func OnClose { get; set; } 10 | 11 | public abstract void Flush(); 12 | 13 | public abstract Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000); 14 | 15 | public abstract Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000); 16 | 17 | public void Dispose() 18 | { 19 | // Do not change this code. Put cleanup code in Dispose(bool disposing) above. 20 | Dispose(true); 21 | } 22 | 23 | public virtual void Close() 24 | { 25 | try 26 | { 27 | OnClose?.Invoke(); 28 | Dispose(); 29 | } 30 | catch (Exception ex) 31 | { 32 | Log.Error(ex); 33 | } 34 | } 35 | 36 | public abstract void SetLength(long len); 37 | 38 | protected abstract void Dispose(bool disposing); 39 | } 40 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/ByteArrayBlockWriter.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.IO; 5 | using System.Threading.Tasks; 6 | 7 | public class ByteArrayBlockWriter : AbstractBlockStream 8 | { 9 | public MemoryStream Content { get; } = new MemoryStream(); 10 | 11 | public override void Flush() 12 | { 13 | } 14 | 15 | public override Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000) 16 | { 17 | throw new NotSupportedException(); 18 | } 19 | 20 | public override void SetLength(long len) 21 | { 22 | } 23 | 24 | public override Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000) 25 | { 26 | Content.SetLength(position + count); 27 | 28 | Array.Copy(buffer, offset, Content.GetBuffer(), position, count); 29 | return Task.FromResult(true); 30 | } 31 | 32 | protected override void Dispose(bool disposing) 33 | { 34 | if (disposing) 35 | { 36 | Content.Dispose(); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Cloud.DokanNetTests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/CacheEntry.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Threading; 5 | 6 | public class CacheEntry : IDisposable 7 | { 8 | private readonly ReaderWriterLockSlim lk = new ReaderWriterLockSlim(); 9 | private DateTime accessTime; 10 | 11 | public DateTime AccessTime 12 | { 13 | get 14 | { 15 | lk.EnterReadLock(); 16 | try 17 | { 18 | return accessTime; 19 | } 20 | finally 21 | { 22 | lk.ExitReadLock(); 23 | } 24 | } 25 | 26 | set 27 | { 28 | lk.EnterWriteLock(); 29 | try 30 | { 31 | accessTime = value; 32 | } 33 | finally 34 | { 35 | lk.ExitWriteLock(); 36 | } 37 | } 38 | } 39 | 40 | public string Id { get; set; } 41 | 42 | public long Length { get; set; } 43 | 44 | public string LinkPath { get; set; } 45 | 46 | public void Dispose() 47 | { 48 | lk.Dispose(); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/DokanLogger.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using global::DokanNet.Logging; 4 | using Tools; 5 | 6 | public class DokanLogger : ILogger 7 | { 8 | public void Debug(string message, params object[] args) 9 | { 10 | Log.Trace(Format(message, args), Log.Dokan); 11 | } 12 | 13 | public void Error(string message, params object[] args) 14 | { 15 | Log.ErrorTrace(Format(message, args), Log.Dokan); 16 | } 17 | 18 | public void Fatal(string message, params object[] args) 19 | { 20 | Log.ErrorTrace(Format(message, args), Log.Dokan); 21 | } 22 | 23 | public void Info(string message, params object[] args) 24 | { 25 | Log.Trace(Format(message, args), Log.Dokan); 26 | } 27 | 28 | public void Warn(string message, params object[] args) 29 | { 30 | Log.Warn(Format(message, args), Log.Dokan); 31 | } 32 | 33 | private static string Format(string message, params object[] args) 34 | { 35 | if (args == null || args.Length == 0) 36 | { 37 | return message; 38 | } 39 | 40 | return string.Format(message, args); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %TEMP%\ACDDokanNetCache 7 | 8 | 9 | 20 10 | 11 | 12 | 1000 13 | 14 | 15 | True 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 23 | 24 | False 25 | 26 | 27 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/ByteArrayBlockReader.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | internal class ByteArrayBlockReader : AbstractBlockStream 7 | { 8 | private readonly byte[] data; 9 | 10 | public ByteArrayBlockReader(byte[] data) 11 | { 12 | this.data = data; 13 | } 14 | 15 | public override void Flush() 16 | { 17 | // Nothing 18 | } 19 | 20 | public override Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000) 21 | { 22 | var realCount = (int)(data.Length - position); 23 | if (realCount > count) 24 | { 25 | realCount = count; 26 | } 27 | 28 | Array.Copy(data, position, buffer, offset, realCount); 29 | return Task.FromResult(realCount); 30 | } 31 | 32 | public override void SetLength(long len) 33 | { 34 | throw new NotSupportedException(); 35 | } 36 | 37 | public override Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000) 38 | { 39 | throw new NotSupportedException(); 40 | } 41 | 42 | protected override void Dispose(bool disposing) 43 | { 44 | // Nothing 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Tools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Tools")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Tools")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("199cdb28-7472-41bd-bb1f-bf345451a68d")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.7.3")] 34 | [assembly: AssemblyFileVersion("1.7.3")] -------------------------------------------------------------------------------- /Cloud.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Cloud.Common")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Cloud.Common")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("93841375-56d7-4b34-aa7c-ba69f29f8b66")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.7.0")] 34 | [assembly: AssemblyFileVersion("1.7.0")] -------------------------------------------------------------------------------- /AmazonCloudDrive/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AmazonCloudDrive")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("AmazonCloudDrive")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("43097c04-9303-428d-a06c-1d2bf1d6647d")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.7.0")] 34 | [assembly: AssemblyFileVersion("1.7.0")] -------------------------------------------------------------------------------- /MicrosoftOneDrive/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("MicrosoftOneDrive")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("MicrosoftOneDrive")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("88e3c06f-d698-44b4-8a20-7951f786ae20")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.7.0")] 34 | [assembly: AssemblyFileVersion("1.7.0")] 35 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokanTests/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ACDDokanNetTest\ACDDokanNetCache 19 | 20 | 21 | 20 22 | 23 | 24 | 1000 25 | 26 | 27 | False 28 | 29 | 30 | -------------------------------------------------------------------------------- /Cloud.DokanNet.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Cloud.DokanNet.Console")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Cloud.DokanNet.Console")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("e95a8efe-853d-4a21-aee3-596133c08343")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | 34 | [assembly: AssemblyVersion("1.7.0")] 35 | [assembly: AssemblyFileVersion("1.7.0")] 36 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokanTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("amazon-clouddrive-dokanTests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("amazon-clouddrive-dokanTests")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("07444044-fb75-4639-af4b-044a48ead482")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /AmazonCloudDrive/MountWaitBox.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Cloud.DokanNet/BlockingQueue.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | public class BlockingQueue 11 | { 12 | private Queue queue = new Queue(); 13 | 14 | private SemaphoreSlim itemsSem = new SemaphoreSlim(0, int.MaxValue); 15 | 16 | public void Enqueue(T item) 17 | { 18 | lock (queue) 19 | { 20 | queue.Enqueue(item); 21 | itemsSem.Release(); 22 | } 23 | } 24 | 25 | public async Task Dequeue(CancellationToken token) 26 | { 27 | await itemsSem.WaitAsync(token).ConfigureAwait(false); 28 | lock (queue) 29 | { 30 | return queue.Dequeue(); 31 | } 32 | } 33 | 34 | public bool TryDequeue(out T item) 35 | { 36 | lock (queue) 37 | { 38 | if (queue.Count > 0) 39 | { 40 | item = queue.Dequeue(); 41 | return true; 42 | } 43 | } 44 | 45 | item = default(T); 46 | return false; 47 | } 48 | 49 | public async Task BlockingPeek(CancellationToken token) 50 | { 51 | await itemsSem.WaitAsync(token).ConfigureAwait(false); 52 | lock (queue) 53 | { 54 | itemsSem.Release(); 55 | return queue.Peek(); 56 | } 57 | } 58 | 59 | public T Peek() 60 | { 61 | lock (queue) 62 | { 63 | return queue.Peek(); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/App.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/IFSProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Threading.Tasks; 6 | using Common; 7 | using FileInformation=global::DokanNet.FileInformation; 8 | 9 | public interface IFSProvider 10 | { 11 | string CachePath { get; set; } 12 | 13 | bool CheckFileHash { get; set; } 14 | 15 | string FileSystemName { get; } 16 | 17 | SmallFilesCache SmallFilesCache { get; } 18 | 19 | long SmallFilesCacheSize { get; set; } 20 | 21 | long SmallFileSizeLimit { get; set; } 22 | 23 | string VolumeName { get; set; } 24 | 25 | Task BuildItemInfo(FSItem item); 26 | 27 | void CancelUpload(string id); 28 | 29 | Task ClearSmallFilesCache(); 30 | 31 | Task CreateDir(string filePath); 32 | 33 | Task DeleteDir(string filePath); 34 | 35 | Task DeleteFile(string filePath); 36 | 37 | void Dispose(); 38 | 39 | Task Exists(string filePath); 40 | 41 | Task FetchNode(string itemPath); 42 | 43 | Task GetAvailableFreeSpace(); 44 | 45 | Task> GetDirItems(string folderPath); 46 | 47 | Task GetExtendedInfo(string[] streamNameGroups, FSItem item); 48 | 49 | Task GetTotalFreeSpace(); 50 | 51 | Task GetTotalSize(); 52 | 53 | Task GetTotalUsedSpace(); 54 | 55 | Task MoveFile(string oldPath, string newPath, bool replace); 56 | 57 | Task OpenFile(string filePath, FileMode mode, FileAccess fileAccess, FileShare share, FileOptions options); 58 | 59 | ByteArrayBlockWriter OpenUploadHere(FSItem item); 60 | 61 | void StopUpload(); 62 | 63 | Task GetItemInfo(string fileName); 64 | } 65 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("amazon-clouddrive-dokan")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("amazon-clouddrive-dokan")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // In order to begin building localizable applications, set 22 | // CultureYouAreCodingWith in your .csproj file 23 | // inside a . For example, if you are using US English 24 | // in your source files, set the to en-US. Then uncomment 25 | // the NeutralResourceLanguage attribute below. Update the "en-US" in 26 | // the line below to match the UICulture setting in the project file. 27 | 28 | // [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Build and Revision Numbers 38 | // by using the '*' as shown below: 39 | [assembly: AssemblyVersion("1.7.0")] 40 | [assembly: AssemblyFileVersion("1.7.0")] -------------------------------------------------------------------------------- /ShellExtension/Common.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.ShellExtension 2 | { 3 | using System.IO; 4 | using System.Linq; 5 | using Cloud.Common; 6 | using Newtonsoft.Json; 7 | using Trinet.Core.IO.Ntfs; 8 | 9 | public static class Common 10 | { 11 | public static INodeExtendedInfo ReadInfo(string path) 12 | { 13 | using (var info = FileSystem.GetAlternateDataStream(path, CloudDokanNetItemInfo.StreamName).OpenText()) 14 | { 15 | var text = info.ReadToEnd(); 16 | var type = JsonConvert.DeserializeObject(text); 17 | if (type.Type == nameof(CloudDokanNetItemInfo)) 18 | { 19 | return JsonConvert.DeserializeObject(text); 20 | } 21 | 22 | return null; 23 | } 24 | } 25 | 26 | public static string ReadString(string path, params string[] commands) 27 | { 28 | var streamName = string.Join(",", new[] { CloudDokanNetItemInfo.StreamName }.Concat(commands ?? Enumerable.Empty())); 29 | using (var info = FileSystem.GetAlternateDataStream(path, streamName).OpenText()) 30 | { 31 | return info.ReadToEnd(); 32 | } 33 | } 34 | 35 | public static void WriteObject(object obj, string path, params string[] commands) 36 | { 37 | var str = JsonConvert.SerializeObject(obj); 38 | 39 | var streamName = string.Join(",", new[] { CloudDokanNetItemInfo.StreamName }.Concat(commands ?? Enumerable.Empty())); 40 | var info = FileSystem.GetAlternateDataStream(path, streamName).OpenWrite(); 41 | using (var writer = new StreamWriter(info)) 42 | { 43 | writer.Write(str); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : Cloud.DokanNet.IntegrationTests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Cloud.DokanNet.IntegrationTests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Cloud.DokanNet.IntegrationTests application. 9 | 10 | 11 | Cloud.DokanNet.IntegrationTests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Cloud.DokanNet.IntegrationTests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Cloud.DokanNet.IntegrationTests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named Cloud.DokanNet.IntegrationTests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | using System.Windows; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ACD.DokanNet.Gui")] 10 | [assembly: AssemblyDescription("Dokan.Net driver for Amazon Cloud Drive")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Rambalac")] 13 | [assembly: AssemblyProduct("ACD.DokanNet.Gui")] 14 | [assembly: AssemblyCopyright("Rambalac")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // In order to begin building localizable applications, set 24 | // CultureYouAreCodingWith in your .csproj file 25 | // inside a . For example, if you are using US english 26 | // in your source files, set the to en-US. Then uncomment 27 | // the NeutralResourceLanguage attribute below. Update the "en-US" in 28 | // the line below to match the UICulture setting in the project file. 29 | 30 | // [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 31 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | [assembly: AssemblyVersion("1.7.3")] 43 | [assembly: AssemblyFileVersion("1.7.3")] 44 | [assembly: NeutralResourcesLanguage("en-US")] -------------------------------------------------------------------------------- /Tools/Processes.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Tools 2 | { 3 | using System; 4 | using System.Collections.Concurrent; 5 | using System.Diagnostics.Contracts; 6 | using System.Management; 7 | 8 | public static class Processes 9 | { 10 | private static readonly ConcurrentDictionary PidOwner = new ConcurrentDictionary(); 11 | 12 | public static string GetProcessOwner(int id) 13 | { 14 | var result = PidOwner.GetOrAdd(id, processId => new ProcInfo { UserName = GetOwner(processId) }); 15 | if (DateTime.UtcNow > result.Expire) 16 | { 17 | result = new ProcInfo { UserName = GetOwner(id) }; 18 | PidOwner[id] = result; 19 | } 20 | 21 | return result.UserName; 22 | } 23 | 24 | private static string GetOwner(int processId) 25 | { 26 | var query = "Select * From Win32_Process Where ProcessID = " + processId; 27 | var searcher = new ManagementObjectSearcher(query); 28 | var processList = searcher.Get(); 29 | 30 | foreach (var o in processList) 31 | { 32 | var obj = o as ManagementObject; 33 | if (obj == null) 34 | { 35 | Log.ErrorTrace("obj is null"); 36 | continue; 37 | } 38 | 39 | Contract.Assert(obj != null, "obj != null"); 40 | object[] argList = { string.Empty, string.Empty }; 41 | var returnVal = Convert.ToInt32(obj.InvokeMethod("GetOwner", argList)); 42 | if (returnVal == 0) 43 | { 44 | // return DOMAIN\user 45 | return argList[1] + "\\" + argList[0]; 46 | } 47 | } 48 | 49 | return "NO OWNER"; 50 | } 51 | 52 | private class ProcInfo 53 | { 54 | public string UserName { get; set; } 55 | 56 | public DateTime Expire { get; } = DateTime.UtcNow.AddMilliseconds(10000); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Cloud.DokanNet.Console/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.IO.Pipes; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Cloud.DokanNet.Console 8 | { 9 | class Program 10 | { 11 | private const string AppName = "ACDDokanNet"; 12 | 13 | static int Main(string[] args) 14 | { 15 | using (var pipe = new NamedPipeClientStream(".", "pipe" + AppName, PipeDirection.InOut)) 16 | { 17 | try 18 | { 19 | pipe.Connect(1000); 20 | } 21 | catch (TimeoutException) 22 | { 23 | System.Console.WriteLine("Application is not started."); 24 | return 1; 25 | } 26 | catch (UnauthorizedAccessException) 27 | { 28 | System.Console.WriteLine("Main application has higher priviledges level than console application."); 29 | return 1; 30 | } 31 | 32 | try 33 | { 34 | var writer = new StreamWriter(pipe, Encoding.UTF8, 1024, true); 35 | var reader = new StreamReader(pipe, Encoding.UTF8, false, 1024, true); 36 | writer.WriteLine(string.Join(" ", args.Select(s => s.Contains(' ') ? "\"" + s + "\"" : s))); 37 | writer.Flush(); 38 | string lastString = null; 39 | string response; 40 | while ((response = reader.ReadLine()) != null) 41 | { 42 | lastString = response; 43 | 44 | if (response != "Done") 45 | { 46 | System.Console.WriteLine(response); 47 | } 48 | } 49 | return (lastString == "Done") ? 0 : 1; 50 | } 51 | catch (Exception ex) 52 | { 53 | System.Console.WriteLine(ex); 54 | return 1; 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Cloud.Common/IHttpCloud.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.Common 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | public delegate Task Progress(long progress); 10 | 11 | public interface IHttpCloud : IDisposable 12 | { 13 | string CloudServiceIcon { get; } 14 | 15 | string CloudServiceName { get; } 16 | 17 | IHttpCloudFiles Files { get; } 18 | 19 | string Id { get; set; } 20 | 21 | IHttpCloudNodes Nodes { get; } 22 | 23 | IAuthUpdateListener OnAuthUpdated { get; set; } 24 | 25 | Task AuthenticateNew(CancellationToken cs); 26 | 27 | Task AuthenticateSaved(CancellationToken cs, string save); 28 | 29 | Task GetAvailableFreeSpace(); 30 | 31 | Task GetTotalFreeSpace(); 32 | 33 | Task GetTotalSize(); 34 | 35 | Task GetTotalUsedSpace(); 36 | 37 | Task SignOut(string save); 38 | 39 | Task CalculateLocalStreamContentId(Stream stream); 40 | } 41 | 42 | public interface IHttpCloudFiles 43 | { 44 | Task Download(string id); 45 | 46 | Task Overwrite(string id, Func p, Progress progress); 47 | 48 | Task UploadNew(string parentId, string fileName, Func p, Progress progress); 49 | } 50 | 51 | public interface IHttpCloudNodes 52 | { 53 | Task CreateFolder(string parentid, string name); 54 | 55 | Task GetChild(string id, string name); 56 | 57 | Task> GetChildren(string id); 58 | 59 | Task GetNode(string id); 60 | 61 | Task GetNodeExtended(string id); 62 | 63 | Task GetRoot(); 64 | 65 | Task Move(string itemId, string oldParentId, string newParentId); 66 | 67 | Task Remove(string itemId, string parentId); 68 | 69 | Task Rename(string id, string newName); 70 | 71 | Task ShareNode(string id, NodeShareType type); 72 | 73 | Task Trash(string id); 74 | } 75 | } -------------------------------------------------------------------------------- /amazon-clouddrive-dokan/UploadInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet 2 | { 3 | using System; 4 | using System.Collections.Concurrent; 5 | using System.Linq; 6 | using System.Threading; 7 | using Common; 8 | using Newtonsoft.Json; 9 | 10 | public class UploadInfo : IDisposable 11 | { 12 | private bool disposedValue; 13 | 14 | public UploadInfo() 15 | { 16 | } 17 | 18 | public UploadInfo(FSItem item) 19 | { 20 | Id = item.Id; 21 | Path = item.Path; 22 | ParentId = item.ParentIds.First(); 23 | Length = item.Length; 24 | } 25 | 26 | [JsonIgnore] 27 | public CancellationTokenSource Cancellation { get; } = new CancellationTokenSource(); 28 | 29 | [JsonIgnore] 30 | public string FailReason { get; set; } 31 | 32 | public string Id { get; set; } 33 | 34 | public long Length { get; set; } 35 | 36 | public bool Overwrite { get; set; } = false; 37 | 38 | public string ParentId { get; set; } 39 | 40 | public string SourcePath { get; set; } 41 | 42 | /// 43 | /// Gets or sets original remote file path 44 | /// 45 | public string Path { get; set; } 46 | 47 | [JsonIgnore] 48 | public string ContentId { get; set; } 49 | 50 | public void Dispose() 51 | { 52 | Dispose(true); 53 | } 54 | 55 | internal FSItem ToFSItem() 56 | { 57 | var result = new FSItem.Builder() 58 | { 59 | Id = Id, 60 | Name = System.IO.Path.GetFileName(Path), 61 | Length = Length, 62 | ParentIds = new ConcurrentBag(new[] { ParentId }), 63 | ParentPath = System.IO.Path.GetDirectoryName(Path) 64 | }.Build(); 65 | result.MakeUploading(); 66 | return result; 67 | } 68 | 69 | protected virtual void Dispose(bool disposing) 70 | { 71 | if (!disposedValue) 72 | { 73 | if (disposing) 74 | { 75 | Cancellation.Dispose(); 76 | } 77 | 78 | disposedValue = true; 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /ShellExtension/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ShellExtension")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("ShellExtension")] 14 | [assembly: AssemblyCopyright("Copyright © 2016")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(true)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("8dac61ef-e07b-4bd2-8d79-5865ef2799bb")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("1.7.0")] 36 | [assembly: AssemblyFileVersion("1.7.0")] 37 | [assembly: NeutralResourcesLanguage("en-US")] 38 | [assembly: InternalsVisibleTo("ShellExtension.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100790ec106e50ddcbb960d611b552f7d4460ff89a591931116497e92f463f6befc030503faa4c923f809946ba046420e0dd60c6fb2f284b1385126356172b990e7749767d06c2b1610f44d4687493a86706b046e3a2d64aa59fffc3fe78469e75acbef48b57045fa4eeec1a31ba40b9fc4ddfb47b717395f7da8a11f1b242532a7")] 39 | [assembly: InternalsVisibleTo("ShellExtension.Explorables, PublicKey=0024000004800000940000000602000000240000525341310004000001000100790ec106e50ddcbb960d611b552f7d4460ff89a591931116497e92f463f6befc030503faa4c923f809946ba046420e0dd60c6fb2f284b1385126356172b990e7749767d06c2b1610f44d4687493a86706b046e3a2d64aa59fffc3fe78469e75acbef48b57045fa4eeec1a31ba40b9fc4ddfb47b717395f7da8a11f1b242532a7")] -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/TaskbarIcon Commands/ModelBasedCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Azi.Cloud.DokanNet.Gui 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | using System.Windows; 6 | using System.Windows.Input; 7 | 8 | public abstract class ModelBasedCommand : ICommand 9 | { 10 | public static readonly DependencyProperty ModelProperty = DependencyProperty.RegisterAttached( 11 | nameof(Model), 12 | typeof(ViewModel), 13 | typeof(DownloadUpdateCommand), 14 | new FrameworkPropertyMetadata(null)); 15 | 16 | private ViewModel model; 17 | 18 | public event EventHandler CanExecuteChanged; 19 | 20 | public ViewModel Model 21 | { 22 | get 23 | { 24 | return model; 25 | } 26 | 27 | set 28 | { 29 | model = value; 30 | if (model != null) 31 | { 32 | model.PropertyChanged += Model_PropertyChanged; 33 | } 34 | } 35 | } 36 | 37 | public static string GetMyProperty(UIElement element) 38 | { 39 | if (element == null) 40 | { 41 | throw new ArgumentNullException(nameof(element)); 42 | } 43 | 44 | return (string)element.GetValue(ModelProperty); 45 | } 46 | 47 | public static void SetMyProperty(UIElement element, string value) 48 | { 49 | if (element == null) 50 | { 51 | throw new ArgumentNullException(nameof(element)); 52 | } 53 | 54 | element.SetValue(ModelProperty, value); 55 | } 56 | 57 | public virtual bool CanExecute(object parameter) 58 | { 59 | return true; 60 | } 61 | 62 | public abstract void Execute(object parameter); 63 | 64 | public virtual void OnModelChanged(string property) 65 | { 66 | } 67 | 68 | private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e) 69 | { 70 | OnModelChanged(e.PropertyName); 71 | try 72 | { 73 | CanExecuteChanged?.Invoke(this, null); 74 | } 75 | catch (Exception) 76 | { 77 | // Ignore 78 | } 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /Cloud.DokanNet.IntegrationTests/Cloud.DokanNet.IntegrationTests.cpp: -------------------------------------------------------------------------------- 1 | // Cloud.DokanNet.IntegrationTests.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include 6 | #include "Cloud.DokanNet.IntegrationTests.h" 7 | 8 | void TestOverlappedWrite(const wchar_t* dir) 9 | { 10 | auto path = new wchar_t[1024]; 11 | GetTempFileName(dir, L"tmp", 1, path); 12 | 13 | auto file = CreateFile(path, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, 0); 14 | 15 | const auto length = 1 << 20; 16 | auto buffer = new byte[length]; 17 | for (int i = 0; i < length; i++) 18 | { 19 | buffer[i] = i & 255; 20 | } 21 | 22 | const int parts = 8; 23 | auto overlapped = new OVERLAPPED[parts]; 24 | 25 | SetFilePointer(file, length*parts, 0, FILE_BEGIN); 26 | SetEndOfFile(file); 27 | 28 | for (int i = 0; i < parts; i++) 29 | { 30 | memset(overlapped + i, 0, sizeof(OVERLAPPED)); 31 | overlapped[i].Offset = i*length; 32 | 33 | DWORD writ; 34 | WriteFileEx(file, buffer, length, overlapped + i, 0); 35 | } 36 | 37 | CloseHandle(file); 38 | delete[] overlapped; 39 | delete[] buffer; 40 | 41 | printf("Wait till file upload\r\n"); 42 | Sleep(10000); 43 | 44 | buffer = new byte[length*parts]; 45 | file = CreateFile(path, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0); 46 | DWORD red; 47 | 48 | DWORD pos = 0; 49 | do { 50 | ReadFile(file, buffer + pos, length*parts, &red, 0); 51 | pos += red; 52 | } while (red > 0 && pos < length*parts); 53 | 54 | CloseHandle(file); 55 | 56 | if (pos != length*parts) 57 | { 58 | printf("Read only %d(%d) bytes of %d\r\n", pos, red, length*parts); 59 | exit(0); 60 | } 61 | 62 | for (int i = 0; i < length*parts; i++) 63 | { 64 | byte val = (i%length) & 255; 65 | if (buffer[i] != val) 66 | { 67 | printf("Expected %d was %d at %d\r\n", val, buffer[i], i); 68 | exit(0); 69 | } 70 | } 71 | 72 | delete[] buffer; 73 | DeleteFile(path); 74 | } 75 | 76 | int main() 77 | { 78 | //wchar_t* temp; 79 | //size_t tempSize; 80 | //_wdupenv_s(&temp, &tempSize, L"TEMP"); 81 | //TestOverlappedWrite(temp); 82 | 83 | const auto path = L"F:\\Tests"; 84 | _wmkdir(path); 85 | 86 | for (int i = 0; i < 10; i++) 87 | { 88 | printf("Iteration %d\r\n", i); 89 | TestOverlappedWrite(path); 90 | } 91 | 92 | _wrmdir(path); 93 | printf("All testest passed\r\n"); 94 | } -------------------------------------------------------------------------------- /ACD.DokanNet.Gui/FileItem.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | % 25 | 26 |