Coding

All things computer programming related...

Count top-level subdirectories

- Posted in Coding by

C# get number of top-level subdirectories in a directory.

Here's a brief program that demonstrates counting the number of top-level subdirectories that reside within a given directory:

https://gist.github.com/kyrathasoft/1dc1a1eb4d6a2a56827dcb5f43840afe

Compress to archive using c-sharp

- Posted in Coding by

I've hosted the source code on GitHub demonstrating using .NET to compress a folder and its contents into a single .zip archive. It also demonstrates decompressing such an archive into its component directory, subdirectories, and files.

To compile, you'll need response file resp.rsp in the same directory as simpleCompExt.cs. The contents of that response file should be:

/r:System.IO.Compression.dll
/r:System.IO.Compression.FileSystem.dll
/out:simple.exe
simpleCompExt.cs

To compile from the command line, execute the following from the source code directory:

csc @resp.rsp

If you want to experiment with this, be sure to add a few small files to the /start subdirectory (so that there's something to compress and extract).

Copy one directory to another

- Posted in Coding by

Introducing the CopyTo method, which faithfully copies one directory's contents to another directory. The method listing is on Github here.

And here is a sample program demonstrating its usage.

Moving a form programmatically using C#

- Posted in Coding by

Shows how we can access Form1's default TextBox (textBox1) from within another class, by passing into that other class's constructor a refence to Form1. We create public properties for the form's 'textBox1' TextBox, because the textbox is private to Form1 (see the declaration in Form1Designer.cs, which looks like this):

private System.Windows.Forms.TextBox textBox1;

By passing a reference to Form1 into the other class's constructor, and then utilizing the properties we created, we can alter Form1's textbox's .Width and .Text properties from another class:

Properly capitalize proper nouns with c-sharp

- Posted in Coding by

C# properly capitalize proper nouns

Here is a method that, if passed a proper noun, such as a person's name or a street address, will return a properly formatted version of that string.

Twine and Glaive Seeker

- Posted in Coding by

I'd estimate I'm probably halfway through the development of Glaive Seeker, a play-in-your-browser game I'm authoring with Squiffy for the player in my Earth Apotheosis game on r.rpol.net.

I've not been impressed with the robustness with which Squiffy handles variables. Twine seems more robust in that regard. In fairness, though, I just wrote a very brief example source file, and variable incrementing worked as expected. So perhaps I have syntax errors in the game I'm writing. I'm not experienced using Squiffy, after all.

I'm thinking that Twine is a more mature tool, certainly in terms of its age. However, in doing some reading about the new v3.01 Harlowe story format, it seems far more complicated than what I want to fool with or need. At the time of this writing, I'm thinking future games or tutorials might best be fit by the SugarCube2 format for Twine.

Incidentally, the nodes screenshot above was taken from a layout created using Twine. That's right, I'm using Twine to help visualize the flow of my Squiffy story.

I shared the above screenshot with my player on 9/16/2019 (note that this assertion conflicts with the date shown above this post's title; that's because Flatpress uses UTC time) in msg 120 of a private message thread and will be interested in the player's reaction.

Brothers getting in some chair time

- Posted in Coding by

One of my favorite pictures of my brother and myself together. This would have been late 1970s or so.

Page 11 of 11