Files
Samuele E. Locatelli 0f84613d8d Fix show log
2019-12-13 09:13:03 +01:00

72 lines
1.6 KiB
C#

using SteamWare;
using System;
using System.IO;
using System.Linq;
namespace WebLCP
{
public partial class showLog : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string outputLog
{
get
{
int lastRows = 10;
string outValue = "";
string origFile = memLayer.ML.QSS("orig");
outValue += "<b>------------ START LOG ------------</b><br/>";
if (origFile != "")
{
// leggo file, mostro SOLO ultime 5 righe...
string fullPath = Server.MapPath(origFile);
try
{
string[] origLines = File.ReadAllLines(fullPath);
// prendo ultime 5...
long numLines = origLines.LongCount();
if (numLines > lastRows)
{
for (int i = 0; i < lastRows; i++)
{
outValue += $"{origLines[numLines - lastRows + i]}<br/>";
}
}
else
{
foreach (var item in origLines)
{
outValue += $"{item}<br/>";
}
}
}
catch
{
outValue += $"File not found<br/>";
}
}
outValue += "<b>------------ END LOG ------------</b><br/>";
return outValue;
}
}
public string errorDescr
{
get
{
string answ = "ND";
try
{
answ = memLayer.ML.QSS("errorType");
}
catch
{ }
return answ;
}
}
}
}