This is a preview version of Cyotek's blog and may be missing functionality and/or unstable. Please visit https://www.cyotek.com/blog for the current version of the blog.
If you encounter any problems using this preview site, please contact us with the details.

Painting animated images using C#

c# image animate 0 Comments Downloads

While reviewing The C# Top 100 it occurred to me that in my own code base I have many bits of code which may make useful blog posts, and that shouldn't take as long to write as the ones I usually create. Plus, I've a fair amount of source code for extending built in controls in various ways, creating new controls from scratch and other useful library code - I need to explore ways of decoupling some of that and releasing it for a...

Read More

Book Review: The C# Helper Top 100

c# review book 0 Comments

Almost 20 years ago after finishing a training scheme I was hired for my first permanent role. After getting paid for the first time I immediately rushed off to the bookshop to buy myself a programming book. The selection of books in my chosen language of the time (Visual Basic (not .NET!)) wasn't large, but in the end I bought Rod Stephens Custom Controls Library, which still graces my technical bookshelves even now. Since then I've bought many computing books, but I couldn't tell you the ...

Read More

Getting a window rectangle without the drop shadow

c# api win32 0 Comments

In my last article, I describe how to use the Win32 API to capture screenshots of the desktop. There was one frustrating problem with this however - when capturing an image based on the value of the Bounds property of a Form unexpected values were returned for the left position, width and height of the window, causing my screenshots to be too big.

I thought that was odd but as I wanted to be able to capture unmanaged windows in future then using Form.Bounds wasn't going to be possible anyway and I would have to use GetWindowRect. I'm sure that deep down in the Windows Forms code base it uses the same API so I was expecting to get the same "wrong" results, and I wasn't disappointed.

Read More

Capturing screenshots using C# and p/invoke

c# api win32 screenshot 2 Comments Downloads

I was recently updating some documentation and wanted to programmatically capture some screenshots of the application in different states. This article describes how you can easily capture screenshots in your own applications.

This article makes use of a number of Win32 API methods. Although you may not have much call to use them directly in day to day .NET (not to mention Microsoft wanting everyone to use universal "apps" these days), they are still extraordinarily useful and powerful.

Read More

Writing custom Markdig extensions

c# markdig markdown 0 Comments Downloads

Markdig, according to its description, "is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET". While most of our older projects use MarkdownDeep (including an increasingly creaky cyotek.com), current projects use Markdig and thus...

Read More

Announcing MantisSharp, a .NET client for using the MantisBT REST API

c# api rest mantisbt mantissharp 3 Comments

I've released a new open source project named MantisSharp, a simple .NET client for working with the recently introduced REST API for Mantis Bug Tracker.

The library is just getting started and is missing various functions (hello documentation!) but it seems to be usable - as well as the WinForms sample browser that I was using for development testing, I also tested it in an ASP.NET MVC application, both locally and then remotely using the development version of cyotek.com.

Read More

Restoring missing Authorization header when using PHP with Apache

php apache 3 Comments

I was recently looking into using our Mantis Bug Tracker instance to automatically generate product road-maps - now that we are actually starting to properly plan product updates and as keeping them up to date manually isn't really working.

I spent a fair amount of fruitless time sending requests to Mantis via Postman only for every single request to fail with 401 API Token required - despite the fact I'd created a limited access user and generated an API token associated with that.

Read More

Translating text with Azure cognitive services

c# api azure rest translate localization 1 Comments Downloads

Some time ago, I used the Bing Translator API to help create localization for some of our products. As Microsoft recently retired the Data Market used to provide this service it was high time to migrate to the replacement Cognitive Services API hosted on Azure. This article covers using the basics of Azure cognitive services to translate text using simple HTTP requests.

I'm going to assume you've already signed up for the Text Translation Cognitive Services API. If you haven't, you can find a step by step guide on the API documentation site. Just as with the original version, there's a free tier where you can translate 2 million characters per month.

Read More

Using custom type converters with C# and YamlDotNet, part 2

c# convert yaml type 0 Comments Downloads

Recently I discussed using type converters to perform custom serialization of types in YamlDotNet. In this post I'll concentrate on expanding the type converter to support deserialization as well.

I'll be reusing a lot of code and knowledge from the first part of this mini-series, so if you haven't read that yet it is a good place to start.

Read More

Using custom type converters with C# and YamlDotNet, part 1

c# convert yaml type 0 Comments Downloads

One of our internal tools eschews XML or JSON configuration files in favour of something more human readable - YAML using YamlDotNet. For the most part the serialisation and deserialisation of YAML documents in .NET objects is as straight forward as using libraries such as JSON.net ...

Read More