My real aim is to DateTime.Parse a date string from Shell32 GetDetailsOf Extended date field. While furthering my debuging, I simply created a string that appears the same and DateTime is able to parse it. When I view the 2 strings in Memory, they appear different.
The first few Bytes only.....
s > 4c 22 2e 63 16 00 00 00 0e 20 39 00 2f 00 0e 20 35 00 2f
q > 4c 22 2e 63 11 00 00 00 39 00 2f 00 35 00 2f 00 32 00 30
Is there a way to format the string so that I am able to parse it with DateTime.Parse?
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder objFolder;
objFolder = shell.NameSpace(folder);
int i = 0;
foreach (Shell32.FolderItem2 item in objFolder.Items())
{
if (item.Type == "Windows Recorded TV Show")
{
mediaArray[i, 0] = objFolder.GetDetailsOf(item, 21); // serName
mediaArray[i, 1] = objFolder.GetDetailsOf(item, 254); // epName
mediaArray[i, 2] = objFolder.GetDetailsOf(item, 259); // desc
mediaArray[i, 3] = objFolder.GetDetailsOf(item, 258); // broad Date
DateTime dateValue;
CultureInfo culture;
DateTimeStyles styles;
styles = DateTimeStyles.AssumeLocal;
culture = CultureInfo.CreateSpecificCulture("en-US");
string s = mediaArray[i, 3].Normalize(); // Guessing this string isn't ASCII?
string q = "9/5/2014 12:00 AM";
if (s == q) { MessageBox.Show("They are the same."); } // Never Entered. ):
MessageBox.Show(s+"\n"+q); // They appear exactly the same!
dateValue = DateTime.Parse(q, culture, styles); // parses correctly
dateValue = DateTime.Parse(s, culture, styles); // fails at runtime
i++;
}
}