コード例 #1
0
        public static IIS_Log_File convertData(this IIS_Log_File logFile)
        {
            var columns = new List <string>();

            if (logFile.File.fileExists())
            {
                foreach (var line in logFile.File.fileContents().split_onLines())
                {
                    if (line.starts("#"))
                    {
                        logFile.Comments.add(line);
                        if (line.starts("#Fields: "))
                        {
                            columns = line.remove("#Fields: ").split_onSpace();
                            //"there are {0} columns".debug(columns.size());
                        }
                    }
                    else
                    {
                        var logEntry = new IIS_Log_Entry();
                        //logEntry.RawLine = line;
                        var items = line.split_onSpace();
                        for (int i = 0; i < items.size(); i++)
                        {
                            //"item #{0} : {1}".info(columns[i], items[i]);
                            var propertyName = columns[i].upperCaseFirstLetter().replace("-", "_").replace("(", "_").replace(")", "_");
                            logEntry.prop(propertyName, items[i]);
                        }
                        logFile.LogEntries.Add(logEntry);
                    }
                }
            }
            return(logFile);
        }
コード例 #2
0
        public static IIS_Log_File logFile_Convert(this string file)
        {
            var o2Timer = new O2Timer("created IIS_Log_File object from file: {0}".format(file)).start();
            var logFile = new IIS_Log_File();

            logFile.File = file;
            logFile.convertData();
            o2Timer.stop();
            return(logFile);
        }
コード例 #3
0
        public static string saveToFolder(this IIS_Log_File logFile, string targetFolder)
        {
            if (logFile.File.fileExists())
            {
                var targetFile = targetFolder.pathCombine(logFile.File.fileName() + ".xml");
                if (logFile.saveAs(targetFile))
                {
                    return(targetFile);
                }
            }

            return(null);
        }
コード例 #4
0
		public static IIS_Log_File logFile_Convert(this string file)
		{
			var o2Timer = new O2Timer("created IIS_Log_File object from file: {0}".format(file)).start();
			var logFile = new IIS_Log_File();
			logFile.File = file;
			logFile.convertData();
			o2Timer.stop();
			return logFile;
		}