Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ DocProject/Help/html
# Click-Once directory
publish/

# .NET Framework to .NET 8 migration - old files
*_old.*
packages.config
App.config
Properties/AssemblyInfo.cs

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
Expand Down Expand Up @@ -250,3 +256,5 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
publish/
release/
116 changes: 34 additions & 82 deletions ASGE.csproj
Original file line number Diff line number Diff line change
@@ -1,95 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{84285BB3-2556-45F3-965F-4667855A6EB6}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>asge</AssemblyName>
<RootNamespace>ASGE</RootNamespace>
<AssemblyName>ASGE</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

<PropertyGroup>
<AssemblyTitle>ASGE</AssemblyTitle>
<AssemblyDescription>Azure Storage GZip Encoding Tool</AssemblyDescription>
<AssemblyProduct>ASGE</AssemblyProduct>
<AssemblyCopyright>Copyright © Stefan Gordon 2016</AssemblyCopyright>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
<HintPath>packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\WindowsAzure.Storage.7.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<Compile Include="Options.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utility.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Options_old.cs" />
<Compile Remove="Program_old.cs" />
<Compile Remove="Utility_old.cs" />
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
22 changes: 0 additions & 22 deletions ASGE.sln

This file was deleted.

13 changes: 0 additions & 13 deletions App.config

This file was deleted.

63 changes: 20 additions & 43 deletions Options.cs
Original file line number Diff line number Diff line change
@@ -1,73 +1,50 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;

namespace ASGE
{
class Options
public class Options
{
[Option('a', "account", Required = false, MutuallyExclusiveSet = "Account and Key",
HelpText = "Storage account host. [mystorage]")]
public string StorageAccount { get; set; }
[Option('a', "account", Required = false, SetName = "AccountAndKey",
HelpText = "Storage account name. [mystorage]")]
public string? StorageAccount { get; set; }

[Option('k', "key", Required = false, MutuallyExclusiveSet = "Account and Key",
[Option('k', "key", Required = false, SetName = "AccountAndKey",
HelpText = "Storage account key.")]
public string StorageKey { get; set; }
public string? StorageKey { get; set; }

[Option('c', "connectionstring", Required = false, MutuallyExclusiveSet = "ConnectionString",
[Option('c', "connectionstring", Required = false, SetName = "ConnectionString",
HelpText = "Storage account connection string.")]
public string ConnectionString { get; set; }
public string? ConnectionString { get; set; }

[OptionArray('e', "extensions", Required = true,
[Option('e', "extensions", Required = true,
HelpText = "Extensions to operate on. [.js, .css, .dat]")]
public string[] Extensions { get; set; }
public IEnumerable<string> Extensions { get; set; } = Array.Empty<string>();

[Option('r', "replace", Required = false, DefaultValue = false,
[Option('r', "replace", Required = false, Default = false,
HelpText = "Replace existing files in-place.")]
public bool Replace { get; set; }

[Option('s', "simulate", Required = false, DefaultValue = false,
[Option('s', "simulate", Required = false, Default = false,
HelpText = "Do everything except write to blob store.")]
public bool Simulate { get; set; }

[Option('n', "newextension", Required = false,
HelpText = "Copy file with a new postfix. [.gz]")]
public string NewExtension { get; set; }
public string? NewExtension { get; set; }

[Option('f', "container", Required = true,
HelpText = "Container to search in.")]
public string Container { get; set; }
public string Container { get; set; } = string.Empty;

[Option('x', "cacheage", Required = false, DefaultValue = 2592000,
HelpText = "Duration for cache control max age header, in seconds. Default 2592000 (30 days).")]
[Option('x', "cacheage", Required = false, Default = 2592000,
HelpText = "Duration for cache control max age header, in seconds. Default 2592000 (30 days).")]
public int MaxAgeSeconds { get; set; }

[Option('w', "wildcardcors", Required = false, DefaultValue = false,
[Option('w', "wildcardcors", Required = false, Default = false,
HelpText = "Enable wildcard CORS for this storage account.")]
public bool wildcard { get; set; }


[HelpOption]
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("Azure Storage GZip Encoder", "1.0"),
Copyright = new CopyrightInfo("Stefan Gordon", 2016),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
};
help.AddPreOptionsLine("https://github.com/stefangordon/azure-storage-gzip-encoding\n");
help.AddPreOptionsLine("\nExample 1: asge --extensions .css .js --container assets --replace --connectionstring <conn string>");
help.AddPreOptionsLine("Example 2: asge --extensions .css .js --container assets --newextension .gz --account mystorage --key <storage key>");
help.AddPreOptionsLine("\nUse either connection string (-c) or account and key (-a and -k).");
help.AddOptions(this);
return help;
}

public bool Wildcard { get; set; }
}
}
}
Loading