├── Properties
└── launchSettings.json
├── SoReFetch.csproj
├── LICENSE
├── SoReFetch.sln
├── 3RDPARTY.txt
├── README.md
├── .gitattributes
├── Program.cs
├── .gitignore
└── LumiaDownloadModel.cs
/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "SoReFetch": {
4 | "commandName": "Project",
5 | "commandLineArgs": "-t RM-1085"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/SoReFetch.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net5.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Always
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020-2021 Gustave Monce
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 |
--------------------------------------------------------------------------------
/SoReFetch.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31220.234
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoReFetch", "SoReFetch.csproj", "{EBA99D05-83C5-465A-87B5-C35035E04658}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {EBA99D05-83C5-465A-87B5-C35035E04658}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {EBA99D05-83C5-465A-87B5-C35035E04658}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {EBA99D05-83C5-465A-87B5-C35035E04658}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {EBA99D05-83C5-465A-87B5-C35035E04658}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {FC9D6A23-60E1-46C2-9223-95E05029B5D2}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/3RDPARTY.txt:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in
11 | // all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 | // DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SoReFetch
2 |
3 | Tool to fetch firmware & data from Microsoft Lumia Software Repository Server
4 |
5 | ## Help
6 |
7 | ```
8 | Software Repository (SoRe) Fetch Utility
9 | Copyright 2021 (c) Gustave Monce
10 |
11 | This software uses code from the following open source projects released under the MIT license:
12 |
13 | WPinternals - Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
14 |
15 | Please see 3RDPARTY.txt for more information
16 |
17 | SoReFetch 1.0.0
18 | Copyright (C) 2021 SoReFetch
19 |
20 | ERROR(S):
21 | Required option 't, product-type' is missing.
22 |
23 | -c, --product-code Product Code.
24 |
25 | -t, --product-type Required. Product Type.
26 |
27 | -o, --operator-code Operator Code.
28 |
29 | -r, --revision Revision (useful for getting older package versions).
30 |
31 | -f, --firmware-revision Phone Firmware Revision (useful only for changing what Test package you get for
32 | ENOSW/MMOS).
33 |
34 | --help Display this help screen.
35 |
36 | --version Display version information.
37 |
38 | ```
39 |
40 | Example:
41 |
42 | ```SoReFetch -c 059X4D5 -f 01078.00053.16236.35035 -o ATT-US -t RM-1104```
43 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using System;
3 |
4 | namespace SoReFetch
5 | {
6 | internal static class Program
7 | {
8 | public class Options
9 | {
10 | [Option('c', "product-code", Required = false, HelpText = "Product Code.")]
11 | public string ProductCode { get; set; }
12 |
13 | [Option('t', "product-type", Required = true, HelpText = "Product Type.")]
14 | public string ProductType { get; set; }
15 |
16 | [Option('o', "operator-code", Required = false, HelpText = "Operator Code.")]
17 | public string OperatorCode { get; set; }
18 |
19 | [Option('r', "revision", Required = false, HelpText = "Revision (useful for getting older package versions).")]
20 | public string Revision { get; set; }
21 |
22 | [Option('f', "firmware-revision", Required = false, HelpText = "Phone Firmware Revision (useful only for changing what Test package you get for ENOSW/MMOS).")]
23 | public string FirmwareRevision { get; set; }
24 | }
25 |
26 | private static void Main(string[] args)
27 | {
28 | Console.WriteLine();
29 | Console.WriteLine("Software Repository (SoRe) Fetch Utility");
30 | Console.WriteLine("Copyright 2021 (c) Gustave Monce");
31 | Console.WriteLine();
32 | Console.WriteLine("This software uses code from the following open source projects released under the MIT license:");
33 | Console.WriteLine();
34 | Console.WriteLine("WPinternals - Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda");
35 | Console.WriteLine();
36 | Console.WriteLine("Please see 3RDPARTY.txt for more information");
37 | Console.WriteLine();
38 |
39 | Parser.Default.ParseArguments(args)
40 | .WithParsed(o =>
41 | {
42 | string foundType = string.Empty;
43 | string ffu = string.Empty;
44 | string enosw = string.Empty;
45 | string[] emergency = Array.Empty();
46 |
47 | try
48 | {
49 | Console.WriteLine();
50 | Console.WriteLine("Searching FFU");
51 | Console.WriteLine();
52 | ffu = LumiaDownloadModel.SearchFFU(o.ProductType, o.ProductCode, o.OperatorCode, out foundType, o.Revision);
53 | }
54 | catch (DetailedException ex)
55 | {
56 | Console.WriteLine("Error while searching FFU");
57 | Console.WriteLine(ex.Message);
58 | Console.WriteLine(ex.SubMessage);
59 | }
60 | catch (Exception ex)
61 | {
62 | Console.WriteLine("Error while searching FFU");
63 | Console.WriteLine(ex.Message);
64 | }
65 |
66 | try
67 | {
68 | Console.WriteLine();
69 | Console.WriteLine("Searching ENOSW");
70 | Console.WriteLine();
71 | enosw = LumiaDownloadModel.SearchENOSW(o.ProductType, o.FirmwareRevision, o.Revision);
72 | }
73 | catch (DetailedException ex)
74 | {
75 | Console.WriteLine("Error while searching ENOSW");
76 | Console.WriteLine(ex.Message);
77 | Console.WriteLine(ex.SubMessage);
78 | }
79 | catch (Exception ex)
80 | {
81 | Console.WriteLine("Error while searching ENOSW");
82 | Console.WriteLine(ex.Message);
83 | }
84 |
85 | try
86 | {
87 | Console.WriteLine();
88 | Console.WriteLine("Searching Emergency");
89 | Console.WriteLine();
90 | emergency = LumiaDownloadModel.SearchEmergencyFiles(o.ProductType);
91 | }
92 | catch (DetailedException ex)
93 | {
94 | Console.WriteLine("Error while searching Emergency");
95 | Console.WriteLine(ex.Message);
96 | Console.WriteLine(ex.SubMessage);
97 | }
98 | catch (Exception ex)
99 | {
100 | Console.WriteLine("Error while searching Emergency");
101 | Console.WriteLine(ex.Message);
102 | }
103 |
104 | Console.WriteLine();
105 | Console.WriteLine("Results");
106 | Console.WriteLine();
107 |
108 | if (!string.IsNullOrEmpty(foundType))
109 | {
110 | Console.WriteLine("Product Type: " + foundType);
111 | Console.WriteLine();
112 | }
113 |
114 | if (!string.IsNullOrEmpty(ffu))
115 | {
116 | Console.WriteLine("FFU: " + ffu);
117 | Console.WriteLine();
118 | }
119 |
120 | if (!string.IsNullOrEmpty(enosw))
121 | {
122 | Console.WriteLine("ENOSW: " + enosw);
123 | Console.WriteLine();
124 | }
125 |
126 | if (emergency != null)
127 | {
128 | for (int i = 0; i < emergency.Length; i++)
129 | {
130 | Console.WriteLine("Emergency[" + i + "]: " + emergency[i]);
131 | }
132 | }
133 | });
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/LumiaDownloadModel.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in
11 | // all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 | // DEALINGS IN THE SOFTWARE.
20 |
21 | using System;
22 | using System.Collections.Generic;
23 | using System.IO;
24 | using System.Linq;
25 | using System.Net;
26 | using System.Net.Http;
27 | using System.Net.Http.Headers;
28 | using System.Runtime.Serialization;
29 | using System.Runtime.Serialization.Json;
30 | using System.Text;
31 | using System.Threading.Tasks;
32 | using System.Xml;
33 | using System.Xml.Serialization;
34 |
35 | namespace SoReFetch
36 | {
37 | internal class DetailedException : Exception
38 | {
39 | // Message and SubMessaage are always printable
40 | internal string SubMessage = null;
41 |
42 | internal DetailedException() : base() { }
43 |
44 | internal DetailedException(string Message) : base(Message) { }
45 |
46 | internal DetailedException(string Message, Exception InnerException) : base(Message, InnerException) { }
47 |
48 | internal DetailedException(string Message, string SubMessage) : base(Message) { this.SubMessage = SubMessage; }
49 |
50 | internal DetailedException(string Message, string SubMessage, Exception InnerException) : base(Message, InnerException) { this.SubMessage = SubMessage; }
51 | }
52 |
53 | internal static class LumiaDownloadModel
54 | {
55 | internal static string SearchFFU(string ProductType, string ProductCode, string OperatorCode, string Revision = null)
56 | {
57 | return SearchFFU(ProductType, ProductCode, OperatorCode, out _, Revision);
58 | }
59 |
60 | internal static string SearchFFU(string ProductType, string ProductCode, string OperatorCode, out string FoundProductType, string Revision = null)
61 | {
62 | if (ProductType?.Length == 0)
63 | {
64 | ProductType = null;
65 | }
66 |
67 | if (ProductCode?.Length == 0)
68 | {
69 | ProductCode = null;
70 | }
71 |
72 | if (OperatorCode?.Length == 0)
73 | {
74 | OperatorCode = null;
75 | }
76 |
77 | if (ProductCode != null)
78 | {
79 | ProductCode = ProductCode.ToUpper();
80 | ProductType = null;
81 | OperatorCode = null;
82 | }
83 | if (ProductType != null)
84 | {
85 | ProductType = ProductType.ToUpper();
86 | if (ProductType.StartsWith("RM") && !ProductType.StartsWith("RM-"))
87 | {
88 | ProductType = "RM-" + ProductType[2..];
89 | }
90 | }
91 | if (OperatorCode != null)
92 | {
93 | OperatorCode = OperatorCode.ToUpper();
94 | }
95 |
96 | DiscoveryQueryParameters DiscoveryQueryParams = new()
97 | {
98 | manufacturerName = "Microsoft",
99 | manufacturerProductLine = "Lumia",
100 | packageType = "Firmware",
101 | packageClass = "Public",
102 | manufacturerHardwareModel = ProductType,
103 | manufacturerHardwareVariant = ProductCode,
104 | operatorName = OperatorCode,
105 | packageSubRevision = Revision
106 | };
107 | DiscoveryParameters DiscoveryParams = new()
108 | {
109 | query = DiscoveryQueryParams
110 | };
111 |
112 | DataContractJsonSerializer Serializer1 = new(typeof(DiscoveryParameters));
113 | MemoryStream JsonStream1 = new();
114 | Serializer1.WriteObject(JsonStream1, DiscoveryParams);
115 | JsonStream1.Seek(0L, SeekOrigin.Begin);
116 | string JsonContent = new StreamReader(JsonStream1).ReadToEnd();
117 |
118 | Uri RequestUri = new("https://api.swrepository.com/rest-api/discovery/1/package");
119 |
120 | HttpClient HttpClient = new();
121 | HttpClient.DefaultRequestHeaders.UserAgent.TryParseAdd("SoftwareRepository");
122 | HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
123 |
124 | Task HttpPostTask = HttpClient.PostAsync(RequestUri, new StringContent(JsonContent, Encoding.UTF8, "application/json"));
125 | HttpPostTask.Wait();
126 | HttpResponseMessage Response = HttpPostTask.Result;
127 |
128 | string JsonResultString = "";
129 | if (Response.StatusCode == HttpStatusCode.OK)
130 | {
131 | Task ReadResponseTask = Response.Content.ReadAsStringAsync();
132 | ReadResponseTask.Wait();
133 | JsonResultString = ReadResponseTask.Result;
134 | }
135 |
136 | SoftwarePackage Package = null;
137 | using (MemoryStream JsonStream2 = new(Encoding.UTF8.GetBytes(JsonResultString)))
138 | {
139 | DataContractJsonSerializer Serializer2 = new(typeof(SoftwarePackages));
140 | SoftwarePackages SoftwarePackages = (SoftwarePackages)Serializer2.ReadObject(JsonStream2);
141 | if (SoftwarePackages != null)
142 | {
143 | Package = SoftwarePackages.softwarePackages.FirstOrDefault();
144 | }
145 | }
146 |
147 | if (Package == null)
148 | {
149 | throw new DetailedException("FFU not found", "No FFU has been found in the remote software repository for the requested model.");
150 | }
151 |
152 | Console.WriteLine("Revision found (FFU): " + Package.packageSubRevision);
153 |
154 | FoundProductType = Package.manufacturerHardwareModel[0];
155 |
156 | SoftwareFile FileInfo = Package.files.First(f => f.fileName.EndsWith(".ffu", StringComparison.OrdinalIgnoreCase));
157 |
158 | Uri FileInfoUri = new("https://api.swrepository.com/rest-api/discovery/fileurl/1/" + Package.id + "/" + FileInfo.fileName);
159 | Task GetFileInfoTask = HttpClient.GetStringAsync(FileInfoUri);
160 | GetFileInfoTask.Wait();
161 | string FileInfoString = GetFileInfoTask.Result;
162 |
163 | string FfuUrl = "";
164 | FileUrlResult FileUrl = null;
165 | using (MemoryStream JsonStream3 = new(Encoding.UTF8.GetBytes(FileInfoString)))
166 | {
167 | DataContractJsonSerializer Serializer3 = new(typeof(FileUrlResult));
168 | FileUrl = (FileUrlResult)Serializer3.ReadObject(JsonStream3);
169 | if (FileUrl != null)
170 | {
171 | FfuUrl = FileUrl.url.Replace("sr.azureedge.net", "softwarerepo.blob.core.windows.net");
172 | }
173 | }
174 |
175 | HttpClient.Dispose();
176 |
177 | return FfuUrl;
178 | }
179 |
180 | internal static string SearchENOSW(string ProductType, string PhoneFirmwareRevision = null, string Revision = null)
181 | {
182 | if (ProductType?.Length == 0)
183 | {
184 | ProductType = null;
185 | }
186 |
187 | if (ProductType != null)
188 | {
189 | ProductType = ProductType.ToUpper();
190 | if (ProductType.StartsWith("RM") && !ProductType.StartsWith("RM-"))
191 | {
192 | ProductType = "RM-" + ProductType[2..];
193 | }
194 | }
195 |
196 | DiscoveryQueryParameters DiscoveryQueryParams = new()
197 | {
198 | manufacturerName = "Microsoft",
199 | manufacturerProductLine = "Lumia",
200 | packageType = "Test Mode",
201 | packageClass = "Public",
202 | manufacturerHardwareModel = ProductType,
203 | packageSubRevision = Revision
204 | };
205 | DiscoveryParameters DiscoveryParams = new()
206 | {
207 | query = DiscoveryQueryParams
208 | };
209 |
210 | DataContractJsonSerializer Serializer1 = new(typeof(DiscoveryParameters));
211 | MemoryStream JsonStream1 = new();
212 | Serializer1.WriteObject(JsonStream1, DiscoveryParams);
213 | JsonStream1.Seek(0L, SeekOrigin.Begin);
214 | string JsonContent = new StreamReader(JsonStream1).ReadToEnd();
215 |
216 | Uri RequestUri = new("https://api.swrepository.com/rest-api/discovery/1/package");
217 |
218 | HttpClient HttpClient = new();
219 | HttpClient.DefaultRequestHeaders.UserAgent.TryParseAdd("SoftwareRepository");
220 | HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
221 |
222 | Task HttpPostTask = HttpClient.PostAsync(RequestUri, new StringContent(JsonContent, Encoding.UTF8, "application/json"));
223 | HttpPostTask.Wait();
224 | HttpResponseMessage Response = HttpPostTask.Result;
225 |
226 | string JsonResultString = "";
227 | if (Response.StatusCode == HttpStatusCode.OK)
228 | {
229 | Task ReadResponseTask = Response.Content.ReadAsStringAsync();
230 | ReadResponseTask.Wait();
231 | JsonResultString = ReadResponseTask.Result;
232 | }
233 |
234 | SoftwarePackage Package = null;
235 | using (MemoryStream JsonStream2 = new(Encoding.UTF8.GetBytes(JsonResultString)))
236 | {
237 | DataContractJsonSerializer Serializer2 = new(typeof(SoftwarePackages));
238 | SoftwarePackages SoftwarePackages = (SoftwarePackages)Serializer2.ReadObject(JsonStream2);
239 | if (SoftwarePackages != null)
240 | {
241 | foreach (SoftwarePackage pkg in SoftwarePackages.softwarePackages)
242 | {
243 | Package = SoftwarePackages.softwarePackages.FirstOrDefault();
244 | }
245 | }
246 | }
247 |
248 | if (Package == null)
249 | {
250 | throw new DetailedException("ENOSW package not found", "No ENOSW package has been found in the remote software repository for the requested model.");
251 | }
252 |
253 | Console.WriteLine("Revision found (ENOSW): " + Package.packageSubRevision);
254 |
255 | SoftwareFile FileInfo = Package.files.First(f => f.fileName.EndsWith(".secwim", StringComparison.OrdinalIgnoreCase));
256 |
257 | SoftwareFile DPLF = Package.files.First(f => f.fileName.EndsWith(".dpl", StringComparison.OrdinalIgnoreCase));
258 | Uri DPLUri = new("https://api.swrepository.com/rest-api/discovery/fileurl/1/" + Package.id + "/" + DPLF.fileName);
259 | Task GetDPLTask = HttpClient.GetStringAsync(DPLUri);
260 | GetDPLTask.Wait();
261 | string DPLString = GetDPLTask.Result;
262 |
263 | string DPLUrl = "";
264 | FileUrlResult FileUrlDPL = null;
265 | using (MemoryStream JsonStream3 = new(Encoding.UTF8.GetBytes(DPLString)))
266 | {
267 | DataContractJsonSerializer Serializer3 = new(typeof(FileUrlResult));
268 | FileUrlDPL = (FileUrlResult)Serializer3.ReadObject(JsonStream3);
269 | if (FileUrlDPL != null)
270 | {
271 | DPLUrl = FileUrlDPL.url.Replace("sr.azureedge.net", "softwarerepo.blob.core.windows.net");
272 | }
273 | }
274 |
275 | if (DPLUrl?.Length == 0)
276 | {
277 | throw new DetailedException("DPL not found", "No DPL has been found in the remote software repository for the requested model.");
278 | }
279 |
280 | Task GetDPLStrTask = HttpClient.GetStringAsync(DPLUrl);
281 | GetDPLStrTask.Wait();
282 | string DPLStrString = GetDPLStrTask.Result;
283 |
284 | DPL.Package dpl;
285 | XmlSerializer serializer = new(typeof(DPL.Package));
286 | using (StringReader reader = new(DPLStrString.Replace("ft:", "").Replace("dpl:", "").Replace("typedes:", "")))
287 | {
288 | dpl = (DPL.Package)serializer.Deserialize(reader);
289 | }
290 |
291 | foreach (DPL.File file in dpl.Content.Files.File)
292 | {
293 | string name = file.Name;
294 |
295 | DPL.Range range = file.Extensions.MmosWimFile.UseCaseCompatibilities.Compatibility.FirstOrDefault().Range;
296 |
297 | if (PhoneFirmwareRevision == null || IsFirmwareBetween(PhoneFirmwareRevision, range.From, range.To))
298 | {
299 | FileInfo = Package.files.First(f => f.fileName.EndsWith(name, StringComparison.OrdinalIgnoreCase));
300 | break;
301 | }
302 | }
303 |
304 | Uri FileInfoUri = new("https://api.swrepository.com/rest-api/discovery/fileurl/1/" + Package.id + "/" + FileInfo.fileName);
305 | Task GetFileInfoTask = HttpClient.GetStringAsync(FileInfoUri);
306 | GetFileInfoTask.Wait();
307 | string FileInfoString = GetFileInfoTask.Result;
308 |
309 | string ENOSWUrl = "";
310 | FileUrlResult FileUrl = null;
311 | using (MemoryStream JsonStream3 = new(Encoding.UTF8.GetBytes(FileInfoString)))
312 | {
313 | DataContractJsonSerializer Serializer3 = new(typeof(FileUrlResult));
314 | FileUrl = (FileUrlResult)Serializer3.ReadObject(JsonStream3);
315 | if (FileUrl != null)
316 | {
317 | ENOSWUrl = FileUrl.url.Replace("sr.azureedge.net", "softwarerepo.blob.core.windows.net");
318 | }
319 | }
320 |
321 | HttpClient.Dispose();
322 |
323 | return ENOSWUrl;
324 | }
325 |
326 | private static bool IsFirmwareBetween(string PhoneFirmwareRevision, string Limit1, string Limit2)
327 | {
328 | var version = new Version(PhoneFirmwareRevision);
329 | var version1 = new Version(Limit1);
330 | var version2 = new Version(Limit2);
331 |
332 | var result = version.CompareTo(version1);
333 | var result2 = version.CompareTo(version2);
334 |
335 | return result >= 0 && result2 <= 0;
336 | }
337 |
338 | internal static string[] SearchEmergencyFiles(string ProductType)
339 | {
340 | ProductType = ProductType.ToUpper();
341 | if (ProductType.StartsWith("RM") && !ProductType.StartsWith("RM-"))
342 | {
343 | ProductType = "RM-" + ProductType[2..];
344 | }
345 |
346 | Console.WriteLine("Getting Emergency files for: " + ProductType);
347 |
348 | if ((ProductType == "RM-1072") || (ProductType == "RM-1073"))
349 | {
350 | Console.WriteLine("Due to mix-up in online-repository, redirecting to emergency files of RM-1113");
351 | ProductType = "RM-1113";
352 | }
353 |
354 | List Result = new();
355 |
356 | WebClient Client = new();
357 | string Src;
358 | string FileName;
359 | string Config = null;
360 | try
361 | {
362 | Config = Client.DownloadString("https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/" + ProductType + "/emergency_flash_config.xml");
363 | }
364 | catch
365 | {
366 | Console.WriteLine("Emergency files for " + ProductType + " not found");
367 | return null;
368 | }
369 | Client.Dispose();
370 |
371 | XmlDocument Doc = new();
372 | Doc.LoadXml(Config);
373 |
374 | // Hex
375 | XmlNode Node = Doc.SelectSingleNode("//emergency_flash_config/hex_flasher");
376 | if (Node != null)
377 | {
378 | FileName = Node.Attributes["image_path"].InnerText;
379 | Src = "https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/" + ProductType + "/" + FileName;
380 | Console.WriteLine("Hex-file: " + Src);
381 | Result.Add(Src);
382 | }
383 |
384 | // Mbn
385 | Node = Doc.SelectSingleNode("//emergency_flash_config/mbn_image");
386 | if (Node != null)
387 | {
388 | FileName = Node.Attributes["image_path"].InnerText;
389 | Src = "https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/" + ProductType + "/" + FileName;
390 | Console.WriteLine("Mbn-file: " + Src);
391 | Result.Add(Src);
392 | }
393 |
394 | // Ede
395 | foreach (XmlNode SubNode in Doc.SelectNodes("//emergency_flash_config/first_boot_images/first_boot_image"))
396 | {
397 | FileName = SubNode.Attributes["image_path"].InnerText;
398 | Src = "https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/" + ProductType + "/" + FileName;
399 | Console.WriteLine("Firehose-programmer-file: " + Src);
400 | Result.Add(Src);
401 | }
402 |
403 | // Edp
404 | foreach (XmlNode SubNode in Doc.SelectNodes("//emergency_flash_config/second_boot_firehose_single_image/firehose_image"))
405 | {
406 | FileName = SubNode.Attributes["image_path"].InnerText;
407 | Src = "https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/" + ProductType + "/" + FileName;
408 | Console.WriteLine("Firehose-payload-file: " + Src);
409 | Result.Add(Src);
410 | }
411 |
412 | return Result.ToArray();
413 | }
414 | }
415 |
416 | #pragma warning disable 0649
417 | [DataContract]
418 | internal class FileUrlResult
419 | {
420 | [DataMember]
421 | internal string url;
422 |
423 | [DataMember]
424 | internal List alternateUrl;
425 |
426 | [DataMember]
427 | internal long fileSize;
428 |
429 | [DataMember]
430 | internal List checksum;
431 | }
432 | #pragma warning restore 0649
433 |
434 | [DataContract]
435 | public class DiscoveryQueryParameters
436 | {
437 | [DataMember(EmitDefaultValue = false)]
438 | public string customerName;
439 |
440 | [DataMember(EmitDefaultValue = false)]
441 | public ExtendedAttributes extendedAttributes;
442 |
443 | [DataMember(EmitDefaultValue = false)]
444 | public string manufacturerHardwareModel;
445 |
446 | [DataMember(EmitDefaultValue = false)]
447 | public string manufacturerHardwareVariant;
448 |
449 | [DataMember(EmitDefaultValue = false)]
450 | public string manufacturerModelName;
451 |
452 | [DataMember]
453 | public string manufacturerName;
454 |
455 | [DataMember(EmitDefaultValue = false)]
456 | public string manufacturerPackageId;
457 |
458 | [DataMember(EmitDefaultValue = false)]
459 | public string manufacturerPlatformId;
460 |
461 | [DataMember]
462 | public string manufacturerProductLine;
463 |
464 | [DataMember(EmitDefaultValue = false)]
465 | public string manufacturerVariantName;
466 |
467 | [DataMember(EmitDefaultValue = false)]
468 | public string operatorName;
469 |
470 | [DataMember]
471 | public string packageClass;
472 |
473 | [DataMember(EmitDefaultValue = false)]
474 | public string packageRevision;
475 |
476 | [DataMember(EmitDefaultValue = false)]
477 | public string packageState;
478 |
479 | [DataMember(EmitDefaultValue = false)]
480 | public string packageSubRevision;
481 |
482 | [DataMember(EmitDefaultValue = false)]
483 | public string packageSubtitle;
484 |
485 | [DataMember(EmitDefaultValue = false)]
486 | public string packageTitle;
487 |
488 | [DataMember]
489 | public string packageType;
490 | }
491 |
492 | [DataContract]
493 | public class DiscoveryParameters
494 | {
495 | [DataMember(Name = "api-version")]
496 | public string apiVersion;
497 |
498 | [DataMember]
499 | public DiscoveryQueryParameters query;
500 |
501 | [DataMember]
502 | public List condition;
503 |
504 | [DataMember]
505 | public List response;
506 |
507 | public DiscoveryParameters() : this(DiscoveryCondition.Default)
508 | {
509 | }
510 |
511 | public DiscoveryParameters(DiscoveryCondition Condition)
512 | {
513 | this.apiVersion = "1";
514 | this.query = new DiscoveryQueryParameters();
515 | this.condition = new List();
516 | if (Condition == DiscoveryCondition.All)
517 | {
518 | this.condition.Add("all");
519 | return;
520 | }
521 | if (Condition == DiscoveryCondition.Latest)
522 | {
523 | this.condition.Add("latest");
524 | return;
525 | }
526 | this.condition.Add("default");
527 | }
528 | }
529 |
530 | public enum DiscoveryCondition
531 | {
532 | Default,
533 | All,
534 | Latest
535 | }
536 |
537 | [Serializable]
538 | public class ExtendedAttributes : ISerializable
539 | {
540 | public Dictionary Dictionary;
541 |
542 | public ExtendedAttributes()
543 | {
544 | this.Dictionary = new Dictionary();
545 | }
546 |
547 | protected ExtendedAttributes(SerializationInfo info, StreamingContext context)
548 | {
549 | if (info != null)
550 | {
551 | this.Dictionary = new Dictionary();
552 | SerializationInfoEnumerator Enumerator = info.GetEnumerator();
553 | while (Enumerator.MoveNext())
554 | {
555 | this.Dictionary.Add(Enumerator.Current.Name, (string)Enumerator.Current.Value);
556 | }
557 | }
558 | }
559 |
560 | public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
561 | {
562 | if (info != null)
563 | {
564 | foreach (string Current in this.Dictionary.Keys)
565 | {
566 | info.AddValue(Current, this.Dictionary[Current]);
567 | }
568 | }
569 | }
570 | }
571 |
572 | [DataContract]
573 | public class SoftwareFileChecksum
574 | {
575 | [DataMember]
576 | public string type;
577 |
578 | [DataMember]
579 | public string value;
580 | }
581 |
582 | [DataContract]
583 | public class SoftwarePackages
584 | {
585 | [DataMember]
586 | public List softwarePackages;
587 | }
588 |
589 | [DataContract]
590 | public class SoftwarePackage
591 | {
592 | [DataMember]
593 | public List customerName;
594 |
595 | [DataMember]
596 | public ExtendedAttributes extendedAttributes;
597 |
598 | [DataMember]
599 | public List files;
600 |
601 | [DataMember]
602 | public string id;
603 |
604 | [DataMember]
605 | public List manufacturerHardwareModel;
606 |
607 | [DataMember]
608 | public List manufacturerHardwareVariant;
609 |
610 | [DataMember]
611 | public List manufacturerModelName;
612 |
613 | [DataMember]
614 | public string manufacturerName;
615 |
616 | [DataMember]
617 | public string manufacturerPackageId;
618 |
619 | [DataMember]
620 | public List manufacturerPlatformId;
621 |
622 | [DataMember]
623 | public string manufacturerProductLine;
624 |
625 | [DataMember]
626 | public List manufacturerVariantName;
627 |
628 | [DataMember]
629 | public List operatorName;
630 |
631 | [DataMember]
632 | public List packageClass;
633 |
634 | [DataMember]
635 | public string packageDescription;
636 |
637 | [DataMember]
638 | public string packageRevision;
639 |
640 | [DataMember]
641 | public string packageState;
642 |
643 | [DataMember]
644 | public string packageSubRevision;
645 |
646 | [DataMember]
647 | public string packageSubtitle;
648 |
649 | [DataMember]
650 | public string packageTitle;
651 |
652 | [DataMember]
653 | public string packageType;
654 | }
655 |
656 | [DataContract]
657 | public class SoftwareFile
658 | {
659 | [DataMember]
660 | public List checksum;
661 |
662 | [DataMember]
663 | public string fileName;
664 |
665 | [DataMember]
666 | public long fileSize;
667 |
668 | [DataMember]
669 | public string fileType;
670 | }
671 |
672 | public static class DPL
673 | {
674 | [XmlRoot(ElementName = "BasicProductCodes")]
675 | public class BasicProductCodes
676 | {
677 | [XmlElement(ElementName = "BasicProductCode")]
678 | public List BasicProductCode { get; set; }
679 | }
680 |
681 | [XmlRoot(ElementName = "Identification")]
682 | public class Identification
683 | {
684 | [XmlElement(ElementName = "TypeDesignator")]
685 | public string TypeDesignator { get; set; }
686 | [XmlElement(ElementName = "BasicProductCodes")]
687 | public BasicProductCodes BasicProductCodes { get; set; }
688 | [XmlElement(ElementName = "Purpose")]
689 | public string Purpose { get; set; }
690 | }
691 |
692 | [XmlRoot(ElementName = "Extensions")]
693 | public class Extensions
694 | {
695 | [XmlElement(ElementName = "PackageType")]
696 | public string PackageType { get; set; }
697 | [XmlElement(ElementName = "Identification")]
698 | public Identification Identification { get; set; }
699 | [XmlElement(ElementName = "FileType")]
700 | public string FileType { get; set; }
701 | [XmlElement(ElementName = "MmosWimFile")]
702 | public MmosWimFile MmosWimFile { get; set; }
703 | }
704 |
705 | [XmlRoot(ElementName = "PackageDescription")]
706 | public class PackageDescription
707 | {
708 | [XmlElement(ElementName = "Identifier")]
709 | public string Identifier { get; set; }
710 | [XmlElement(ElementName = "Revision")]
711 | public string Revision { get; set; }
712 | [XmlElement(ElementName = "Extensions")]
713 | public Extensions Extensions { get; set; }
714 | }
715 |
716 | [XmlRoot(ElementName = "Digest")]
717 | public class Digest
718 | {
719 | [XmlAttribute(AttributeName = "method")]
720 | public string Method { get; set; }
721 | [XmlAttribute(AttributeName = "encoding")]
722 | public string Encoding { get; set; }
723 | [XmlText]
724 | public string Text { get; set; }
725 | }
726 |
727 | [XmlRoot(ElementName = "Digests")]
728 | public class Digests
729 | {
730 | [XmlElement(ElementName = "Digest")]
731 | public List Digest { get; set; }
732 | }
733 |
734 | [XmlRoot(ElementName = "Range")]
735 | public class Range
736 | {
737 | [XmlAttribute(AttributeName = "from")]
738 | public string From { get; set; }
739 | [XmlAttribute(AttributeName = "to")]
740 | public string To { get; set; }
741 | }
742 |
743 | [XmlRoot(ElementName = "Compatibility")]
744 | public class Compatibility
745 | {
746 | [XmlElement(ElementName = "Range")]
747 | public Range Range { get; set; }
748 | [XmlAttribute(AttributeName = "useCase")]
749 | public string UseCase { get; set; }
750 | }
751 |
752 | [XmlRoot(ElementName = "UseCaseCompatibilities")]
753 | public class UseCaseCompatibilities
754 | {
755 | [XmlElement(ElementName = "Compatibility")]
756 | public List Compatibility { get; set; }
757 | }
758 |
759 | [XmlRoot(ElementName = "MmosWimFile")]
760 | public class MmosWimFile
761 | {
762 | [XmlElement(ElementName = "UseCaseCompatibilities")]
763 | public UseCaseCompatibilities UseCaseCompatibilities { get; set; }
764 | }
765 |
766 | [XmlRoot(ElementName = "File")]
767 | public class File
768 | {
769 | [XmlElement(ElementName = "Name")]
770 | public string Name { get; set; }
771 | [XmlElement(ElementName = "Digests")]
772 | public Digests Digests { get; set; }
773 | [XmlElement(ElementName = "Revision")]
774 | public string Revision { get; set; }
775 | [XmlElement(ElementName = "Extensions")]
776 | public Extensions Extensions { get; set; }
777 | }
778 |
779 | [XmlRoot(ElementName = "Files")]
780 | public class Files
781 | {
782 | [XmlElement(ElementName = "File")]
783 | public List File { get; set; }
784 | }
785 |
786 | [XmlRoot(ElementName = "Content")]
787 | public class Content
788 | {
789 | [XmlElement(ElementName = "PackageDescription")]
790 | public PackageDescription PackageDescription { get; set; }
791 | [XmlElement(ElementName = "Files")]
792 | public Files Files { get; set; }
793 | }
794 |
795 | [XmlRoot(ElementName = "CanonicalizationMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
796 | public class CanonicalizationMethod
797 | {
798 | [XmlAttribute(AttributeName = "Algorithm")]
799 | public string Algorithm { get; set; }
800 | }
801 |
802 | [XmlRoot(ElementName = "SignatureMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
803 | public class SignatureMethod
804 | {
805 | [XmlAttribute(AttributeName = "Algorithm")]
806 | public string Algorithm { get; set; }
807 | }
808 |
809 | [XmlRoot(ElementName = "Transform", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
810 | public class Transform
811 | {
812 | [XmlAttribute(AttributeName = "Algorithm")]
813 | public string Algorithm { get; set; }
814 | }
815 |
816 | [XmlRoot(ElementName = "Transforms", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
817 | public class Transforms
818 | {
819 | [XmlElement(ElementName = "Transform", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
820 | public Transform Transform { get; set; }
821 | }
822 |
823 | [XmlRoot(ElementName = "DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
824 | public class DigestMethod
825 | {
826 | [XmlAttribute(AttributeName = "Algorithm")]
827 | public string Algorithm { get; set; }
828 | }
829 |
830 | [XmlRoot(ElementName = "Reference", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
831 | public class Reference
832 | {
833 | [XmlElement(ElementName = "Transforms", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
834 | public Transforms Transforms { get; set; }
835 | [XmlElement(ElementName = "DigestMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
836 | public DigestMethod DigestMethod { get; set; }
837 | [XmlElement(ElementName = "DigestValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
838 | public string DigestValue { get; set; }
839 | [XmlAttribute(AttributeName = "URI")]
840 | public string URI { get; set; }
841 | }
842 |
843 | [XmlRoot(ElementName = "SignedInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
844 | public class SignedInfo
845 | {
846 | [XmlElement(ElementName = "CanonicalizationMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
847 | public CanonicalizationMethod CanonicalizationMethod { get; set; }
848 | [XmlElement(ElementName = "SignatureMethod", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
849 | public SignatureMethod SignatureMethod { get; set; }
850 | [XmlElement(ElementName = "Reference", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
851 | public Reference Reference { get; set; }
852 | }
853 |
854 | [XmlRoot(ElementName = "KeyInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
855 | public class KeyInfo
856 | {
857 | [XmlElement(ElementName = "KeyName", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
858 | public string KeyName { get; set; }
859 | }
860 |
861 | [XmlRoot(ElementName = "Signature", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
862 | public class Signature
863 | {
864 | [XmlElement(ElementName = "SignedInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
865 | public SignedInfo SignedInfo { get; set; }
866 | [XmlElement(ElementName = "SignatureValue", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
867 | public string SignatureValue { get; set; }
868 | [XmlElement(ElementName = "KeyInfo", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
869 | public KeyInfo KeyInfo { get; set; }
870 | [XmlAttribute(AttributeName = "xmlns")]
871 | public string Xmlns { get; set; }
872 | }
873 |
874 | [XmlRoot(ElementName = "Package")]
875 | public class Package
876 | {
877 | [XmlElement(ElementName = "Content")]
878 | public Content Content { get; set; }
879 | [XmlElement(ElementName = "Signature", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
880 | public Signature Signature { get; set; }
881 | }
882 | }
883 | }
--------------------------------------------------------------------------------