Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 29, 2016, 05:11:12 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: I'm posting a small utility class I wrote for files, in C#  (Read 2335 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
I'm posting a small utility class I wrote for files, in C#
« on: June 01, 2014, 03:59:04 PM »
The attached zip file can be extracted and then the project can be run with Visual Studio (Express or higher editions).
The text file just lists the method signature for the six methods of the static class, and comments them.
As demonstrated in the project, use a "using" statement to reference my namespace.

Demonstrates:
(1) converting file size (number of bytes) to string description, e.g., "7.405 Kb"
(2) reading a file into an array of type byte
(3) writing string data to a filepath
(4) returning number of files in given directory matching a given pattern
(5) returning total size of those pattern-matched files, in bytes
(6) obtaining the directory of the currently executing assembly for a C# console application

See this link: http://www.donationcoder.com/forum/index.php?topic=38081
« Last Edit: June 02, 2014, 07:01:17 AM by kyrathaba »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Re: I'm posting a small utility class I wrote for files, in C#
« Reply #1 on: June 01, 2014, 04:03:35 PM »
^ Fixed a couple typos in my previous post.

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Re: I'm posting a small utility class I wrote for files, in C#
« Reply #2 on: June 01, 2014, 04:53:29 PM »
I'm posting a slightly modified version of the project that adds a demonstration of creating a nested subdirectory and writing a file to it. This version does everything the project in the OP does, plus this extra functionality. See attachment.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 7,650
    • View Profile
    • The Blog of Deozaan
    • Read more about this member.
    • Donate to Member
Re: I'm posting a small utility class I wrote for files, in C#
« Reply #3 on: June 02, 2014, 02:46:59 AM »
Wouldn't it be easier to manage and update if you just posted a link to a gist?


kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member
Re: I'm posting a small utility class I wrote for files, in C#
« Reply #4 on: June 02, 2014, 06:24:51 AM »
Good idea. I'll look into it.

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,120
    • View Profile
    • Donate to Member