Skip to content

Commit f2b6915

Browse files
Adds OpenApiDocGeneratorPlugin. Closes #425 (#428)
1 parent a1785c9 commit f2b6915

File tree

7 files changed

+917
-26
lines changed

7 files changed

+917
-26
lines changed

dev-proxy-abstractions/ProxyUtils.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Reflection;
45
using System.Text.RegularExpressions;
56
using Microsoft.Data.Sqlite;
67
using Titanium.Web.Proxy.Http;
@@ -253,4 +254,27 @@ string search
253254
var origin = uri.GetLeftPart(UriPartial.Authority);
254255
return RemoveExtraSlashesFromUrl($"{origin}/{queryVersion}/{requestUrl + search}");
255256
}
257+
258+
private static Assembly? _assembly;
259+
internal static Assembly GetAssembly()
260+
=> _assembly ??= (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly());
261+
262+
private static string _productVersion = string.Empty;
263+
public static string ProductVersion {
264+
get {
265+
if (_productVersion == string.Empty) {
266+
var assembly = GetAssembly();
267+
var assemblyVersionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
268+
269+
if (assemblyVersionAttribute is null) {
270+
_productVersion = assembly.GetName().Version?.ToString() ?? "";
271+
}
272+
else {
273+
_productVersion = assemblyVersionAttribute.InformationalVersion;
274+
}
275+
}
276+
277+
return _productVersion;
278+
}
279+
}
256280
}

0 commit comments

Comments
 (0)