Fix code issues (naming, unused stuff)

This commit is contained in:
Flamefire committed 2014-03-12 09:41:34 +01:00
1 parent 424cb826ed
commit 898819fcf5
34 files changed
+128 -141

No files matched your search

+4 -4
View File
@@ -60,10 +60,10 @@ namespace Vocaluxe.Base
public static int ScreenW = 1024; public static int ScreenW = 1024;
public static int ScreenH = 576; public static int ScreenH = 576;
public static int BorderLeft = 0; public static int BorderLeft;
public static int BorderRight = 0; public static int BorderRight;
public static int BorderTop = 0; public static int BorderTop;
public static int BorderBottom = 0; public static int BorderBottom;
public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0;
+9 -14
View File
@@ -208,7 +208,7 @@ namespace Vocaluxe.Base
public static void UpdatePoints(float time) public static void UpdatePoints(float time)
{ {
bool DEBUG_HIT = false; const bool DEBUG_HIT = false;
CSong song = _SongQueue.GetSong(); CSong song = _SongQueue.GetSong();
@@ -274,8 +274,6 @@ namespace Vocaluxe.Base
{ {
int tone = notes[note].Tone; int tone = notes[note].Tone;
int tonePlayer = CSound.RecordGetTone(p); int tonePlayer = CSound.RecordGetTone(p);
if (DEBUG_HIT)
tonePlayer = tone;
while (tonePlayer - tone > 6) while (tonePlayer - tone > 6)
tonePlayer -= 12; tonePlayer -= 12;
@@ -362,7 +360,7 @@ namespace Vocaluxe.Base
public static void ResetToLastLine(int soundStream, int vidStream) public static void ResetToLastLine(int soundStream, int vidStream)
{ {
float[] time = GetLastSungLineStart(); float[] time = _GetLastSungLineStart();
ResetToTime(time[0], time[1], soundStream, vidStream); ResetToTime(time[0], time[1], soundStream, vidStream);
} }
@@ -416,15 +414,15 @@ namespace Vocaluxe.Base
CVideo.Skip(vidStream, time, GetSong().VideoGap); CVideo.Skip(vidStream, time, GetSong().VideoGap);
} }
private static float[] GetLastSungLineStart() private static float[] _GetLastSungLineStart()
{ {
return GetNoteTimeBeforeBeat(CurrentBeat); return _GetNoteTimeBeforeBeat(CurrentBeat);
} }
private static float[] GetNoteTimeBeforeBeat(int beat) private static float[] _GetNoteTimeBeforeBeat(int beat)
{ {
CSong song = GetSong(); CSong song = GetSong();
int StartBeat = (int)Math.Floor(beat - GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f)); int startBeat = (int)Math.Floor(beat - GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f));
int lastStart = 0; int lastStart = 0;
int nextStart = 0; int nextStart = 0;
foreach (CVoice voice in song.Notes.Voices) foreach (CVoice voice in song.Notes.Voices)
@@ -436,16 +434,13 @@ namespace Vocaluxe.Base
{ {
foreach (CSongNote note in line.Notes) foreach (CSongNote note in line.Notes)
{ {
if (note.StartBeat > StartBeat) if (note.StartBeat > startBeat)
{ {
nextStartNote = note.StartBeat; nextStartNote = note.StartBeat;
break; break;
} }
else voiceStart = note.StartBeat;
{ lastEnd = note.EndBeat;
voiceStart = note.StartBeat;
lastEnd = note.EndBeat;
}
} }
if (nextStartNote > 0) if (nextStartNote > 0)
break; break;
-3
View File
@@ -404,9 +404,6 @@ namespace Vocaluxe.Base
CConfig.BorderTop = 0; CConfig.BorderTop = 0;
CConfig.BorderBottom = 0; CConfig.BorderBottom = 0;
break; break;
default:
break;
} }
CConfig.SaveConfig(); CConfig.SaveConfig();
break; break;
+1 -1
View File
@@ -104,7 +104,7 @@ namespace Vocaluxe.Base
#endif #endif
Path.Combine(DataPath, FolderProfiles) Path.Combine(DataPath, FolderProfiles)
}; };
public static string FolderPhotos = "Photos"; public const string FolderPhotos = "Photos";
public const string FolderSongs = "Songs"; public const string FolderSongs = "Songs";
public const string FolderSounds = "Sounds"; public const string FolderSounds = "Sounds";
public const string FolderLanguages = "Languages"; public const string FolderLanguages = "Languages";
+1 -3
View File
@@ -221,9 +221,7 @@ namespace Vocaluxe.Base
return; return;
//Calc avarage sing-count //Calc avarage sing-count
int totalCounts = 0; int totalCounts = VisibleSongs.Sum(song => song.NumPlayedSession);
foreach (CSong song in VisibleSongs)
totalCounts += song.NumPlayedSession;
int averageCount = totalCounts / NumSongsVisible; int averageCount = totalCounts / NumSongsVisible;
foreach (CSong song in VisibleSongs) foreach (CSong song in VisibleSongs)
-1
View File
@@ -18,7 +18,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Fonts;
+1 -2
View File
@@ -96,9 +96,8 @@ namespace Vocaluxe.Base.Server
var stream = new MemoryStream(); var stream = new MemoryStream();
stream.Write(cmd, 0, cmd.Length); stream.Write(cmd, 0, cmd.Length);
byte[] data;
string json = JsonConvert.SerializeObject(obj); string json = JsonConvert.SerializeObject(obj);
data = _Encoder.GetBytes(json); byte[] data = _Encoder.GetBytes(json);
stream.Write(data, 0, data.Length); stream.Write(data, 0, data.Length);
return stream.ToArray(); return stream.ToArray();
} }
+7 -8
View File
@@ -26,7 +26,6 @@ using ServerLib;
using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Input;
using Vocaluxe.Lib.Playlist; using Vocaluxe.Lib.Playlist;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
@@ -314,7 +313,7 @@ namespace Vocaluxe.Base.Server
#endregion #endregion
#region photo #region photo
private static List<string> photosOfThisRound = new List<string>(); private static readonly List<string> _PhotosOfThisRound = new List<string>();
private static bool _SendPhoto(SPhotoData photoData) private static bool _SendPhoto(SPhotoData photoData)
{ {
@@ -325,17 +324,17 @@ namespace Vocaluxe.Base.Server
string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos); string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos);
if (!string.IsNullOrEmpty(filePath)) if (!string.IsNullOrEmpty(filePath))
{ {
photosOfThisRound.Add(filePath); _PhotosOfThisRound.Add(filePath);
return true; return true;
} }
return false; return false;
} }
internal static string[] getPhotosOfThisRound() internal static string[] GetPhotosOfThisRound()
{ {
string[] result = photosOfThisRound.ToArray(); string[] result = _PhotosOfThisRound.ToArray();
photosOfThisRound.Clear(); _PhotosOfThisRound.Clear();
return result; return result;
} }
#endregion #endregion
@@ -583,11 +582,11 @@ namespace Vocaluxe.Base.Server
return false; return false;
} }
byte[] salt = profile.PasswordSalt; //byte[] salt = profile.PasswordSalt;
return hashedPassword.SequenceEqual(profile.PasswordHash); return hashedPassword.SequenceEqual(profile.PasswordHash);
} }
private static byte[] _GetPassowordSalt(int profileId) private static byte[] _GetPasswordSalt(int profileId)
{ {
CProfile profile = CProfiles.GetProfile(profileId); CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null) if (profile == null)
-4
View File
@@ -16,12 +16,8 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Security; using System.Security;
using System.Text;
using Microsoft.Win32; using Microsoft.Win32;
using Vocaluxe.Base; using Vocaluxe.Base;
-1
View File
@@ -18,7 +18,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Xml; using System.Xml;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
+1 -3
View File
@@ -665,7 +665,7 @@ namespace Vocaluxe.Lib.Sound
return -1; return -1;
} }
public bool Skip(float time) public void Skip(float time)
{ {
lock (_LockSyncSignals) lock (_LockSyncSignals)
{ {
@@ -673,8 +673,6 @@ namespace Vocaluxe.Lib.Sound
_SetSkip = true; _SetSkip = true;
_Waiting = true; _Waiting = true;
} }
return true;
} }
#region Threading #region Threading
-6
View File
@@ -15,7 +15,6 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using ServerLib;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Base.Server; using Vocaluxe.Base.Server;
using VocaluxeLib; using VocaluxeLib;
@@ -56,11 +55,6 @@ namespace Vocaluxe.Screens
_ThemeTexts = new string[] {_TextServerAddress, _TextServerNotRunning}; _ThemeTexts = new string[] {_TextServerAddress, _TextServerNotRunning};
} }
public override void LoadTheme(string xmlPath)
{
base.LoadTheme(xmlPath);
}
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
@@ -15,12 +15,10 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Draw;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
+3 -3
View File
@@ -187,8 +187,8 @@ namespace Vocaluxe.Screens
if (_SlideShowBGAvailable) if (_SlideShowBGAvailable)
_SlideShowBG.Draw(); _SlideShowBG.Draw();
else else
base._DrawBG(); _DrawBG();
base._DrawFG(); _DrawFG();
return true; return true;
} }
@@ -428,7 +428,7 @@ namespace Vocaluxe.Screens
private bool _UpdateBackground() private bool _UpdateBackground()
{ {
string[] photos = CVocaluxeServer.getPhotosOfThisRound(); string[] photos = CVocaluxeServer.GetPhotosOfThisRound();
_SlideShowBG.RemoveSlideShowTextures(); _SlideShowBG.RemoveSlideShowTextures();
foreach (string photo in photos) foreach (string photo in photos)
_SlideShowBG.AddSlideShowTexture(photo); _SlideShowBG.AddSlideShowTexture(photo);
+2
View File
@@ -22,6 +22,7 @@
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: #000000;
background-color: rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.7);
} }
@@ -30,6 +31,7 @@
height: 100%; height: 100%;
top: 0; top: 0;
margin: 0; margin: 0;
background: #000000;
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.3);
display: none; display: none;
position: fixed; position: fixed;
+2
View File
@@ -355,6 +355,7 @@ namespace VocaluxeLib
[Flags] [Flags]
public enum EUserRole public enum EUserRole
{ {
// ReSharper disable InconsistentNaming
TR_USERROLE_GUEST = 0, TR_USERROLE_GUEST = 0,
TR_USERROLE_NORMAL = 1, TR_USERROLE_NORMAL = 1,
TR_USERROLE_ADMIN = 2, TR_USERROLE_ADMIN = 2,
@@ -362,5 +363,6 @@ namespace VocaluxeLib
TR_USERROLE_ADDSONGSUSER = 8, TR_USERROLE_ADDSONGSUSER = 8,
TR_USERROLE_PLAYLISTEDITOR = 16, TR_USERROLE_PLAYLISTEDITOR = 16,
TR_USERROLE_PROFILEEDITOR = 32 TR_USERROLE_PROFILEEDITOR = 32
// ReSharper restore InconsistentNaming
} }
} }
+1 -2
View File
@@ -19,11 +19,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text;
namespace VocaluxeLib namespace VocaluxeLib
{ {
public static class Extensions public static class CExtensions
{ {
/// <summary> /// <summary>
/// Resizes the given list to the given size. Removes elements or adds default values /// Resizes the given list to the given size. Removes elements or adds default values
+4 -5
View File
@@ -54,8 +54,8 @@ namespace VocaluxeLib.Menu
private bool _ThemeLoaded; private bool _ThemeLoaded;
private int _SlideShowCurrent; private int _SlideShowCurrent;
private Stopwatch _SlideShowTimer = new Stopwatch(); private readonly Stopwatch _SlideShowTimer = new Stopwatch();
private List<CTexture> _SlideShowTextures = new List<CTexture>(); private readonly List<CTexture> _SlideShowTextures = new List<CTexture>();
public SColorF Color; public SColorF Color;
@@ -69,8 +69,7 @@ namespace VocaluxeLib.Menu
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_ThemeLoaded = false; _ThemeLoaded = false;
_Theme = new SThemeBackground(); _Theme = new SThemeBackground {SlideShowTextures = new List<string>()};
_Theme.SlideShowTextures = new List<string>();
Color = new SColorF(0f, 0f, 0f, 1f); Color = new SColorF(0f, 0f, 0f, 1f);
} }
@@ -102,11 +101,11 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= success; _ThemeLoaded &= success;
} }
string slideShow = "";
int i = 1; int i = 1;
while (xmlReader.ItemExists(item + "/SlideShow" + i)) while (xmlReader.ItemExists(item + "/SlideShow" + i))
{ {
string slideShow;
xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty); xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty);
if (slideShow != "") if (slideShow != "")
_Theme.SlideShowTextures.Add(slideShow); _Theme.SlideShowTextures.Add(slideShow);
-2
View File
@@ -16,8 +16,6 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml; using System.Xml;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
-1
View File
@@ -19,7 +19,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
+56 -19
View File
@@ -15,11 +15,8 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
@@ -94,10 +91,7 @@ namespace VocaluxeLib.Menu
_NumPlayer = numPlayer; _NumPlayer = numPlayer;
_NumPlayerTeams = numPlayerTeams; _NumPlayerTeams = numPlayerTeams;
if (_NumTeams > 0) _TeamList = new List<int>[_NumTeams > 0 ? _NumTeams : 1];
_TeamList = new List<int>[_NumTeams];
else
_TeamList = new List<int>[1];
if (_NumTeams != _NumPlayerTeams.Length) if (_NumTeams != _NumPlayerTeams.Length)
_NumPlayerTeams = new int[_NumTeams]; _NumPlayerTeams = new int[_NumTeams];
@@ -126,7 +120,7 @@ namespace VocaluxeLib.Menu
{ {
//Handle left/right/up/down //Handle left/right/up/down
_NameSelections[_NameSelection].HandleInput(keyEvent); _NameSelections[_NameSelection].HandleInput(keyEvent);
int numberPressed = -1; int numPressed = -1;
bool resetSelection = false; bool resetSelection = false;
switch (keyEvent.Key) switch (keyEvent.Key)
{ {
@@ -157,20 +151,65 @@ namespace VocaluxeLib.Menu
case Keys.Back: case Keys.Back:
resetSelection = true; resetSelection = true;
break; break;
case Keys.D1:
case Keys.NumPad1:
numPressed = 1;
break;
case Keys.D2:
case Keys.NumPad2:
numPressed = 2;
break;
case Keys.D3:
case Keys.NumPad3:
numPressed = 3;
break;
case Keys.D4:
case Keys.NumPad4:
numPressed = 4;
break;
case Keys.D5:
case Keys.NumPad5:
numPressed = 5;
break;
case Keys.D6:
case Keys.NumPad6:
numPressed = 6;
break;
case Keys.D7:
case Keys.NumPad7:
numPressed = 7;
break;
case Keys.D8:
case Keys.NumPad8:
numPressed = 8;
break;
case Keys.D9:
case Keys.NumPad9:
numPressed = 9;
break;
} }
if (numberPressed > 0 || resetSelection) if (numPressed > 0 || resetSelection)
{ {
if (numberPressed == _SelectingFastPlayerNr || resetSelection) if (numPressed == _SelectingFastPlayerNr || resetSelection)
{ {
//Reset all values //Reset all values
_SelectingFastPlayerNr = 0; _SelectingFastPlayerNr = 0;
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
_NameSelections[_NameSelection].FastSelection(false, -1); _NameSelections[_NameSelection].FastSelection(false, -1);
} }
else if (numberPressed <= _NumPlayerTeams[_CurrentTeam]) else if (numPressed <= _NumPlayerTeams[_CurrentTeam])
{ {
_SelectingFastPlayerNr = numberPressed; _SelectingFastPlayerNr = numPressed;
_NameSelections[_NameSelection].FastSelection(true, numberPressed); _NameSelections[_NameSelection].FastSelection(true, numPressed);
} }
_SelectingFast = false; _SelectingFast = false;
} }
@@ -530,9 +569,7 @@ namespace VocaluxeLib.Menu
public SPartyNameOptions GetData() public SPartyNameOptions GetData()
{ {
SPartyNameOptions option = new SPartyNameOptions(); SPartyNameOptions option = new SPartyNameOptions {NumPlayerTeams = _NumPlayerTeams, TeamList = _TeamList};
option.NumPlayerTeams = _NumPlayerTeams;
option.TeamList = _TeamList;
return option; return option;
} }
@@ -692,7 +729,7 @@ namespace VocaluxeLib.Menu
{ {
if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic) if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic)
return; return;
else if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam()) if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam())
return; return;
_NameSelections[_NameSelection].UseProfile(profileID); _NameSelections[_NameSelection].UseProfile(profileID);
@@ -707,8 +744,8 @@ namespace VocaluxeLib.Menu
{ {
List<int> ids = new List<int>(); List<int> ids = new List<int>();
ids.AddRange(_TeamList[t]); ids.AddRange(_TeamList[t]);
for (int p = 0; p < ids.Count; p++) foreach (int id in ids)
_RemovePlayer(t, ids[p]); _RemovePlayer(t, id);
} }
} }
+1 -2
View File
@@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu
private int _Player = -1; private int _Player = -1;
private readonly List<int> _VisibleProfiles; private readonly List<int> _VisibleProfiles;
private List<int> _UsedProfiles; private readonly List<int> _UsedProfiles;
private CStatic _PlayerSelector; private CStatic _PlayerSelector;
@@ -416,7 +416,6 @@ namespace VocaluxeLib.Menu
_Tiles[i].Avatar.Texture = CBase.Profiles.GetAvatar(_VisibleProfiles[i + offset * _Tiles.Count]); _Tiles[i].Avatar.Texture = CBase.Profiles.GetAvatar(_VisibleProfiles[i + offset * _Tiles.Count]);
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1); _Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
_Tiles[i].Name.Text = CBase.Profiles.GetPlayerName(_VisibleProfiles[i + offset * _Tiles.Count]); _Tiles[i].Name.Text = CBase.Profiles.GetPlayerName(_VisibleProfiles[i + offset * _Tiles.Count]);
;
_Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count]; _Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count];
} }
else else
+2 -3
View File
@@ -214,7 +214,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (_SongMenu != null) if (_SongMenu != null)
_SongMenu.OnHide(); _SongMenu.OnHide();
switch (CBase.Config.GetSongMenuType()) _Type = CBase.Config.GetSongMenuType();
switch (_Type)
{ {
//case ESongMenu.TR_CONFIG_LIST: //case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList(); // _SongMenu = new CSongMenuList();
@@ -231,8 +232,6 @@ namespace VocaluxeLib.Menu.SongMenu
// _SongMenu = new CSongMenuBook(); // _SongMenu = new CSongMenuBook();
// break; // break;
} }
_Type = CBase.Config.GetSongMenuType();
} }
} }
} }
+20 -21
View File
@@ -67,11 +67,11 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
set set
{ {
base._PlaySong(value); _PlaySong(value);
base._PreviewIdInternal = value; _PreviewIdInternal = value;
_UpdatePreview(); _UpdatePreview();
} }
get { return base._PreviewIdInternal; } get { return _PreviewIdInternal; }
} }
public override int GetActualSelection() public override int GetActualSelection()
@@ -138,7 +138,7 @@ namespace VocaluxeLib.Menu.SongMenu
} }
if (_Length < 0 && CBase.Sound.GetLength(_PreviewSongStream) > 0 && CBase.Songs.IsInCategory()) if (_Length < 0 && CBase.Sound.GetLength(_PreviewSongStream) > 0 && CBase.Songs.IsInCategory())
UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId)); _UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId));
} }
private void _UpdatePreview() private void _UpdatePreview()
@@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu.SongMenu
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated; _MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag; _MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
UpdateLength(song); _UpdateLength(song);
} }
else else
{ {
@@ -198,23 +198,22 @@ namespace VocaluxeLib.Menu.SongMenu
} }
} }
private void UpdateLength(CSong song) private void _UpdateLength(CSong song)
{ {
if (song != null) if (song == null)
{ return;
float time = CBase.Sound.GetLength(_PreviewSongStream); float time = CBase.Sound.GetLength(_PreviewSongStream);
if (Math.Abs(song.Finish) > 0.001) if (Math.Abs(song.Finish) > 0.001)
time = song.Finish; time = song.Finish;
// The audiobackend is not yet ready to return the length // The audiobackend is ready to return the length
if (time > 0) if (time > 0)
{ {
time -= song.Start; time -= song.Start;
var min = (int)Math.Floor(time / 60f); var min = (int)Math.Floor(time / 60f);
var sec = (int)(time - min * 60f); var sec = (int)(time - min * 60f);
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
_Length = time; _Length = time;
}
} }
} }
@@ -556,7 +555,7 @@ namespace VocaluxeLib.Menu.SongMenu
public override void SetSelectedSong(int visibleSongNr) public override void SetSelectedSong(int visibleSongNr)
{ {
base._PlaySong(visibleSongNr); _PlaySong(visibleSongNr);
base.SetSelectedSong(visibleSongNr); base.SetSelectedSong(visibleSongNr);
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible()) if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible())
+1 -1
View File
@@ -49,7 +49,7 @@ namespace VocaluxeLib.Profile
CBase.Drawing.RemoveTexture(ref Texture); CBase.Drawing.RemoveTexture(ref Texture);
} }
public string getFileName() public string GetFileName()
{ {
return FileName; return FileName;
} }
+6 -5
View File
@@ -17,7 +17,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Text;
using System.Xml; using System.Xml;
namespace VocaluxeLib.Profile namespace VocaluxeLib.Profile
@@ -71,9 +70,11 @@ namespace VocaluxeLib.Profile
FileName = String.Empty; FileName = String.Empty;
} }
public bool LoadProfile() public bool LoadProfile(string pathName, string fileName)
{ {
return LoadProfile(FilePath, FileName); FilePath = pathName;
FileName = fileName;
return LoadProfile();
} }
public bool LoadProfile(string file) public bool LoadProfile(string file)
@@ -81,10 +82,10 @@ namespace VocaluxeLib.Profile
FileName = Path.GetFileName(file); FileName = Path.GetFileName(file);
FilePath = Path.GetDirectoryName(file); FilePath = Path.GetDirectoryName(file);
return LoadProfile(FilePath, FileName); return LoadProfile();
} }
public bool LoadProfile(string pathName, string fileName) public bool LoadProfile()
{ {
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(FilePath, FileName)); CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(FilePath, FileName));
if (xmlReader == null) if (xmlReader == null)
+1 -2
View File
@@ -135,11 +135,10 @@ namespace VocaluxeLib.Songs
return false; return false;
} }
public bool IncLastNoteLength() public void IncLastNoteLength()
{ {
if (_Notes.Count > 0) if (_Notes.Count > 0)
_Notes[NoteCount - 1].Duration++; _Notes[NoteCount - 1].Duration++;
return false;
} }
public void DeleteAllNotes() public void DeleteAllNotes()
+1 -1
View File
@@ -97,7 +97,7 @@ namespace VocaluxeLib.Songs
public string MP3FileName = String.Empty; public string MP3FileName = String.Empty;
public string CoverFileName = String.Empty; public string CoverFileName = String.Empty;
public List<string> BackgroundFileNames = new List<string>(); public readonly List<string> BackgroundFileNames = new List<string>();
public string VideoFileName = String.Empty; public string VideoFileName = String.Empty;
public EAspect VideoAspect = EAspect.Crop; public EAspect VideoAspect = EAspect.Crop;
+1
View File
@@ -41,6 +41,7 @@ namespace VocaluxeLib.Songs
/// <param name="duration"></param> /// <param name="duration"></param>
/// <param name="tone"></param> /// <param name="tone"></param>
/// <param name="hitNote"></param> /// <param name="hitNote"></param>
/// <param name="points"></param>
public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points) : this(startBeat, duration, tone) public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points) : this(startBeat, duration, tone)
{ {
HitNote = hitNote; HitNote = hitNote;
+1 -3
View File
@@ -205,15 +205,13 @@ namespace VocaluxeLib.Songs
public void UpdateTimings() public void UpdateTimings()
{ {
CSongNote lastNote;
if (_Lines.Count == 0) if (_Lines.Count == 0)
return; return;
_Lines[0].StartBeat = -10000; _Lines[0].StartBeat = -10000;
for (int i = 1; i < _Lines.Count; i++) for (int i = 1; i < _Lines.Count; i++)
{ {
lastNote = _Lines[i - 1].LastNote; CSongNote lastNote = _Lines[i - 1].LastNote;
CSongNote firstNote = _Lines[i].FirstNote; CSongNote firstNote = _Lines[i].FirstNote;
if ((lastNote != null) && (firstNote != null)) if ((lastNote != null) && (firstNote != null))
+2 -13
View File
@@ -15,7 +15,6 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System.Diagnostics;
using System.Security.Authentication; using System.Security.Authentication;
using System.Security.Principal; using System.Security.Principal;
using Security.Cryptography; using Security.Cryptography;
@@ -166,12 +165,7 @@ namespace WebserverInitalConfig
{ {
if (!profile.FirewallEnabled) if (!profile.FirewallEnabled)
return true; return true;
foreach (INetFwAuthorizedApplication a in profile.AuthorizedApplications) return profile.AuthorizedApplications.Cast<INetFwAuthorizedApplication>().Any(a => a.ProcessImageFileName == _ExePath);
{
if (a.ProcessImageFileName == _ExePath)
return true;
}
return false;
} }
private bool _IsPortOpen(INetFwProfile profile) private bool _IsPortOpen(INetFwProfile profile)
@@ -180,12 +174,7 @@ namespace WebserverInitalConfig
if (!profile.FirewallEnabled) if (!profile.FirewallEnabled)
return true; return true;
foreach (INetFwOpenPort p in profile.GloballyOpenPorts) return profile.GloballyOpenPorts.Cast<INetFwOpenPort>().Any(p => p.Protocol == protocol && p.Port == _Port);
{
if (p.Protocol == protocol && p.Port == _Port)
return true;
}
return false;
} }
private NET_FW_IP_PROTOCOL_ _GetProtocol() private NET_FW_IP_PROTOCOL_ _GetProtocol()
-3
View File
@@ -18,13 +18,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace WebserverInitalConfig namespace WebserverInitalConfig
{ {
-2
View File
@@ -19,9 +19,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Mime;
using System.Security.Authentication; using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
namespace WebserverInitalConfig namespace WebserverInitalConfig
{ {
@@ -16,7 +16,6 @@
#endregion #endregion
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden // Allgemeine Informationen über eine Assembly werden über die folgenden