Repository navigation
Extras
Egbert Scherman edited this page Feb 10, 2023
·
7 revisions
Any Single Function Operators.
- 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.
ExFun.LoadFile(filePathOnClientPC, filePathInProject, toOverwriteClientFile);- Copies A Directory (Folder) And Its Content To A New Location.
ExFun.CopyDir(sourceDirPath, destDirPath, toCopySubDir);- It Will Check If Your Program Is Connected To A Service Or The Internet In General.
ExFun.ConnectionChecker(failAfterATime, connectionURL);- Converts A List To ObservableCollection
ExFun.ListToObservableCollection(list);
ExFun.ListToObservableCollection(list, ref observableCollection);- Gets The Index Of A Element In A Dictionary Based On Its Key Or Value
ExFun.IndexOfDictionary(dictionary, key);
ExFun.IndexOfDictionary(dictionary, value);- Converts A DateTime Or Integer To The Name Of The Week.
ExFun.ToWeek(week, longString);
//Ex. "Fry" : (Long = true) "Fryday"- Converts A DateTime OR Integer To The Name Of The Month.
ExFun.ToMonth(week, longString);Ex. "Feb" : (Long = true) "February"
//Ex. "Feb" : (Long = true) "February"- Clears The Current Line In The Console.
- Only Used In A Console App.
ExFun.ClearCurrentConsoleLine();Any Single Mathematical Functions Operators
- Used To Round A Decimal / Double To Any Floating Point.
- More Reliable Than
Math.Round().
ExMath.Round(valueToRound, pointToRoundTo);- Used To Maintain A Settings File For Your Program.
- Useful If Your Project Does Not Have One Built In.
// 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();- Helps Manage Logging If You Want To Log Errors In The Project.
// Create A New Instance
var log = ExLog(fileName, directoryToStoreTheLogFile, extensionType);
// Log Something
log.Log(theMessageToLog);
// Read The Log File
ExLog.ReadLog(fullPathOfLogFile);- A Small Object To House Console Commands
// Create A New Instance
var cmds = new ExCMD(commandName, whatItDoes, userFrendlyHelpText);- Create Custom WPF / XAML Commands
- It's Wildly Used And Very Useful With XAML.
// 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- A List Of Routable Commands For WPF.
<Window.CommandBindings>
<CommandBinding Command="ExCom.Exit"/>
<CommandBinding Command="ExCom.Refresh"/>
</Window.CommandBindings>