PoE2-MxFilterGen2/MxFilterGen2/Message.cs

220 lines
6.9 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MxFilterGen2
{
internal class Message
{
public static void CM(string msg, bool time, int color)
{
DateTime now;
string str1;
int num;
if (DateTime.Now.Second < 10)
{
now = DateTime.Now;
str1 = string.Format("0{0}", (object)now.Second);
}
else
{
num = DateTime.Now.Second;
str1 = num.ToString();
}
now = DateTime.Now;
string str2;
if (now.Minute < 10)
{
now = DateTime.Now;
str2 = string.Format("0{0}", (object)now.Minute);
}
else
{
now = DateTime.Now;
num = now.Minute;
str2 = num.ToString();
}
now = DateTime.Now;
string str3;
if (now.Hour < 10)
{
now = DateTime.Now;
str3 = string.Format("0{0}", (object)now.Hour);
}
else
{
now = DateTime.Now;
num = now.Hour;
str3 = num.ToString();
}
string str4 = string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1);
ConsoleColor consoleColor = ConsoleColor.White;
switch (color)
{
case 1:
consoleColor = ConsoleColor.Cyan;
break;
case 2:
consoleColor = ConsoleColor.Green;
break;
case 3:
consoleColor = ConsoleColor.Red;
break;
}
if (time)
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format("[{0}] {1}", (object)str4, (object)msg));
}
else
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format("{0}", (object)msg));
}
Console.ForegroundColor = ConsoleColor.White;
}
public static void CMW(string msg, bool time, int color)
{
DateTime now;
string str1;
int num;
if (DateTime.Now.Second < 10)
{
now = DateTime.Now;
str1 = string.Format("0{0}", (object)now.Second);
}
else
{
num = DateTime.Now.Second;
str1 = num.ToString();
}
now = DateTime.Now;
string str2;
if (now.Minute < 10)
{
now = DateTime.Now;
str2 = string.Format("0{0}", (object)now.Minute);
}
else
{
now = DateTime.Now;
num = now.Minute;
str2 = num.ToString();
}
now = DateTime.Now;
string str3;
if (now.Hour < 10)
{
now = DateTime.Now;
str3 = string.Format("0{0}", (object)now.Hour);
}
else
{
now = DateTime.Now;
num = now.Hour;
str3 = num.ToString();
}
string str4 = string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1);
File.AppendAllText("mxfiltergen.logs", string.Format("[{0}] {1}", (object)str4, (object)msg) + Environment.NewLine);
ConsoleColor consoleColor = ConsoleColor.White;
switch (color)
{
case 1:
consoleColor = ConsoleColor.Cyan;
break;
case 2:
consoleColor = ConsoleColor.Green;
break;
case 3:
consoleColor = ConsoleColor.Red;
break;
}
if (time)
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format("[{0}] {1}", (object)str4, (object)msg));
}
else
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format(""));
}
Console.ForegroundColor = ConsoleColor.White;
}
public static void drawProgress(int progress, int total)
{
DateTime now;
string str1;
int num;
if (DateTime.Now.Second < 10)
{
now = DateTime.Now;
str1 = string.Format("0{0}", (object)now.Second);
}
else
{
num = DateTime.Now.Second;
str1 = num.ToString();
}
now = DateTime.Now;
string str2;
if (now.Minute < 10)
{
now = DateTime.Now;
str2 = string.Format("0{0}", (object)now.Minute);
}
else
{
now = DateTime.Now;
num = now.Minute;
str2 = num.ToString();
}
now = DateTime.Now;
string str3;
if (now.Hour < 10)
{
now = DateTime.Now;
str3 = string.Format("0{0}", (object)now.Hour);
}
else
{
now = DateTime.Now;
num = now.Hour;
str3 = num.ToString();
}
string str4 = string.Format("[{0}] [", (object)string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1));
Console.ForegroundColor = ConsoleColor.Cyan;
if (progress == 1)
{
Console.Write(str4);
Console.CursorLeft = total + str4.Length;
Console.Write("]");
}
Console.CursorLeft = progress + str4.Length - 1;
Console.Write("#");
Console.CursorLeft = str4.Length + total + 2;
Console.Write(string.Format("{0}/{1}", (object)progress, (object)total));
if (progress != total)
return;
Console.WriteLine();
}
public static void Splash(string progname, string dev)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("");
Console.WriteLine($"#### {progname}");
Console.WriteLine(string.Format("#### VERSION: {0}", (object)Program.version));
Console.WriteLine($"#### DEV: {dev}");
Console.WriteLine("#### POWERED BY: poe.ninja");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.White;
}
}
}