├── .gitignore
├── FilePicker
├── FilePicker.sln
└── FilePicker
│ ├── Plugin.FilePicker.Abstractions
│ ├── FileData.cs
│ ├── FilePickerEventArgs.cs
│ ├── IFilePicker.cs
│ ├── Plugin.FilePicker.Abstractions.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ ├── Plugin.FilePicker.Android
│ ├── FilePickerActivity.cs
│ ├── FilePickerImplementation.cs
│ ├── IOUtil.cs
│ ├── Plugin.FilePicker.Android.csproj
│ ├── Plugin.FilePicker.Android.csproj.bak
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Resources
│ │ ├── AboutResources.txt
│ │ └── Resource.Designer.cs
│ ├── Plugin.FilePicker.Mac
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.Mac.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ ├── Plugin.FilePicker.UWP
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.UWP.csproj
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Plugin.FilePicker.UWP.rd.xml
│ └── project.json
│ ├── Plugin.FilePicker.WindowsPhone8
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.WindowsPhone8.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ ├── Plugin.FilePicker.WindowsPhone81
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.WindowsPhone81.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ ├── Plugin.FilePicker.WindowsStore
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.WindowsStore.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ ├── Plugin.FilePicker.iOS
│ ├── FilePickerImplementation.cs
│ ├── Plugin.FilePicker.iOS.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
│ └── Plugin.FilePicker
│ ├── CrossFilePicker.cs
│ ├── Plugin.FilePicker.csproj
│ └── Properties
│ └── AssemblyInfo.cs
├── LICENSE
├── README.md
└── Xamarin.Plugin.FilePicker.nuspec
/.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 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 | # NuGet v3's project.json files produces more ignoreable files
154 | *.nuget.props
155 | *.nuget.targets
156 |
157 | # Microsoft Azure Build Output
158 | csx/
159 | *.build.csdef
160 |
161 | # Microsoft Azure Emulator
162 | ecf/
163 | rcf/
164 |
165 | # Microsoft Azure ApplicationInsights config file
166 | ApplicationInsights.config
167 |
168 | # Windows Store app package directory
169 | AppPackages/
170 | BundleArtifacts/
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # RIA/Silverlight projects
190 | Generated_Code/
191 |
192 | # Backup & report files from converting an old project file
193 | # to a newer Visual Studio version. Backup files are not needed,
194 | # because we have git ;-)
195 | _UpgradeReport_Files/
196 | Backup*/
197 | UpgradeLog*.XML
198 | UpgradeLog*.htm
199 |
200 | # SQL Server files
201 | *.mdf
202 | *.ldf
203 |
204 | # Business Intelligence projects
205 | *.rdl.data
206 | *.bim.layout
207 | *.bim_*.settings
208 |
209 | # Microsoft Fakes
210 | FakesAssemblies/
211 |
212 | # GhostDoc plugin setting file
213 | *.GhostDoc.xml
214 |
215 | # Node.js Tools for Visual Studio
216 | .ntvs_analysis.dat
217 |
218 | # Visual Studio 6 build log
219 | *.plg
220 |
221 | # Visual Studio 6 workspace options file
222 | *.opt
223 |
224 | # Visual Studio LightSwitch build output
225 | **/*.HTMLClient/GeneratedArtifacts
226 | **/*.DesktopClient/GeneratedArtifacts
227 | **/*.DesktopClient/ModelManifest.xml
228 | **/*.Server/GeneratedArtifacts
229 | **/*.Server/ModelManifest.xml
230 | _Pvt_Extensions
231 |
232 | # Paket dependency manager
233 | .paket/paket.exe
234 |
235 | # FAKE - F# Make
236 | .fake/
237 |
238 | FilePicker/.DS_Store
239 |
240 | .DS_Store
241 |
242 | *.userprefs
243 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker", "FilePicker\Plugin.FilePicker\Plugin.FilePicker.csproj", "{A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.Abstractions", "FilePicker\Plugin.FilePicker.Abstractions\Plugin.FilePicker.Abstractions.csproj", "{6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.iOS", "FilePicker\Plugin.FilePicker.iOS\Plugin.FilePicker.iOS.csproj", "{2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.Android", "FilePicker\Plugin.FilePicker.Android\Plugin.FilePicker.Android.csproj", "{56A56F17-7DE1-4CA1-9617-BF32E971AC84}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.WindowsStore", "FilePicker\Plugin.FilePicker.WindowsStore\Plugin.FilePicker.WindowsStore.csproj", "{ED9A4CA1-C04C-457D-9A2E-7995CCF12356}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.Mac", "FilePicker\Plugin.FilePicker.Mac\Plugin.FilePicker.Mac.csproj", "{C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}"
17 | EndProject
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.WindowsPhone8", "FilePicker\Plugin.FilePicker.WindowsPhone8\Plugin.FilePicker.WindowsPhone8.csproj", "{5876144B-47DD-4C4E-B421-BC03F191B996}"
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.WindowsPhone81", "FilePicker\Plugin.FilePicker.WindowsPhone81\Plugin.FilePicker.WindowsPhone81.csproj", "{7169373F-0B82-4E5D-9129-7CC3065B90FA}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.FilePicker.UWP", "FilePicker\Plugin.FilePicker.UWP\Plugin.FilePicker.UWP.csproj", "{E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}"
23 | EndProject
24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B5D9C3EE-C113-4BD5-9D91-248957142A8D}"
25 | ProjectSection(SolutionItems) = preProject
26 | ..\LICENSE = ..\LICENSE
27 | ..\README.md = ..\README.md
28 | ..\Xamarin.Plugin.FilePicker.nuspec = ..\Xamarin.Plugin.FilePicker.nuspec
29 | EndProjectSection
30 | EndProject
31 | Global
32 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
33 | AppStore|Any CPU = AppStore|Any CPU
34 | AppStore|ARM = AppStore|ARM
35 | AppStore|x64 = AppStore|x64
36 | AppStore|x86 = AppStore|x86
37 | Debug|Any CPU = Debug|Any CPU
38 | Debug|ARM = Debug|ARM
39 | Debug|x64 = Debug|x64
40 | Debug|x86 = Debug|x86
41 | Release|Any CPU = Release|Any CPU
42 | Release|ARM = Release|ARM
43 | Release|x64 = Release|x64
44 | Release|x86 = Release|x86
45 | EndGlobalSection
46 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
47 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
48 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|Any CPU.Build.0 = Release|Any CPU
49 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|ARM.ActiveCfg = Release|Any CPU
50 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|ARM.Build.0 = Release|Any CPU
51 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|x64.ActiveCfg = Release|Any CPU
52 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|x64.Build.0 = Release|Any CPU
53 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|x86.ActiveCfg = Release|Any CPU
54 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.AppStore|x86.Build.0 = Release|Any CPU
55 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
56 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|Any CPU.Build.0 = Debug|Any CPU
57 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|ARM.ActiveCfg = Debug|Any CPU
58 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|ARM.Build.0 = Debug|Any CPU
59 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|x64.ActiveCfg = Debug|Any CPU
60 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|x64.Build.0 = Debug|Any CPU
61 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|x86.ActiveCfg = Debug|Any CPU
62 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Debug|x86.Build.0 = Debug|Any CPU
63 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|Any CPU.ActiveCfg = Release|Any CPU
64 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|Any CPU.Build.0 = Release|Any CPU
65 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|ARM.ActiveCfg = Release|Any CPU
66 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|ARM.Build.0 = Release|Any CPU
67 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|x64.ActiveCfg = Release|Any CPU
68 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|x64.Build.0 = Release|Any CPU
69 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|x86.ActiveCfg = Release|Any CPU
70 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}.Release|x86.Build.0 = Release|Any CPU
71 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
72 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|Any CPU.Build.0 = Release|Any CPU
73 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|ARM.ActiveCfg = Release|Any CPU
74 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|ARM.Build.0 = Release|Any CPU
75 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|x64.ActiveCfg = Release|Any CPU
76 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|x64.Build.0 = Release|Any CPU
77 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|x86.ActiveCfg = Release|Any CPU
78 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.AppStore|x86.Build.0 = Release|Any CPU
79 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
80 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|Any CPU.Build.0 = Debug|Any CPU
81 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|ARM.ActiveCfg = Debug|Any CPU
82 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|ARM.Build.0 = Debug|Any CPU
83 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|x64.ActiveCfg = Debug|Any CPU
84 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|x64.Build.0 = Debug|Any CPU
85 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|x86.ActiveCfg = Debug|Any CPU
86 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Debug|x86.Build.0 = Debug|Any CPU
87 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|Any CPU.ActiveCfg = Release|Any CPU
88 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|Any CPU.Build.0 = Release|Any CPU
89 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|ARM.ActiveCfg = Release|Any CPU
90 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|ARM.Build.0 = Release|Any CPU
91 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|x64.ActiveCfg = Release|Any CPU
92 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|x64.Build.0 = Release|Any CPU
93 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|x86.ActiveCfg = Release|Any CPU
94 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}.Release|x86.Build.0 = Release|Any CPU
95 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
96 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|Any CPU.Build.0 = Release|Any CPU
97 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|ARM.ActiveCfg = Release|Any CPU
98 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|ARM.Build.0 = Release|Any CPU
99 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|x64.ActiveCfg = Release|Any CPU
100 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|x64.Build.0 = Release|Any CPU
101 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|x86.ActiveCfg = Release|Any CPU
102 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.AppStore|x86.Build.0 = Release|Any CPU
103 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
104 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
105 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|ARM.ActiveCfg = Debug|Any CPU
106 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|ARM.Build.0 = Debug|Any CPU
107 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|x64.ActiveCfg = Debug|Any CPU
108 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|x64.Build.0 = Debug|Any CPU
109 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|x86.ActiveCfg = Debug|Any CPU
110 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Debug|x86.Build.0 = Debug|Any CPU
111 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
112 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|Any CPU.Build.0 = Release|Any CPU
113 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|ARM.ActiveCfg = Release|Any CPU
114 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|ARM.Build.0 = Release|Any CPU
115 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|x64.ActiveCfg = Release|Any CPU
116 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|x64.Build.0 = Release|Any CPU
117 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|x86.ActiveCfg = Release|Any CPU
118 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}.Release|x86.Build.0 = Release|Any CPU
119 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
120 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|Any CPU.Build.0 = Release|Any CPU
121 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|ARM.ActiveCfg = Release|Any CPU
122 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|ARM.Build.0 = Release|Any CPU
123 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|x64.ActiveCfg = Release|Any CPU
124 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|x64.Build.0 = Release|Any CPU
125 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|x86.ActiveCfg = Release|Any CPU
126 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.AppStore|x86.Build.0 = Release|Any CPU
127 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
128 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
129 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|ARM.ActiveCfg = Debug|Any CPU
130 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|ARM.Build.0 = Debug|Any CPU
131 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|x64.ActiveCfg = Debug|Any CPU
132 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|x64.Build.0 = Debug|Any CPU
133 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|x86.ActiveCfg = Debug|Any CPU
134 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Debug|x86.Build.0 = Debug|Any CPU
135 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
136 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|Any CPU.Build.0 = Release|Any CPU
137 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|ARM.ActiveCfg = Release|Any CPU
138 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|ARM.Build.0 = Release|Any CPU
139 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|x64.ActiveCfg = Release|Any CPU
140 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|x64.Build.0 = Release|Any CPU
141 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|x86.ActiveCfg = Release|Any CPU
142 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}.Release|x86.Build.0 = Release|Any CPU
143 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
144 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|Any CPU.Build.0 = Release|Any CPU
145 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|ARM.ActiveCfg = Release|ARM
146 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|ARM.Build.0 = Release|ARM
147 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|x64.ActiveCfg = Release|x64
148 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|x64.Build.0 = Release|x64
149 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|x86.ActiveCfg = Release|x86
150 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.AppStore|x86.Build.0 = Release|x86
151 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
152 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|Any CPU.Build.0 = Debug|Any CPU
153 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|ARM.ActiveCfg = Debug|ARM
154 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|ARM.Build.0 = Debug|ARM
155 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|x64.ActiveCfg = Debug|x64
156 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|x64.Build.0 = Debug|x64
157 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|x86.ActiveCfg = Debug|x86
158 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Debug|x86.Build.0 = Debug|x86
159 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|Any CPU.ActiveCfg = Release|Any CPU
160 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|Any CPU.Build.0 = Release|Any CPU
161 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|ARM.ActiveCfg = Release|ARM
162 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|ARM.Build.0 = Release|ARM
163 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|x64.ActiveCfg = Release|x64
164 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|x64.Build.0 = Release|x64
165 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|x86.ActiveCfg = Release|x86
166 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}.Release|x86.Build.0 = Release|x86
167 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
168 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|Any CPU.Build.0 = Release|Any CPU
169 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|ARM.ActiveCfg = Release|Any CPU
170 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|ARM.Build.0 = Release|Any CPU
171 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|x64.ActiveCfg = Release|Any CPU
172 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|x64.Build.0 = Release|Any CPU
173 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|x86.ActiveCfg = Release|Any CPU
174 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.AppStore|x86.Build.0 = Release|Any CPU
175 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
176 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|Any CPU.Build.0 = Debug|Any CPU
177 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|ARM.ActiveCfg = Debug|Any CPU
178 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|ARM.Build.0 = Debug|Any CPU
179 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|x64.ActiveCfg = Debug|Any CPU
180 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|x64.Build.0 = Debug|Any CPU
181 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|x86.ActiveCfg = Debug|Any CPU
182 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Debug|x86.Build.0 = Debug|Any CPU
183 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|Any CPU.ActiveCfg = Release|Any CPU
184 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|Any CPU.Build.0 = Release|Any CPU
185 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|ARM.ActiveCfg = Release|Any CPU
186 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|ARM.Build.0 = Release|Any CPU
187 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|x64.ActiveCfg = Release|Any CPU
188 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|x64.Build.0 = Release|Any CPU
189 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|x86.ActiveCfg = Release|Any CPU
190 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}.Release|x86.Build.0 = Release|Any CPU
191 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
192 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|Any CPU.Build.0 = Release|Any CPU
193 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|ARM.ActiveCfg = Release|ARM
194 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|ARM.Build.0 = Release|ARM
195 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|x64.ActiveCfg = Release|Any CPU
196 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|x64.Build.0 = Release|Any CPU
197 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|x86.ActiveCfg = Release|x86
198 | {5876144B-47DD-4C4E-B421-BC03F191B996}.AppStore|x86.Build.0 = Release|x86
199 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
200 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|Any CPU.Build.0 = Debug|Any CPU
201 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|ARM.ActiveCfg = Debug|ARM
202 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|ARM.Build.0 = Debug|ARM
203 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|x64.ActiveCfg = Debug|Any CPU
204 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|x64.Build.0 = Debug|Any CPU
205 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|x86.ActiveCfg = Debug|x86
206 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Debug|x86.Build.0 = Debug|x86
207 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|Any CPU.ActiveCfg = Release|Any CPU
208 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|Any CPU.Build.0 = Release|Any CPU
209 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|ARM.ActiveCfg = Release|ARM
210 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|ARM.Build.0 = Release|ARM
211 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|x64.ActiveCfg = Release|Any CPU
212 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|x64.Build.0 = Release|Any CPU
213 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|x86.ActiveCfg = Release|x86
214 | {5876144B-47DD-4C4E-B421-BC03F191B996}.Release|x86.Build.0 = Release|x86
215 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
216 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|Any CPU.Build.0 = Release|Any CPU
217 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|ARM.ActiveCfg = Release|ARM
218 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|ARM.Build.0 = Release|ARM
219 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|x64.ActiveCfg = Release|Any CPU
220 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|x64.Build.0 = Release|Any CPU
221 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|x86.ActiveCfg = Release|x86
222 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.AppStore|x86.Build.0 = Release|x86
223 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
224 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
225 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|ARM.ActiveCfg = Debug|ARM
226 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|ARM.Build.0 = Debug|ARM
227 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|x64.ActiveCfg = Debug|Any CPU
228 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|x64.Build.0 = Debug|Any CPU
229 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|x86.ActiveCfg = Debug|x86
230 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Debug|x86.Build.0 = Debug|x86
231 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
232 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|Any CPU.Build.0 = Release|Any CPU
233 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|ARM.ActiveCfg = Release|ARM
234 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|ARM.Build.0 = Release|ARM
235 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|x64.ActiveCfg = Release|Any CPU
236 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|x64.Build.0 = Release|Any CPU
237 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|x86.ActiveCfg = Release|x86
238 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}.Release|x86.Build.0 = Release|x86
239 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
240 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|Any CPU.Build.0 = Release|Any CPU
241 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|ARM.ActiveCfg = Release|ARM
242 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|ARM.Build.0 = Release|ARM
243 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|x64.ActiveCfg = Release|x64
244 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|x64.Build.0 = Release|x64
245 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|x86.ActiveCfg = Release|x86
246 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.AppStore|x86.Build.0 = Release|x86
247 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
248 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
249 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|ARM.ActiveCfg = Debug|ARM
250 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|ARM.Build.0 = Debug|ARM
251 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|x64.ActiveCfg = Debug|x64
252 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|x64.Build.0 = Debug|x64
253 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|x86.ActiveCfg = Debug|x86
254 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Debug|x86.Build.0 = Debug|x86
255 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
256 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|Any CPU.Build.0 = Release|Any CPU
257 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|ARM.ActiveCfg = Release|ARM
258 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|ARM.Build.0 = Release|ARM
259 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|x64.ActiveCfg = Release|x64
260 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|x64.Build.0 = Release|x64
261 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|x86.ActiveCfg = Release|x86
262 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}.Release|x86.Build.0 = Release|x86
263 | EndGlobalSection
264 | GlobalSection(SolutionProperties) = preSolution
265 | HideSolutionNode = FALSE
266 | EndGlobalSection
267 | EndGlobal
268 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Abstractions/FileData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Plugin.FilePicker.Abstractions
5 | {
6 | ///
7 | /// The object used as a wrapper for the file picked by the user
8 | ///
9 | public class FileData : IDisposable
10 | {
11 | private string _fileName;
12 | private string _filePath;
13 | private bool _isDisposed;
14 | private readonly Action _dispose;
15 | private readonly Func _streamGetter;
16 |
17 | public FileData()
18 | { }
19 |
20 | public FileData(string filePath, string fileName, Func streamGetter, Action dispose = null)
21 | {
22 | _filePath = filePath;
23 | _fileName = fileName;
24 | _dispose = dispose;
25 | _streamGetter = streamGetter;
26 | }
27 |
28 | public byte[] DataArray
29 | {
30 | get
31 | {
32 | using (var stream = GetStream())
33 | {
34 | var resultBytes = new byte[stream.Length];
35 | stream.Read(resultBytes, 0, (int)stream.Length);
36 |
37 | return resultBytes;
38 | }
39 | }
40 | }
41 |
42 | ///
43 | /// Filename of the picked file
44 | ///
45 | public string FileName
46 | {
47 | get
48 | {
49 | if (_isDisposed)
50 | throw new ObjectDisposedException(null);
51 |
52 | return _fileName;
53 | }
54 |
55 | set
56 | {
57 | if (_isDisposed)
58 | throw new ObjectDisposedException(null);
59 |
60 | _fileName = value;
61 | }
62 | }
63 |
64 | ///
65 | /// Full filepath of the picked file
66 | ///
67 | public string FilePath
68 | {
69 | get
70 | {
71 | if (_isDisposed)
72 | throw new ObjectDisposedException(null);
73 |
74 | return _filePath;
75 | }
76 |
77 | set
78 | {
79 | if (_isDisposed)
80 | throw new ObjectDisposedException(null);
81 |
82 | _filePath = value;
83 | }
84 | }
85 |
86 | ///
87 | /// Get stream if available
88 | ///
89 | ///
90 | public Stream GetStream()
91 | {
92 | if (_isDisposed)
93 | throw new ObjectDisposedException(null);
94 |
95 | return _streamGetter();
96 | }
97 |
98 | public void Dispose()
99 | {
100 | Dispose(true);
101 | GC.SuppressFinalize(this);
102 | }
103 |
104 | private void Dispose(bool disposing)
105 | {
106 | if (_isDisposed)
107 | return;
108 |
109 | _isDisposed = true;
110 | _dispose?.Invoke(disposing);
111 | }
112 |
113 | ~FileData()
114 | {
115 | Dispose(false);
116 | }
117 | }
118 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Abstractions/FilePickerEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Plugin.FilePicker.Abstractions
4 | {
5 | public class FilePickerEventArgs : EventArgs
6 | {
7 | public byte [] FileByte { get; set; }
8 |
9 | public string FileName { get; set; }
10 |
11 | public string FilePath { get; set; }
12 |
13 | public FilePickerEventArgs ()
14 | {
15 |
16 | }
17 |
18 | public FilePickerEventArgs (byte [] fileByte)
19 | {
20 | FileByte = fileByte;
21 | }
22 |
23 | public FilePickerEventArgs (byte [] fileByte, string fileName)
24 | : this (fileByte)
25 | {
26 | FileName = fileName;
27 | }
28 |
29 | public FilePickerEventArgs (byte [] fileByte, string fileName, string filePath)
30 | : this (fileByte, fileName)
31 | {
32 | FilePath = filePath;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Abstractions/IFilePicker.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Plugin.FilePicker.Abstractions
4 | {
5 | ///
6 | /// Interface for FilePicker
7 | ///
8 | public interface IFilePicker
9 | {
10 | Task PickFile ();
11 |
12 | Task SaveFile (FileData fileToSave);
13 |
14 | void OpenFile (string fileToOpen);
15 |
16 | void OpenFile (FileData fileToOpen);
17 | }
18 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Abstractions/Plugin.FilePicker.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 10.0
6 | Debug
7 | AnyCPU
8 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}
9 | Library
10 | Properties
11 | Plugin.FilePicker.Abstractions
12 | Plugin.FilePicker.Abstractions
13 | en-US
14 | 512
15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | Profile259
17 | v4.5
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | bin\Release\Plugin.FilePicker.Abstractions.XML
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
54 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Abstractions/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
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("Plugin.FilePicker.Abstractions")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Plugin.FilePicker.Abstractions")]
14 | [assembly: AssemblyCopyright("Copyright © 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: NeutralResourcesLanguage("en")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.3.0.0")]
30 | [assembly: AssemblyFileVersion("1.3.0.0")]
31 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/FilePickerActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Android.App;
3 | using Android.Content;
4 | using Android.OS;
5 | using Android.Runtime;
6 | using System.Threading.Tasks;
7 | using Plugin.FilePicker.Abstractions;
8 | using Android.Provider;
9 |
10 | namespace Plugin.FilePicker
11 | {
12 | [Activity (ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
13 | [Preserve (AllMembers = true)]
14 | public class FilePickerActivity : Activity
15 | {
16 | private Context context;
17 |
18 | protected override void OnCreate (Bundle savedInstanceState)
19 | {
20 | base.OnCreate (savedInstanceState);
21 |
22 | context = Application.Context;
23 |
24 |
25 | var intent = new Intent (Intent.ActionGetContent);
26 | intent.SetType ("*/*");
27 |
28 | intent.AddCategory (Intent.CategoryOpenable);
29 | try {
30 | StartActivityForResult (Intent.CreateChooser (intent, "Select file"), 0);
31 | } catch (Exception exAct) {
32 | System.Diagnostics.Debug.Write (exAct);
33 | }
34 | }
35 |
36 | protected override void OnActivityResult (int requestCode, [GeneratedEnum] Result resultCode, Intent data)
37 | {
38 | base.OnActivityResult (requestCode, resultCode, data);
39 |
40 | if (resultCode == Result.Canceled) {
41 | // Notify user file picking was cancelled.
42 | OnFilePickCancelled ();
43 | Finish ();
44 | } else {
45 | System.Diagnostics.Debug.Write (data.Data);
46 | try {
47 | var _uri = data.Data;
48 |
49 | var filePath = IOUtil.getPath (context, _uri);
50 |
51 | if (string.IsNullOrEmpty (filePath))
52 | filePath = _uri.Path;
53 |
54 | var file = IOUtil.readFile (filePath);
55 |
56 | var fileName = GetFileName (context, _uri);
57 |
58 | OnFilePicked (new FilePickerEventArgs (file, fileName, filePath));
59 | } catch (Exception readEx) {
60 | // Notify user file picking failed.
61 | OnFilePickCancelled ();
62 | System.Diagnostics.Debug.Write (readEx);
63 | } finally {
64 | Finish ();
65 | }
66 | }
67 | }
68 |
69 | string GetFileName (Context ctx, Android.Net.Uri uri)
70 | {
71 |
72 | string [] projection = { MediaStore.MediaColumns.DisplayName };
73 |
74 | var cr = ctx.ContentResolver;
75 | var name = "";
76 | var metaCursor = cr.Query (uri, projection, null, null, null);
77 |
78 | if (metaCursor != null) {
79 | try {
80 | if (metaCursor.MoveToFirst ()) {
81 | name = metaCursor.GetString (0);
82 | }
83 | } finally {
84 | metaCursor.Close ();
85 | }
86 | }
87 | return name;
88 | }
89 |
90 | internal static event EventHandler FilePicked;
91 | internal static event EventHandler FilePickCancelled;
92 |
93 | private static void OnFilePickCancelled ()
94 | {
95 | FilePickCancelled?.Invoke (null, null);
96 | }
97 |
98 | private static void OnFilePicked (FilePickerEventArgs e)
99 | {
100 | var picked = FilePicked;
101 |
102 | if (picked != null)
103 | picked (null, e);
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content;
3 | using Android.Runtime;
4 | using Java.IO;
5 | using Plugin.FilePicker.Abstractions;
6 | using System;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using System.Diagnostics;
10 |
11 | namespace Plugin.FilePicker
12 | {
13 | ///
14 | /// Implementation for Feature
15 | ///
16 | ///
17 | [Preserve (AllMembers = true)]
18 | public class FilePickerImplementation : IFilePicker
19 | {
20 | private readonly Context _context;
21 | private int _requestId;
22 | private TaskCompletionSource _completionSource;
23 |
24 | public FilePickerImplementation ()
25 | {
26 | _context = Application.Context;
27 | }
28 |
29 | public async Task PickFile ()
30 | {
31 | var media = await TakeMediaAsync ("file/*", Intent.ActionGetContent);
32 |
33 | return media;
34 | }
35 |
36 | private Task TakeMediaAsync (string type, string action)
37 | {
38 | var id = GetRequestId ();
39 |
40 | var ntcs = new TaskCompletionSource (id);
41 |
42 | if (Interlocked.CompareExchange (ref _completionSource, ntcs, null) != null)
43 | throw new InvalidOperationException ("Only one operation can be active at a time");
44 |
45 | try {
46 | var pickerIntent = new Intent (this._context, typeof (FilePickerActivity));
47 | pickerIntent.SetFlags (ActivityFlags.NewTask);
48 |
49 | this._context.StartActivity (pickerIntent);
50 |
51 | EventHandler handler = null;
52 | EventHandler cancelledHandler = null;
53 |
54 | handler = (s, e) => {
55 | var tcs = Interlocked.Exchange (ref _completionSource, null);
56 |
57 | FilePickerActivity.FilePicked -= handler;
58 |
59 | tcs?.SetResult (new FileData (e.FilePath, e.FileName, () => System.IO.File.OpenRead (e.FilePath)));
60 | };
61 |
62 | cancelledHandler = (s, e) => {
63 | var tcs = Interlocked.Exchange (ref _completionSource, null);
64 |
65 | FilePickerActivity.FilePickCancelled -= cancelledHandler;
66 |
67 | tcs?.SetResult (null);
68 | };
69 |
70 | FilePickerActivity.FilePickCancelled += cancelledHandler;
71 | FilePickerActivity.FilePicked += handler;
72 | } catch (Exception exAct) {
73 | Debug.Write (exAct);
74 | }
75 |
76 | return _completionSource.Task;
77 | }
78 |
79 | private int GetRequestId ()
80 | {
81 | int id = _requestId;
82 |
83 | if (_requestId == int.MaxValue)
84 | _requestId = 0;
85 | else
86 | _requestId++;
87 |
88 | return id;
89 | }
90 |
91 | public async Task SaveFile (FileData fileToSave)
92 | {
93 | try {
94 | var myFile = new File (Android.OS.Environment.ExternalStorageDirectory, fileToSave.FileName);
95 |
96 | if (myFile.Exists ())
97 | return true;
98 |
99 | var fos = new FileOutputStream (myFile.Path);
100 |
101 | fos.Write (fileToSave.DataArray);
102 | fos.Close ();
103 |
104 | return true;
105 | } catch (Exception ex) {
106 | Debug.WriteLine (ex.Message);
107 | return false;
108 | }
109 | }
110 |
111 | public void OpenFile (File fileToOpen)
112 | {
113 | var uri = Android.Net.Uri.FromFile (fileToOpen);
114 | var intent = new Intent ();
115 | var mime = IOUtil.GetMimeType (uri.ToString ());
116 |
117 | intent.SetAction (Intent.ActionView);
118 | intent.SetDataAndType (uri, mime);
119 | intent.SetFlags (ActivityFlags.NewTask);
120 |
121 | _context.StartActivity (intent);
122 | }
123 |
124 | public void OpenFile (string fileToOpen)
125 | {
126 | var myFile = new File (Android.OS.Environment.ExternalStorageState, fileToOpen);
127 |
128 | OpenFile (myFile);
129 | }
130 |
131 | public async void OpenFile (FileData fileToOpen)
132 | {
133 | var myFile = new File (Android.OS.Environment.ExternalStorageState, fileToOpen.FileName);
134 |
135 | if (!myFile.Exists ())
136 | await SaveFile (fileToOpen);
137 |
138 | OpenFile (fileToOpen);
139 | }
140 | }
141 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/IOUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Android.Content;
3 | using Android.OS;
4 | using Android.Provider;
5 | using Android.Database;
6 | using Java.IO;
7 | using Android.Webkit;
8 |
9 | namespace Plugin.FilePicker
10 | {
11 | public class IOUtil
12 | {
13 |
14 | public static string getPath (Context context, Android.Net.Uri uri)
15 | {
16 | bool isKitKat = Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat;
17 |
18 | // DocumentProvider
19 | if (isKitKat && DocumentsContract.IsDocumentUri (context, uri)) {
20 | // ExternalStorageProvider
21 | if (isExternalStorageDocument (uri)) {
22 | var docId = DocumentsContract.GetDocumentId (uri);
23 | string [] split = docId.Split (':');
24 | var type = split [0];
25 |
26 | if ("primary".Equals (type, StringComparison.OrdinalIgnoreCase)) {
27 | return Android.OS.Environment.ExternalStorageDirectory + "/" + split [1];
28 | }
29 |
30 | // TODO handle non-primary volumes
31 | }
32 | // DownloadsProvider
33 | else if (isDownloadsDocument (uri)) {
34 |
35 | string id = DocumentsContract.GetDocumentId (uri);
36 | Android.Net.Uri contentUri = ContentUris.WithAppendedId (
37 | Android.Net.Uri.Parse ("content://downloads/public_downloads"), long.Parse (id));
38 |
39 | return getDataColumn (context, contentUri, null, null);
40 | }
41 | // MediaProvider
42 | else if (isMediaDocument (uri)) {
43 | var docId = DocumentsContract.GetDocumentId (uri);
44 | string [] split = docId.Split (':');
45 | var type = split [0];
46 |
47 | Android.Net.Uri contentUri = null;
48 | if ("image".Equals (type)) {
49 | contentUri = MediaStore.Images.Media.ExternalContentUri;
50 | } else if ("video".Equals (type)) {
51 | contentUri = MediaStore.Video.Media.ExternalContentUri;
52 | } else if ("audio".Equals (type)) {
53 | contentUri = MediaStore.Audio.Media.ExternalContentUri;
54 | }
55 |
56 | var selection = "_id=?";
57 | var selectionArgs = new string [] {
58 | split[1]
59 | };
60 |
61 | return getDataColumn (context, contentUri, selection, selectionArgs);
62 | }
63 | }
64 | // MediaStore (and general)
65 | else if ("content".Equals (uri.Scheme, StringComparison.OrdinalIgnoreCase)) {
66 | return getDataColumn (context, uri, null, null);
67 | }
68 | // File
69 | else if ("file".Equals (uri.Scheme, StringComparison.OrdinalIgnoreCase)) {
70 | return uri.Path;
71 | }
72 |
73 | return null;
74 | }
75 |
76 | public static string getDataColumn (Context context, Android.Net.Uri uri, string selection,
77 | string [] selectionArgs)
78 | {
79 |
80 | ICursor cursor = null;
81 | var column = "_data";
82 | string [] projection = {
83 | column
84 | };
85 |
86 | try {
87 | cursor = context.ContentResolver.Query (uri, projection, selection, selectionArgs,
88 | null);
89 | if (cursor != null && cursor.MoveToFirst ()) {
90 | int column_index = cursor.GetColumnIndexOrThrow (column);
91 | return cursor.GetString (column_index);
92 | }
93 | } finally {
94 | if (cursor != null)
95 | cursor.Close ();
96 | }
97 | return null;
98 | }
99 |
100 | /**
101 | * @param uri The Uri to check.
102 | * @return Whether the Uri authority is ExternalStorageProvider.
103 | */
104 | public static bool isExternalStorageDocument (Android.Net.Uri uri)
105 | {
106 | return "com.android.externalstorage.documents".Equals (uri.Authority);
107 | }
108 |
109 | /**
110 | * @param uri The Uri to check.
111 | * @return Whether the Uri authority is DownloadsProvider.
112 | */
113 | public static bool isDownloadsDocument (Android.Net.Uri uri)
114 | {
115 | return "com.android.providers.downloads.documents".Equals (uri.Authority);
116 | }
117 |
118 | /**
119 | * @param uri The Uri to check.
120 | * @return Whether the Uri authority is MediaProvider.
121 | */
122 | public static bool isMediaDocument (Android.Net.Uri uri)
123 | {
124 | return "com.android.providers.media.documents".Equals (uri.Authority);
125 | }
126 |
127 | public static byte [] readFile (string file)
128 | {
129 | try {
130 | return readFile (new File (file));
131 | } catch (Exception ex) {
132 | System.Diagnostics.Debug.Write (ex);
133 | return new byte [0];
134 | }
135 | }
136 |
137 | public static byte [] readFile (File file)
138 | {
139 | // Open file
140 | var f = new RandomAccessFile (file, "r");
141 |
142 | try {
143 | // Get and check length
144 | long longlength = f.Length ();
145 | var length = (int)longlength;
146 |
147 | if (length != longlength)
148 | throw new IOException ("Filesize exceeds allowed size");
149 | // Read file and return data
150 | byte [] data = new byte [length];
151 | f.ReadFully (data);
152 | return data;
153 | } catch (Exception ex) {
154 | System.Diagnostics.Debug.Write (ex);
155 | return new byte [0];
156 | } finally {
157 | f.Close ();
158 | }
159 | }
160 |
161 | public static string GetMimeType (string url)
162 | {
163 | string type = null;
164 | var extension = MimeTypeMap.GetFileExtensionFromUrl (url);
165 |
166 | if (extension != null) {
167 | type = MimeTypeMap.Singleton.GetMimeTypeFromExtension (extension);
168 | }
169 |
170 | return type;
171 | }
172 | }
173 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/Plugin.FilePicker.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | Plugin.FilePicker
13 | Plugin.FilePicker
14 | 512
15 | Resources\Resource.Designer.cs
16 | Off
17 | True
18 | True
19 | v7.1
20 |
21 |
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | bin\Release\Plugin.FilePicker.XML
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | CrossFilePicker.cs
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
63 | Plugin.FilePicker.Abstractions
64 |
65 |
66 |
67 |
74 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/Plugin.FilePicker.Android.csproj.bak:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | Plugin.FilePicker
13 | Plugin.FilePicker
14 | 512
15 | Resources\Resource.Designer.cs
16 | Off
17 | True
18 | True
19 | v7.0
20 |
21 |
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | bin\Release\Plugin.FilePicker.XML
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | CrossFilePicker.cs
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
63 | Plugin.FilePicker.Abstractions
64 |
65 |
66 |
67 |
74 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
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("Plugin.FilePicker.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Plugin.FilePicker.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2016")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Android/Resources/Resource.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Studyxnet/FilePicker-Plugin-for-Xamarin-and-Windows/0fd9792caad47c4f3be9dcefe91bc77e6c7c4406/FilePicker/FilePicker/Plugin.FilePicker.Android/Resources/Resource.Designer.cs
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Mac/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using AppKit;
7 | using Foundation;
8 | using MobileCoreServices;
9 | using Plugin.FilePicker.Abstractions;
10 |
11 | namespace Plugin.FilePicker
12 | {
13 | public class FilePickerImplementation : NSObject, IFilePicker
14 | {
15 | public Task PickFile()
16 | {
17 | // for consistency with other platforms, only allow selecting of a single file.
18 | // would be nice if we passed a "file options" to override picking multiple files & directories
19 | var openPanel = new NSOpenPanel(); ;
20 | openPanel.CanChooseFiles = true;
21 | openPanel.AllowsMultipleSelection = false;
22 | openPanel.CanChooseDirectories = false;
23 |
24 | FileData data = null;
25 |
26 | var result = openPanel.RunModal();
27 | if (result == 1)
28 | {
29 | // Nab the first file
30 | var url = openPanel.Urls[0];
31 | var fileName = openPanel.Filenames[0];
32 |
33 | if (url != null)
34 | {
35 | var path = url.Path;
36 | data = new FileData(path, fileName, () => File.OpenRead(path));
37 | }
38 | }
39 |
40 | return Task.FromResult(data);
41 | }
42 |
43 | public Task SaveFile(FileData fileToSave)
44 | {
45 | try
46 | {
47 | var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
48 |
49 | var savePanel = new NSSavePanel();
50 | savePanel.Title = $"Save {fileToSave.FileName}";
51 | savePanel.CanCreateDirectories = true;
52 |
53 | var result = savePanel.RunModal(documents, fileToSave.FileName);
54 |
55 | if (result == 1)
56 | {
57 | var path = savePanel.Url.Path;
58 |
59 | File.WriteAllBytes(path, fileToSave.DataArray);
60 |
61 | return Task.FromResult(true);
62 | }
63 |
64 | return Task.FromResult(false);
65 | }
66 | catch (Exception ex)
67 | {
68 | Debug.WriteLine(ex.Message);
69 | return Task.FromResult(false);
70 | }
71 | }
72 |
73 | public void OpenFile(string fileToOpen)
74 | {
75 | try
76 | {
77 | if (!NSWorkspace.SharedWorkspace.OpenFile(fileToOpen))
78 | {
79 | Debug.WriteLine($"Unable to open file at path: {fileToOpen}.");
80 | }
81 | }
82 | catch (FileNotFoundException ex)
83 | {
84 | }
85 | catch (Exception ex)
86 | {
87 | }
88 | }
89 |
90 | public async void OpenFile(FileData fileToOpen)
91 | {
92 | try
93 | {
94 | if (!NSWorkspace.SharedWorkspace.OpenFile(fileToOpen.FileName))
95 | {
96 | Debug.WriteLine($"Unable to open file at path: {fileToOpen}.");
97 | }
98 | }
99 | catch (FileNotFoundException ex)
100 | {
101 | // this could be some strange UI behavior.
102 | // user would get prompted to save the file in order to open the file
103 | await SaveFile(fileToOpen);
104 | OpenFile(fileToOpen);
105 | }
106 | catch (Exception ex)
107 | {
108 | }
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Mac/Plugin.FilePicker.Mac.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {C1E6D43D-38EB-4673-A9AA-8B1116CE9C10}
7 | {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | Library
9 | Plugin.FilePicker
10 | Plugin.FilePicker.Mac
11 | v2.0
12 | Xamarin.Mac
13 | Resources
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug
20 | DEBUG;
21 | prompt
22 | 4
23 | false
24 | false
25 | false
26 | false
27 | false
28 |
29 |
30 |
31 |
32 |
33 |
34 | true
35 | bin\Release
36 |
37 | prompt
38 | 4
39 | false
40 | false
41 | false
42 | false
43 | false
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | CrossFilePicker.cs
60 |
61 |
62 |
63 |
64 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}
65 | Plugin.FilePicker
66 |
67 |
68 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}
69 | Plugin.FilePicker.Abstractions
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.Mac/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("Plugin.FilePicker.Mac")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Plugin.FilePicker.Mac")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 | [assembly: ComVisible(false)]
17 |
18 | // Version information for an assembly consists of the following four values:
19 | //
20 | // Major Version
21 | // Minor Version
22 | // Build Number
23 | // Revision
24 | //
25 | // You can specify all the values or you can default the Build and Revision Numbers
26 | // by using the '*' as shown below:
27 | // [assembly: AssemblyVersion("1.0.*")]
28 | [assembly: AssemblyVersion("1.0.0.0")]
29 | [assembly: AssemblyFileVersion("1.0.0.0")]
30 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.UWP/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Plugin.FilePicker.Abstractions;
2 | using System;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using Windows.Storage;
6 | using Windows.Storage.AccessCache;
7 | using Windows.System;
8 |
9 | namespace Plugin.FilePicker
10 | {
11 | ///
12 | /// Implementation for Feature
13 | ///
14 | public class FilePickerImplementation : IFilePicker
15 | {
16 | public async Task PickFile()
17 | {
18 | var picker = new Windows.Storage.Pickers.FileOpenPicker
19 | {
20 | ViewMode = Windows.Storage.Pickers.PickerViewMode.List,
21 | SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary
22 | };
23 | picker.FileTypeFilter.Add("*");
24 |
25 | var file = await picker.PickSingleFileAsync();
26 | if (null == file)
27 | return null;
28 |
29 | StorageApplicationPermissions.FutureAccessList.Add(file);
30 | return new FileData(file.Path, file.Name, () => File.OpenRead(file.Path));
31 | }
32 |
33 | public async Task SaveFile(FileData fileToSave)
34 | {
35 | try
36 | {
37 | var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileToSave.FileName, CreationCollisionOption.ReplaceExisting);
38 |
39 | await FileIO.WriteBytesAsync(file, fileToSave.DataArray);
40 |
41 | return true;
42 | }
43 | catch (Exception ex)
44 | {
45 | return false;
46 | }
47 | }
48 |
49 | public async void OpenFile(string fileToOpen)
50 | {
51 | try
52 | {
53 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen);
54 |
55 | if (file != null)
56 | {
57 | await Launcher.LaunchFileAsync(file);
58 | }
59 | }
60 | catch (FileNotFoundException ex)
61 | {
62 | }
63 | catch (Exception ex)
64 | {
65 | }
66 | }
67 |
68 | public async void OpenFile(FileData fileToOpen)
69 | {
70 | try
71 | {
72 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen.FileName);
73 |
74 | if (file != null)
75 | {
76 | await Launcher.LaunchFileAsync(file);
77 | }
78 | }
79 | catch (FileNotFoundException ex)
80 | {
81 | await SaveFile(fileToOpen);
82 | OpenFile(fileToOpen);
83 | }
84 | catch (Exception ex)
85 | {
86 | }
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.UWP/Plugin.FilePicker.UWP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}
8 | Library
9 | Properties
10 | Plugin.FilePicker
11 | Plugin.FilePicker
12 | en-US
13 | UAP
14 | 10.0.10586.0
15 | 10.0.10240.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 | bin\Release\Plugin.FilePicker.XML
39 |
40 |
41 | x86
42 | true
43 | bin\x86\Debug\
44 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
45 | ;2008
46 | full
47 | x86
48 | false
49 | prompt
50 |
51 |
52 | x86
53 | bin\Release\
54 | TRACE;NETFX_CORE;WINDOWS_UWP
55 | true
56 | ;2008
57 | pdbonly
58 | x86
59 | false
60 | prompt
61 | bin\Release\Plugin.FilePicker.XML
62 |
63 |
64 | ARM
65 | true
66 | bin\ARM\Debug\
67 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
68 | ;2008
69 | full
70 | ARM
71 | false
72 | prompt
73 |
74 |
75 | ARM
76 | bin\ARM\Release\
77 | TRACE;NETFX_CORE;WINDOWS_UWP
78 | true
79 | ;2008
80 | pdbonly
81 | ARM
82 | false
83 | prompt
84 |
85 |
86 | x64
87 | true
88 | bin\x64\Debug\
89 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
90 | ;2008
91 | full
92 | x64
93 | false
94 | prompt
95 |
96 |
97 | x64
98 | bin\x64\Release\
99 | TRACE;NETFX_CORE;WINDOWS_UWP
100 | true
101 | ;2008
102 | pdbonly
103 | x64
104 | false
105 | prompt
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | CrossFilePicker.cs
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
122 | Plugin.FilePicker.Abstractions
123 |
124 |
125 |
126 | 14.0
127 |
128 |
129 |
136 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.UWP/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("Plugin.FilePicker.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Plugin.FilePicker.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.3.0.0")]
28 | [assembly: AssemblyFileVersion("1.3.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.UWP/Properties/Plugin.FilePicker.UWP.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.UWP/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone8/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Plugin.FilePicker.Abstractions;
2 | using System;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using Windows.Storage;
6 | using Windows.System;
7 |
8 | namespace Plugin.FilePicker
9 | {
10 | ///
11 | /// Implementation for FilePicker
12 | ///
13 | public class FilePickerImplementation : IFilePicker
14 | {
15 | public async Task PickFile()
16 | {
17 | var picker = new Windows.Storage.Pickers.FileOpenPicker
18 | {
19 | ViewMode = Windows.Storage.Pickers.PickerViewMode.List,
20 | SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary
21 | };
22 |
23 | picker.FileTypeFilter.Add("*");
24 |
25 | var file = await picker.PickSingleFileAsync();
26 |
27 | if (file != null)
28 | return new FileData(file.Path, file.Name, () => File.OpenRead(file.Path));
29 |
30 | return null;
31 | }
32 |
33 | public async Task SaveFile(FileData fileToSave)
34 | {
35 | try
36 | {
37 | var local = ApplicationData.Current.LocalFolder;
38 |
39 | var file = await local.CreateFileAsync(fileToSave.FileName, CreationCollisionOption.ReplaceExisting);
40 |
41 | using (var s = await file.OpenStreamForWriteAsync())
42 | {
43 | s.Write(fileToSave.DataArray, 0, fileToSave.DataArray.Length);
44 | }
45 |
46 | return true;
47 | }
48 | catch (Exception ex)
49 | {
50 | return false;
51 | }
52 | }
53 |
54 | public async void OpenFile(string fileToOpen)
55 | {
56 | try
57 | {
58 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen);
59 |
60 | if (file != null)
61 | await Launcher.LaunchFileAsync(file);
62 | }
63 | catch (FileNotFoundException ex)
64 | {
65 | }
66 | catch (Exception ex)
67 | {
68 | }
69 | }
70 |
71 | public async void OpenFile(FileData fileToOpen)
72 | {
73 | try
74 | {
75 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen.FileName);
76 |
77 | if (file != null)
78 | await Launcher.LaunchFileAsync(file);
79 | }
80 | catch (FileNotFoundException ex)
81 | {
82 | await SaveFile(fileToOpen);
83 | OpenFile(fileToOpen);
84 | }
85 | catch (Exception ex)
86 | {
87 | }
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone8/Plugin.FilePicker.WindowsPhone8.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {5876144B-47DD-4C4E-B421-BC03F191B996}
9 | {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
10 | Library
11 | Properties
12 | Plugin.FilePicker
13 | Plugin.FilePicker
14 | WindowsPhone
15 | v8.0
16 | $(TargetFrameworkVersion)
17 | false
18 | true
19 | 11.0
20 | true
21 |
22 |
23 | true
24 | full
25 | false
26 | Bin\Debug
27 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
28 | true
29 | true
30 | prompt
31 | 4
32 |
33 |
34 | pdbonly
35 | true
36 | Bin\Release
37 | TRACE;SILVERLIGHT;WINDOWS_PHONE
38 | true
39 | true
40 | prompt
41 | 4
42 | Bin\Release\Plugin.FilePicker.XML
43 |
44 |
45 | true
46 | full
47 | false
48 | Bin\x86\Debug
49 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
50 | true
51 | true
52 | prompt
53 | 4
54 |
55 |
56 | pdbonly
57 | true
58 | Bin\Release
59 | TRACE;SILVERLIGHT;WINDOWS_PHONE
60 | true
61 | true
62 | prompt
63 | 4
64 | bin\Release\Plugin.FilePicker.XML
65 |
66 |
67 | true
68 | full
69 | false
70 | Bin\ARM\Debug
71 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
72 | true
73 | true
74 | prompt
75 | 4
76 |
77 |
78 | pdbonly
79 | true
80 | Bin\ARM\Release
81 | TRACE;SILVERLIGHT;WINDOWS_PHONE
82 | true
83 | true
84 | prompt
85 | 4
86 |
87 |
88 |
89 | CrossFilePicker.cs
90 |
91 |
92 |
93 |
94 |
95 |
96 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
97 | Plugin.FilePicker.Abstractions
98 |
99 |
100 |
101 |
102 |
103 |
110 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone8/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
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("Plugin.FilePicker.WindowsPhone8")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Plugin.FilePicker.WindowsPhone8")]
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(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("5876144b-47dd-4c4e-b421-bc03f191b996")]
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 Revision and Build Numbers
34 | // by using the '*' as shown below:
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 | [assembly: NeutralResourcesLanguageAttribute("en-US")]
38 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone81/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Plugin.FilePicker.Abstractions;
2 | using System;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using Windows.Storage;
6 | using Windows.System;
7 |
8 | namespace Plugin.FilePicker
9 | {
10 | ///
11 | /// Implementation for FilePicker
12 | ///
13 | public class FilePickerImplementation : IFilePicker
14 | {
15 | public async Task PickFile()
16 | {
17 | var picker = new Windows.Storage.Pickers.FileOpenPicker
18 | {
19 | ViewMode = Windows.Storage.Pickers.PickerViewMode.List,
20 | SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary
21 | };
22 | picker.FileTypeFilter.Add("*");
23 |
24 | var file = await picker.PickSingleFileAsync();
25 |
26 | if (file != null)
27 | return new FileData(file.Name, file.Path, () => file.OpenStreamForReadAsync().Result);
28 |
29 | return null;
30 | }
31 |
32 | public async Task SaveFile(FileData fileToSave)
33 | {
34 | try
35 | {
36 | var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileToSave.FileName, CreationCollisionOption.ReplaceExisting);
37 |
38 | await FileIO.WriteBytesAsync(file, fileToSave.DataArray);
39 |
40 | return true;
41 | }
42 | catch (Exception ex)
43 | {
44 | return false;
45 | }
46 | }
47 |
48 | public async void OpenFile(string fileToOpen)
49 | {
50 | try
51 | {
52 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen);
53 |
54 | if (file != null)
55 | {
56 | await Launcher.LaunchFileAsync(file);
57 | }
58 | }
59 | catch (FileNotFoundException ex)
60 | {
61 | }
62 | catch (Exception ex)
63 | {
64 | }
65 | }
66 |
67 | public async void OpenFile(FileData fileToOpen)
68 | {
69 | try
70 | {
71 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen.FileName);
72 |
73 | if (file != null)
74 | {
75 | await Launcher.LaunchFileAsync(file);
76 | }
77 | }
78 | catch (FileNotFoundException ex)
79 | {
80 | await SaveFile(fileToOpen);
81 | OpenFile(fileToOpen);
82 | }
83 | catch (Exception ex)
84 | {
85 | }
86 | }
87 | }
88 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone81/Plugin.FilePicker.WindowsPhone81.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}
10 | Library
11 | Properties
12 | Plugin.FilePicker
13 | Plugin.FilePicker
14 | en-US
15 | 8.1
16 | 12
17 | 512
18 | {76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
26 | prompt
27 | 4
28 |
29 |
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
34 | prompt
35 | 4
36 | bin\Release\Plugin.FilePicker.XML
37 |
38 |
39 | true
40 | bin\ARM\Debug\
41 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
42 | ;2008
43 | full
44 | ARM
45 | false
46 | prompt
47 | true
48 |
49 |
50 | bin\ARM\Release\
51 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
52 | true
53 | ;2008
54 | pdbonly
55 | ARM
56 | false
57 | prompt
58 | true
59 |
60 |
61 | true
62 | bin\x86\Debug\
63 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
64 | ;2008
65 | full
66 | x86
67 | false
68 | prompt
69 | true
70 |
71 |
72 | bin\Release\
73 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
74 | true
75 | ;2008
76 | pdbonly
77 | x86
78 | false
79 | prompt
80 | bin\Release\Plugin.FilePicker.XML
81 |
82 |
83 |
84 |
85 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
86 | Plugin.FilePicker.Abstractions
87 |
88 |
89 |
90 |
91 | CrossFilePicker.cs
92 |
93 |
94 |
95 |
96 |
97 | 12.0
98 |
99 |
100 | WindowsPhoneApp
101 |
102 |
103 |
110 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsPhone81/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("Plugin.FilePicker.WindowsPhone81")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Plugin.FilePicker.WindowsPhone81")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsStore/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Plugin.FilePicker.Abstractions;
2 | using System;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using Windows.Storage;
6 | using Windows.Storage.Streams;
7 | using Windows.System;
8 |
9 | namespace Plugin.FilePicker
10 | {
11 | ///
12 | /// Implementation for FilePicker
13 | ///
14 | public class FilePickerImplementation : IFilePicker
15 | {
16 | public async Task PickFile()
17 | {
18 | var picker = new Windows.Storage.Pickers.FileOpenPicker();
19 | picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List;
20 | picker.SuggestedStartLocation =
21 | Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
22 | picker.FileTypeFilter.Add("*");
23 |
24 | var file = await picker.PickSingleFileAsync();
25 |
26 | if (file != null)
27 | {
28 | var array = await ReadFile(file);
29 |
30 | return new FileData(file.Path, file.Name, () => file.OpenStreamForReadAsync().Result);
31 | }
32 | else
33 | {
34 | return null;
35 | }
36 | }
37 |
38 | public async Task SaveFile(FileData fileToSave)
39 | {
40 | try
41 | {
42 | var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileToSave.FileName, CreationCollisionOption.ReplaceExisting);
43 |
44 | await FileIO.WriteBytesAsync(file, fileToSave.DataArray);
45 |
46 | return true;
47 | }
48 | catch (Exception ex)
49 | {
50 | return false;
51 | }
52 | }
53 |
54 | public async void OpenFile(string fileToOpen)
55 | {
56 | try
57 | {
58 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen);
59 |
60 | if (file != null)
61 | {
62 | await Launcher.LaunchFileAsync(file);
63 | }
64 | }
65 | catch (System.IO.FileNotFoundException ex)
66 | {
67 | }
68 | catch (System.Exception ex)
69 | {
70 | }
71 | }
72 |
73 | public async void OpenFile(FileData fileToOpen)
74 | {
75 | try
76 | {
77 | var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileToOpen.FileName);
78 |
79 | if (file != null)
80 | {
81 | await Launcher.LaunchFileAsync(file);
82 | }
83 | }
84 | catch (System.IO.FileNotFoundException ex)
85 | {
86 | await SaveFile(fileToOpen);
87 | OpenFile(fileToOpen);
88 | }
89 | catch (System.Exception ex)
90 | {
91 | }
92 | }
93 |
94 | public async Task ReadFile(StorageFile file)
95 | {
96 | byte[] fileBytes;
97 |
98 | using (var stream = await file.OpenReadAsync())
99 | {
100 | fileBytes = new byte[stream.Size];
101 | using (var reader = new DataReader(stream))
102 | {
103 | await reader.LoadAsync((uint)stream.Size);
104 | reader.ReadBytes(fileBytes);
105 | }
106 | }
107 |
108 | return fileBytes;
109 | }
110 | }
111 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsStore/Plugin.FilePicker.WindowsStore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}
10 | Library
11 | Properties
12 | Plugin.FilePicker
13 | Plugin.FilePicker
14 | en-US
15 | 8.1
16 | 12
17 | 512
18 | {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
26 | prompt
27 | 4
28 |
29 |
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE;NETFX_CORE;WINDOWS_APP
34 | prompt
35 | 4
36 | bin\Release\Plugin.FilePicker.XML
37 |
38 |
39 | true
40 | bin\ARM\Debug\
41 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
42 | ;2008
43 | full
44 | ARM
45 | false
46 | prompt
47 | true
48 |
49 |
50 | bin\ARM\Release\
51 | TRACE;NETFX_CORE;WINDOWS_APP
52 | true
53 | ;2008
54 | pdbonly
55 | ARM
56 | false
57 | prompt
58 | true
59 |
60 |
61 | true
62 | bin\x64\Debug\
63 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
64 | ;2008
65 | full
66 | x64
67 | false
68 | prompt
69 | true
70 |
71 |
72 | bin\x64\Release\
73 | TRACE;NETFX_CORE;WINDOWS_APP
74 | true
75 | ;2008
76 | pdbonly
77 | x64
78 | false
79 | prompt
80 | true
81 |
82 |
83 | true
84 | bin\x86\Debug\
85 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
86 | ;2008
87 | full
88 | x86
89 | false
90 | prompt
91 | true
92 |
93 |
94 | bin\Release\
95 | TRACE;NETFX_CORE;WINDOWS_APP
96 | true
97 | ;2008
98 | pdbonly
99 | x86
100 | false
101 | prompt
102 | bin\Release\Plugin.FilePicker.XML
103 |
104 |
105 |
106 |
107 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
108 | Plugin.FilePicker.Abstractions
109 |
110 |
111 |
112 |
113 | CrossFilePicker.cs
114 |
115 |
116 |
117 |
118 |
119 | 12.0
120 |
121 |
122 |
129 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.WindowsStore/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("Plugin.FilePicker.WindowsStore")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Plugin.FilePicker.WindowsStore")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.iOS/FilePickerImplementation.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using MobileCoreServices;
3 | using Plugin.FilePicker.Abstractions;
4 | using System;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using UIKit;
10 | using System.Diagnostics;
11 |
12 | namespace Plugin.FilePicker
13 | {
14 | ///
15 | /// Implementation for FilePicker
16 | ///
17 | public class FilePickerImplementation : NSObject, IUIDocumentMenuDelegate, IFilePicker
18 | {
19 | private int _requestId;
20 | private TaskCompletionSource _completionSource;
21 |
22 | ///
23 | /// Event which is invoked when a file was picked
24 | ///
25 | public EventHandler Handler {
26 | get;
27 | set;
28 | }
29 |
30 | private void OnFilePicked (FilePickerEventArgs e)
31 | {
32 | Handler?.Invoke (null, e);
33 | }
34 |
35 | public void DidPickDocumentPicker (UIDocumentMenuViewController documentMenu, UIDocumentPickerViewController documentPicker)
36 | {
37 | documentPicker.DidPickDocument += DocumentPicker_DidPickDocument;
38 | documentPicker.WasCancelled += DocumentPicker_WasCancelled;
39 | documentPicker.DidPickDocumentAtUrls += DocumentPicker_DidPickDocumentAtUrls;
40 | UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController (documentPicker, true, null);
41 | }
42 |
43 | private void DocumentPicker_DidPickDocumentAtUrls(object sender, UIDocumentPickedAtUrlsEventArgs e)
44 | {
45 | var control = (UIDocumentPickerViewController)sender;
46 | foreach (var url in e.Urls)
47 | DocumentPicker_DidPickDocument(control, new UIDocumentPickedEventArgs(url));
48 |
49 | control.Dispose();
50 | }
51 |
52 | private void DocumentPicker_DidPickDocument (object sender, UIDocumentPickedEventArgs e)
53 | {
54 | var securityEnabled = e.Url.StartAccessingSecurityScopedResource ();
55 | var doc = new UIDocument (e.Url);
56 | var data = NSData.FromUrl (e.Url);
57 | var dataBytes = new byte [data.Length];
58 |
59 | System.Runtime.InteropServices.Marshal.Copy (data.Bytes, dataBytes, 0, Convert.ToInt32 (data.Length));
60 |
61 | string filename = doc.LocalizedName;
62 | string pathname = doc.FileUrl?.ToString();
63 |
64 | // iCloud drive can return null for LocalizedName.
65 | if (filename == null) {
66 | // Retrieve actual filename by taking the last entry after / in FileURL.
67 | // e.g. /path/to/file.ext -> file.ext
68 |
69 | // filesplit is either:
70 | // 0 (pathname is null, or last / is at position 0)
71 | // -1 (no / in pathname)
72 | // positive int (last occurence of / in string)
73 | var filesplit = pathname?.LastIndexOf ('/') ?? 0;
74 |
75 | filename = pathname?.Substring (filesplit + 1);
76 | }
77 |
78 | OnFilePicked (new FilePickerEventArgs (dataBytes, filename, pathname));
79 | }
80 |
81 | ///
82 | /// Handles when the file picker was cancelled. Either in the
83 | /// popup menu or later on.
84 | ///
85 | ///
86 | ///
87 | public void DocumentPicker_WasCancelled (object sender, EventArgs e)
88 | {
89 | {
90 | var tcs = Interlocked.Exchange (ref _completionSource, null);
91 | tcs.SetResult (null);
92 | }
93 | }
94 |
95 | ///
96 | /// Lets the user pick a file with the systems default file picker
97 | /// For iOS iCloud drive needs to be configured
98 | ///
99 | ///
100 | public async Task PickFile ()
101 | {
102 | var media = await TakeMediaAsync ();
103 |
104 | return media;
105 | }
106 |
107 | private Task TakeMediaAsync ()
108 | {
109 | var id = GetRequestId ();
110 |
111 | var ntcs = new TaskCompletionSource (id);
112 |
113 | if (Interlocked.CompareExchange (ref _completionSource, ntcs, null) != null)
114 | throw new InvalidOperationException ("Only one operation can be active at a time");
115 |
116 | var allowedUtis = new string [] {
117 | UTType.UTF8PlainText,
118 | UTType.PlainText,
119 | UTType.RTF,
120 | UTType.PNG,
121 | UTType.Text,
122 | UTType.PDF,
123 | UTType.Image,
124 | UTType.UTF16PlainText,
125 | UTType.FileURL
126 | };
127 |
128 | var importMenu =
129 | new UIDocumentMenuViewController (allowedUtis, UIDocumentPickerMode.Import) {
130 | Delegate = this,
131 | ModalPresentationStyle = UIModalPresentationStyle.Popover
132 | };
133 |
134 | UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController (importMenu, true, null);
135 |
136 | var presPopover = importMenu.PopoverPresentationController;
137 |
138 | if (presPopover != null) {
139 | presPopover.SourceView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;
140 | presPopover.PermittedArrowDirections = UIPopoverArrowDirection.Down;
141 | }
142 |
143 | Handler = null;
144 |
145 | Handler = (s, e) => {
146 | var tcs = Interlocked.Exchange (ref _completionSource, null);
147 |
148 | tcs?.SetResult (new FileData (e.FilePath, e.FileName, () => File.OpenRead (e.FilePath)));
149 | };
150 |
151 | return _completionSource.Task;
152 | }
153 |
154 | public void WasCancelled (UIDocumentMenuViewController documentMenu)
155 | {
156 | var tcs = Interlocked.Exchange (ref _completionSource, null);
157 |
158 | tcs?.SetResult (null);
159 | }
160 |
161 | private int GetRequestId ()
162 | {
163 | var id = _requestId;
164 |
165 | if (_requestId == int.MaxValue)
166 | _requestId = 0;
167 | else
168 | _requestId++;
169 |
170 | return id;
171 | }
172 |
173 | public async Task SaveFile (FileData fileToSave)
174 | {
175 | try {
176 | var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
177 | var fileName = Path.Combine (documents, fileToSave.FileName);
178 |
179 | File.WriteAllBytes (fileName, fileToSave.DataArray);
180 |
181 | return true;
182 | } catch (Exception ex) {
183 | Debug.WriteLine (ex.Message);
184 | return false;
185 | }
186 | }
187 |
188 | public void OpenFile (NSUrl fileUrl)
189 | {
190 | var docControl = UIDocumentInteractionController.FromUrl (fileUrl);
191 |
192 | var window = UIApplication.SharedApplication.KeyWindow;
193 | var subViews = window.Subviews;
194 | var lastView = subViews.Last ();
195 | var frame = lastView.Frame;
196 |
197 | docControl.PresentOpenInMenu (frame, lastView, true);
198 | }
199 |
200 | public void OpenFile (string fileToOpen)
201 | {
202 | var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
203 |
204 | var fileName = Path.Combine (documents, fileToOpen);
205 |
206 | if (NSFileManager.DefaultManager.FileExists (fileName)) {
207 | var url = new NSUrl (fileName, true);
208 | OpenFile (url);
209 | }
210 | }
211 |
212 | public async void OpenFile (FileData fileToOpen)
213 | {
214 | var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
215 |
216 | var fileName = Path.Combine (documents, fileToOpen.FileName);
217 |
218 | if (NSFileManager.DefaultManager.FileExists (fileName)) {
219 | var url = new NSUrl (fileName, true);
220 |
221 | OpenFile (url);
222 | } else {
223 | await SaveFile (fileToOpen);
224 | OpenFile (fileToOpen);
225 | }
226 | }
227 | }
228 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.iOS/Plugin.FilePicker.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}
9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Plugin.FilePicker
12 | Resources
13 | Plugin.FilePicker
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\iPhone\Debug
20 | DEBUG
21 | prompt
22 | 4
23 | false
24 | true
25 | iPhone Developer
26 |
27 |
28 | none
29 | true
30 | bin\iPhone\Release
31 | prompt
32 | 4
33 | false
34 | iPhone Developer
35 | bin\iPhone\Release\Plugin.FilePicker.XML
36 |
37 |
38 |
39 | CrossFilePicker.cs
40 |
41 |
42 |
43 |
44 |
45 |
46 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
47 | Plugin.FilePicker.Abstractions
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker.iOS/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("Plugin.FilePicker.iOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Plugin.FilePicker.iOS")]
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("38453772-383c-4ada-845b-100c5b84f50a")]
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 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker/CrossFilePicker.cs:
--------------------------------------------------------------------------------
1 | using Plugin.FilePicker.Abstractions;
2 | using System;
3 |
4 | namespace Plugin.FilePicker
5 | {
6 | ///
7 | /// Cross platform FilePicker implemenations
8 | ///
9 | public class CrossFilePicker
10 | {
11 | private static Lazy Implementation = new Lazy(() => CreateFilePicker(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
12 |
13 | ///
14 | /// Current settings to use
15 | ///
16 | public static IFilePicker Current
17 | {
18 | get
19 | {
20 | var ret = Implementation.Value;
21 | if (ret == null)
22 | {
23 | throw NotImplementedInReferenceAssembly();
24 | }
25 | return ret;
26 | }
27 | }
28 |
29 | private static IFilePicker CreateFilePicker()
30 | {
31 | #if PORTABLE
32 | return null;
33 | #else
34 | return new FilePickerImplementation();
35 | #endif
36 | }
37 |
38 | internal static Exception NotImplementedInReferenceAssembly()
39 | {
40 | return new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker/Plugin.FilePicker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 10.0
6 | Debug
7 | AnyCPU
8 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}
9 | Library
10 | Properties
11 | Plugin.FilePicker
12 | Plugin.FilePicker
13 | en-US
14 | 512
15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | Profile259
17 | v4.5
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | TRACE;DEBUG;PORTABLE
25 | prompt
26 | 4
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE;PORTABLE
33 | prompt
34 | 4
35 | bin\Release\Plugin.FilePicker.XML
36 |
37 |
38 |
39 |
40 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
41 | Plugin.FilePicker.Abstractions
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
56 |
--------------------------------------------------------------------------------
/FilePicker/FilePicker/Plugin.FilePicker/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
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("Plugin.FilePicker")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Plugin.FilePicker")]
14 | [assembly: AssemblyCopyright("Copyright © 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: NeutralResourcesLanguage("en")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.3.0.0")]
30 | [assembly: AssemblyFileVersion("1.3.0.0")]
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Studyxnet - Xamarin & .NET
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## FilePicker Plugin for Xamarin.Forms
2 |
3 | Simple cross-platform plug-in that allows you to pick files from the filesystem (iCloud drive in case of iOS) and work with them.
4 |
5 | ### Setup
6 | [](https://badge.fury.io/nu/Xam.Plugin.FilePicker)
7 |
8 | * Available on NuGet: [FilePicker Nuget](https://www.nuget.org/packages/Xam.Plugin.FilePicker)
9 | * Install into your PCL project and Client projects.
10 |
11 | **Platform Support**
12 |
13 | |Platform|Supported|Version|
14 | | ------------------- | :-----------: | :------------------: |
15 | |Xamarin.iOS|Yes|iOS 6+|
16 | |Xamarin.iOS Unified|Yes|iOS 6+|
17 | |Xamarin.Android|Yes|API 10+|
18 | |Windows Phone Silverlight|No||
19 | |Windows Phone RT|Yes|8.1+|
20 | |Windows Store RT|Yes|8.1+|
21 | |Windows 10 UWP|Yes|10+|
22 | |Xamarin.Mac|Yes|* 10.12+|
23 |
24 | \* The Xamarin.Mac implementaiton has only been tested on MacOS 10.12.
25 |
26 | ### API Usage
27 |
28 | Call **CrossFilePicker.Current** from any project or PCL to gain access to APIs.
29 |
30 | ### **IMPORTANT**
31 | **Android:**
32 | The `WRITE_EXTERNAL_STORAGE` & `READ_EXTERNAL_STORAGE` permissions are required.
33 |
34 | **iOS:**
35 | Need [Configure iCloud Driver for your app](https://developer.xamarin.com/guides/ios/platform_features/intro_to_cloudkit)
36 |
37 | #### Contributors
38 | * [rafaelrmou](https://github.com/rafaelrmou)
39 | * [jfversluis](https://github.com/jfversluis)
40 |
41 | Thanks!
42 |
43 | #### License
44 | Licensed under main repo license
45 |
--------------------------------------------------------------------------------
/Xamarin.Plugin.FilePicker.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Xamarin.Plugin.FilePicker
5 | 1.4.0-beta
6 | FilePicker Plugin for Xamarin.Forms
7 | Gerald Versluis, rafaelrmou
8 | Gerald Versluis
9 | https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows/blob/master/LICENSE
10 | https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows
11 |
12 | false
13 |
14 | Simple cross-platform plug-in that allows you to pick files from the filesystem (iCloud drive in case of iOS) and work with them.
15 |
16 | Simple cross-platform plug-in that allows you to pick files from the filesystem (iCloud drive in case of iOS) and work with them. View full project page for README
17 |
18 |
19 | [1.4] - Support Xamarin.Mac
20 | [1.3] - FileData now has a GetStream() method to retrieve the binary data as a Stream
21 | [1.2] - Retrieve full file path from selected file
22 | [1.1] - Support Windows Phone 8, 8.1 e Windows Store.
23 | [1.0] - Pick files, save files and open the archive in Default App.
24 |
25 | xamarin, file, picker, filepicker, filebrowser, pcl, xam.pcl, plugin, plugin for xamarin, windows phone, winphone, wp8, winrt, android, xamarin.forms, ios
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 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------