Updating a WinUI 3 Preview 1 Project to Preview 2

WinUI 3 Preview 2 I didn’t notice for about half a month, but WinUI 3 Preview 2 was released. WinUI 3 Preview 2 (July 2020) So, I tried updating the following WinUI 3 Desktop project, which I previously created using WinUI 3 Preview 1, to Preview 2. This is a record of that process. Since I basically just followed the official instructions, there isn’t much useful information here. GitHub: ayumax/WinUIExplorer ...

2020-08-07 · 3 min · 514 words · ayumax

Unloading Assemblies in .NET Core

Mechanism for Unloading Assemblies This article is for the 10th day of the C# Advent Calendar 2019. An application I create for work (made with .NET Framework) has a user plugin (DLL) loading feature. This feature allows users to add functionality to the development tool by creating their own DLLs according to rules. This feature involves the development tool loading the relevant DLLs once, querying them, and then unloading DLLs that don’t need to be loaded. ...

2019-12-10 · 7 min · 1303 words · ayumax

Wanting to Write UE4 Scripts in C# (Experiment Edition)

Wanting to Write Scripts in C# I like UE4 C++. I have also released several C++ plugins on the Marketplace. However, since I also write a lot of C#, I sometimes think, “If only this were C#, it would be much easier to write.” Thinking about such things, I casually made the following post on Twitter. ふとUE4のスクリプトをC#で書きたいなあ。どうしたらいいかなあと考えていたんだけど、なかなかいい実装が思いつかない。 — ayuma (@ayuma_x) August 24, 2019 Then, I received this invitation from @kekyo2, and today I actually spent the whole day trying it out. ...

2019-09-15 · 6 min · 1206 words · ayumax

Trying out .NET Core 3.0 WPF (Made a Node-Based Calculator)

Tried It Out With the combination of Visual Studio 2019 + .NET Core 3.0, WPF is usable, so I created a new project and tried it out. For now, I’ll try writing as if I’m using the traditional WPF, forgetting that I’m using .NET Core, and see how it feels. Usage methods are introduced by various people, but you can use it by installing Visual Studio 2019 and .NET Core 3.0, and then checking ON “Use preview .NET Core SDK” in Visual Studio options. ...

2019-05-13 · 6 min · 1062 words · ayumax

Attended Center CLR Try! Development #2

Attended Center CLR Try! Development #2 I recently attended “Center CLR Try! Development #2”. The venue was different from #1, right in front of Kanayama Station, making it easily accessible. However, the target building was under construction, making the entrance hard to find, and I wandered around for a few minutes… (Being directionally challenged, I initially went to the wrong building). There were three participants that day (Mr. Matsui, Mr. Matsuoka, and myself). Being alongside two amazing individuals made me a little, no, quite nervous. But thanks to the small group size, I was able to talk about various things, making it a meaningful day. ...

2018-11-12 · 3 min · 531 words · ayumax

Gave an LT at CenterCLR Study Group

Attended Study Group I attended the CenterCLR study group on 8/11. Signed Up for LT Initially, I signed up for the regular participation slot, but one day I happened to check and saw an LT (Lightning Talk) slot was open, so I signed up for it. At that point, I hadn’t decided what to talk about yet, but I started deciding on the topic and preparing the presentation materials for the day (this was about 2 weeks prior). ...

2018-08-13 · 2 min · 338 words · ayumax

Outputting PowerPoint Files (*.pptx) Using OpenXML SDK in C#

Introduction This article is a continuation of Parsing Markdown and Performing Custom Output in C# (Using markdig). The tool mentioned in the above article, which converts Markdown to PPTX, creates PPTX files using the OpenXML SDK. I initially struggled greatly with using this OpenXML SDK, so this article will focus on that part. The tool that converts Markdown to PPTX is available on GitHub. GitHub: ayumax/MDToPPTX What is OpenXML? It’s a file format used since Office 2007, consisting of XML files bundled into a zip archive. Therefore, by changing the file extension to .zip and then unzipping it, you can view the XML files inside. Unlike the previous binary format, it allows creation even in environments where Office is not installed. Development Environment Here’s the setup: Windows 10 Visual Studio 2017 C# .NET Standard 2.0 Class library About OpenXML SDK I referred to the following official website for the OpenXML description method: https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk However, understanding it solely from the explanations on the above site likely takes considerable time. Therefore, if you plan to use the OpenXML SDK from now on, I recommend the following method. Open XML SDK Productivity Tool https://www.microsoft.com/en-us/download/details.aspx?id=30425 Using this tool, you can inspect the internal structure of a specified OpenXML format file (like xlsx or pptx). What’s also helpful for tool creation is the feature that displays the necessary C# code to create the loaded file in the right-hand pane. So, by creating a file with the content you want to implement, loading it, and examining the C# code, the possibility of creating something functional, even without 100% understanding, increases significantly. I used this to find the code I needed by looking at small differences. Example: How to find out how to make text bold Place only one text element in a newly created pptx file and check the C# code. Copy the above pptx file, make the text part Bold, and check the C# code. Compare 1. and 2. Explanation of PowerPoint’s OpenXML Class Structure Basically, using the method described above with the Open XML SDK Productivity Tool allows you to create the functionality you want, so the discussion could end here. However, I will write down the class structure I investigated below, partly as a personal memo. The class structure of OpenXML files is quite large, so I’m focusing only on the important parts. Overall Structure First, the overall structure. To create a PPTX, you’ll mostly interact with SlidePart and SlideMasterPart at the bottom of the diagram. The division of responsibilities is roughly: SlideMasterPart for overall slide settings (like slide size), and SlidePart for individual slides. ThemePart is manipulated when changing the visual design. Although not shown in the diagram, if you use slide layouts, you’ll also touch SlideLayout. (The feature I created uses the Blank style sheet for all slides except the first title sheet, so I haven’t touched slide layouts.) Slide Next is the slide. Since it corresponds to a single slide in PowerPoint, the number of SlidePart class instances equals the number of pages. The diagram above extracts only the classes that become important when implementing the following features: ...

2018-08-08 · 6 min · 1156 words · ayumax

Parsing Markdown and Performing Custom Output in C# (Using markdig)

Introduction I recently created a tool to convert Markdown files into PowerPoint format (*.pptx). I’ll summarize the technical notes from that process here. This article focuses on Markdown parsing. The created tool is available on GitHub. https://github.com/ayumax/MDToPPTX Also, for the article about the pptx creation tool itself, please refer to this article. Development Environment Considering future integration into a tool using Xamarin, I created the project as a .NET Standard 2.0 C# library. The overall environment is as follows: Windows 10 Visual Studio 2017 C# .NET Standard 2.0 Class library How to Parse Markdown Initially, I considered parsing it myself using regular expressions or something similar. However, the Markdown format has surprisingly many variations, so I searched for a convenient library and found the following. markdig GitHub: lunet-io/markdig This library is available on GitHub under the BSD-Clause 2 license and can be obtained via NuGet. If you just want to convert Markdown to HTML, you can use it as is. It’s also designed so that you can create your own output part for formats other than HTML. Standard Usage of markdig To convert Markdown to HTML, only the following description is needed (excerpt from GitHub’s README.md): var result = Markdown.ToHtml("This is a text with some *emphasis*"); Console.WriteLine(result); // prints: <p>This is a text with some <em>emphasis</em></p> Using markdig as a Parser My goal this time was to parse Markdown and output a PowerPoint file, so I investigated whether I could use only markdig’s parser functionality and create custom output. How markdig’s Processing Works To find out how to perform custom output using markdig, I examined how the preset HtmlRenderer is implemented. The diagram below simplifies this. Tracing the inheritance of HtmlRenderer leads to RendererBase, which defines the Render() method used during conversion and the ObjectRenderers property for handling Markdown blocks and inlines. ...

2018-08-07 · 5 min · 995 words · ayumax

Created a Tool to Convert Markdown to PowerPoint Files

MDToPPTX The beta version of MDToPPTX, a tool I’ve been creating to convert Markdown files to PowerPoint files (*.pptx), is now ready. It’s written in C#, and the library part is built with .NET Standard 2.0. So, although I haven’t tested it, it should also work with .NET Core and Xamarin. GitHub: ayuma0913/MDToPPTX Using this, you can create PowerPoint files from Markdown. markdig For Markdown parsing, I used markdig. Thanks to this, writing the code was very easy. ...

2018-06-06 · 3 min · 480 words · ayumax

PPTX Creation Feature: Image Insertion and Bullet Points

Issues from the Previous Version In the previous article (http://ayumax.hatenablog.com/entry/2018/05/06/231645), there were the following issues: Cannot freely change the position of text No image insertion feature All text becomes bullet points So, this time I addressed these issues. GitHub: ayuma0913/MDToPPTX Text Position Setting Created a new PPTXTextArea class, allowing Position(x,y) and Size(width, height) to be set. In the PowerPoint world, settings seem to be in cm, so I made it possible to input values in cm (internal conversion is performed). ...

2018-05-13 · 2 min · 352 words · ayumax