Open Source Adventure - Tinyinfo

Open Source Adventure - Tinyinfo

Project's 2nd Fork

Introduction

Tinyinfo is a small C# Project I found on https://goodfirstissues.com/. I haven't actively contributed to Open Source projects before and thought this would be an easy introductory step into this world.

Project

Tinyinfo is described as a Lightweight System Info tool for Windows and has a README containing a single screenshot of the interface and a single line of text: Lightweight System Info tool for Windows written in C# using .NET Framework 4.7.2. It was developed by Lion-Craft and put onto GitHub in early October 2023. It's written entirely in C# and is comprised of just three files: Programs.cs, and two Forms - SettingsWindow.cs and MainWindow.cs.

I fork and cloned the project, booted it up in VS Studio and had the program running immediately which was a pleasant surprise. I think I'm too use to the monoliths I work on in my job that require a week's worth of effort to boot up locally that I wasn't prepared for 0 troubleshooting to get working. (Note: I did read through the code to make sure it wasn't going to explode my computer first).

Contributions

When I found the project it had 5 open issues with 3 of them being actively worked on by the main developer based on the list of branches. Only one of the remaining issues was code related so I decided to go ahead and tackle this one. It was a pretty simple Feature request - "Allow exporting system specs to a text file". After a bit of reading into the code I found that the program was just one big textbox that all the system information was dumped into so all that had to be done was to write to a text file containing the value of that textbox. Here's the main function to achieve this:

// Export system info to text file
private void exportItem_Click(object sender, EventArgs e)
{
    // Create a SaveFileDialog to choose the destination file
    SaveFileDialog saveFileDialog = new SaveFileDialog();
    saveFileDialog.Filter = "Text Files|*.txt";

    if (saveFileDialog.ShowDialog() != DialogResult.OK) return;

    var filePath = saveFileDialog.FileName;

    // Open a StreamWriter to write to the selected file
    using (var writer = new StreamWriter(filePath))
    {
        var outputBoxValue = outputBox.Text;
        writer.WriteLine(outputBoxValue);

    }
}

This is invoked when the new dropdown menu item I added is clicked. And that's all there was to it. I created the PR and added the link to the issue. Then, about 8 hours later, the PR was reviewed and merged on to main.

Conclusion

I wanted this to be a quick and easy task so I could try contributing to an open-source project for the first time. In retrospect, I could/should probably have put more effort into the solution, such as including Unit Testing or some form of logging. My thoughts at the time were that as the project was made up of a single contributor I didn't want to go and add too much extra beyond what the requirement was for the Issue. However, even something as simple as adding a check for if the textbox is empty before copying it across may have been a valuable addition.

In saying all that, the creator was happy enough with the changes and Merged them onto main without any additional comments. I wish all contributions could be so easy :)