Example #1
0
        private void OutputToFile(IList <Log> logdata, string filepath)
        {
            var csv    = new CsvTable();
            var header = new List <string>();

            header.Add("LineId");
            header = header.Concat(this.LogFormatHeader).ToList();
            header.Remove("Content");
            header.Add("Content");
            header.Add("EventId");
            header.Add("EventTemplate");
            header.Add("ParameterList");
            csv.AppendLine(header);

            foreach (var log in logdata)
            {
                var line     = new List <object>();
                var template = this.Model.Lookup(log.LogId);
                //template.ApplyToLogData(log);

                line.Add(log.LogId);
                line = line.Concat(log.FormatLog.Where(x => x.Key != "Content").Select(x => "\"" + x.Value + "\"").ToArray()).ToList();
                line.Add("\"" + log.FormatLog["Content"].Replace("\"", "\'") + "\"");
                line.Add(template.TemplateId);
                line.Add("\"" + template.ToString().Replace("\"", "\'") + "\"");
                line.Add("\"" + string.Join(",", template.Match(log)).Replace("\"", "\'") + "\"");
                csv.AppendLine(line);
            }

            csv.SaveFile(filepath);
        }
Example #2
0
    void OnGUI()
    {
        if (GUILayout.Button("TestCSV"))
        {
            LogUtil.Log(System.DateTime.Now.Millisecond);
            CsvTable table = CsvTable.FromFile(GlobalConfig.GAME_DATA_PATH + "/Instance.csv");
            LogUtil.Log(System.DateTime.Now.Millisecond);
            int index = table.GetColumnIndex("ID");
            LogUtil.LogWarning("index", index);

            CsvTable.SaveFile(table, GlobalConfig.GAME_DATA_PATH + "/Instances.csv");
        }
    }