Skip to content

Commit

Permalink
Common: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Oct 15, 2023
1 parent 85a32b7 commit 1ef4375
Show file tree
Hide file tree
Showing 61 changed files with 169 additions and 171 deletions.
6 changes: 3 additions & 3 deletions UUPMediaCreator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Wim", "thirdparty
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Privileges", "thirdparty\Privileges\Privileges.csproj", "{43C8BFCA-DB35-41F6-8602-A3E99BDD8EC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Imaging", "src\UnifiedUpdatePlatform.Imaging\UnifiedUpdatePlatform.Imaging.csproj", "{6A920E9F-BC98-4EAA-AA9B-2C9FA82443E9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.Imaging", "src\UnifiedUpdatePlatform.Imaging\UnifiedUpdatePlatform.Services.Imaging.csproj", "{6A920E9F-BC98-4EAA-AA9B-2C9FA82443E9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.WindowsUpdate", "src\UnifiedUpdatePlatform.Services.WindowsUpdate\UnifiedUpdatePlatform.Services.WindowsUpdate.csproj", "{B601B162-CDCD-492A-A8CF-747E0D3F6F83}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Media.Creator.Planning", "src\UnifiedUpdatePlatform.Media.Creator.Planning\UnifiedUpdatePlatform.Media.Creator.Planning.csproj", "{6FA4B632-E5EB-4DFF-9E11-F1093BDEAA6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompDB", "src\CompDB\CompDB.csproj", "{A5EF8678-B621-451A-B58E-D1AFDD92751B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.Composition.Database", "src\CompDB\UnifiedUpdatePlatform.Services.Composition.Database.csproj", "{A5EF8678-B621-451A-B58E-D1AFDD92751B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UUPMediaConverter", "src\Applications\UUPMediaConverter\UUPMediaConverter.csproj", "{0BAE9C75-B86F-4976-B24D-7A4B54853342}"
EndProject
Expand All @@ -37,7 +37,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cabinet", "src\Cabinet\Cabi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.StoreServices.DisplayCatalog", "src\Microsoft.StoreServices.DisplayCatalog\Microsoft.StoreServices.DisplayCatalog.csproj", "{09F6A782-B790-4734-82BD-2685AACC489F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TempManager", "src\TempManager\TempManager.csproj", "{1AAC4923-A4E5-41D9-87FA-CFB028F802E5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.Temp", "src\TempManager\UnifiedUpdatePlatform.Services.Temp.csproj", "{1AAC4923-A4E5-41D9-87FA-CFB028F802E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
5 changes: 3 additions & 2 deletions src/Applications/UUPDownload/BuildTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using CompDB;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnifiedUpdatePlatform.Media.Creator.Planning;
using UnifiedUpdatePlatform.Services.Composition.Database;
using UnifiedUpdatePlatform.Services.Temp;
using UnifiedUpdatePlatform.Services.WindowsUpdate;

namespace UUPDownload
Expand Down Expand Up @@ -53,7 +54,7 @@ public static async Task<EditionPlanningWithLanguage> GetTargetedPlanAsync(this
return null;
}

_ = ConversionPlanBuilder.GetTargetedPlan(compDBs, editionPkg, LanguageCode, true, out List<EditionTarget> targets, new TempManager.TempManager(), null);
_ = ConversionPlanBuilder.GetTargetedPlan(compDBs, editionPkg, LanguageCode, true, out List<EditionTarget> targets, new TempManager(), null);
return new EditionPlanningWithLanguage() { EditionTargets = targets, LanguageCode = LanguageCode };
}

Expand Down
3 changes: 1 addition & 2 deletions src/Applications/UUPDownload/DownloadRequest/Process.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using CompDB;
using System;
using System.Collections.Generic;
using System.Data;
Expand All @@ -29,8 +28,8 @@
using System.Security.Cryptography;
using System.Text.Json;
using System.Threading.Tasks;
using UnifiedUpdatePlatform.Services.Composition.Database;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
using UnifiedUpdatePlatform.Services.WindowsUpdate.Shared;
using UUPDownload.Downloading;

namespace UUPDownload.DownloadRequest
Expand Down
2 changes: 1 addition & 1 deletion src/Applications/UUPDownload/DownloadRequest/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Version(ulong MajorVersion = 0, ulong MinorVersion = 0, ulong Build = 0,

public static Version Parse(string versionStr)
{
ulong[] verArray = versionStr.Split(".").Select(x => ulong.Parse(x)).ToArray();
ulong[] verArray = versionStr.Split(".").Select(ulong.Parse).ToArray();
return new Version(verArray[0], verArray[1], verArray[2], verArray[3]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Applications/UUPDownload/Downloading/ReportProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads;
using System;
using System.Collections.Generic;
using System.Threading;
using UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads;

namespace UUPDownload.Downloading
{
Expand Down
1 change: 0 additions & 1 deletion src/Applications/UUPDownload/RingCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using System.Linq;
using System.Threading.Tasks;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
using UnifiedUpdatePlatform.Services.WindowsUpdate.Shared;

namespace UUPDownload
{
Expand Down
4 changes: 2 additions & 2 deletions src/Applications/UUPDownload/UUPDownload.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<ItemGroup>
<ProjectReference Include="..\..\Cabinet\Cabinet.csproj" />
<ProjectReference Include="..\..\UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads\UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.csproj" />
<ProjectReference Include="..\..\CompDB\CompDB.csproj" />
<ProjectReference Include="..\..\CompDB\UnifiedUpdatePlatform.Services.Composition.Database.csproj" />
<ProjectReference Include="..\..\UnifiedUpdatePlatform.Media.Creator.Planning\UnifiedUpdatePlatform.Media.Creator.Planning.csproj" />
<ProjectReference Include="..\..\TempManager\TempManager.csproj" />
<ProjectReference Include="..\..\TempManager\UnifiedUpdatePlatform.Services.Temp.csproj" />
<ProjectReference Include="..\..\UnifiedUpdatePlatform.Services.WindowsUpdate\UnifiedUpdatePlatform.Services.WindowsUpdate.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Applications/UUPDownload/UpdateUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using CompDB;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnifiedUpdatePlatform.Services.Composition.Database;
using UnifiedUpdatePlatform.Services.WindowsUpdate;

namespace UUPDownload
Expand Down
2 changes: 1 addition & 1 deletion src/Cabinet/Cabinet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using Cabinet.Xna;
using ICSharpCode.SharpZipLib.Zip.Compression;
using Microsoft.Xna.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
18 changes: 9 additions & 9 deletions src/Cabinet/Xna/LzxDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
using System;
using System.IO;

namespace Microsoft.Xna.Framework
namespace Cabinet.Xna
{
internal class LzxDecoder
{
Expand Down Expand Up @@ -89,7 +89,7 @@ internal LzxDecoder(int window)
for (int i = 0, j = 0; i <= 50; i += 2)
{
extra_bits[i] = extra_bits[i + 1] = (byte)j;
if ((i != 0) && (j < 17))
if (i != 0 && j < 17)
{
j++;
}
Expand Down Expand Up @@ -254,7 +254,7 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
}

/* buffer exhaustion check */
if (inData.Position > (startpos + inLen))
if (inData.Position > startpos + inLen)
{
/* it's possible to have a file where the next run is less than
* 16 bits in size. In this case, the READ_HUFFSYM() macro used
Expand All @@ -265,7 +265,7 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
* the compressed data)
*/
Console.WriteLine("WTF");
if (inData.Position > (startpos + inLen + 2) || bitbuf.GetBitsLeft() < 16)
if (inData.Position > startpos + inLen + 2 || bitbuf.GetBitsLeft() < 16)
{
return -1; //TODO throw proper exception
}
Expand All @@ -284,7 +284,7 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
/* apply 2^x-1 mask */
window_posn &= window_size - 1;
/* runs can't straddle the window wraparound */
if ((window_posn + this_run) > window_size)
if (window_posn + this_run > window_size)
{
return -1; //TODO throw proper exception
}
Expand Down Expand Up @@ -517,7 +517,7 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
break;

case LzxConstants.BLOCKTYPE.UNCOMPRESSED:
if ((inData.Position + this_run) > endpos)
if (inData.Position + this_run > endpos)
{
return -1; //TODO throw proper exception
}
Expand Down Expand Up @@ -556,7 +556,7 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
// TODO finish intel E8 decoding
/* intel E8 decoding */
//if (m_state.intel_started != 0 && m_state.intel_filesize != 0 && (m_state.frames_read++ < 32768) && outLen > 10)
if ((m_state.frames_read++ < 32768) && m_state.intel_filesize != 0)
if (m_state.frames_read++ < 32768 && m_state.intel_filesize != 0)
{
if (outLen <= 6 || m_state.intel_started == 0)
{
Expand All @@ -577,9 +577,9 @@ internal int Decompress(Stream inData, int inLen, Stream outData, int outLen)
continue;
}
abs_off = (byte)outData.ReadByte() | ((byte)outData.ReadByte() << 8) | ((byte)outData.ReadByte() << 16) | ((byte)outData.ReadByte() << 24);
if ((abs_off >= 0 - curpos) && abs_off < m_state.intel_filesize)
if (abs_off >= 0 - curpos && abs_off < m_state.intel_filesize)
{
rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + m_state.intel_filesize;
rel_off = abs_off >= 0 ? abs_off - curpos : abs_off + m_state.intel_filesize;
_ = outData.Seek(-4, SeekOrigin.Current);
outData.WriteByte((byte)rel_off);
outData.WriteByte((byte)(rel_off >> 8));
Expand Down
2 changes: 1 addition & 1 deletion src/CompDB/Applications/AppxApplicabilityEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
using System.Collections.Generic;

namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
internal static class AppxApplicabilityEngine
{
Expand Down
2 changes: 1 addition & 1 deletion src/CompDB/Applications/AppxInstallWorkload.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public class AppxInstallWorkload
{
Expand Down
3 changes: 1 addition & 2 deletions src/CompDB/Applications/AppxSelectionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using CompDB;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public static class AppxSelectionEngine
{
Expand Down
6 changes: 3 additions & 3 deletions src/CompDB/Applications/DeploymentProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using System.Collections.Generic;
using System.Linq;

namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public class DeploymentProperties
{
Expand Down Expand Up @@ -55,11 +55,11 @@ public bool HasLicense
get; set;
}

public void AddApplicablePackages(IEnumerable<CompDB.CompDBXmlClass.Package> packageElements, IEnumerable<string> applicableLanguageTags)
public void AddApplicablePackages(IEnumerable<CompDBXmlClass.Package> packageElements, IEnumerable<string> applicableLanguageTags)
{
PackageIDs = new HashSet<string>();
Dictionary<int, string> scaleDictionary = null;
foreach (CompDB.CompDBXmlClass.Package package in packageElements)
foreach (CompDBXmlClass.Package package in packageElements)
{
string packageId = package.ID;
switch (package.PackageType)
Expand Down
6 changes: 3 additions & 3 deletions src/CompDB/Applications/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Collections.Generic;
using System.Linq;

namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public static class EnumerableExtensions
{
Expand All @@ -37,15 +37,15 @@ public static class EnumerableExtensions
/// <exception cref="ArgumentNullException"></exception>
public static IEnumerable<T[]> Combinations<T>(this IEnumerable<T> source)
{
return null == source ? throw new ArgumentNullException(nameof(source)) : Combinations(source.ToArray());
return null == source ? throw new ArgumentNullException(nameof(source)) : source.ToArray().Combinations();
}

public static IEnumerable<T[]> Combinations<T>(this T[] data)
{
return null == data
? throw new ArgumentNullException(nameof(data))
: (IEnumerable<T[]>)Enumerable
.Range(0, 1 << (data.Length))
.Range(0, 1 << data.Length)
.Select(index => data
.Where((v, i) => (index & (1 << i)) != 0)
.ToArray()).ToArray();
Expand Down
2 changes: 1 addition & 1 deletion src/CompDB/Applications/PackageProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public class PackageProperties
{
Expand Down
2 changes: 1 addition & 1 deletion src/CompDB/Applications/ResourceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedUpdatePlatform.Media.Creator.Planning.Applications
namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public enum ResourceType
{
Expand Down
2 changes: 1 addition & 1 deletion src/CompDB/CompDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.IO;
using System.Xml.Serialization;

namespace CompDB
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
public static class CompDBXmlClass
{
Expand Down
4 changes: 2 additions & 2 deletions src/CompDB/CompDBExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using System.IO;
using System.Linq;

namespace CompDB
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
public static class CompDBExtensions
{
Expand Down Expand Up @@ -92,7 +92,7 @@ public static CompDBXmlClass.CompDB GetNeutralCompDB(this IEnumerable<CompDBXmlC
compDB.Tags.Tag.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
compDB.Tags.Tag.Find(x => x.Name.Equals("Language", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals(LanguageCode, StringComparison.InvariantCultureIgnoreCase) == true &&
compDB.Tags.Tag.Any(x => x.Name.Equals("Edition", StringComparison.InvariantCultureIgnoreCase)) &&
compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
compDB.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
{
_ = filteredCompDBs.Add(compDB);
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions src/TempManager/TempManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.IO;

namespace TempManager
namespace UnifiedUpdatePlatform.Services.Temp
{
public class TempManager : IDisposable
{
Expand Down
File renamed without changes.
9 changes: 3 additions & 6 deletions src/UnifiedUpdatePlatform.Imaging/IImaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@
*/
using ManagedWimLib;
using Microsoft.Wim;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using UnifiedUpdatePlatform.Services.Temp;

namespace UnifiedUpdatePlatform.Imaging
namespace UnifiedUpdatePlatform.Services.Imaging
{
public interface IImaging
{
Expand All @@ -53,7 +50,7 @@ public bool CaptureImage(
string imageDescription,
string imageFlag,
string InputDirectory,
TempManager.TempManager tempManager,
TempManager tempManager,
string imageDisplayName = null,
string imageDisplayDescription = null,
WimCompressionType compressionType = WimCompressionType.Lzx,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -37,7 +37,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\thirdparty\Microsoft.Wim\Microsoft.Wim.csproj" />
<ProjectReference Include="..\TempManager\TempManager.csproj" />
<ProjectReference Include="..\TempManager\UnifiedUpdatePlatform.Services.Temp.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Joveler.DynLoader" Version="2.3.0" />
Expand Down
Loading

0 comments on commit 1ef4375

Please sign in to comment.