This repository has been archived by the owner on Oct 16, 2020. It is now read-only.
/
SplashScreen.cs
107 lines (94 loc) · 2.66 KB
/
SplashScreen.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop
{
public class SplashScreenForm : Form
{
static SplashScreenForm splashScreen;
static List<string> requestedFileList = new List<string>();
static List<string> parameterList = new List<string>();
Bitmap bitmap;
public static SplashScreenForm SplashScreen {
get {
return splashScreen;
}
set {
splashScreen = value;
}
}
public SplashScreenForm()
{
const string versionText = "SharpDevelop"
+ " " + RevisionClass.FullVersion
#if DEBUG
+ " (debug)"
#endif
;
FormBorderStyle = FormBorderStyle.None;
StartPosition = FormStartPosition.CenterScreen;
ShowInTaskbar = false;
// Stream must be kept open for the lifetime of the bitmap
bitmap = new Bitmap(typeof(SplashScreenForm).Assembly.GetManifestResourceStream("Resources.SplashScreen.jpg"));
this.ClientSize = bitmap.Size;
using (Font font = new Font("Sans Serif", 4)) {
using (Graphics g = Graphics.FromImage(bitmap)) {
g.DrawString(versionText, font, Brushes.Black, 166 - 3 * versionText.Length, 142);
}
}
BackgroundImage = bitmap;
}
public static void ShowSplashScreen()
{
splashScreen = new SplashScreenForm();
splashScreen.Show();
}
protected override void Dispose(bool disposing)
{
if (disposing) {
if (bitmap != null) {
bitmap.Dispose();
bitmap = null;
}
}
base.Dispose(disposing);
}
public static string[] GetParameterList()
{
return parameterList.ToArray();
}
public static string[] GetRequestedFileList()
{
return requestedFileList.ToArray();
}
public static void SetCommandLineArgs(string[] args)
{
requestedFileList.Clear();
parameterList.Clear();
foreach (string arg in args) {
if (arg.Length == 0) continue;
if (arg[0] == '-' || arg[0] == '/') {
int markerLength = 1;
if (arg.Length >= 2 && arg[0] == '-' && arg[1] == '-') {
markerLength = 2;
}
string param = arg.Substring(markerLength);
// work around .NET "feature" that causes trouble with /addindir:"c:\temp\"
// http://www.mobzystems.com/code/bugingetcommandlineargs.aspx
if (param.EndsWith("\"", StringComparison.Ordinal))
param = param.Substring(0, param.Length - 1) + "\\";
parameterList.Add(param);
} else {
requestedFileList.Add(arg);
}
}
}
}
}