Check results of Init() calls

Also Part 2 of commits regarding nested benchmarks
This commit is contained in:
Flamefire committed 2014-03-16 18:06:56 +01:00
1 parent 723a76b6be
commit e321b3d657
18 files changed
+245 -137

No files matched your search

+15 -8
View File
@@ -36,19 +36,26 @@ namespace Vocaluxe.Base
_KeysPool = new List<SKeyEvent>();
_MousePool = new List<SMouseEvent>();
_Controller.Add(new CWiiMote());
_Controller.Add(CVocaluxeServer.Controller);
_AddController(new CWiiMote());
_AddController(CVocaluxeServer.Controller);
}
foreach (IController controller in _Controller)
controller.Init();
private static void _AddController(IController controller)
{
if (controller.Init())
_Controller.Add(controller);
}
public static void Close()
{
foreach (IController controller in _Controller)
controller.Close();
_Controller = new List<IController>();
if (_Controller != null)
{
foreach (IController controller in _Controller)
controller.Close();
_Controller = null;
_KeysPool = null;
_MousePool = null;
}
}
public static void Connect()
+14 -10
View File
@@ -56,7 +56,7 @@ namespace Vocaluxe.Base
private static SQLiteConnection _ConnectionCover;
private static SQLiteTransaction _TransactionCover;
public static void Init()
public static bool Init()
{
_HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileHighscoreDB);
_CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileCoverDB);
@@ -66,14 +66,15 @@ namespace Vocaluxe.Base
if (!_InitCoverDB())
{
CLog.LogError("Error initializing Cover-DB", true, true);
return;
return false;
}
if (!_InitCreditsRessourcesDB())
{
CLog.LogError("Error initializing Cover-DB", true, true);
return;
return false;
}
GC.Collect();
return true;
}
#region Highscores
@@ -431,7 +432,7 @@ namespace Vocaluxe.Base
return false;
}
private static void _InitHighscoreDB()
private static bool _InitHighscoreDB()
{
string oldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileOldHighscoreDB);
if (File.Exists(oldDBFilePath))
@@ -441,17 +442,17 @@ namespace Vocaluxe.Base
if (!_CreateOrConvert(oldDBFilePath))
{
CLog.LogError("Cannot init Highscore DB: Error opening database: " + oldDBFilePath, true, true);
return;
return false;
}
if (!_CreateOrConvert(_HighscoreFilePath))
{
CLog.LogError("Cannot init Highscore DB: Error opening database: " + _HighscoreFilePath, true, true);
return;
return false;
}
if (!_ImportData(oldDBFilePath))
{
CLog.LogError("Cannot init Highscore DB: Error importing data", true, true);
return;
return false;
}
}
else
@@ -460,13 +461,17 @@ namespace Vocaluxe.Base
if (!_CreateOrConvert(_HighscoreFilePath))
{
CLog.LogError("Cannot init Highscore DB: Error opening database: " + _HighscoreFilePath, true, true);
return;
return false;
}
}
File.Delete(oldDBFilePath);
}
else if (!_CreateOrConvert(_HighscoreFilePath))
{
CLog.LogError("Cannot init Highscore DB: Error opening database: " + _HighscoreFilePath, true, true);
return false;
}
return true;
}
private static void _CreateHighscoreDB(string filePath)
@@ -1169,13 +1174,12 @@ namespace Vocaluxe.Base
}
}
public static void CloseConnections()
public static void Close()
{
CommitCovers();
if (_ConnectionCover != null)
{
_ConnectionCover.Close();
_ConnectionCover.Dispose();
_ConnectionCover = null;
}
+11 -5
View File
@@ -28,8 +28,10 @@ namespace Vocaluxe.Base
{
private static IDraw _Draw;
public static void InitDraw()
public static bool InitDraw()
{
if (_Draw != null)
return false;
switch (CConfig.Renderer)
{
case ERenderer.TR_CONFIG_SOFTWARE:
@@ -45,6 +47,7 @@ namespace Vocaluxe.Base
{
CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
" your graphic card drivers are up to date.", true, true);
return false;
}
break;
@@ -59,6 +62,7 @@ namespace Vocaluxe.Base
CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", true, true);
return false;
}
break;
#endif
@@ -67,8 +71,7 @@ namespace Vocaluxe.Base
_Draw = new CDrawWinForm();
break;
}
if (!_Draw.Init())
CLog.LogError("Could not init drawing interface!", true, true);
return _Draw.Init();
}
public static void MainLoop()
@@ -79,8 +82,11 @@ namespace Vocaluxe.Base
public static void Unload()
{
_Draw.Unload();
_Draw = null;
if (_Draw != null)
{
_Draw.Unload();
_Draw = null;
}
}
public static int GetScreenWidth()
+7 -7
View File
@@ -61,10 +61,10 @@ namespace Vocaluxe.Base
}
#region public methods
public static void InitGraphics()
public static void Init()
{
// Add Screens, must be the same order as in EScreens!
CLog.StartBenchmark(1, "Build Screen List");
CLog.StartBenchmark("Build Screen List");
_Screens.Add(new CScreenTest());
_Screens.Add(new CScreenLoad());
@@ -91,7 +91,7 @@ namespace Vocaluxe.Base
_PopupScreens.Add(new CPopupScreenVolumeControl());
_PopupScreens.Add(new CPopupScreenServerQR());
CLog.StopBenchmark(1, "Build Screen List");
CLog.StopBenchmark("Build Screen List");
_CurrentScreen = EScreens.ScreenLoad;
_NextScreen = EScreens.ScreenNull;
@@ -101,9 +101,9 @@ namespace Vocaluxe.Base
_GlobalAlpha = 1f;
_ZOffset = 0f;
CLog.StartBenchmark(0, "Load Theme");
CLog.StartBenchmark("Load Theme");
LoadTheme();
CLog.StopBenchmark(0, "Load Theme");
CLog.StopBenchmark("Load Theme");
}
public static void LoadTheme()
@@ -112,10 +112,10 @@ namespace Vocaluxe.Base
for (int i = 0; i < _Screens.Count; i++)
{
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
_Screens[i].Init();
_Screens[i].LoadTheme(CTheme.GetThemeScreensPath(-1));
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
}
foreach (IMenu popup in _PopupScreens)
+1
View File
@@ -223,6 +223,7 @@ namespace Vocaluxe.Base
foreach (string file in files)
{
SPartyMode pm = _LoadPartyMode(file);
if(pm.NoErrors)
_PartyModes.Add(pm.PartyModeID, pm);
}
}
+9 -2
View File
@@ -10,8 +10,10 @@ namespace Vocaluxe.Base
{
private static IRecord _Record;
public static void Init()
public static bool Init()
{
if (_Record != null)
return false;
switch (CConfig.RecordLib)
{
#if WIN
@@ -25,11 +27,16 @@ namespace Vocaluxe.Base
_Record = new CPortAudioRecord();
break;
}
return _Record.Init();
}
public static void Close()
{
_Record.Close();
if (_Record != null)
{
_Record.Close();
_Record = null;
}
}
public static bool Start()
+10 -10
View File
@@ -332,11 +332,11 @@ namespace Vocaluxe.Base
public static void LoadSongs()
{
CLog.StartBenchmark(1, "Load Songs");
CLog.StartBenchmark("Load Songs");
SongsLoaded = false;
_Songs.Clear();
CLog.StartBenchmark(2, "List Songs");
CLog.StartBenchmark("List Songs");
var files = new List<string>();
foreach (string p in CConfig.SongFolder)
{
@@ -344,9 +344,9 @@ namespace Vocaluxe.Base
files.AddRange(CHelper.ListFiles(path, "*.txt", true, true));
files.AddRange(CHelper.ListFiles(path, "*.txd", true, true));
}
CLog.StopBenchmark(2, "List Songs");
CLog.StopBenchmark("List Songs");
CLog.StartBenchmark(2, "Read TXTs");
CLog.StartBenchmark("Read TXTs");
foreach (string file in files)
{
CSong song = CSong.LoadSong(file);
@@ -356,24 +356,24 @@ namespace Vocaluxe.Base
if (song.LoadNotes())
_Songs.Add(song);
}
CLog.StopBenchmark(2, "Read TXTs");
CLog.StopBenchmark("Read TXTs");
CLog.StartBenchmark(2, "Sort Songs");
CLog.StartBenchmark("Sort Songs");
Sorter.SongSorting = CConfig.SongSorting;
Sorter.IgnoreArticles = CConfig.IgnoreArticles;
Categorizer.Tabs = CConfig.Tabs;
Categorizer.ObjectChanged += _HandleCategoriesChanged;
CLog.StopBenchmark(2, "Sort Songs");
CLog.StopBenchmark("Sort Songs");
Category = -1;
SongsLoaded = true;
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
{
CLog.StartBenchmark(2, "Load Covers/Notes");
CLog.StartBenchmark("Load Covers/Notes");
_LoadCover();
CLog.StopBenchmark(2, "Load Covers/Notes");
CLog.StopBenchmark("Load Covers/Notes");
}
CLog.StopBenchmark(1, "Load Songs ");
CLog.StopBenchmark("Load Songs ");
GC.Collect();
}
+10 -1
View File
@@ -38,6 +38,8 @@ namespace Vocaluxe.Base
public static bool Init()
{
if (_Playback != null)
return false;
switch (CConfig.PlayBackLib)
{
case EPlaybackLib.PortAudio:
@@ -75,7 +77,14 @@ namespace Vocaluxe.Base
public static void CloseAllStreams()
{
_Playback.CloseAll();
if (_Playback != null)
_Playback.CloseAll();
}
public static void Close()
{
CloseAllStreams();
_Playback = null;
}
#region Stream Handling
+16 -7
View File
@@ -142,22 +142,30 @@ namespace Vocaluxe.Base
#endregion Vars
#region Theme and Skin loading and writing
public static void InitTheme()
public static bool Init()
{
_ListThemes();
ListSkins();
LoadSkins();
LoadTheme();
return LoadSkins() && LoadTheme();
}
public static void LoadSkins()
public static bool LoadSkins()
{
//Fail if loading of any skin failed or no skin was loaded
//TODO: implement handlers that failing skins are logged and ignored
bool result = false;
for (int index = 0; index < _Skins.Count; index++)
{
if (_Skins[index].PartyModeID == -1)
LoadSkin(index);
{
if (LoadSkin(index))
result = true;
else
return false;
}
}
return result;
}
public static bool LoadSkin(int skinIndex)
@@ -225,13 +233,14 @@ namespace Vocaluxe.Base
}
}
public static void LoadTheme()
public static bool LoadTheme()
{
for (int i = 0; i < _Themes.Count; i++)
{
if (_Themes[i].Name == CConfig.Theme && _Themes[i].PartyModeID == -1)
LoadTheme(i);
return LoadTheme(i);
}
return false;
}
public static bool LoadTheme(int themeIndex)
+10 -4
View File
@@ -29,8 +29,10 @@ namespace Vocaluxe.Base
private static IVideoDecoder _VideoDecoder;
#region Init
public static void Init()
public static bool Init()
{
if (_VideoDecoder != null)
return false;
switch (CConfig.VideoDecoder)
{
case EVideoDecoder.FFmpeg:
@@ -44,14 +46,18 @@ namespace Vocaluxe.Base
break;
}
_VideoDecoder.Init();
return _VideoDecoder.Init();
}
#endregion Init
#region Interface
public static void CloseAll()
public static void Close()
{
_VideoDecoder.CloseAll();
if (_VideoDecoder != null)
{
_VideoDecoder.CloseAll();
_VideoDecoder = null;
}
}
public static int GetNumStreams()
+11 -3
View File
@@ -26,8 +26,10 @@ namespace Vocaluxe.Base
{
private static IWebcam _Webcam;
public static void Init()
public static bool Init()
{
if (_Webcam != null)
return false;
switch (CConfig.WebcamLib)
{
case EWebcamLib.AForgeNet:
@@ -38,11 +40,13 @@ namespace Vocaluxe.Base
_Webcam = new CAForgeNet();
break;
}
_Webcam.Init();
if (!_Webcam.Init())
return false;
_Webcam.Select(CConfig.WebcamConfig);
CConfig.WebcamConfig = _Webcam.GetConfig();
CConfig.SaveConfig();
return true;
}
public static bool GetFrame(ref CTexture tex)
@@ -57,7 +61,11 @@ namespace Vocaluxe.Base
public static void Close()
{
_Webcam.Close();
if (_Webcam != null)
{
_Webcam.Close();
_Webcam = null;
}
}
public static void Pause()
+4 -4
View File
@@ -361,9 +361,9 @@ namespace Vocaluxe.Base.Fonts
public static void LoadThemeFonts(string themeName, string fontFolder, CXMLReader xmlReader)
{
_LoadFontFiles(xmlReader, fontFolder, themeName);
CLog.StartBenchmark(1, "BuildGlyphs");
CLog.StartBenchmark("BuildGlyphs");
_BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
CLog.StopBenchmark("BuildGlyphs");
}
/// <summary>
@@ -372,9 +372,9 @@ namespace Vocaluxe.Base.Fonts
public static void LoadPartyModeFonts(int partyModeID, string fontFolder, CXMLReader xmlReader)
{
_LoadFontFiles(xmlReader, fontFolder, "", partyModeID);
CLog.StartBenchmark(1, "BuildGlyphs");
CLog.StartBenchmark("BuildGlyphs");
_BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
CLog.StopBenchmark("BuildGlyphs");
}
public static void SaveThemeFonts(string themeName, XmlWriter writer)
+17 -6
View File
@@ -18,8 +18,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using ServerLib;
@@ -29,16 +30,23 @@ using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Profile;
using VocaluxeLib.Songs;
using System.Security.Cryptography;
namespace Vocaluxe.Base.Server
{
static class CVocaluxeServer
{
private class CServerController : CControllerFramework
{
public override string GetName()
{
return "App controller";
}
}
private static CServer _Server;
//private static CDiscover _Discover;
public static readonly CControllerFramework Controller = new CControllerFramework();
public static readonly CControllerFramework Controller = new CServerController();
public static void Init()
{
@@ -69,7 +77,6 @@ namespace Vocaluxe.Base.Server
CServer.AddPlaylist = _AddPlaylist;
//_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword);
Controller.Init();
}
public static void Start()
@@ -83,8 +90,12 @@ namespace Vocaluxe.Base.Server
public static void Close()
{
_Server.Stop();
//_Discover.Stop();
if (_Server != null)
{
_Server.Stop();
_Server = null;
//_Discover.Stop();
}
}
public static string GetServerAddress()
+2 -1
View File
@@ -32,7 +32,8 @@ namespace Vocaluxe.Lib.Input
interface IController
{
void Init();
string GetName();
bool Init();
void Close();
void Connect();
void Disconnect();
+31 -5
View File
@@ -42,19 +42,28 @@ namespace Vocaluxe.Lib.Input.WiiMote
private bool _Connected;
private Thread _HandlerThread;
private AutoResetEvent _EvTerminate;
private Object _Sync;
private bool _Active;
private CRumbleTimer _RumbleTimer;
private CGesture _Gesture;
public void Init()
public string GetName()
{
return "WiiMote";
}
public bool Init()
{
if (_HandlerThread != null)
return false;
_Sync = new Object();
_RumbleTimer = new CRumbleTimer();
_Gesture = new CGesture();
_HandlerThread = new Thread(_MainLoop) {Name = "WiiMote", Priority = ThreadPriority.BelowNormal};
_EvTerminate = new AutoResetEvent(false);
_KeysPool = new List<SKeyEvent>();
_CurrentKeysPool = new List<SKeyEvent>();
@@ -64,17 +73,31 @@ namespace Vocaluxe.Lib.Input.WiiMote
_ButtonStates = new bool[11];
_OldPosition = new Point();
return true;
}
public void Close()
{
_Active = false;
_WiiMote.Disconnect();
if (_HandlerThread != null)
{
//Join before freeing stuff
//This also ensures, that no other thread is created till the current one is terminated
_EvTerminate.Set();
_HandlerThread.Join();
_HandlerThread = null;
_EvTerminate.Dispose();
_EvTerminate = null;
_KeysPool = null;
_CurrentKeysPool = null;
_MousePool = null;
_CurrentMousePool = null;
}
}
public void Connect()
{
if (_Active)
if (_Active || _HandlerThread == null)
return;
_Active = true;
_HandlerThread.Start();
@@ -82,7 +105,8 @@ namespace Vocaluxe.Lib.Input.WiiMote
public void Disconnect()
{
_Active = false;
//TODO: Allow reconnect
Close();
}
public bool IsConnected()
@@ -92,6 +116,8 @@ namespace Vocaluxe.Lib.Input.WiiMote
public void Update()
{
if (_HandlerThread == null)
return;
_CopyEvents();
}
@@ -137,7 +163,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (!_WiiMote.Connected)
{
if (!_DoConnect())
Thread.Sleep(1000);
_EvTerminate.WaitOne(1000);
}
else
{
@@ -15,11 +15,11 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Collections.ObjectModel;
using System.Threading;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using System.Threading;
using Vocaluxe.Base;
namespace Vocaluxe.Lib.Sound.Record.PortAudio
@@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
class CPortAudioRecord : IRecord
{
private bool _Initialized;
private List<CRecordDevice> _Devices;
private readonly List<CRecordDevice> _Devices = new List<CRecordDevice>();
private PortAudioSharp.PortAudio.PaStreamCallbackDelegate _MyRecProc;
private IntPtr[] _RecHandle;
@@ -36,13 +36,9 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
public CPortAudioRecord()
{
_Devices = null;
_Buffer = new CBuffer[CSettings.MaxNumPlayer];
for (int i = 0; i < _Buffer.Length; i++)
_Buffer[i] = new CBuffer();
Init();
}
/// <summary>
@@ -51,8 +47,6 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
/// <returns>true if success</returns>
public bool Init()
{
_Devices = new List<CRecordDevice>();
try
{
if (_Initialized)
@@ -61,9 +55,8 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
if (_ErrorCheck("Initialize", PortAudioSharp.PortAudio.Pa_Initialize()))
return false;
_Initialized = true;
_Devices.Clear();
int hostAPI = _ApiSelect();
int numDevices = PortAudioSharp.PortAudio.Pa_GetDeviceCount();
for (int i = 0; i < numDevices; i++)
{
@@ -76,8 +69,12 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
}
}
foreach (CBuffer buffer in _Buffer)
buffer.Reset();
_RecHandle = new IntPtr[_Devices.Count];
_MyRecProc = _MyPaStreamCallback;
_Initialized = true;
}
catch (Exception e)
{
@@ -101,6 +98,8 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
if (_RecHandle == null || _RecHandle.Length == 0)
return false;
Stop();
foreach (CBuffer buffer in _Buffer)
buffer.Reset();
+63 -49
View File
@@ -20,15 +20,21 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Windows.Forms;
using Vocaluxe.Base;
using System.Runtime.ExceptionServices;
using Vocaluxe.Base.Fonts;
using Vocaluxe.Base.Server;
namespace Vocaluxe
{
class CLoadingException : Exception
{
public CLoadingException(string component)
: base("Failed to load " + component) {}
}
static class CMainProgram
{
private static CSplashScreen _SplashScreen;
@@ -85,146 +91,154 @@ namespace Vocaluxe
Application.DoEvents();
// Init Language
CLog.StartBenchmark(0, "Init Language");
CLog.StartBenchmark("Init Language");
CLanguage.Init();
CLog.StopBenchmark(0, "Init Language");
CLog.StopBenchmark("Init Language");
Application.DoEvents();
// load config
CLog.StartBenchmark(0, "Init Config");
CLog.StartBenchmark("Init Config");
CConfig.LoadCommandLineParams(args);
CConfig.UseCommandLineParamsBefore();
CConfig.Init();
CConfig.UseCommandLineParamsAfter();
CLog.StopBenchmark(0, "Init Config");
CLog.StopBenchmark("Init Config");
Application.DoEvents();
_SplashScreen = new CSplashScreen();
Application.DoEvents();
// Init Draw
CLog.StartBenchmark(0, "Init Draw");
CDraw.InitDraw();
CLog.StopBenchmark(0, "Init Draw");
CLog.StartBenchmark("Init Draw");
if (!CDraw.InitDraw())
throw new CLoadingException("drawing");
CLog.StopBenchmark("Init Draw");
Application.DoEvents();
// Init Database
CLog.StartBenchmark(0, "Init Database");
CDataBase.Init();
CLog.StopBenchmark(0, "Init Database");
CLog.StartBenchmark("Init Database");
if (!CDataBase.Init())
throw new CLoadingException("database");
CLog.StopBenchmark("Init Database");
Application.DoEvents();
// Init Playback
CLog.StartBenchmark(0, "Init Playback");
CSound.Init();
CLog.StopBenchmark(0, "Init Playback");
CLog.StartBenchmark("Init Playback");
if (!CSound.Init())
throw new CLoadingException("playback");
CLog.StopBenchmark("Init Playback");
Application.DoEvents();
// Init Record
CLog.StartBenchmark(0, "Init Record");
CRecord.Init();
CLog.StopBenchmark(0, "Init Record");
CLog.StartBenchmark("Init Record");
if (!CRecord.Init())
throw new CLoadingException("record");
CLog.StopBenchmark("Init Record");
Application.DoEvents();
//Init Webcam
CLog.StartBenchmark(0, "Init Webcam");
CWebcam.Init();
CLog.StopBenchmark(0, "Init Webcam");
CLog.StartBenchmark("Init Webcam");
if (!CWebcam.Init())
throw new CLoadingException("webcam");
CLog.StopBenchmark("Init Webcam");
Application.DoEvents();
// Init Background Music
CLog.StartBenchmark(0, "Init Background Music");
CLog.StartBenchmark("Init Background Music");
CBackgroundMusic.Init();
CLog.StopBenchmark(0, "Init Background Music");
CLog.StopBenchmark("Init Background Music");
Application.DoEvents();
// Init Profiles
CLog.StartBenchmark(0, "Init Profiles");
CLog.StartBenchmark("Init Profiles");
CProfiles.Init();
CLog.StopBenchmark(0, "Init Profiles");
CLog.StopBenchmark("Init Profiles");
Application.DoEvents();
// Init Font
CLog.StartBenchmark(0, "Init Font");
CLog.StartBenchmark("Init Font");
CFonts.Init();
CLog.StopBenchmark(0, "Init Font");
CLog.StopBenchmark("Init Font");
Application.DoEvents();
// Init VideoDecoder
CLog.StartBenchmark(0, "Init Videodecoder");
CVideo.Init();
CLog.StopBenchmark(0, "Init Videodecoder");
CLog.StartBenchmark("Init Videodecoder");
if (!CVideo.Init())
throw new CLoadingException("video");
CLog.StopBenchmark("Init Videodecoder");
Application.DoEvents();
// Load Cover
CLog.StartBenchmark(0, "Init Cover");
CLog.StartBenchmark("Init Cover");
CCover.Init();
CLog.StopBenchmark(0, "Init Cover");
CLog.StopBenchmark("Init Cover");
Application.DoEvents();
// Theme System
CLog.StartBenchmark(0, "Init Theme");
CTheme.InitTheme();
CLog.StopBenchmark(0, "Init Theme");
CLog.StartBenchmark("Init Theme");
if (!CTheme.Init())
throw new CLoadingException("theme");
CLog.StopBenchmark("Init Theme");
Application.DoEvents();
// Init Screens
CLog.StartBenchmark(0, "Init Screens");
CGraphics.InitGraphics();
CLog.StopBenchmark(0, "Init Screens");
CLog.StartBenchmark("Init Screens");
CGraphics.Init();
CLog.StopBenchmark("Init Screens");
Application.DoEvents();
// Init Server
CLog.StartBenchmark(0, "Init Server");
CLog.StartBenchmark("Init Server");
CVocaluxeServer.Init();
CLog.StopBenchmark(0, "Init Server");
CLog.StopBenchmark("Init Server");
Application.DoEvents();
// Init Input
CLog.StartBenchmark(0, "Init Input");
CLog.StartBenchmark("Init Input");
CController.Init();
CController.Connect();
CLog.StopBenchmark(0, "Init Input");
CLog.StopBenchmark("Init Input");
Application.DoEvents();
// Init Game;
CLog.StartBenchmark(0, "Init Game");
CLog.StartBenchmark("Init Game");
CGame.Init();
CProfiles.Update();
CConfig.UsePlayers();
CLog.StopBenchmark(0, "Init Game");
CLog.StopBenchmark("Init Game");
Application.DoEvents();
// Init Party Modes;
CLog.StartBenchmark(0, "Init Party Modes");
CLog.StartBenchmark("Init Party Modes");
CParty.Init();
CLog.StopBenchmark(0, "Init Party Modes");
CLog.StopBenchmark("Init Party Modes");
Application.DoEvents();
}
catch (Exception e)
{
MessageBox.Show("Error on start up: " + e.Message + e.StackTrace);
MessageBox.Show("Error on start up: " + e.Message);
CLog.LogError("Error on start up: " + e);
if (_SplashScreen != null)
_SplashScreen.Close();
_CloseProgram();
return;
}
Application.DoEvents();
@@ -244,10 +258,10 @@ namespace Vocaluxe
CVocaluxeServer.Close();
CController.Close();
CRecord.Close();
CSound.CloseAllStreams();
CVideo.CloseAll();
CSound.Close();
CVideo.Close();
CDraw.Unload();
CDataBase.CloseConnections();
CDataBase.Close();
CWebcam.Close();
CLog.CloseAll();
}
+4 -4
View File
@@ -129,7 +129,7 @@ namespace Vocaluxe.Screens
videoPlayer.PreLoad();
}
CLog.StartBenchmark(0, "Load Songs Full");
CLog.StartBenchmark("Load Songs Full");
_SongLoaderThread.IsBackground = true;
_SongLoaderThread.Start();
@@ -198,12 +198,12 @@ namespace Vocaluxe.Screens
CBackgroundMusic.CanSing = true;
CLog.StopBenchmark(0, "Load Songs Full");
CLog.StopBenchmark("Load Songs Full");
//Init Playlists
CLog.StartBenchmark(0, "Init Playlists");
CLog.StartBenchmark("Init Playlists");
CPlaylists.Init();
CLog.StopBenchmark(0, "Init Playlists");
CLog.StopBenchmark("Init Playlists");
}
private void _CheckStartIntroVideos()