Skip to content

Commit

Permalink
Small enhancement of AsciiDoc features (#252)
Browse files Browse the repository at this point in the history
* * redo changes of MIHO/Post_SpecConf_AsciiDoc

* * fix w.r.t. missing
   CoundtryFlags nuget
   package.
* backported from Blazor

* * added heading4 to
   AsciiDoc export

* * post build commands for
   AsciiDoc
* View command for AsciiDoc

* * ROOT for AsciiDoc

---------

Co-authored-by: Michael Hoffmeister <[email protected]>
  • Loading branch information
MichaelHoffmeisterFesto and festo-i40 authored Oct 9, 2024
1 parent a16fa08 commit 0d51ef1
Show file tree
Hide file tree
Showing 14 changed files with 566 additions and 21 deletions.
41 changes: 39 additions & 2 deletions src/AasxCsharpLibrary/AdminShellUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,11 +1090,12 @@ public static string GetTemporaryDirectory()

// see: https://stackoverflow.com/questions/6386113/using-system-io-packaging-to-generate-a-zip-file
public static void AddFileToZip(
string zipFilename, string fileToAdd,
string zipFilename,
string fileToAdd,
CompressionOption compression = CompressionOption.Normal,
FileMode fileMode = FileMode.OpenOrCreate)
{
using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate))
using (Package zip = System.IO.Packaging.Package.Open(zipFilename, fileMode))
{
string destFilename = ".\\" + Path.GetFileName(fileToAdd);
Uri uri = PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));
Expand All @@ -1113,6 +1114,42 @@ public static void AddFileToZip(
}
}

public static void RecursiveAddDirToZip(
Package zip,
string localPath,
string zipPath = "",
CompressionOption compression = CompressionOption.Normal)
{
// enumerate only on this level
foreach (var infn in Directory.EnumerateDirectories(localPath, "*"))
{
// recurse
RecursiveAddDirToZip(
zip,
localPath: infn,
zipPath: Path.Combine(zipPath, Path.GetFileName(infn)),
compression: compression);
}

foreach (var infn in Directory.EnumerateFiles(localPath, "*"))
{
string destFilename = ".\\" + Path.Combine(zipPath, Path.GetFileName(infn));
Uri uri = PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));
if (zip.PartExists(uri))
{
zip.DeletePart(uri);
}
PackagePart part = zip.CreatePart(uri, "", compression);
using (FileStream fileStream = new FileStream(infn, FileMode.Open, FileAccess.Read))
{
using (Stream dest = part.GetStream())
{
fileStream.CopyTo(dest);
}
}
}
}

//
// some URL enabled path handling
//
Expand Down
6 changes: 6 additions & 0 deletions src/AasxIntegrationBaseWpf/AasxIntegrationBaseWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
<UseWPF>true</UseWPF>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\country_flags.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AasxIntegrationBase\AasxIntegrationBase.csproj" />
<ProjectReference Include="..\AnyUi\AnyUi.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\country_flags.png">
<Pack>True</Pack>
</Resource>
<Resource Include="Resources\msg_error.png" />
<Resource Include="Resources\msg_hand.png" />
<Resource Include="Resources\msg_info.png" />
Expand Down
Loading

0 comments on commit 0d51ef1

Please sign in to comment.