AppMetrics.Const.FormatFilePath C# (CSharp) Method

FormatFilePath() public static method

public static FormatFilePath ( string dataRootPath, string sessionId, System.DateTime time ) : string
dataRootPath string
sessionId string
time System.DateTime
return string
        public static string FormatFilePath(string dataRootPath, string sessionId, DateTime time)
        {
            var timeText = time.ToString("yyyy-MM-dd HH_mm_ss");
            var filePath = Path.GetFullPath(string.Format("{0}\\{1}.{2}.txt", dataRootPath, timeText, sessionId));
            if (!filePath.StartsWith(dataRootPath)) // block malicious session ids
                throw new ArgumentException(filePath);
            return filePath;
        }