Click here to Skip to main content
15,903,540 members
Home / Discussions / C#
   

C#

 
QuestionGlobal Hotkeys? Pin
Linus Agren24-Feb-15 4:57
Linus Agren24-Feb-15 4:57 
SuggestionRe: Global Hotkeys? Pin
Richard MacCutchan24-Feb-15 5:41
mveRichard MacCutchan24-Feb-15 5:41 
GeneralRe: Global Hotkeys? Pin
Linus Agren24-Feb-15 5:56
Linus Agren24-Feb-15 5:56 
AnswerRe: Global Hotkeys? Pin
Eddy Vluggen24-Feb-15 7:19
professionalEddy Vluggen24-Feb-15 7:19 
QuestionRe: Global Hotkeys? Pin
Linus Agren24-Feb-15 16:59
Linus Agren24-Feb-15 16:59 
AnswerRe: Global Hotkeys? Pin
Eddy Vluggen25-Feb-15 0:30
professionalEddy Vluggen25-Feb-15 0:30 
AnswerRe: Global Hotkeys? Pin
BillWoodruff24-Feb-15 19:51
professionalBillWoodruff24-Feb-15 19:51 
QuestionDateTime ToString [confused] Pin
V.24-Feb-15 2:19
professionalV.24-Feb-15 2:19 
This morning one of the users showed me an error (in an application I didn't write, but did modify) where a generated (file)path resulted in yyyy-MM instead of yyyy/MM. The error was of course that the file could not be found.

We solved it (or worked around it) by changing his regional settings. So I went back to the code where the log of the erroneous path was generated and found this:

C#
string serverpath = Utilities.Settings.Setting["drawingpath"] + "/" +
                                  /*D.DateTime.Year + "/" +
                                  D.DateTime.Month.ToString("00") + "/" +*/
									D.DateTime.ToString("yyyy/MM") + "/" +
                                  D.Prefix +
                                  D.DateTime.ToString("yyyyMMddHHmm") + ".jpg";
                    string localpath = Utilities.Settings.Setting["drawingtemppath"] + "/" +
                                  /*D.DateTime.Year + "/" +
                                  D.DateTime.Month.ToString("00") + "/" +*/
									D.DateTime.ToString("yyyy/MM") + "/" +
                                  D.Prefix +
                                  D.DateTime.ToString("yyyyMMddHHmm") + ".jpg";

                    System.IO.Directory.CreateDirectory(Utilities.Settings.Setting["drawingtemppath"] + "/" + D.DateTime.ToString("yyyy/MM"));
					try{
						System.IO.File.Copy(serverpath, localpath, true);
					}
					catch(Exception ex){
						string msg = "DSGUI_BulkAnalyze().goByStats(): Error:["+ex.Message+"]";
						Utilities.Logger.WriteLog(Utilities.Logger.TYPE.ERROR, Utilities.Logger.ACTION.SYSTEM, Utilities.Logger.SEVERITY.HIGH, msg);
					}
                }


The error is thrown by the serverpath variable, but I'm confused how it generates yyyy-MM instead of yyyy/MM and how the regional settings of the machine are involved.

Anyone any idea?
I know it is the serverpath variable because of the "C:\archdrawings_dev" part of the path.

Here's an example of one of the logs:
DSGUI_BulkAnalyze().goByStats(): Error:[Could not find a part of the path 'C:\archdrawings_dev/2011-04/usd201104270615.jpg'.]


thanks.
V.

(MQOTD rules and previous solutions)

AnswerRe: DateTime ToString [confused] Pin
GuyThiebaut24-Feb-15 2:43
professionalGuyThiebaut24-Feb-15 2:43 
AnswerRe: DateTime ToString [confused] PinPopular
OriginalGriff24-Feb-15 2:43
mveOriginalGriff24-Feb-15 2:43 
GeneralRe: DateTime ToString [confused] Pin
V.24-Feb-15 2:51
professionalV.24-Feb-15 2:51 
GeneralRe: DateTime ToString [confused] Pin
Rob Philpott24-Feb-15 2:57
Rob Philpott24-Feb-15 2:57 
AnswerRe: DateTime ToString [confused] Pin
F-ES Sitecore24-Feb-15 3:33
professionalF-ES Sitecore24-Feb-15 3:33 
AnswerRe: DateTime ToString [confused] Pin
Daniel Pfeffer25-Feb-15 2:54
professionalDaniel Pfeffer25-Feb-15 2:54 
QuestionIterate through data table Pin
dattagunturu24-Feb-15 1:39
dattagunturu24-Feb-15 1:39 
AnswerRe: Iterate through data table Pin
manchanx24-Feb-15 2:00
professionalmanchanx24-Feb-15 2:00 
AnswerRe: Iterate through data table Pin
Pete O'Hanlon24-Feb-15 2:03
mvePete O'Hanlon24-Feb-15 2:03 
Questionbest pattern queue Pin
vahidbakhtiary23-Feb-15 21:29
vahidbakhtiary23-Feb-15 21:29 
AnswerRe: best pattern queue Pin
OriginalGriff23-Feb-15 21:40
mveOriginalGriff23-Feb-15 21:40 
AnswerRe: best pattern queue Pin
Pete O'Hanlon23-Feb-15 21:45
mvePete O'Hanlon23-Feb-15 21:45 
AnswerRe: best pattern queue Pin
vahidbakhtiary23-Feb-15 23:07
vahidbakhtiary23-Feb-15 23:07 
GeneralRe: best pattern queue Pin
OriginalGriff23-Feb-15 23:42
mveOriginalGriff23-Feb-15 23:42 
GeneralRe: best pattern queue Pin
vahidbakhtiary24-Feb-15 0:02
vahidbakhtiary24-Feb-15 0:02 
GeneralRe: best pattern queue Pin
OriginalGriff24-Feb-15 0:17
mveOriginalGriff24-Feb-15 0:17 
GeneralRe: best pattern queue Pin
Pete O'Hanlon24-Feb-15 0:30
mvePete O'Hanlon24-Feb-15 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.