DEIFR/DEIFR/Program.cs
2015-01-10 21:59:14 +00:00

51 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DEIFR
{
static class Program
{
public static bool KeepImages;
public static int MaxImages;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (File.Exists("DEIFRSettings.ini"))
{
string[] ss = File.ReadAllLines("DEIFRSettings.ini");
foreach (var s in ss)
{
string[] x = s.Split('=');
switch (x[0])
{
case "keepimages":
KeepImages = bool.Parse(x[1]);
break;
case "maximages":
MaxImages = int.Parse(x[1]);
break;
}
}
}
ImageDownloader.Update();
if (args.Length == 0)
Application.Run(new Form1());
else if (args[0] != "silent")
Console.WriteLine("Error: Unknown parameter(s). Use \"silent\" to open in background, otherwise don't give any parameters to show settings.");
List<string> sw = new List<string>();
sw.Add("maximages=" + MaxImages);
sw.Add("keepimages=" + KeepImages);
File.WriteAllLines("DEIFRSettings.ini", sw);
}
}
}