forked from arkane-systems/mousejiggler
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProgram.cs
70 lines (58 loc) · 2.51 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#region header
// MouseJiggle - Program.cs
//
// Alistair J. R. Young
// Arkane Systems
//
// Copyright Arkane Systems 2012-2013.
//
// Created: 2013-08-24 12:41 PM
#endregion
using System;
using System.Threading;
using System.Windows.Forms;
namespace ArkaneSystems.MouseJiggle
{
internal static class Program
{
public static bool StartJiggling = false;
public static bool StartMinimized = false;
public static bool StartScreenOn = false;
public static int JiggleInterval = 1; // Minutes
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main (string[] args)
{
Mutex instance = new Mutex(false, "single instance: ArkaneSystems.MouseJiggle");
if (instance.WaitOne(0, false))
{
// Check for command-line switches.
for (int i=0; i < args.Length; ++i)
{
string arg = args[i];
if ((System.String.Compare(arg.ToUpperInvariant(), "--JIGGLE", System.StringComparison.Ordinal) == 0) ||
(System.String.Compare(arg.ToUpperInvariant(), "-J", System.StringComparison.Ordinal) == 0))
StartJiggling = true;
if ((System.String.Compare(arg.ToUpperInvariant(), "--SCREEN", System.StringComparison.Ordinal) == 0) ||
(System.String.Compare(arg.ToUpperInvariant(), "-S", System.StringComparison.Ordinal) == 0))
StartScreenOn = true;
if (
(System.String.Compare(arg.ToUpperInvariant(), "--MINIMIZED", System.StringComparison.Ordinal) == 0) ||
(System.String.Compare(arg.ToUpperInvariant(), "-M", System.StringComparison.Ordinal) == 0))
StartMinimized = true;
if (
((System.String.Compare(arg.ToUpperInvariant(), "--INTERVAL", System.StringComparison.Ordinal) == 0) ||
(System.String.Compare(arg.ToUpperInvariant(), "-I", System.StringComparison.Ordinal) == 0)) &&
i+1 < args.Length)
JiggleInterval = int.Parse(args[++i]);
}
Application.EnableVisualStyles ();
Application.SetCompatibleTextRenderingDefault (false);
Application.Run (new MainForm ());
}
instance.Close ();
}
}
}