Date String to TimeSpan and Xml Save Settings File
$30-80 USD
W trakcie realizacji
Opublikowano ponad 15 lat temu
$30-80 USD
Płatne przy odbiorze
Part I:
I need a Regex function that can read a string from a form field and convert it to a TimeSpan object in C#. The function must be able to convert multiple input including decimals and add them to one value.
Examples:
1. Duration: 2.25 hours converted to new TimeSpan(2, 15, 0)
2. Duration: 1 d 3.2 hrs converted to new TimeSpan(1, 3, 12, 0)
3. Duration: 4 days 15 mins converted to new TimeSpan(4, 0, 15, 0)
It must be able to read the values for wholes words as well as common abbreviations for days, hours, and minutes. It must ask for a corrected input via MessageBox if the value is unrecognizable.
Part II:
I need to be able to save certain values to an xml file for certain settings that I would like to be able to read either onClick event or when I load my form. The file should be saved to the same location that my form is. The exact names of what I need to save is unclear for now so I basically just need the function to have maybe three sample values that I can save when and read when I need to. The file will be used to save whatever settings that I need for the form to remember when the application is restarted. I should be able to add other values to the form with ease. Also if there is a better way to save settings for an application, I'm open to suggestions.