Beispiel #1
0
 /// --------------------------------------------------------------------
 /// <summary>This will return the type of logger based on logType</summary>
 /// --------------------------------------------------------------------
 public static ILogger GetLogger(LogTypes logType)
 {
     return GetLogger(logType.ToString());
 }
        /// <summary>
        /// returns temporary filename without extension for given logType
        /// </summary>
        private static string GetLogFileNameWithoutExtension(LogTypes logType)
        {
            string fileName = null;

            switch (logType)
            {
                case LogTypes.OverallResults: fileName = constOverallResultsFileName; break;
                case LogTypes.AllResults: fileName = constAllResultsFileName; break;
                case LogTypes.FullDetailResults: fileName = constFullDetailResultsFileName; break;
                case LogTypes.TestLog: fileName = constTestLogTemplateFileName; break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            return GetTempFilesPrefix() + "." + fileName;
        }
        /// <summary>
        /// fires event that navigation changed
        /// </summary>
        protected virtual void OnNavigationChanged(Uri url)
        {
            string urlFileName = Path.GetFileNameWithoutExtension(url.LocalPath);

            LogTypes newLogType = this._logType;

            if (urlFileName.StartsWith(GetLogFileNameWithoutExtension(LogTypes.OverallResults)))
                newLogType = LogTypes.OverallResults;
            else if (urlFileName.StartsWith(GetLogFileNameWithoutExtension(LogTypes.AllResults)))
                newLogType = LogTypes.AllResults;
            else if (urlFileName.StartsWith(GetLogFileNameWithoutExtension(LogTypes.FullDetailResults)))
                newLogType = LogTypes.FullDetailResults;
            else
            {
                string testLogFileNamePrefix = GetTempFilesPrefix() + ".test";
                if (urlFileName.StartsWith(testLogFileNamePrefix))
                {
                    newLogType = LogTypes.TestLog;
                    this._lastTestId = urlFileName.Substring(testLogFileNamePrefix.Length);
                }
                else if (urlFileName.StartsWith(GetXmlLogFileName()))
                    newLogType = LogTypes.XmlOutput;
            }

            if (newLogType != this._logType)
            {
                this._logType = newLogType;

                if (this.NavigationChanged != null)
                    this.NavigationChanged(this, new NavigationChangedEventArgs(newLogType));
            }
        }
 /// <summary>
 /// returns temporary file path without extension for given logType
 /// </summary>
 private static string GetLogFilePathWithoutExtension(LogTypes logType)
 {
     return Path.GetTempPath() + GetLogFileNameWithoutExtension(logType);
 }
 /// <summary>
 /// returns template file name for given type
 /// </summary>
 private static string GetTemplateFileName(LogTypes logType)
 {
     return GetLogFileNameWithoutExtension(logType) + ".xslt";
 }
 /// <summary>
 /// return path to a log file
 /// </summary>
 private static string GetLogFilePath(LogTypes logType)
 {
     return GetLogFilePathWithoutExtension(logType) + ".xml";
 }
        private string GetLogTypeFilePath()
        {
            if (!this._logFilesGenerated)
            {
                EmitTemplates();

                foreach (LogTypes logType in Enum.GetValues(typeof(LogTypes)))
                {
                    if(logType != LogTypes.XmlOutput && logType != LogTypes.TestLog)
                    {
                        WriteLogFile(GetTemplateFileName(logType), GetLogFilePath(logType));
                    }
                }
                this._logFilesGenerated = true;
            }

            if (this._logType == LogTypes.TestLog)
            {
                string testLogFileName = GetXmlTestFilePath(this._lastTestId);
                if (File.Exists(testLogFileName))
                    return testLogFileName;

                this._logType = LogTypes.OverallResults;
            }

            return GetLogFilePath(this._logType);
        }
Beispiel #8
0
 /// --------------------------------------------------------------------
 /// <summary>This will return the type of logger based on logType</summary>
 /// --------------------------------------------------------------------
 public static ILogger GetLogger(LogTypes logType)
 {
     return(GetLogger(logType.ToString()));
 }