mirror of
https://github.com/chylex/Code-Statistics.git
synced 2025-06-02 06:34:04 +02:00
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using CodeStatistics.Forms;
|
|
using CodeStatistics.Data;
|
|
using CodeStatistics.Input.Methods;
|
|
using CodeStatisticsCore.Input;
|
|
|
|
namespace CodeStatistics{
|
|
static class Program{
|
|
public static ProgramConfiguration Config { get; private set; }
|
|
|
|
[STAThread]
|
|
static void Main(string[] args){
|
|
Application.EnableVisualStyles();
|
|
|
|
#if WINDOWS
|
|
if (IsRunningMono()){
|
|
MessageBox.Show(Lang.Get["ErrorLaunchMonoOnWindowsBuild"],Lang.Get["ErrorLaunchTitle"],MessageBoxButtons.OK,MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
ProgramArguments programArgs = new ProgramArguments(args,ProgramConfiguration.Validate);
|
|
|
|
if (programArgs.HasError){
|
|
MessageBox.Show(programArgs.Error,Lang.Get["ErrorInvalidArgsTitle"],MessageBoxButtons.OK,MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
|
|
Config = new ProgramConfiguration(programArgs);
|
|
Start();
|
|
|
|
IOUtils.CleanupTemporaryDirectory();
|
|
}
|
|
|
|
private static void Start(){
|
|
IInputMethod immediateInput = Config.GetImmediateInputMethod();
|
|
|
|
if (immediateInput != null){
|
|
new ProjectLoadForm(immediateInput).ShowDialog();
|
|
return;
|
|
}
|
|
|
|
while(true){
|
|
MainForm form = new MainForm();
|
|
|
|
if (form.ShowDialog() == DialogResult.OK){
|
|
DialogResult result = new ProjectLoadForm(form.InputMethod).ShowDialog();
|
|
if (result == DialogResult.Abort)return;
|
|
}
|
|
else return;
|
|
}
|
|
}
|
|
|
|
public static bool IsRunningMono(){
|
|
return Type.GetType("Mono.Runtime") != null;
|
|
}
|
|
}
|
|
}
|