All the c# source code of the last few articles, and then some…

I guess it will never really be ready to share, so here it is… as is.

My old share that you’ll find links to in older posts, was shared on OneDrive. This is on Google drive. You’ll find two zip files in the shared directory. I’ll keep these updated until I put this in a shared repo.

  1. RomyView.zip contains the full source code.
  2. RomyView Release.zip contains the built binaries.

The name of the app is just a shortened version of my first name with “view” slapped onto it.

The reason it’s so large is that it includes all the code it references, and two static builds of ffmpeg.exe. If you use the video conversion part of the application, it then uses either the 32 bit or 64 bit executable depending on your machine.

The solution expects Visual Studio 2019, and .NET Framework version 4.8. I had to download 4.8 manually, because on my Windows 10 machines, the latest was 4.7.2. If everything is set up correctly on your machine, you should be able to run BuildAndBackup.cmd in the extracted directory, and that should then build the release, then create the two zip files that you downloaded as well as create a backup directory, where it puts the existing zip files. And obviously the solution should open and build with no issues in Visual Studio 2019.

The application itself launches with a splash screen that fades from completely opaque to invisible, before the browser form is shown. It supports being opened with a directory name parameter and only allows one instance. If you try to open it again, it will pass the command line on to the original instance. Then, it can open some image formats internally, view most videos (if you install Direct Show codecs like the KLite-Codec Pack), and it can open zip files (without password) internally. It also converts videos using ffmpeg, and in an unfortunate dodgy way, will allow you to do as many video conversions as you want simultaneously, each one showing a separate progress dialog which allows you to pause or resume the process, as well as set the process priority – even to realtime which will bring your machine to a grinding halt. Used unwisely, the application can turn your machine into a toaster.

The video player has some dodgy features, such as automatically persisting 10 playlists, and some repeat modes as well as starting and ending position for videos and slow-motion play… that only a meth-head could have written while tweaking on porn.

The image viewer can do some limited image editing, mostly applying image filters for contrast, hue, saturation, brightness, and so on. Most of the image filter dialogs have an implementation of my own pattern that can apply filters to all files in a directory asynchronously. So you can do crazy shit like, use ffmpeg to extract all frames of a video, then apply the same image filters to all the frames, then re-encode all those frames back to a video. Actually I used to do the last part with a batch file – I never added the option to select separate audio and video streams and join them with my ffmpeg wrapper.

Everything is custom-drawn, even the toolstrip and menustrips. So hovering the mouse over menu items draws a nice gradient-filled rounded rectangle like selected thumbnails.

I did some crazy shit with drawing shadows for all the windows controls. For example, this dialog… Not a very intelligent batch rename dialog, but notice the thumbnail control on the right is the same as that used in the main form, plus all the panels and buttons on this dialog have shadows.

SNAGHTML34ec01fa

Here’s a screenshot that shows the custom-drawn context menu: (Open in new tab to see it properly.)

image

Thumbnails are cached to binary on the filesystem, while thumbnail controls themselves are reused via an object pool.

There’s some good code here, and some… well, dodgy code. Mostly there’s code that I’m proud of and it pisses me off that nobody ever uses it.

Some screenshots of the application…

The main form:

SNAGHTML34d553c3

The zip viewer:

SNAGHTML34d5cc3f

The image viewer, viewing a screenshot of the post that got me banned from Facebook:

SNAGHTML34de3274

The video convertor, having selected a video of my two beautiful children:

SNAGHTML34dcbcad

The video player playing a “Satanic Winnie the Pooh” video

If you don’t find this funny, I feel sorry for you.

image

You don’t wanna know how long I tweaked on the images and custom slider to make this form look alright, back when I was still a meth-head. Here’s the same form when my app is using its dark theme…

The controls shown on this form, all are all custom ToolStripButtons and a slider, with images carefully created by hand in Photoshop. From left to right, they are: play, pause, stop, fast-forward, step back (hidden in half-size mode due to the window size and overflow settings), step forward, next file, and previous file; then play-rate, zoom mode, repeat (folder) mode , time/duration label, volume/mute button, and custom slider.

image

Since the code is now shared, I can write other posts that refer to bits of it and link back here.

Advertisements

About Jerome

I am a senior C# developer in Johannesburg, South Africa. I am also a recovering addict, who spent nearly eight years using methamphetamine. I write on my recovery blog about my lessons learned and sometimes give advice to others who have made similar mistakes, often from my viewpoint as an atheist, and I also write some C# programming articles on my programming blog.
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s