Skip to content
Egbert Scherman edited this page Feb 10, 2023 · 7 revisions

ExFun

Any Single Function Operators.

Load File

Function

  • It Loads / Copies A File From Your Program Folder To Where You Need It.
  • It Will Create The Output Directory If Does Not Exist.
  • If The File Exists Then Nothing Will Happen Otherwise It Will Copy The File Over.
  • Overwrite Will Overwrite The File If It Exists.

Usage

ExFun.LoadFile(filePathOnClientPC, filePathInProject, toOverwriteClientFile);

Copy Directory

Function

  • Copies A Directory (Folder) And Its Content To A New Location.

Usage

ExFun.CopyDir(sourceDirPath, destDirPath, toCopySubDir);

Connection Checker

Function

  • It Will Check If Your Program Is Connected To A Service Or The Internet In General.

Usage

ExFun.ConnectionChecker(failAfterATime, connectionURL);

List To ObservaleCollection

Function

  • Converts A List To ObservableCollection

Usage

ExFun.ListToObservableCollection(list);
ExFun.ListToObservableCollection(list, ref observableCollection);

Index Of Dictionary

Function

  • Gets The Index Of A Element In A Dictionary Based On Its Key Or Value

Usage

ExFun.IndexOfDictionary(dictionary, key);
ExFun.IndexOfDictionary(dictionary, value);

ToWeek

Function

  • Converts A DateTime Or Integer To The Name Of The Week.

Usage

ExFun.ToWeek(week, longString);
//Ex. "Fry" : (Long = true) "Fryday"

Other Notes

ToMonth

Function

  • Converts A DateTime OR Integer To The Name Of The Month.

Usage

ExFun.ToMonth(week, longString);Ex. "Feb" : (Long = true) "February"
//Ex. "Feb" : (Long = true) "February"

ClearCurrentConsoleLine

Function

  • Clears The Current Line In The Console.
  • Only Used In A Console App.

Usage

ExFun.ClearCurrentConsoleLine();

ExMath

Any Single Mathematical Functions Operators

Round

Function

  • Used To Round A Decimal / Double To Any Floating Point.
  • More Reliable Than Math.Round().

Usage

ExMath.Round(valueToRound, pointToRoundTo);

ExSettings

Object

  • Used To Maintain A Settings File For Your Program.
  • Useful If Your Project Does Not Have One Built In.

Usage

// Create A New Instance
var settings = new ExSettings(directoryToSaveSettingsFile, extensionToUse); // Create A New Settings File If Not Exist
var settings = new ExSettings(fullPathToSettingsFile); // Load In A Existing File;

// Add A New Setting
settings.Add(newSettingName, settingValue);

// Remove A Setting
settings.Remove(settingName);
settings.RemoveAt(settingIndex);

// Set A New Value
settings.SetSetting(settingName, newValue);

// Rename A Setting
setting.Rename(oldSettingName, newSettingName);

// Get All The Settings
settings.GetNames(); // Returns All Setting Names
settings.GetValues(setting Name); // Returns Setting Value
settings.GetSettings(); // Returns All Setting Names + Values
settings.Load(); // Returns All Settings Directly From The Settings File

// Save All Changes
settings.Save();

ExLog

Object

  • Helps Manage Logging If You Want To Log Errors In The Project.

Usage

// Create A New Instance
var log = ExLog(fileName, directoryToStoreTheLogFile, extensionType); 

// Log Something
log.Log(theMessageToLog);

// Read The Log File
ExLog.ReadLog(fullPathOfLogFile);

ExCMD

Object

  • A Small Object To House Console Commands

Usage

// Create A New Instance
var cmds = new ExCMD(commandName, whatItDoes, userFrendlyHelpText);

ExICom

Object

  • Create Custom WPF / XAML Commands
  • It's Wildly Used And Very Useful With XAML.

Usage

// Example Methods
void button_Click(object sender){ // Do Stuff }
bool click_Valid(object sender) { /* Validate Something */ return true; }

ICommand command = new ExIcom(button_Click, click_Valid);

// Connect Command To Component

ExCom

Object

  • A List Of Routable Commands For WPF.

Usage

<Window.CommandBindings>
  <CommandBinding Command="ExCom.Exit"/>
  <CommandBinding Command="ExCom.Refresh"/>
</Window.CommandBindings>

Clone this wiki locally