├── 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 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Cloud.DokanNet.IntegrationTests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Cloud.DokanNet.IntegrationTests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Cloud.DokanNet.IntegrationTests")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("1e40273d-f091-46dd-ba66-553b019e65ff")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/CloudItemControl.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.DokanNet.Gui
2 | {
3 | using System;
4 | using System.Windows;
5 | using Tools;
6 |
7 | ///
8 | /// Interaction logic for CloudItemControl.xaml
9 | ///
10 | public partial class CloudItemControl
11 | {
12 | public CloudItemControl()
13 | {
14 | InitializeComponent();
15 | }
16 |
17 | private CloudMount Model => (CloudMount)DataContext;
18 |
19 | private async void DeleteButton_Click(object sender, RoutedEventArgs e)
20 | {
21 | await Model.Delete();
22 | }
23 |
24 | private async void MountButton_Click(object sender, RoutedEventArgs e)
25 | {
26 | var win = Window.GetWindow(this);
27 | if (win == null)
28 | {
29 | Log.ErrorTrace("Window is null");
30 | }
31 |
32 | try
33 | {
34 | await Model.MountAsync();
35 | }
36 | catch (Exception ex)
37 | {
38 | Log.Error(ex);
39 | if (win != null)
40 | {
41 | MessageBox.Show(win, ex.Message);
42 | }
43 | else
44 | {
45 | MessageBox.Show(ex.Message);
46 | }
47 | }
48 |
49 | win?.Activate();
50 | }
51 |
52 | private async void UnmountButton_Click(object sender, RoutedEventArgs e)
53 | {
54 | await Model.UnmountAsync();
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Cloud.DokanNet.IntegrationTests/Cloud.DokanNet.IntegrationTests.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Cloud.DokanNetTests/BlockTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using Azi.Cloud.DokanNet;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Moq;
9 | using System.IO;
10 |
11 | namespace Azi.Cloud.DokanNet.Tests
12 | {
13 | public class BlockTests
14 | {
15 | [Fact]
16 | public async Task ReadFromStreamAndWaitTest()
17 | {
18 | var mockItem = new Mock();
19 |
20 | var block = new Block(mockItem.Object, 0, 20);
21 | var task = Task.Factory.StartNew(async () =>
22 | {
23 | var str = new MemoryStream(new byte[] { 111 });
24 | for (int i = 0; i < 10; i++)
25 | {
26 | var red = await block.ReadFromStream(str).ConfigureAwait(false);
27 | str.Position = 0;
28 | await Task.Delay(10).ConfigureAwait(false);
29 | }
30 | block.MakeComplete();
31 | });
32 |
33 | var lastUpdate = DateTime.MinValue;
34 | int lastSize = 0;
35 | while (!block.IsComplete)
36 | {
37 | var newUpdate = await block.WaitUpdate(lastUpdate).ConfigureAwait(false);
38 | Assert.NotEqual(lastUpdate, newUpdate);
39 |
40 | lastUpdate = newUpdate;
41 | var curSize = block.CurrentSize;
42 | Assert.NotEqual(lastSize, curSize);
43 | }
44 | Assert.Equal(10, block.CurrentSize);
45 | }
46 |
47 | }
48 | }
--------------------------------------------------------------------------------
/Cloud.DokanNetTests/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Azi.Cloud.DokanNet.Tests.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("")]
29 | public string AuthToken {
30 | get {
31 | return ((string)(this["AuthToken"]));
32 | }
33 | set {
34 | this["AuthToken"] = value;
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/AvailableCloudsList.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
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 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/amazon-clouddrive-dokan/VirtualDriveWrapper.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 Tools;
9 |
10 | public class VirtualDriveWrapper
11 | {
12 | private readonly VirtualDrive virtualDrive;
13 |
14 | private char mountLetter;
15 |
16 | public VirtualDriveWrapper(IFSProvider provider)
17 | {
18 | virtualDrive = new VirtualDrive(provider)
19 | {
20 | OnMount = () => { Mounted?.Invoke(mountLetter); },
21 | OnUnmount = () => { Unmounted?.Invoke(mountLetter); }
22 | };
23 | }
24 |
25 | public static bool IsDokanInstalled
26 | {
27 | get
28 | {
29 | try
30 | {
31 | return Dokan.DriverVersion >= 400;
32 | }
33 | catch (Exception ex)
34 | {
35 | Log.Error(ex);
36 | return false;
37 | }
38 | }
39 | }
40 |
41 | public Action Mounted { get; set; }
42 |
43 | public Action Unmounted { get; set; }
44 |
45 | public static IList GetFreeDriveLettes()
46 | {
47 | return Enumerable.Range('C', 'Z' - 'C' + 1).Select(c => (char)c).Except(Environment.GetLogicalDrives().Select(s => s[0])).ToList();
48 | }
49 |
50 | public static void Unmount(char letter)
51 | {
52 | Dokan.Unmount(letter);
53 | }
54 |
55 | public void Mount(char letter, bool readOnly)
56 | {
57 | Contract.Ensures(letter > 'C' && letter <= 'Z');
58 | try
59 | {
60 | virtualDrive.ReadOnly = readOnly;
61 | virtualDrive.MountPath = letter + ":\\";
62 | mountLetter = letter;
63 | #if DEBUG
64 | virtualDrive.Mount(virtualDrive.MountPath, DokanOptions.DebugMode | DokanOptions.AltStream | DokanOptions.FixedDrive, 0, 800, TimeSpan.FromSeconds(30), new DokanLogger());
65 | #else
66 | virtualDrive.Mount(virtualDrive.MountPath, DokanOptions.AltStream | DokanOptions.FixedDrive, 0, 1000, TimeSpan.FromSeconds(30), new DokanLogger());
67 | #endif
68 | }
69 | catch (Exception e)
70 | {
71 | Log.Error(e);
72 | throw new InvalidOperationException(e.Message, e);
73 | }
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/StatusToolTip.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | Update
42 |
43 | is available.
44 |
45 | Click right button to update.
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Tools/HttpWebRequestExtensions.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Rambalac. All rights reserved.
3 | //
4 |
5 | namespace Azi.Tools
6 | {
7 | using System;
8 | using System.IO;
9 | using System.Linq;
10 | using System.Net;
11 | using System.Net.Http.Headers;
12 | using System.Threading.Tasks;
13 | using Newtonsoft.Json;
14 |
15 | ///
16 | /// Helper methods to work with Http protocol
17 | ///
18 | public static class HttpWebRequestExtensions
19 | {
20 | private static readonly HttpStatusCode[] SuccessStatusCodes = { HttpStatusCode.OK, HttpStatusCode.Created, HttpStatusCode.PartialContent };
21 |
22 | ///
23 | /// Returns ContentRange from headers.
24 | ///
25 | /// Headers collection
26 | /// ContentRange object
27 | public static ContentRangeHeaderValue GetContentRange(this WebHeaderCollection headers)
28 | {
29 | return ContentRangeHeaderValue.Parse(headers["Content-Range"]);
30 | }
31 |
32 | ///
33 | /// Check if response is successful
34 | ///
35 | /// Response to check
36 | /// True if success
37 | public static bool IsSuccessStatusCode(this HttpWebResponse response) => SuccessStatusCodes.Contains(response.StatusCode);
38 |
39 | ///
40 | /// Returns object as parsed JSON from response.
41 | ///
42 | /// Type of object to parse
43 | /// Response to parse
44 | /// Parsed object
45 | public static async Task ReadAsAsync(this HttpWebResponse response)
46 | {
47 | var text = await response.ReadAsStringAsync().ConfigureAwait(false);
48 | return JsonConvert.DeserializeObject(text);
49 | }
50 |
51 | ///
52 | /// Returns response as string.
53 | ///
54 | /// Response to read.
55 | /// String of response.
56 | public static async Task ReadAsStringAsync(this HttpWebResponse response)
57 | {
58 | var stream = response.GetResponseStream();
59 | if (stream == null)
60 | {
61 | throw new InvalidOperationException("stream is null");
62 | }
63 |
64 | using (var reader = new StreamReader(stream))
65 | {
66 | return await reader.ReadToEndAsync().ConfigureAwait(false);
67 | }
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/Cloud.Common/CloudInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.Common
2 | {
3 | using System.ComponentModel;
4 | using System.Configuration;
5 | using System.Runtime.CompilerServices;
6 | using Annotations;
7 |
8 | [SettingsSerializeAs(SettingsSerializeAs.Xml)]
9 | public class CloudInfo : INotifyPropertyChanged
10 | {
11 | private string assemblyFileName;
12 |
13 | private bool autoMount;
14 |
15 | private string className;
16 |
17 | private char driveLetter;
18 |
19 | private string name;
20 |
21 | private bool readOnly;
22 |
23 | private string rootFolder;
24 |
25 | public event PropertyChangedEventHandler PropertyChanged;
26 |
27 | public string AssemblyFileName
28 | {
29 | get => assemblyFileName;
30 |
31 | set
32 | {
33 | assemblyFileName = value;
34 | OnPropertyChanged();
35 | }
36 | }
37 |
38 | public string AuthSave { get; set; }
39 |
40 | public bool AutoMount
41 | {
42 | get => autoMount;
43 |
44 | set
45 | {
46 | autoMount = value;
47 | OnPropertyChanged();
48 | }
49 | }
50 |
51 | public string ClassName
52 | {
53 | get => className;
54 |
55 | set
56 | {
57 | className = value;
58 | OnPropertyChanged();
59 | }
60 | }
61 |
62 | public char DriveLetter
63 | {
64 | get => driveLetter;
65 |
66 | set
67 | {
68 | driveLetter = value;
69 | OnPropertyChanged();
70 | }
71 | }
72 |
73 | public string Id { get; set; }
74 |
75 | public string Name
76 | {
77 | get => name;
78 |
79 | set
80 | {
81 | name = value;
82 | OnPropertyChanged();
83 | }
84 | }
85 |
86 | public bool ReadOnly
87 | {
88 | get => readOnly;
89 |
90 | set
91 | {
92 | readOnly = value;
93 | OnPropertyChanged();
94 | }
95 | }
96 |
97 | public string RootFolder
98 | {
99 | get => rootFolder;
100 | set
101 | {
102 | rootFolder = value;
103 | OnPropertyChanged();
104 | }
105 | }
106 |
107 | [NotifyPropertyChangedInvocator]
108 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
109 | {
110 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
111 | }
112 | }
113 | }
--------------------------------------------------------------------------------
/Cloud.DokanNet.IntegrationTests/Cloud.DokanNet.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1E40273D-F091-46DD-BA66-553B019E65FF}
8 | Exe
9 | Properties
10 | Cloud.DokanNet.IntegrationTests
11 | Cloud.DokanNet.IntegrationTests
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
60 |
--------------------------------------------------------------------------------
/Cloud.DokanNet/Block.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.DokanNet
2 | {
3 | using System;
4 | using System.Diagnostics.Contracts;
5 | using System.IO;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using Nito.AsyncEx;
9 |
10 | public class Block : IDisposable
11 | {
12 | private readonly IAbsoluteCacheItem item;
13 | private int currentSize;
14 | private DateTime? lastUpdate;
15 |
16 | private AsyncAutoResetEvent updateEvent = new AsyncAutoResetEvent(false);
17 | private object updateSync = new object();
18 |
19 | public Block(IAbsoluteCacheItem item, long n, int expectedSize)
20 | {
21 | this.item = item;
22 | BlockIndex = n;
23 | Data = new byte[expectedSize];
24 | lastUpdate = DateTime.UtcNow;
25 | }
26 |
27 | public long BlockIndex { get; }
28 |
29 | public int CurrentSize => currentSize;
30 |
31 | public byte[] Data { get; }
32 |
33 | public bool IsComplete { get; private set; } = false;
34 |
35 | public DateTime? LastUpdate => lastUpdate;
36 |
37 | internal int RefCounter { get; set; }
38 |
39 | public void Dispose()
40 | {
41 | item.ReleaseBlock(this);
42 | }
43 |
44 | public void MakeComplete()
45 | {
46 | IsComplete = true;
47 | Update();
48 | }
49 |
50 | public async Task ReadFromStream(Stream stream) => await ReadFromStream(stream, CancellationToken.None).ConfigureAwait(false);
51 |
52 | public async Task ReadFromStream(Stream stream, CancellationToken token)
53 | {
54 | Contract.Ensures(!IsComplete);
55 |
56 | var red = await stream.ReadAsync(Data, CurrentSize, Data.Length - CurrentSize, token).ConfigureAwait(false);
57 | Interlocked.Add(ref currentSize, red);
58 |
59 | Update();
60 |
61 | return red;
62 | }
63 |
64 | public async Task WaitUpdate(DateTime prevUpdate) => await WaitUpdate(prevUpdate, CancellationToken.None).ConfigureAwait(false);
65 |
66 | public async Task WaitUpdate(DateTime prevUpdate, CancellationToken token)
67 | {
68 | do
69 | {
70 | lock (updateSync)
71 | {
72 | if (IsComplete || (lastUpdate != null && lastUpdate > prevUpdate))
73 | {
74 | return lastUpdate.Value;
75 | }
76 | }
77 |
78 | await updateEvent.WaitAsync(token).ConfigureAwait(false);
79 | }
80 | while (true);
81 | }
82 |
83 | private void Update()
84 | {
85 | lock (updateSync)
86 | {
87 | lastUpdate = DateTime.UtcNow;
88 | updateEvent.Set();
89 | }
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/amazon-clouddrive-dokanTests/NewFileBlockWriterTests.cs:
--------------------------------------------------------------------------------
1 | using Azi.Cloud.Common;
2 | using System;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using Xunit;
8 |
9 | namespace Azi.Cloud.DokanNet.Tests
10 | {
11 | public sealed class NewFileBlockWriterTests : IDisposable
12 | {
13 | private NewFileBlockWriter writer;
14 |
15 | private readonly FSItem item = new FSItem.Builder()
16 | {
17 | Id = "id",
18 | ParentPath = "p",
19 | Name = "n",
20 | ParentIds = new System.Collections.Concurrent.ConcurrentBag(new[] { "id" })
21 | }.Build();
22 |
23 | private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
24 |
25 | [Fact]
26 | public void MultipleParallelWriteTest()
27 | {
28 | for (var i = 0; i < 10; i++)
29 | {
30 | ParallelWriteTest();
31 | }
32 | }
33 |
34 | public void ParallelWriteTest()
35 | {
36 | writer = new NewFileBlockWriter(item, tempPath);
37 |
38 | var array = Enumerable.Range(0, 1 << 10).Select(i => (byte)(i & 255)).ToArray();
39 | const int parts = 8;
40 | var tasks = new Task[parts];
41 | for (var i = 0; i < parts; i++)
42 | {
43 | var ii = i;
44 | tasks[i] = Task.Factory.StartNew(async () =>
45 | {
46 | await writer.Write(ii * array.Length, array, 0, array.Length);
47 | }, TaskCreationOptions.LongRunning);
48 | }
49 | Task.WaitAll(tasks);
50 | writer.Close();
51 |
52 | var info = new FileInfo(tempPath);
53 | Assert.Equal(array.Length * parts, info.Length);
54 |
55 | using (var reader = new BinaryReader(File.OpenRead(tempPath)))
56 | {
57 | for (var i = 0; i < parts; i++)
58 | for (var j = 0; j < array.Length; j++)
59 | {
60 | var val = reader.ReadByte();
61 | Assert.True(array[j] == val, $"{array[j]}!={val} ({i} {j})");
62 | }
63 | }
64 |
65 | File.Delete(tempPath);
66 | }
67 |
68 | private bool disposedValue; // To detect redundant calls
69 |
70 | void Dispose(bool disposing)
71 | {
72 | if (!disposedValue)
73 | {
74 | if (disposing)
75 | {
76 | try
77 | {
78 | File.Delete(tempPath);
79 | }
80 | catch (Exception e)
81 | {
82 | Debug.WriteLine(e);
83 | }
84 | writer.Dispose();
85 | }
86 |
87 | disposedValue = true;
88 | }
89 | }
90 |
91 | public void Dispose()
92 | {
93 | Dispose(true);
94 | }
95 |
96 |
97 | }
98 | }
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | %TEMP%\ACDDokanNetCache
16 |
17 |
18 | 20
19 |
20 |
21 | 1000
22 |
23 |
24 | True
25 |
26 |
27 | 0
28 |
29 |
30 | False
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Cloud.DokanNet.Console/Cloud.DokanNet.Console.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E95A8EFE-853D-4A21-AEE3-596133C08343}
8 | Exe
9 | Properties
10 | Cloud.DokanNet.Console
11 | ACD.DokanNet.Console
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | Cloud.DokanNet.Console.Program
38 |
39 |
40 | true
41 |
42 |
43 | StrongSign.pfx
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/amazon-clouddrive-dokanTests/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 | ACDDokanNetTest\ACDDokanNetCache
25 |
26 |
27 | 20
28 |
29 |
30 | 1000
31 |
32 |
33 | False
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | %TEMP%\ACDDokanNetCache
51 |
52 |
53 | 20
54 |
55 |
56 | 1000
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/ShellExtension/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable InconsistentNaming
2 | // ReSharper disable UnusedMember.Local
3 | namespace Azi.ShellExtension
4 | {
5 | using System;
6 | using System.Runtime.InteropServices;
7 | using System.Text;
8 |
9 | public static class NativeMethods
10 | {
11 | private enum AssocF
12 | {
13 | ASSOCF_NONE = 0x00000000,
14 | ASSOCF_INIT_NOREMAPCLSID = 0x00000001,
15 | ASSOCF_INIT_BYEXENAME = 0x00000002,
16 | ASSOCF_OPEN_BYEXENAME = 0x00000002,
17 | ASSOCF_INIT_DEFAULTTOSTAR = 0x00000004,
18 | ASSOCF_INIT_DEFAULTTOFOLDER = 0x00000008,
19 | ASSOCF_NOUSERSETTINGS = 0x00000010,
20 | ASSOCF_NOTRUNCATE = 0x00000020,
21 | ASSOCF_VERIFY = 0x00000040,
22 | ASSOCF_REMAPRUNDLL = 0x00000080,
23 | ASSOCF_NOFIXUPS = 0x00000100,
24 | ASSOCF_IGNOREBASECLASS = 0x00000200,
25 | ASSOCF_INIT_IGNOREUNKNOWN = 0x00000400,
26 | ASSOCF_INIT_FIXED_PROGID = 0x00000800,
27 | ASSOCF_IS_PROTOCOL = 0x00001000,
28 | ASSOCF_INIT_FOR_FILE = 0x00002000
29 | }
30 |
31 | private enum AssocStr
32 | {
33 | ASSOCSTR_COMMAND = 1,
34 | ASSOCSTR_EXECUTABLE = 2,
35 | ASSOCSTR_FRIENDLYDOCNAME = 3,
36 | ASSOCSTR_FRIENDLYAPPNAME = 4,
37 | ASSOCSTR_NOOPEN = 5,
38 | ASSOCSTR_SHELLNEWVALUE = 6,
39 | ASSOCSTR_DDECOMMAND = 7,
40 | ASSOCSTR_DDEIFEXEC = 8,
41 | ASSOCSTR_DDEAPPLICATION = 9,
42 | ASSOCSTR_DDETOPIC = 10,
43 | ASSOCSTR_INFOTIP = 11,
44 | ASSOCSTR_QUICKTIP = 12,
45 | ASSOCSTR_TILEINFO = 13,
46 | ASSOCSTR_CONTENTTYPE = 14,
47 | ASSOCSTR_DEFAULTICON = 15,
48 | ASSOCSTR_SHELLEXTENSION = 16,
49 | ASSOCSTR_DROPTARGET = 17,
50 | ASSOCSTR_DELEGATEEXECUTE = 18,
51 | ASSOCSTR_SUPPORTED_URI_PROTOCOLS = 19,
52 | ASSOCSTR_PROGID = 20,
53 | ASSOCSTR_APPID = 21,
54 | ASSOCSTR_APPPUBLISHER = 22,
55 | ASSOCSTR_APPICONREFERENCE = 23,
56 | ASSOCSTR_MAX = 24
57 | }
58 |
59 | public static string AssocQueryString(string extension)
60 | {
61 | const int S_OK = 0;
62 | const int S_FALSE = 1;
63 |
64 | uint length = 0;
65 | var ret = AssocQueryString(AssocF.ASSOCF_NONE, AssocStr.ASSOCSTR_COMMAND, extension, null, null, ref length);
66 | if (ret != S_FALSE)
67 | {
68 | throw new InvalidOperationException("Could not determine associated string");
69 | }
70 |
71 | var sb = new StringBuilder((int)length); // (length-1) will probably work too as the marshaller adds null termination
72 | ret = AssocQueryString(AssocF.ASSOCF_NONE, AssocStr.ASSOCSTR_COMMAND, extension, null, sb, ref length);
73 | if (ret != S_OK)
74 | {
75 | throw new InvalidOperationException("Could not determine associated string");
76 | }
77 |
78 | return sb.ToString();
79 | }
80 |
81 | [DllImport("Shlwapi.dll", CharSet = CharSet.Unicode)]
82 | private static extern uint AssocQueryString(AssocF flags, AssocStr str, string pszAssoc, string pszExtra, [Out] StringBuilder pszOut, ref uint pcchOut);
83 | }
84 | }
--------------------------------------------------------------------------------
/amazon-clouddrive-dokan/Downloader.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.DokanNet
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using Common;
8 | using Nito.AsyncEx;
9 | using Tools;
10 |
11 | public class Downloader
12 | {
13 | private readonly AsyncLock lck = new AsyncLock();
14 | private readonly List monitor = new List();
15 | private long downloaded;
16 | private bool failed;
17 | private Task task;
18 |
19 | public Downloader(FSItem item, string path)
20 | {
21 | Item = item;
22 | Path = path;
23 | }
24 |
25 | public long Downloaded
26 | {
27 | get
28 | {
29 | return Interlocked.Read(ref downloaded);
30 | }
31 |
32 | set
33 | {
34 | using (lck.Lock())
35 | {
36 | Interlocked.Exchange(ref downloaded, value);
37 | Pulse();
38 | }
39 | }
40 | }
41 |
42 | public FSItem Item { get; }
43 |
44 | public string Path { get; private set; }
45 |
46 | public Task Task
47 | {
48 | get
49 | {
50 | return task;
51 | }
52 |
53 | set
54 | {
55 | if (task != null)
56 | {
57 | throw new InvalidOperationException("Cannot reset task");
58 | }
59 |
60 | task = value;
61 | }
62 | }
63 |
64 | public static Downloader CreateCompleted(FSItem item, string path, long length)
65 | {
66 | return new Downloader(item, path)
67 | {
68 | Downloaded = length,
69 | Task = Task.FromResult(true),
70 | };
71 | }
72 |
73 | public async Task Failed()
74 | {
75 | using (await lck.LockAsync())
76 | {
77 | failed = true;
78 | Pulse();
79 | }
80 | }
81 |
82 | public async Task WaitToPosition(long pos, CancellationToken token)
83 | {
84 | var ev = new AsyncAutoResetEvent(false);
85 | using (await lck.LockAsync())
86 | {
87 | if (Downloaded > pos)
88 | {
89 | return;
90 | }
91 |
92 | monitor.Add(ev);
93 | }
94 |
95 | while (Downloaded <= pos)
96 | {
97 | await ev.WaitAsync(token);
98 | if (failed)
99 | {
100 | throw new Exception("Download failed");
101 | }
102 | }
103 |
104 | Log.Trace($"Finished WaitToPosition: {Item.Name} - {Item.Id} Downloaded: {Downloaded} Pos: {pos}");
105 | }
106 |
107 | public async Task WaitToTheEnd(CancellationToken token)
108 | {
109 | await WaitToPosition(Item.Length, token);
110 | }
111 |
112 | private void Pulse()
113 | {
114 | foreach (var ev in monitor)
115 | {
116 | ev.Set();
117 | }
118 | }
119 | }
120 | }
--------------------------------------------------------------------------------
/AmazonCloudDrive/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Azi.Cloud.AmazonCloudDrive.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | public class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | public static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Azi.Cloud.AmazonCloudDrive.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | public static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized string similar to Please follow Amazon Cloud Drive login page in your browser and retrun here after it's complete..
65 | ///
66 | public static string WaitForRedirectMessage {
67 | get {
68 | return ResourceManager.GetString("WaitForRedirectMessage", resourceCulture);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Cloud.DokanNet.ruleset:
--------------------------------------------------------------------------------
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 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/CloudItemControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/amazon-clouddrive-dokan/NewFileBlockWriter.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.DokanNet
2 | {
3 | using System.IO;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using Common;
7 | using Tools;
8 |
9 | public class NewFileBlockWriter : AbstractBlockStream
10 | {
11 | private readonly FSItem item;
12 | private readonly FileStream stream;
13 | private readonly SemaphoreSlim sem = new SemaphoreSlim(1, 1);
14 | private bool closed;
15 | private bool disposedValue;
16 |
17 | public NewFileBlockWriter(FSItem item, string filePath)
18 | {
19 | this.item = item;
20 | UploadCachePath = filePath;
21 | stream = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, true);
22 | }
23 |
24 | public bool Cancelled { get; private set; }
25 |
26 | public string UploadCachePath { get; }
27 |
28 | public void CancelUpload()
29 | {
30 | Cancelled = true;
31 | }
32 |
33 | public override void Close()
34 | {
35 | if (closed)
36 | {
37 | return;
38 | }
39 |
40 | closed = true;
41 |
42 | item.Length = stream.Length;
43 | stream.Close();
44 | stream.Dispose();
45 |
46 | Log.Trace($"Closed New file: {item.Path} of {item.Length} bytes");
47 | base.Close();
48 | }
49 |
50 | public override void Flush()
51 | {
52 | stream.Flush();
53 | }
54 |
55 | public override async Task Read(long position, byte[] buffer, int offset, int count, int timeout = 1000)
56 | {
57 | await sem.WaitAsync();
58 | try
59 | {
60 | stream.Position = position;
61 | return await stream.ReadAsync(buffer, offset, count);
62 | }
63 | finally
64 | {
65 | sem.Release();
66 | }
67 | }
68 |
69 | public override void SetLength(long len)
70 | {
71 | sem.Wait();
72 | try
73 | {
74 | stream.SetLength(len);
75 | }
76 | finally
77 | {
78 | sem.Release();
79 | }
80 |
81 | item.Length = len;
82 | }
83 |
84 | public override async Task Write(long position, byte[] buffer, int offset, int count, int timeout = 1000)
85 | {
86 | await sem.WaitAsync();
87 | try
88 | {
89 | // if (lastPosition != position) Log.Warn($"Write Position in New file was changed from {lastPosition} to {position}");
90 | stream.Position = position;
91 | await stream.WriteAsync(buffer, offset, count);
92 |
93 | item.Length = stream.Length;
94 | }
95 | finally
96 | {
97 | sem.Release();
98 | }
99 | }
100 |
101 | protected override void Dispose(bool disposing)
102 | {
103 | if (!disposedValue)
104 | {
105 | if (disposing)
106 | {
107 | Close();
108 | stream.Dispose();
109 | sem.Dispose();
110 | }
111 |
112 | disposedValue = true;
113 | }
114 | }
115 | }
116 | }
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/UpdateChecker.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.DokanNet.Gui
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Text.RegularExpressions;
8 | using System.Threading.Tasks;
9 | using Octokit;
10 |
11 | public class UpdateChecker
12 | {
13 | private static readonly Regex VersionExp = new Regex("^\\D*(\\d.*$)");
14 | private readonly long repositoryId;
15 |
16 | private readonly string githubApiAccessId;
17 |
18 | public UpdateChecker(long repositoryId, string githubApiAccessId)
19 | {
20 | this.repositoryId = repositoryId;
21 | this.githubApiAccessId = githubApiAccessId;
22 | }
23 |
24 | public UpdateChecker(long repositoryId)
25 | : this(repositoryId, "ForRepositoryId" + repositoryId)
26 | {
27 | }
28 |
29 | public enum UpdateType
30 | {
31 | Build,
32 | Patch,
33 | Major,
34 | Minor
35 | }
36 |
37 | public async Task CheckUpdate(UpdateType type = UpdateType.Patch, Version currentVersion = null)
38 | {
39 | var github = new GitHubClient(new ProductHeaderValue(githubApiAccessId));
40 |
41 | var releases = await github.Repository.Release.GetAll(repositoryId);
42 |
43 | if (currentVersion == null)
44 | {
45 | currentVersion = Assembly.GetEntryAssembly().GetName().Version;
46 | }
47 |
48 | var curver = new Semver.SemVersion(currentVersion.Major, currentVersion.Minor, currentVersion.Build, string.Empty, currentVersion.Revision.ToString());
49 | var result = releases.FirstOrDefault(r =>
50 | {
51 | var tagMatch = VersionExp.Match(r.TagName);
52 | if (!tagMatch.Success)
53 | {
54 | return false;
55 | }
56 |
57 | var parsed = Semver.SemVersion.TryParse(tagMatch.Groups[1].Value, out Semver.SemVersion relver);
58 | if (!parsed)
59 | {
60 | return false;
61 | }
62 |
63 | switch (type)
64 | {
65 | case UpdateType.Major:
66 | relver = new Semver.SemVersion(relver.Major);
67 | break;
68 | case UpdateType.Minor:
69 | relver = new Semver.SemVersion(relver.Major, relver.Minor);
70 | break;
71 | case UpdateType.Patch:
72 | relver = new Semver.SemVersion(relver.Major, relver.Minor, relver.Patch);
73 | break;
74 | }
75 |
76 | return relver > curver;
77 | });
78 | if (result == null)
79 | {
80 | return null;
81 | }
82 |
83 | return new UpdateInfo
84 | {
85 | Description = result.Body,
86 | Name = result.Name,
87 | Version = result.TagName,
88 | Assets = result.Assets.Select(a => new UpdateAssetsInfo
89 | {
90 | Name = a.Name,
91 | Url = a.Url,
92 | BrowserUrl = a.BrowserDownloadUrl
93 | }).ToList()
94 | };
95 | }
96 |
97 | public class UpdateAssetsInfo
98 | {
99 | public string BrowserUrl { get; internal set; }
100 |
101 | public string Name { get; internal set; }
102 |
103 | public string Url { get; internal set; }
104 | }
105 |
106 | public class UpdateInfo
107 | {
108 | public List Assets { get; internal set; }
109 |
110 | public string Description { get; internal set; }
111 |
112 | public string Name { get; internal set; }
113 |
114 | public string Version { get; internal set; }
115 | }
116 | }
117 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | ## TODO: Comment the next line if you want to checkin your
137 | ## web deploy settings but do note that will include unencrypted
138 | ## passwords
139 | #*.pubxml
140 |
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Windows Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Windows Store app package directory
157 | AppPackages/
158 |
159 | # Visual Studio cache files
160 | # files ending in .cache can be ignored
161 | *.[Cc]ache
162 | # but keep track of directories ending in .cache
163 | !*.[Cc]ache/
164 |
165 | # Others
166 | ClientBin/
167 | [Ss]tyle[Cc]op.*
168 | ~$*
169 | *~
170 | *.dbmdl
171 | *.dbproj.schemaview
172 | *.publishsettings
173 | node_modules/
174 | orleans.codegen.cs
175 |
176 | # RIA/Silverlight projects
177 | Generated_Code/
178 |
179 | # Backup & report files from converting an old project file
180 | # to a newer Visual Studio version. Backup files are not needed,
181 | # because we have git ;-)
182 | _UpgradeReport_Files/
183 | Backup*/
184 | UpgradeLog*.XML
185 | UpgradeLog*.htm
186 |
187 | # SQL Server files
188 | *.mdf
189 | *.ldf
190 |
191 | # Business Intelligence projects
192 | *.rdl.data
193 | *.bim.layout
194 | *.bim_*.settings
195 |
196 | # Microsoft Fakes
197 | FakesAssemblies/
198 |
199 | # Node.js Tools for Visual Studio
200 | .ntvs_analysis.dat
201 |
202 | # Visual Studio 6 build log
203 | *.plg
204 |
205 | # Visual Studio 6 workspace options file
206 | *.opt
207 |
208 | # LightSwitch generated files
209 | GeneratedArtifacts/
210 | _Pvt_Extensions/
211 | ModelManifest.xml
212 | AmazonSecret.cs
213 | MicrosoftSecret.cs
214 | *.db
215 | *.opendb
216 |
--------------------------------------------------------------------------------
/Cloud.Common/Cloud.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {93841375-56D7-4B34-AA7C-BA69F29F8B66}
8 | Library
9 | Properties
10 | Azi.Cloud.Common
11 | Cloud.Common
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | ..\Cloud.DokanNet.ruleset
25 |
26 |
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | ..\Cloud.DokanNet.ruleset
36 |
37 |
38 |
39 |
40 | true
41 |
42 |
43 | StrongSign.pfx
44 |
45 |
46 |
47 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
94 |
--------------------------------------------------------------------------------
/ACD.DokanNet.Gui/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Azi.Cloud.DokanNet.Gui.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("%TEMP%\\ACDDokanNetCache")]
29 | public string CacheFolder {
30 | get {
31 | return ((string)(this["CacheFolder"]));
32 | }
33 | set {
34 | this["CacheFolder"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("20")]
41 | public long SmallFileSizeLimit {
42 | get {
43 | return ((long)(this["SmallFileSizeLimit"]));
44 | }
45 | set {
46 | this["SmallFileSizeLimit"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | [global::System.Configuration.DefaultSettingValueAttribute("1000")]
53 | public long SmallFilesCacheLimit {
54 | get {
55 | return ((long)(this["SmallFilesCacheLimit"]));
56 | }
57 | set {
58 | this["SmallFilesCacheLimit"] = value;
59 | }
60 | }
61 |
62 | [global::System.Configuration.UserScopedSettingAttribute()]
63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
65 | public bool NeedUpgrade {
66 | get {
67 | return ((bool)(this["NeedUpgrade"]));
68 | }
69 | set {
70 | this["NeedUpgrade"] = value;
71 | }
72 | }
73 |
74 | [global::System.Configuration.UserScopedSettingAttribute()]
75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
76 | public global::Azi.Cloud.Common.CloudInfoCollection Clouds {
77 | get {
78 | return ((global::Azi.Cloud.Common.CloudInfoCollection)(this["Clouds"]));
79 | }
80 | set {
81 | this["Clouds"] = value;
82 | }
83 | }
84 |
85 | [global::System.Configuration.UserScopedSettingAttribute()]
86 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
87 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
88 | public int WinHeight {
89 | get {
90 | return ((int)(this["WinHeight"]));
91 | }
92 | set {
93 | this["WinHeight"] = value;
94 | }
95 | }
96 |
97 | [global::System.Configuration.UserScopedSettingAttribute()]
98 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
99 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
100 | public bool CheckFileHash {
101 | get {
102 | return ((bool)(this["CheckFileHash"]));
103 | }
104 | set {
105 | this["CheckFileHash"] = value;
106 | }
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Tools/Tools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {199CDB28-7472-41BD-BB1F-BF345451A68D}
8 | Library
9 | Properties
10 | Tools
11 | Tools
12 | v4.5
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | AnyCPU
25 | ..\Cloud.DokanNet.ruleset
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | AnyCPU
35 | ..\Cloud.DokanNet.ruleset
36 |
37 |
38 | true
39 |
40 |
41 | StrongSign.pfx
42 |
43 |
44 |
45 | ..\packages\HockeySDK.WPF.4.1.6\lib\net45\Microsoft.HockeyApp.Core45.dll
46 |
47 |
48 | ..\packages\HockeySDK.WPF.4.1.6\lib\net45\Microsoft.HockeyApp.Kit.dll
49 |
50 |
51 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
91 |
--------------------------------------------------------------------------------
/amazon-clouddrive-dokanTests/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Azi.Cloud.DokanNet.Tests.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
16 | public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("")]
29 | public string AuthToken {
30 | get {
31 | return ((string)(this["AuthToken"]));
32 | }
33 | set {
34 | this["AuthToken"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("")]
41 | public string AuthRenewToken {
42 | get {
43 | return ((string)(this["AuthRenewToken"]));
44 | }
45 | set {
46 | this["AuthRenewToken"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | public global::System.DateTime AuthTokenExpiration {
53 | get {
54 | return ((global::System.DateTime)(this["AuthTokenExpiration"]));
55 | }
56 | set {
57 | this["AuthTokenExpiration"] = value;
58 | }
59 | }
60 |
61 | [global::System.Configuration.UserScopedSettingAttribute()]
62 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
63 | public char LastDriveLetter {
64 | get {
65 | return ((char)(this["LastDriveLetter"]));
66 | }
67 | set {
68 | this["LastDriveLetter"] = value;
69 | }
70 | }
71 |
72 | [global::System.Configuration.UserScopedSettingAttribute()]
73 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
74 | [global::System.Configuration.DefaultSettingValueAttribute("ACDDokanNetTest\\ACDDokanNetCache")]
75 | public string CacheFolder {
76 | get {
77 | return ((string)(this["CacheFolder"]));
78 | }
79 | set {
80 | this["CacheFolder"] = value;
81 | }
82 | }
83 |
84 | [global::System.Configuration.UserScopedSettingAttribute()]
85 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
86 | [global::System.Configuration.DefaultSettingValueAttribute("20")]
87 | public long SmallFileSizeLimit {
88 | get {
89 | return ((long)(this["SmallFileSizeLimit"]));
90 | }
91 | set {
92 | this["SmallFileSizeLimit"] = value;
93 | }
94 | }
95 |
96 | [global::System.Configuration.UserScopedSettingAttribute()]
97 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
98 | [global::System.Configuration.DefaultSettingValueAttribute("1000")]
99 | public long SmallFilesCacheLimit {
100 | get {
101 | return ((long)(this["SmallFilesCacheLimit"]));
102 | }
103 | set {
104 | this["SmallFilesCacheLimit"] = value;
105 | }
106 | }
107 |
108 | [global::System.Configuration.UserScopedSettingAttribute()]
109 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
110 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
111 | public bool ReadOnly {
112 | get {
113 | return ((bool)(this["ReadOnly"]));
114 | }
115 | set {
116 | this["ReadOnly"] = value;
117 | }
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/amazon-clouddrive-dokan/RootFolderFSProvider.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 class RootFolderFSProvider : IFSProvider
10 | {
11 | private readonly IFSProvider provider;
12 | private string rootFolder;
13 |
14 | public RootFolderFSProvider(IFSProvider provider)
15 | {
16 | this.provider = provider;
17 | }
18 |
19 | public string CachePath
20 | {
21 | get { return provider.CachePath; }
22 | set { provider.CachePath = value; }
23 | }
24 |
25 | public bool CheckFileHash
26 | {
27 | get { return provider.CheckFileHash; }
28 | set { provider.CheckFileHash = value; }
29 | }
30 |
31 | public string FileSystemName => provider.FileSystemName;
32 |
33 | public SmallFilesCache SmallFilesCache => provider.SmallFilesCache;
34 |
35 | public long SmallFilesCacheSize
36 | {
37 | get { return provider.SmallFilesCacheSize; }
38 | set { provider.SmallFilesCacheSize = value; }
39 | }
40 |
41 | public long SmallFileSizeLimit
42 | {
43 | get { return provider.SmallFileSizeLimit; }
44 | set { provider.SmallFileSizeLimit = value; }
45 | }
46 |
47 | public string VolumeName
48 | {
49 | get { return provider.VolumeName; }
50 | set { provider.VolumeName = value; }
51 | }
52 |
53 | public async Task BuildItemInfo(FSItem item) => await provider.BuildItemInfo(item).ConfigureAwait(false);
54 |
55 | public void CancelUpload(string id) => provider.CancelUpload(id);
56 |
57 | public async Task ClearSmallFilesCache() => await provider.ClearSmallFilesCache().ConfigureAwait(false);
58 |
59 | public async Task CreateDir(string filePath) => await provider.CreateDir(FixRoot(filePath)).ConfigureAwait(false);
60 |
61 | public async Task DeleteDir(string filePath) => await provider.DeleteDir(FixRoot(filePath)).ConfigureAwait(false);
62 |
63 | public async Task DeleteFile(string filePath) => await provider.DeleteFile(FixRoot(filePath)).ConfigureAwait(false);
64 |
65 | public void Dispose()
66 | {
67 | provider.Dispose();
68 | }
69 |
70 | public async Task Exists(string filePath) => await provider.Exists(FixRoot(filePath)).ConfigureAwait(false);
71 |
72 | public async Task FetchNode(string itemPath) => await provider.FetchNode(FixRoot(itemPath)).ConfigureAwait(false);
73 |
74 | public async Task GetAvailableFreeSpace() => await provider.GetAvailableFreeSpace().ConfigureAwait(false);
75 |
76 | public async Task> GetDirItems(string folderPath)
77 | {
78 | var result = await provider.GetDirItems(FixRoot(folderPath)).ConfigureAwait(false);
79 | foreach (var fsItem in result)
80 | {
81 | if (fsItem.Path.StartsWith(rootFolder))
82 | {
83 | fsItem.Path = fsItem.Path.Substring(rootFolder.Length);
84 | }
85 | }
86 |
87 | return result;
88 | }
89 |
90 | public async Task GetExtendedInfo(string[] streamNameGroups, FSItem item) => await provider.GetExtendedInfo(streamNameGroups, item).ConfigureAwait(false);
91 |
92 | public async Task GetTotalFreeSpace() => await provider.GetTotalFreeSpace().ConfigureAwait(false);
93 |
94 | public async Task GetTotalSize() => await provider.GetTotalSize().ConfigureAwait(false);
95 |
96 | public async Task GetTotalUsedSpace() => await provider.GetTotalUsedSpace().ConfigureAwait(false);
97 |
98 | public async Task MoveFile(string oldPath, string newPath, bool replace) => await provider.MoveFile(FixRoot(oldPath), FixRoot(newPath), replace).ConfigureAwait(false);
99 |
100 | public async Task OpenFile(string filePath, FileMode mode, FileAccess fileAccess, FileShare share, FileOptions options)
101 | {
102 | return await provider.OpenFile(FixRoot(filePath), mode, fileAccess, share, options).ConfigureAwait(false);
103 | }
104 |
105 | public async Task GetItemInfo(string fileName) => await provider.GetItemInfo(FixRoot(fileName)).ConfigureAwait(false);
106 |
107 | public ByteArrayBlockWriter OpenUploadHere(FSItem item) => provider.OpenUploadHere(item);
108 |
109 | public async Task SetRootFolder(string rootfolder)
110 | {
111 | if (string.IsNullOrWhiteSpace(rootfolder))
112 | {
113 | rootFolder = string.Empty;
114 | return;
115 | }
116 |
117 | rootFolder = "\\" + rootfolder.TrimStart('\\');
118 | rootFolder = await provider.Exists(rootfolder).ConfigureAwait(false) ? rootfolder : string.Empty;
119 | }
120 |
121 | public void StopUpload() => provider.StopUpload();
122 |
123 | private string FixRoot(string folderPath) => Path.Combine(rootFolder, folderPath.TrimStart('\\'));
124 | }
125 | }
--------------------------------------------------------------------------------
/AmazonCloudDrive/AmazonCloudDrive.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {43097C04-9303-428D-A06C-1D2BF1D6647D}
8 | Library
9 | Properties
10 | Azi.Cloud.AmazonCloudDrive
11 | Clouds.AmazonCloudDrive
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 | ..\Cloud.DokanNet.ruleset
27 |
28 |
29 |
30 |
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | ..\Cloud.DokanNet.ruleset
38 |
39 |
40 |
41 |
42 | true
43 |
44 |
45 | StrongSign.pfx
46 |
47 |
48 |
49 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | MountWaitBox.xaml
71 |
72 |
73 |
74 | True
75 | True
76 | Resources.resx
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | {2c611335-3d92-492f-b3eb-2cf3955f63a1}
87 | AmazonCloudDriveApi
88 |
89 |
90 | {93841375-56d7-4b34-aa7c-ba69f29f8b66}
91 | Cloud.Common
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | MSBuild:Compile
100 | Designer
101 |
102 |
103 |
104 |
105 | PublicResXFileCodeGenerator
106 | Resources.Designer.cs
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
122 |
--------------------------------------------------------------------------------
/Cloud.Common/FSItem.cs:
--------------------------------------------------------------------------------
1 | namespace Azi.Cloud.Common
2 | {
3 | using System;
4 | using System.Collections.Concurrent;
5 | using System.Threading;
6 |
7 | public class FSItem
8 | {
9 | private long length;
10 |
11 | public FSItem(FSItem item)
12 | {
13 | IsUploading = item.IsUploading;
14 | Path = item.Path;
15 | Id = item.Id;
16 | IsDir = item.IsDir;
17 | Length = item.Length;
18 | LastAccessTime = item.LastAccessTime;
19 | LastWriteTime = item.LastWriteTime;
20 | CreationTime = item.CreationTime;
21 | ContentId = item.ContentId;
22 | ParentIds = new ConcurrentBag(item.ParentIds);
23 | }
24 |
25 | private FSItem()
26 | {
27 | }
28 |
29 | public DateTime CreationTime { get; set; }
30 |
31 | public string Dir => System.IO.Path.GetDirectoryName(Path);
32 |
33 | public DateTime FetchTime { get; } = DateTime.UtcNow;
34 |
35 | public string Id { get; internal set; }
36 |
37 | public byte[] Info { get; set; }
38 |
39 | public bool IsDir { get; internal set; }
40 |
41 | public bool IsUploading { get; internal set; }
42 |
43 | public DateTime LastAccessTime { get; set; }
44 |
45 | public DateTime LastWriteTime { get; set; }
46 |
47 | public string ContentId { get; internal set; }
48 |
49 | public long Length
50 | {
51 | get
52 | {
53 | return Interlocked.Read(ref length);
54 | }
55 |
56 | set
57 | {
58 | Interlocked.Exchange(ref length, value);
59 | }
60 | }
61 |
62 | public string Name => System.IO.Path.GetFileName(Path);
63 |
64 | // To replacement to cache files in path that does not exist
65 | public bool NotExistingDummy { get; private set; }
66 |
67 | public ConcurrentBag ParentIds { get; private set; }
68 |
69 | public string Path { get; set; }
70 |
71 | public static FSItem MakeNotExistingDummy(string path)
72 | {
73 | return new FSItem
74 | {
75 | Path = path,
76 | NotExistingDummy = true
77 | };
78 | }
79 |
80 | public static FSItem MakeUploading(string path, string cachedId, string parentId, long length)
81 | {
82 | var now = DateTime.UtcNow;
83 | return new FSItem
84 | {
85 | IsUploading = true,
86 | Length = length,
87 | Id = cachedId,
88 | Path = path,
89 | IsDir = false,
90 | CreationTime = now,
91 | LastAccessTime = now,
92 | LastWriteTime = now,
93 | ParentIds = new ConcurrentBag(new[] { parentId })
94 | };
95 | }
96 |
97 | public bool IsContentIdEqual(FSItem i)
98 | {
99 | if (string.IsNullOrWhiteSpace(i?.ContentId) || string.IsNullOrWhiteSpace(ContentId))
100 | {
101 | return false;
102 | }
103 |
104 | return ContentId == i.ContentId;
105 | }
106 |
107 | public bool IsExpired(int expirationSeconds) => DateTime.UtcNow > FetchTime.AddSeconds(expirationSeconds);
108 |
109 | public void MakeNotUploading()
110 | {
111 | IsUploading = false;
112 | }
113 |
114 | public void MakeUploading()
115 | {
116 | IsUploading = true;
117 | }
118 |
119 | public class Builder
120 | {
121 | public DateTime CreationTime { get; set; }
122 |
123 | public string Id { get; set; }
124 |
125 | public bool IsDir { get; set; }
126 |
127 | public DateTime LastAccessTime { get; set; }
128 |
129 | public DateTime LastWriteTime { get; set; }
130 |
131 | public long Length { get; set; }
132 |
133 | public string Name { get; set; }
134 |
135 | public ConcurrentBag ParentIds { get; set; }
136 |
137 | public string ParentPath { get; set; }
138 |
139 | public string ContentId { get; set; }
140 |
141 | public Builder SetParentPath(string path)
142 | {
143 | if (path != null)
144 | {
145 | ParentPath = path.StartsWith("\\") ? path : "\\" + path;
146 | }
147 |
148 | return this;
149 | }
150 |
151 | public FSItem Build()
152 | {
153 | if (ParentPath == null)
154 | {
155 | throw new NullReferenceException("ParentPath should be set");
156 | }
157 |
158 | var result = new FSItem
159 | {
160 | Id = Id,
161 | CreationTime = CreationTime,
162 | IsDir = IsDir,
163 | LastAccessTime = LastAccessTime,
164 | LastWriteTime = LastWriteTime,
165 | Length = Length,
166 | ContentId = ContentId?.ToLowerInvariant(),
167 | ParentIds = new ConcurrentBag(ParentIds),
168 | Path = (ParentPath != string.Empty) ? System.IO.Path.Combine(ParentPath, Name) : "\\" + Name
169 | };
170 |
171 | return result;
172 | }
173 |
174 | public FSItem BuildRoot()
175 | {
176 | ParentPath = "\\";
177 | Name = string.Empty;
178 | return Build();
179 | }
180 | }
181 | }
182 | }
--------------------------------------------------------------------------------
/ACDDokanNetInstaller/ModifyMsiToEnableLaunchApplication.js:
--------------------------------------------------------------------------------
1 | // EnableLaunchApplication.js
2 | // Performs a post-build fixup of an msi to launch a specific file when the install has completed
3 |
4 | // Configurable values
5 | var checkboxChecked = true; // Is the checkbox on the finished dialog checked by default?
6 | var checkboxText = "Launch Settings"; // Text for the checkbox on the finished dialog
7 | var filename = "ACD.DokanNet.Gui.exe"; // The name of the executable to launch - change this to match the file you want to launch at the end of your setup
8 |
9 | // Constant values from Windows Installer
10 | var msiOpenDatabaseModeTransact = 1;
11 |
12 | var msiViewModifyInsert = 1;
13 | var msiViewModifyUpdate = 2;
14 | var msiViewModifyAssign = 3;
15 | var msiViewModifyReplace = 4;
16 | var msiViewModifyDelete = 6;
17 |
18 | if (WScript.Arguments.Length != 1)
19 | {
20 | WScript.StdErr.WriteLine(WScript.ScriptName + " file");
21 | WScript.Quit(1);
22 | }
23 |
24 | var filespec = WScript.Arguments(0);
25 | var installer = WScript.CreateObject("WindowsInstaller.Installer");
26 | var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
27 |
28 | var sql;
29 | var view;
30 | var record;
31 |
32 | try
33 | {
34 | var fileId = FindFileIdentifier(database, filename);
35 | if (!fileId)
36 | throw "Unable to find '" + filename + "' in File table";
37 |
38 | WScript.Echo("Updating the Control table...");
39 | // Modify the Control_Next of BannerBmp control to point to the new CheckBox
40 | sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FinishedForm' AND `Control`='BannerBmp'";
41 | view = database.OpenView(sql);
42 | view.Execute();
43 | record = view.Fetch();
44 | record.StringData(11) = "CheckboxLaunch";
45 | view.Modify(msiViewModifyReplace, record);
46 | view.Close();
47 |
48 | // Insert the new CheckBox control
49 | sql = "INSERT INTO `Control` (`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help`) VALUES ('FinishedForm', 'CheckboxLaunch', 'CheckBox', '9', '201', '343', '12', '3', 'LAUNCHAPP', '{\\VSI_MS_Sans_Serif13.0_0_0}" + checkboxText + "', 'CloseButton', '|')";
50 | view = database.OpenView(sql);
51 | view.Execute();
52 | view.Close();
53 |
54 | WScript.Echo("Updating the ControlEvent table...");
55 | // Modify the Order of the EndDialog event of the FinishedForm to 1
56 | sql = "SELECT `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_`='FinishedForm' AND `Event`='EndDialog'";
57 | view = database.OpenView(sql);
58 | view.Execute();
59 | record = view.Fetch();
60 | record.IntegerData(6) = 1;
61 | view.Modify(msiViewModifyReplace, record);
62 | view.Close();
63 |
64 | // Insert the Event to launch the application
65 | sql = "INSERT INTO `ControlEvent` (`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES ('FinishedForm', 'CloseButton', 'DoAction', 'VSDCA_Launch', 'LAUNCHAPP=1', '0')";
66 | view = database.OpenView(sql);
67 | view.Execute();
68 | view.Close();
69 |
70 | WScript.Echo("Updating the CustomAction table...");
71 | // Insert the custom action to launch the application when finished
72 | sql = "INSERT INTO `CustomAction` (`Action`, `Type`, `Source`, `Target`) VALUES ('VSDCA_Launch', '210', '" + fileId + "', '')";
73 | view = database.OpenView(sql);
74 | view.Execute();
75 | view.Close();
76 |
77 | if (checkboxChecked)
78 | {
79 | WScript.Echo("Updating the Property table...");
80 | // Set the default value of the CheckBox
81 | sql = "INSERT INTO `Property` (`Property`, `Value`) VALUES ('LAUNCHAPP', '1')";
82 | view = database.OpenView(sql);
83 | view.Execute();
84 | view.Close();
85 | }
86 |
87 | database.Commit();
88 | }
89 | catch(e)
90 | {
91 | WScript.StdErr.WriteLine(e);
92 | WScript.Quit(1);
93 | }
94 |
95 | function FindFileIdentifier(database, fileName)
96 | {
97 | // First, try to find the exact file name
98 | var sql = "SELECT `File` FROM `File` WHERE `FileName`='" + fileName + "'";
99 | var view = database.OpenView(sql);
100 | view.Execute();
101 | var record = view.Fetch();
102 | if (record)
103 | {
104 | var value = record.StringData(1);
105 | view.Close();
106 | return value;
107 | }
108 | view.Close();
109 |
110 | // The file may be in SFN|LFN format. Look for a filename in this case next
111 | sql = "SELECT `File`, `FileName` FROM `File`";
112 | view = database.OpenView(sql);
113 | view.Execute();
114 | record = view.Fetch();
115 | while (record)
116 | {
117 | if (StringEndsWith(record.StringData(2), "|" + fileName))
118 | {
119 | var value = record.StringData(1);
120 | view.Close();
121 | return value;
122 | }
123 |
124 | record = view.Fetch();
125 | }
126 | view.Close();
127 | }
128 |
129 | function StringEndsWith(str, value)
130 | {
131 | if (str.length < value.length)
132 | return false;
133 |
134 | return (str.indexOf(value, str.length - value.length) != -1);
135 | }
--------------------------------------------------------------------------------
/amazon-clouddrive-dokanTests/FSProviderTestsBase.cs:
--------------------------------------------------------------------------------
1 | using Azi.Cloud.AmazonCloudDrive;
2 | using Azi.Cloud.Common;
3 | using System;
4 | using System.IO;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using Azi.Tools;
8 |
9 | namespace Azi.Cloud.DokanNet.Tests
10 | {
11 | public abstract class FSProviderTestsBase : IDisposable, IAuthUpdateListener
12 | {
13 | protected const string Testdir = "\\ACDDokanNetTest\\";
14 |
15 | private bool disposedValue; // To detect redundant calls
16 |
17 | protected async Task Init()
18 | {
19 | Amazon = await Authenticate();
20 | if (Amazon == null)
21 | {
22 | throw new InvalidOperationException("Authentication failed");
23 | }
24 |
25 | DeleteDir("TempCache");
26 |
27 | Provider = new FSProvider(Amazon, (a, b, c) => Task.FromResult(0))
28 | {
29 | CachePath = "TempCache",
30 | SmallFilesCacheSize = 20*(1 << 20),
31 | SmallFileSizeLimit = 1*(1 << 20)
32 | };
33 |
34 | try
35 | {
36 | await Provider.DeleteDir("\\ACDDokanNetTest");
37 | }
38 | catch (FileNotFoundException)
39 | {
40 | //Ignore
41 | }
42 | await Provider.CreateDir("\\ACDDokanNetTest");
43 | }
44 |
45 | protected FSProviderTestsBase()
46 | {
47 | UnitTestDetector.IsUnitTest = true;
48 | StartSTATask(Init).Wait();
49 | }
50 |
51 | public static Task StartSTATask(Func action)
52 | {
53 | var tcs = new TaskCompletionSource