Skip to content

Commit 3423c3a

Browse files
committed
v3.0.1029-Beta
0 parents  commit 3423c3a

55 files changed

Lines changed: 3418 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
##
4+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5+
6+
# User-specific files
7+
*.rsuser
8+
*.suo
9+
*.user
10+
*.userosscache
11+
*.sln.docstates
12+
13+
# User-specific files (MonoDevelop/Xamarin Studio)
14+
*.userprefs
15+
16+
# Mono auto generated files
17+
mono_crash.*
18+
19+
# Build results
20+
[Dd]ebug/
21+
[Dd]ebugPublic/
22+
[Rr]elease/
23+
[Rr]eleases/
24+
x64/
25+
x86/
26+
[Aa][Rr][Mm]/
27+
[Aa][Rr][Mm]64/
28+
bld/
29+
[Bb]in/
30+
[Oo]bj/
31+
[Ll]og/
32+
33+
# Visual Studio 2015/2017 cache/options directory
34+
.vs/
35+
36+
*.DotSettings.user
37+
packages/

FileProviderBinding.sln

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.329
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDavContainer", "WebDavContainer\WebDavContainer.csproj", "{634EB322-4BE5-4928-94D2-4464E9FE29C5}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDavContainerExtension", "WebDavContainerExtension\WebDavContainerExtension.csproj", "{199FFDC4-8BB2-4F21-93F5-6883E627487B}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDavCommon", "WebDavCommon\WebDavCommon.csproj", "{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Debug|iPhone = Debug|iPhone
16+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
17+
Release|Any CPU = Release|Any CPU
18+
Release|iPhone = Release|iPhone
19+
Release|iPhoneSimulator = Release|iPhoneSimulator
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
23+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
24+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|Any CPU.ActiveCfg = Release|iPhone
25+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|Any CPU.Build.0 = Release|iPhone
26+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
27+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
28+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|iPhone.ActiveCfg = Release|iPhone
29+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|iPhone.Build.0 = Release|iPhone
30+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
31+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
32+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|iPhone.ActiveCfg = Debug|iPhone
33+
{634EB322-4BE5-4928-94D2-4464E9FE29C5}.Debug|iPhone.Build.0 = Debug|iPhone
34+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
35+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
36+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|Any CPU.ActiveCfg = Release|iPhone
37+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|Any CPU.Build.0 = Release|iPhone
38+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
39+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
40+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|iPhone.ActiveCfg = Release|iPhone
41+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|iPhone.Build.0 = Release|iPhone
42+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
43+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
44+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|iPhone.ActiveCfg = Debug|iPhone
45+
{199FFDC4-8BB2-4F21-93F5-6883E627487B}.Debug|iPhone.Build.0 = Debug|iPhone
46+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
51+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
52+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|iPhone.ActiveCfg = Release|Any CPU
53+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|iPhone.Build.0 = Release|Any CPU
54+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
55+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
56+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|iPhone.ActiveCfg = Debug|Any CPU
57+
{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}.Debug|iPhone.Build.0 = Debug|Any CPU
58+
EndGlobalSection
59+
GlobalSection(SolutionProperties) = preSolution
60+
HideSolutionNode = FALSE
61+
EndGlobalSection
62+
GlobalSection(ExtensibilityGlobals) = postSolution
63+
SolutionGuid = {53A806CF-6CB1-410A-B58C-826B487CAB12}
64+
EndGlobalSection
65+
EndGlobal

WebDavCommon/AppGroupSettings.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.IO;
3+
using Foundation;
4+
5+
namespace WebDavCommon
6+
{
7+
public static class AppGroupSettings
8+
{
9+
private const string AppGroupId = "group.com.WebDAV.Client.Container";
10+
private const string ServerSettingFile = "data.out";
11+
12+
public static ServerSettings GetServerSettings()
13+
{
14+
using (NSUrl userDataPath = GetSharedContainerUrl())
15+
using (NSDictionary userData = NSDictionary.FromFile(Path.Combine(userDataPath.Path, ServerSettingFile)))
16+
{
17+
if (userData == null)
18+
{
19+
return null;
20+
}
21+
22+
return ServerSettings.CreateFromNsDictionary(userData);
23+
}
24+
}
25+
26+
private static NSUrl GetSharedContainerUrl()
27+
{
28+
NSUrl userDataPath = NSFileManager.DefaultManager.GetContainerUrl(AppGroupId);
29+
if (userDataPath == null)
30+
{
31+
throw new AccessViolationException("Group container is null");
32+
}
33+
34+
return userDataPath;
35+
}
36+
37+
public static void SaveServerSettings(ServerSettings serverSettings)
38+
{
39+
if (serverSettings == null)
40+
{
41+
throw new ArgumentNullException(nameof(serverSettings));
42+
}
43+
44+
using (NSUrl userDataPath = GetSharedContainerUrl())
45+
using (NSDictionary data = serverSettings.ToNsDictionary())
46+
{
47+
if (!data.WriteToFile(Path.Combine(userDataPath.Path, ServerSettingFile), true))
48+
{
49+
throw new Exception("Failed to save server setting");
50+
}
51+
}
52+
}
53+
}
54+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("WebDavCommon")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("")]
12+
[assembly: AssemblyCopyright("${AuthorCopyright}")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]

WebDavCommon/ServerSettings.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System;
2+
using Foundation;
3+
4+
namespace WebDavCommon
5+
{
6+
public class ServerSettings
7+
{
8+
private const string ServerUriKey = "ServerUri";
9+
private const string UserNameKey = "UserName";
10+
private const string PasswordKey = "PassWord";
11+
12+
public Uri ServerUri { get; }
13+
14+
public string Password { get; set; }
15+
16+
public string UserName { get; set; }
17+
18+
public ServerSettings(string serverUri, string userName = "", string password = "")
19+
{
20+
if(string.IsNullOrEmpty(serverUri)) throw new ArgumentException(serverUri);
21+
ServerUri = new Uri(serverUri);
22+
UserName = userName;
23+
Password = password;
24+
}
25+
26+
public bool HasCredential => !string.IsNullOrEmpty(this.Password) && !string.IsNullOrEmpty(this.UserName);
27+
28+
public static ServerSettings CreateFromNsDictionary(NSDictionary userDataDictionary)
29+
{
30+
if(userDataDictionary != null)
31+
{
32+
NSObject serverUrl = userDataDictionary.ValueForKey((NSString) ServerUriKey);
33+
NSObject userName = userDataDictionary.ValueForKey((NSString) UserNameKey);
34+
NSObject passWord = userDataDictionary.ValueForKey((NSString) PasswordKey);
35+
return new ServerSettings(serverUrl.ToString(), userName.ToString(), passWord.ToString());
36+
}
37+
38+
throw new ArgumentNullException(nameof(userDataDictionary));
39+
}
40+
41+
public NSDictionary ToNsDictionary()
42+
{
43+
return new NSDictionary(new NSString(UserNameKey), new NSString(UserName),
44+
new NSString(ServerUriKey), new NSString(ServerUri.ToString()),
45+
new NSString(PasswordKey), new NSString(Password));
46+
}
47+
}
48+
}

WebDavCommon/WebDavCommon.csproj

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{708B1F71-FCB5-4B80-AB5A-DED7C3F4B901}</ProjectGuid>
7+
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>WebDavCommon</RootNamespace>
10+
<AssemblyName>WebDavCommon</AssemblyName>
11+
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\Debug</OutputPath>
18+
<DefineConstants>DEBUG;</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
<CodesignKey>iPhone Developer</CodesignKey>
22+
<MtouchDebug>true</MtouchDebug>
23+
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
24+
<MtouchFastDev>true</MtouchFastDev>
25+
<IOSDebuggerPort>56784</IOSDebuggerPort>
26+
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
27+
<DeviceSpecificBuild>false</DeviceSpecificBuild>
28+
<MtouchVerbosity>
29+
</MtouchVerbosity>
30+
<MtouchLink>
31+
</MtouchLink>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34+
<DebugType>pdbonly</DebugType>
35+
<Optimize>true</Optimize>
36+
<OutputPath>bin\Release</OutputPath>
37+
<DefineConstants>
38+
</DefineConstants>
39+
<ErrorReport>prompt</ErrorReport>
40+
<WarningLevel>4</WarningLevel>
41+
<CodesignKey>iPhone Developer</CodesignKey>
42+
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
43+
<MtouchLink>SdkOnly</MtouchLink>
44+
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
45+
<MtouchVerbosity>
46+
</MtouchVerbosity>
47+
</PropertyGroup>
48+
<ItemGroup>
49+
<Reference Include="System" />
50+
<Reference Include="System.Xml" />
51+
<Reference Include="System.Core" />
52+
<Reference Include="Xamarin.iOS" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Folder Include="Resources\" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
<Compile Include="ServerSettings.cs" />
60+
<Compile Include="AppGroupSettings.cs" />
61+
</ItemGroup>
62+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
63+
</Project>

WebDavContainer/AppDelegate.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using Foundation;
2+
using UIKit;
3+
4+
namespace WebDavContainer
5+
{
6+
// The UIApplicationDelegate for the application. This class is responsible for launching the
7+
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
8+
[Register("AppDelegate")]
9+
public class AppDelegate : UIApplicationDelegate
10+
{
11+
// class-level declarations
12+
13+
public override UIWindow Window
14+
{
15+
get;
16+
set;
17+
}
18+
19+
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
20+
{
21+
// Override point for customization after application launch.
22+
// If not required for your application you can safely delete this method
23+
24+
return true;
25+
}
26+
27+
public override void OnResignActivation(UIApplication application)
28+
{
29+
// Invoked when the application is about to move from active to inactive state.
30+
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
31+
// or when the user quits the application and it begins the transition to the background state.
32+
// Games should use this method to pause the game.
33+
}
34+
35+
public override void DidEnterBackground(UIApplication application)
36+
{
37+
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
38+
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
39+
}
40+
41+
public override void WillEnterForeground(UIApplication application)
42+
{
43+
// Called as part of the transiton from background to active state.
44+
// Here you can undo many of the changes made on entering the background.
45+
}
46+
47+
public override void OnActivated(UIApplication application)
48+
{
49+
// Restart any tasks that were paused (or not yet started) while the application was inactive.
50+
// If the application was previously in the background, optionally refresh the user interface.
51+
}
52+
53+
public override void WillTerminate(UIApplication application)
54+
{
55+
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
56+
}
57+
58+
}
59+
}
60+

0 commit comments

Comments
 (0)