Convert all files to file-scoped name space

This commit is contained in:
Caelan Sayler
2024-02-02 12:26:31 +00:00
parent c10b15278f
commit 2caa7852d3
59 changed files with 5196 additions and 5256 deletions

View File

@@ -7,8 +7,8 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging.Unix
{
namespace Velopack.Packaging.Unix;
public class AppImageTool
{
[SupportedOSPlatform("linux")]
@@ -34,4 +34,3 @@ namespace Velopack.Packaging.Unix
Chmod.ChmodFileAsExecutable(outputFile);
}
}
}

View File

@@ -8,8 +8,8 @@ using ELFSharp.ELF;
using Microsoft.Extensions.Logging;
using Velopack.Packaging.Abstractions;
namespace Velopack.Packaging.Unix.Commands
{
namespace Velopack.Packaging.Unix.Commands;
[SupportedOSPlatform("linux")]
public class LinuxPackCommandRunner : PackageBuilder<LinuxPackOptions>
{
@@ -108,4 +108,3 @@ Categories=Development;
return base.CreateDeltaPackage(progress, releasePkg, prevReleasePkg, outputPkg, mode);
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Text;
using System.Threading.Tasks;
using Velopack.Packaging.Abstractions;
namespace Velopack.Packaging.Unix.Commands
{
namespace Velopack.Packaging.Unix.Commands;
public class LinuxPackOptions : IPackOptions
{
public DirectoryInfo ReleaseDir { get; set; }
@@ -35,4 +35,3 @@ namespace Velopack.Packaging.Unix.Commands
public bool PackIsAppDir { get; set; }
}
}

View File

@@ -2,8 +2,8 @@
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Velopack.Packaging.Windows
{
namespace Velopack.Packaging.Windows;
[SupportedOSPlatform("windows")]
[ExcludeFromCodeCoverage]
public static class AuthenticodeTools
@@ -238,5 +238,4 @@ namespace Velopack.Packaging.Windows
return ptr.m_ptr;
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Text.RegularExpressions;
using Microsoft.Extensions.Logging;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging.Windows
{
namespace Velopack.Packaging.Windows;
[SupportedOSPlatform("windows")]
public class CodeSign
{
@@ -237,4 +237,3 @@ namespace Velopack.Packaging.Windows
// return new ProcessResult(pi.ExitCode, textResult.Trim());
//}
}
}

View File

@@ -8,8 +8,8 @@ using Microsoft.Extensions.Logging;
using NuGet.Versioning;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging.Windows
{
namespace Velopack.Packaging.Windows;
public class DotnetUtil
{
public static NuGetVersion VerifyVelopackApp(string exeFile, ILogger log)
@@ -149,4 +149,3 @@ namespace Velopack.Packaging.Windows
}
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Text;
using System.Threading.Tasks;
using Velopack.NuGet;
namespace Velopack.Packaging.Windows
{
namespace Velopack.Packaging.Windows;
[SupportedOSPlatform("windows")]
public class Rcedit
{
@@ -40,4 +40,3 @@ namespace Velopack.Packaging.Windows
Utility.Retry(() => Exe.InvokeAndThrowIfNonZero(HelperFile.RceditPath, args, null));
}
}
}

View File

@@ -1,9 +1,8 @@
using Microsoft.Extensions.Logging;
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface ICommand<TOpt> where TOpt : class
{
Task Run(TOpt options);
}
}

View File

@@ -1,7 +1,7 @@
using Microsoft.Extensions.Logging;
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface IFancyConsole
{
Task ExecuteProgressAsync(Func<IFancyConsoleProgress, Task> action);
@@ -12,4 +12,3 @@ namespace Velopack.Packaging.Abstractions
void WriteLine(string text = "");
}
}

View File

@@ -1,7 +1,6 @@
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface IFancyConsoleProgress
{
Task RunTask(string name, Func<Action<int>, Task> fn);
}
}

View File

@@ -4,10 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface IOutputOptions
{
DirectoryInfo ReleaseDir { get; }
}
}

View File

@@ -1,9 +1,8 @@
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface IPackOptions : INugetPackCommand, IPlatformOptions
{
string Channel { get; }
DeltaMode DeltaMode { get; }
string EntryExecutableName { get; }
}
}

View File

@@ -4,10 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Packaging.Abstractions
{
namespace Velopack.Packaging.Abstractions;
public interface IPlatformOptions : IOutputOptions
{
RID TargetRuntime { get; }
}
}

View File

@@ -1,8 +1,8 @@
using Velopack.Json;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging
{
namespace Velopack.Packaging;
public class BuildAssets
{
public List<string> Files { get; set; } = new List<string>();
@@ -34,4 +34,3 @@ namespace Velopack.Packaging
return SimpleJson.DeserializeObject<BuildAssets>(File.ReadAllText(path));
}
}
}

View File

@@ -1,8 +1,8 @@
using Microsoft.Extensions.Logging;
using Velopack.Packaging.Abstractions;
namespace Velopack.Packaging.Commands
{
namespace Velopack.Packaging.Commands;
public class DeltaGenCommandRunner : ICommand<DeltaGenOptions>
{
private readonly ILogger _logger;
@@ -28,4 +28,3 @@ namespace Velopack.Packaging.Commands
});
}
}
}

View File

@@ -1,5 +1,5 @@
namespace Velopack.Packaging.Commands
{
namespace Velopack.Packaging.Commands;
public class DeltaGenOptions
{
public DeltaMode DeltaMode { get; set; }
@@ -10,4 +10,3 @@
public string OutputFile { get; set; }
}
}

View File

@@ -3,8 +3,8 @@ using Velopack.Compression;
using Velopack.Packaging.Exceptions;
using Velopack.Packaging.Abstractions;
namespace Velopack.Packaging.Commands
{
namespace Velopack.Packaging.Commands;
public class DeltaPatchCommandRunner : ICommand<DeltaPatchOptions>
{
private readonly ILogger _logger;
@@ -49,4 +49,3 @@ namespace Velopack.Packaging.Commands
});
}
}
}

View File

@@ -1,5 +1,5 @@
namespace Velopack.Packaging.Commands
{
namespace Velopack.Packaging.Commands;
public class DeltaPatchOptions
{
public string BasePackage { get; set; }
@@ -8,4 +8,3 @@
public string OutputFile { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
using Microsoft.Extensions.Logging;
using Velopack.Compression;
namespace Velopack.Packaging
{
namespace Velopack.Packaging;
public class DeltaEmbedded
{
private readonly DeltaImpl _delta;
@@ -32,4 +32,3 @@ namespace Velopack.Packaging
}
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Packaging.Exceptions
{
namespace Velopack.Packaging.Exceptions;
/// <summary>
/// Denotes that an error has occurred for which a stack trace should not be printed.
/// </summary>
@@ -30,4 +30,3 @@ namespace Velopack.Packaging.Exceptions
{
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Packaging.Exceptions
{
namespace Velopack.Packaging.Exceptions;
[ExcludeFromCodeCoverage]
public class VelopackAppVerificationException : UserInfoException
{
@@ -18,4 +18,3 @@ namespace Velopack.Packaging.Exceptions
{
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Text;
using System.Threading.Tasks;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging
{
namespace Velopack.Packaging;
public static class Exe
{
public static void AssertSystemBinaryExists(string binaryName)
@@ -81,4 +81,3 @@ namespace Velopack.Packaging
return psi;
}
}
}

View File

@@ -9,8 +9,8 @@ using Velopack.NuGet;
using Velopack.Packaging.Abstractions;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging
{
namespace Velopack.Packaging;
public abstract class PackageBuilder<T> : ICommand<T>
where T : class, IPackOptions
{
@@ -335,4 +335,3 @@ namespace Velopack.Packaging
File.WriteAllText(Path.Combine(relsDir, ".rels"), rels);
}
}
}

View File

@@ -4,8 +4,8 @@ using Velopack.Json;
using Velopack.NuGet;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging
{
namespace Velopack.Packaging;
public class ReleaseEntryHelper
{
private readonly string _outputDir;
@@ -252,4 +252,3 @@ namespace Velopack.Packaging
}
}

View File

@@ -1,7 +1,7 @@
using Velopack.Packaging;
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public class DeltaGenCommand : BaseCommand
{
public DeltaMode DeltaMode { get; set; }
@@ -40,4 +40,3 @@ namespace Velopack.Vpk.Commands
.SetRequired();
}
}
}

View File

@@ -1,5 +1,5 @@
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public class DeltaPatchCommand : BaseCommand
{
public string BasePackage { get; set; }
@@ -30,4 +30,3 @@
.SetRequired();
}
}
}

View File

@@ -7,8 +7,8 @@ using Microsoft.NET.HostModel.Bundle;
using Octokit;
using Velopack.Packaging;
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public class LinuxPackCommand : PlatformCommand
{
public string PackId { get; private set; }
@@ -99,4 +99,3 @@ namespace Velopack.Vpk.Commands
this.AtLeastOneRequired(icon, appDir);
}
}
}

View File

@@ -7,8 +7,8 @@ using Spectre.Console.Rendering;
using Velopack.Vpk.Logging;
using static System.CommandLine.Help.HelpBuilder;
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public class LongHelpCommand : CliOption<bool>
{
private CliAction _action;
@@ -296,4 +296,3 @@ namespace Velopack.Vpk.Commands
}
}
}
}

View File

@@ -1,7 +1,7 @@
using Velopack.Packaging;
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public abstract class OutputCommand : BaseCommand
{
public string ReleaseDir { get; private set; }
@@ -34,4 +34,3 @@ namespace Velopack.Vpk.Commands
return di;
}
}
}

View File

@@ -1,5 +1,5 @@
namespace Velopack.Vpk.Commands
{
namespace Velopack.Vpk.Commands;
public abstract class PlatformCommand : OutputCommand
{
public string TargetRuntime { get; set; }
@@ -19,4 +19,3 @@
public RuntimeOs GetRuntimeOs() => GetRid().BaseRID;
}
}

View File

@@ -1,7 +1,7 @@
using Velopack.Packaging.Abstractions;
namespace Velopack.Vpk.Logging
{
namespace Velopack.Vpk.Logging;
public class BasicConsole : IFancyConsole
{
private readonly ILogger logger;
@@ -55,4 +55,3 @@ namespace Velopack.Vpk.Logging
}
}
}
}

View File

@@ -4,9 +4,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Vpk.Logging
{
namespace Velopack.Vpk.Logging;
public record DefaultPromptValueFactory(bool DefaultPromptValue)
{
}
}

View File

@@ -8,8 +8,8 @@ using System.Threading.Tasks;
using Spectre.Console;
using Velopack.Packaging.Abstractions;
namespace Velopack.Vpk.Logging
{
namespace Velopack.Vpk.Logging;
public class SpectreConsole : IFancyConsole
{
private readonly ILogger logger;
@@ -141,4 +141,3 @@ namespace Velopack.Vpk.Logging
}
}
}
}

View File

@@ -10,8 +10,8 @@ using Squirrel;
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
namespace LegacyTestApp
{
namespace LegacyTestApp;
internal class Program
{
static int Main(string[] args)
@@ -121,4 +121,3 @@ namespace LegacyTestApp
File.AppendAllText(path, message + Environment.NewLine);
}
}
}

View File

@@ -1,7 +1,7 @@
using System;
namespace LegacyTestApp
{
namespace LegacyTestApp;
#if VELOPACK
using Microsoft.Extensions.Logging;
class SquirrelLogger : ILogger
@@ -41,4 +41,3 @@ namespace LegacyTestApp
}
}
#endif
}

View File

@@ -7,8 +7,8 @@ using Velopack.Packaging.Exceptions;
using Velopack.Packaging.Windows;
using Velopack.Packaging.Windows.Commands;
namespace Velopack.Packaging.Tests
{
namespace Velopack.Packaging.Tests;
public class DotnetUtilTests
{
private readonly ITestOutputHelper _output;
@@ -105,4 +105,3 @@ namespace Velopack.Packaging.Tests
Assert.Throws<UserInfoException>(() => DotnetUtil.VerifyVelopackApp(path, logger));
}
}
}

View File

@@ -6,8 +6,8 @@ using Velopack.Sources;
using Octokit;
using Velopack.Packaging.Exceptions;
namespace Velopack.Packaging.Tests
{
namespace Velopack.Packaging.Tests;
public class GithubDeploymentTests
{
public readonly static string GITHUB_TOKEN = Environment.GetEnvironmentVariable("VELOPACK_GITHUB_TEST_TOKEN");
@@ -234,4 +234,3 @@ This is just a _test_!
}
}

View File

@@ -2,8 +2,8 @@
[assembly: TestFramework("Velopack.Packaging.Tests.TestsInit", "Velopack.Packaging.Tests")]
namespace Velopack.Packaging.Tests
{
namespace Velopack.Packaging.Tests;
public class TestsInit : XunitTestFramework
{
public TestsInit(IMessageSink messageSink)
@@ -13,4 +13,3 @@ namespace Velopack.Packaging.Tests
HelperFile.AddSearchPath(PathHelper.GetVendorLibDir());
}
}
}

View File

@@ -8,8 +8,8 @@ using Velopack.Deployment;
using Velopack.Packaging.Exceptions;
using Velopack.Sources;
namespace Velopack.Packaging.Tests
{
namespace Velopack.Packaging.Tests;
public class S3DeploymentTests
{
public readonly static string B2_KEYID = "0035016844a4188000000000a";
@@ -84,4 +84,3 @@ namespace Velopack.Packaging.Tests
Assert.True(feed.Assets.Count(x => x.Type == VelopackAssetType.Full) <= options.KeepMaxReleases, "Too many releases were kept.");
}
}
}

View File

@@ -8,8 +8,8 @@ using Velopack.Packaging.Unix.Commands;
using Velopack.Packaging.Windows.Commands;
using Velopack.Vpk.Logging;
namespace Velopack.Packaging.Tests
{
namespace Velopack.Packaging.Tests;
public static class TestApp
{
public static void PackTestApp(string id, string version, string testString, string releaseDir, ILogger logger,
@@ -87,4 +87,3 @@ namespace Velopack.Packaging.Tests
}
}
}
}

View File

@@ -2,8 +2,8 @@
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
namespace Velopack.Tests.OldSquirrel
{
namespace Velopack.Tests.OldSquirrel;
[DataContract]
public class ReleaseEntry
{
@@ -276,4 +276,3 @@ namespace Velopack.Tests.OldSquirrel
// .FirstOrDefault();
//}
}
}

View File

@@ -1,7 +1,7 @@
using System.Text.RegularExpressions;
namespace Velopack.Tests.OldSquirrel
{
namespace Velopack.Tests.OldSquirrel;
public static class VersionExtensions
{
static readonly Regex _suffixRegex = new Regex(@"(-full|-delta)?\.nupkg$", RegexOptions.Compiled);
@@ -19,4 +19,3 @@ namespace Velopack.Tests.OldSquirrel
return new SemanticVersion(version);
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Globalization;
using System.Text.RegularExpressions;
namespace Velopack.Tests.OldSquirrel
{
namespace Velopack.Tests.OldSquirrel;
/// <summary>
/// A hybrid implementation of SemVer that supports semantic versioning as described at http://semver.org while not strictly enforcing it to
/// allow older 4-digit versioning schemes to continue working.
@@ -299,4 +299,3 @@ namespace Velopack.Tests.OldSquirrel
return hashCode;
}
}
}

View File

@@ -1,5 +1,5 @@
namespace Velopack.Tests.OldSquirrel
{
namespace Velopack.Tests.OldSquirrel;
internal static class Utility
{
public static bool IsHttpUrl(string urlOrPath)
@@ -12,4 +12,3 @@
return uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps;
}
}
}

View File

@@ -4,8 +4,8 @@ using NuGet.Versioning;
using OldReleaseEntry = Velopack.Tests.OldSquirrel.ReleaseEntry;
using OldSemanticVersion = Velopack.Tests.OldSquirrel.SemanticVersion;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class ReleaseEntryTests
{
[Theory]
@@ -506,4 +506,3 @@ namespace Velopack.Tests
}
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class RuntimeInfoTests
{
[Fact]
@@ -42,4 +42,3 @@ namespace Velopack.Tests
#endif
}
}
}

View File

@@ -2,8 +2,8 @@
using System.Net.Http;
using Velopack.Windows;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class RuntimeTests
{
[Theory]
@@ -105,4 +105,3 @@ namespace Velopack.Tests
result.EnsureSuccessStatusCode();
}
}
}

View File

@@ -8,8 +8,8 @@ using System.Threading.Tasks;
using Velopack.Locators;
using Velopack.Windows;
namespace Velopack.Tests
{
namespace Velopack.Tests;
[SupportedOSPlatform("windows")]
public class ShortcutTests
{
@@ -60,4 +60,3 @@ namespace Velopack.Tests
Assert.Equal(0, after.Keys.Count);
}
}
}

View File

@@ -16,8 +16,8 @@ using SimpleJsonNameAttribute = System.Text.Json.Serialization.JsonPropertyNameA
using SimpleJsonNameAttribute = Velopack.Json.JsonPropertyNameAttribute;
#endif
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class SimpleJsonTests
{
public static readonly JsonSerializerOptions Options = new JsonSerializerOptions {
@@ -148,4 +148,3 @@ namespace Velopack.Tests
public List<string> greetings { get; set; }
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Collections;
using System.Globalization;
namespace Velopack.Tests.TestHelpers
{
namespace Velopack.Tests.TestHelpers;
public static class AssertExtensions
{
public static void ShouldBeAboutEqualTo(this DateTimeOffset expected, DateTimeOffset current)
@@ -144,4 +144,3 @@ namespace Velopack.Tests.TestHelpers
Full,
Minimal
}
}

View File

@@ -6,8 +6,8 @@ using System.Reflection;
// Lovingly stolen from http://exposedobject.codeplex.com/
namespace Velopack.Tests.TestHelpers
{
namespace Velopack.Tests.TestHelpers;
public class ExposedClass : DynamicObject
{
private Type m_type;
@@ -135,4 +135,3 @@ namespace Velopack.Tests.TestHelpers
return new ExposedClass(type);
}
}
}

View File

@@ -7,8 +7,8 @@ using System.Reflection;
// Lovingly stolen from http://exposedobject.codeplex.com/
namespace Velopack.Tests.TestHelpers
{
namespace Velopack.Tests.TestHelpers;
public class ExposedObject : DynamicObject
{
private object m_object;
@@ -166,5 +166,3 @@ namespace Velopack.Tests.TestHelpers
return true;
}
}
}

View File

@@ -6,8 +6,8 @@ using System.Dynamic;
// Lovingly stolen from http://exposedobject.codeplex.com/
namespace Velopack.Tests.TestHelpers
{
namespace Velopack.Tests.TestHelpers;
internal class ExposedObjectHelper
{
private static Type s_csharpInvokePropertyType =
@@ -91,4 +91,3 @@ namespace Velopack.Tests.TestHelpers
}
}
}

View File

@@ -1,7 +1,7 @@
using System.Text;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class FakeDownloader : Sources.IFileDownloader
{
public string LastUrl { get; private set; }
@@ -36,4 +36,3 @@ namespace Velopack.Tests
return Encoding.UTF8.GetString(await DownloadBytes(url, auth, acc));
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Text;
using System.Text.Json;
using Velopack.Sources;
namespace Velopack.Tests.TestHelpers
{
namespace Velopack.Tests.TestHelpers;
internal class FakeFixtureRepository : Sources.IFileDownloader
{
private readonly string _pkgId;
@@ -111,4 +111,3 @@ namespace Velopack.Tests.TestHelpers
throw new NotSupportedException("FakeFixtureRepository doesn't have: " + url);
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Net;
using System.Text;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public sealed class StaticHttpServer : IDisposable
{
public int Port { get; private set; }
@@ -89,4 +89,3 @@ namespace Velopack.Tests
}
}
}
}

View File

@@ -7,8 +7,8 @@ using Velopack.Locators;
using Velopack.Sources;
using Velopack.Tests.TestHelpers;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class UpdateManagerTests
{
private readonly ITestOutputHelper _output;
@@ -381,4 +381,3 @@ namespace Velopack.Tests
Assert.True(File.Exists(target));
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Security.Cryptography;
using System.Text;
using Velopack.Windows;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class UtilityTests
{
private readonly ITestOutputHelper _output;
@@ -235,4 +235,3 @@ namespace Velopack.Tests
}
}
}

View File

@@ -4,8 +4,8 @@ using Velopack.NuGet;
using Velopack.Tests.TestHelpers;
using ZipPackage = Velopack.NuGet.ZipPackage;
namespace Velopack.Tests
{
namespace Velopack.Tests;
public class ZipPackageTests
{
[Fact]
@@ -85,4 +85,3 @@ namespace Velopack.Tests
return Path.GetExtension(p).Equals(NugetUtil.ManifestExtension, StringComparison.OrdinalIgnoreCase);
}
}
}