// // // // // $Revision$ // using System; using System.Collections.Generic; using System.IO; using System.Windows.Forms; using System.Drawing; using System.Reflection; using System.Resources; namespace ICSharpCode.SharpDevelop { public class SplashScreenForm : Form { public const string VersionText = "Serralongue build " + RevisionClass.Revision; static SplashScreenForm splashScreen; static List requestedFileList = new List(); static List parameterList = new List(); Bitmap bitmap; public static SplashScreenForm SplashScreen { get { return splashScreen; } } public SplashScreenForm() { #if !DEBUG TopMost = true; #endif FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.CenterScreen; ShowInTaskbar = false; #if DEBUG string versionText = VersionText + " (debug)"; #else string versionText = VersionText; #endif // 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, 100, 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; } parameterList.Add(arg.Substring(markerLength)); } else { requestedFileList.Add(arg); } } } } }