updated for firebase
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
c8b23a45b5
commit
cdb3ce6d25
@ -15,7 +15,7 @@ namespace KaraokePlayer
|
||||
{
|
||||
public partial class KaraokeVideoPlayer : UserControl
|
||||
{
|
||||
|
||||
public bool isPaused = false;
|
||||
private bool hideOverlay = true;
|
||||
private GraphicsFile _cdgFile;
|
||||
private KaraokeVideoOverlay _overlayForm;
|
||||
@ -76,11 +76,24 @@ namespace KaraokePlayer
|
||||
vlcPlayer.Play();
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
isPaused = false;
|
||||
vlcPlayer.Play();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
isPaused = false;
|
||||
vlcPlayer.Stop();
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
isPaused = true;
|
||||
vlcPlayer.Pause();
|
||||
}
|
||||
|
||||
private void vlcPlayer_Playing(object sender, VlcMediaPlayerPlayingEventArgs e)
|
||||
{
|
||||
_startTime = DateTime.Now;
|
||||
|
||||
6
ConsoleApplication1/App.config
Normal file
6
ConsoleApplication1/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
60
ConsoleApplication1/ConsoleApplication1.csproj
Normal file
60
ConsoleApplication1/ConsoleApplication1.csproj
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{19F06EDF-92BA-40A9-BBFC-1DA75C894059}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ConsoleApplication1</RootNamespace>
|
||||
<AssemblyName>ConsoleApplication1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
15
ConsoleApplication1/Program.cs
Normal file
15
ConsoleApplication1/Program.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApplication1
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ConsoleApplication1/Properties/AssemblyInfo.cs
Normal file
36
ConsoleApplication1/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ConsoleApplication1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConsoleApplication1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("19f06edf-92ba-40a9-bbfc-1da75c894059")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokePlayer", "KaraokePla
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgPlayer", "CdgPlayer\CdgPlayer.csproj", "{A5324295-6BD2-4415-92CD-6EA77D708E00}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Herse.Models", "..\herse.models\Herse.Models.csproj", "{BDE9BC7B-DB3D-4A28-9902-B5D8D1965E5C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -33,10 +31,6 @@ Global
|
||||
{A5324295-6BD2-4415-92CD-6EA77D708E00}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A5324295-6BD2-4415-92CD-6EA77D708E00}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A5324295-6BD2-4415-92CD-6EA77D708E00}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BDE9BC7B-DB3D-4A28-9902-B5D8D1965E5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BDE9BC7B-DB3D-4A28-9902-B5D8D1965E5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BDE9BC7B-DB3D-4A28-9902-B5D8D1965E5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BDE9BC7B-DB3D-4A28-9902-B5D8D1965E5C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -20,4 +20,12 @@
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
21
KaraokePlayer/Classes/Enums.cs
Normal file
21
KaraokePlayer/Classes/Enums.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KaraokePlayer.Enums
|
||||
{
|
||||
public enum PlayerState
|
||||
{
|
||||
Play,
|
||||
Stop,
|
||||
Pause,
|
||||
Next
|
||||
}
|
||||
|
||||
public enum FileType
|
||||
{
|
||||
CDG, MP4, ZIP
|
||||
}
|
||||
}
|
||||
196
KaraokePlayer/Classes/FirebaseController.cs
Normal file
196
KaraokePlayer/Classes/FirebaseController.cs
Normal file
@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using KaraokePlayer.Interfaces;
|
||||
using KaraokePlayer.Enums;
|
||||
using FireSharp.Interfaces;
|
||||
using FireSharp.Config;
|
||||
using FireSharp;
|
||||
|
||||
namespace KaraokePlayer.Classes
|
||||
{
|
||||
public class FirebaseSong : ISong
|
||||
{
|
||||
public string FirebaseId { get; set; }
|
||||
public int Id { get; set; }
|
||||
public int Order { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public FileType FileType { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
|
||||
public class FirebaseController : IController
|
||||
{
|
||||
private IFirebaseConfig config = new FirebaseConfig
|
||||
{
|
||||
AuthSecret = "wj0ERDFZqNSysTtIXcCgCr8Itahr6pJOBeqCjvDF",
|
||||
BasePath = "https://karaokecontroller.firebaseio.com/"
|
||||
};
|
||||
private IFirebaseClient client;
|
||||
private ControllerStateChangedEventHandler StateChanged;
|
||||
private ControllerSongChangedEventHandler SongChanged;
|
||||
|
||||
public FirebaseController(ControllerStateChangedEventHandler stateChanged, ControllerSongChangedEventHandler songChanged)
|
||||
{
|
||||
StateChanged = stateChanged;
|
||||
SongChanged = songChanged;
|
||||
PlayQueue = new List<ISong>();
|
||||
client = new FirebaseClient(config);
|
||||
client.DeleteAsync("controller/state");
|
||||
client.PushAsync("controller/state", "stop");
|
||||
client.DeleteAsync("controller/playQueue");
|
||||
client.DeleteAsync("controller/currentSong");
|
||||
ListenToStream();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public List<ISong> PlayQueue { get; set; }
|
||||
public void GetNextSong()
|
||||
{
|
||||
ISong song = PlayQueue.FirstOrDefault();
|
||||
Stop();
|
||||
client.DeleteAsync("controller/currentSong");
|
||||
client.PushAsync("controller/currentSong", song);
|
||||
}
|
||||
public void RemoveSong(ISong song)
|
||||
{
|
||||
ISong found = PlayQueue.FirstOrDefault(s => s.Id == song.Id);
|
||||
if (found != null)
|
||||
{
|
||||
PlayQueue.Remove(found);
|
||||
client.DeleteAsync("controller/playQueue/" + ((FirebaseSong)song).FirebaseId);
|
||||
}
|
||||
}
|
||||
public void Next()
|
||||
{
|
||||
client.DeleteAsync("controller/state");
|
||||
client.PushAsync("controller/state", "next");
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
client.DeleteAsync("controller/state");
|
||||
client.PushAsync("controller/state", "play");
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
client.DeleteAsync("controller/state");
|
||||
client.PushAsync("controller/state", "stop");
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
client.DeleteAsync("controller/state");
|
||||
client.PushAsync("controller/state", "pause");
|
||||
}
|
||||
|
||||
private async void ListenToStream()
|
||||
{
|
||||
await client.OnAsync("controller/currentSong",
|
||||
added: (s, args, obj) =>
|
||||
{
|
||||
if (args.Path.Contains("Id"))
|
||||
{
|
||||
CurrentSongChanged();
|
||||
}
|
||||
},
|
||||
changed: (s, args, obj) =>
|
||||
{
|
||||
if (args.Path.Contains("Id"))
|
||||
{
|
||||
CurrentSongChanged();
|
||||
}
|
||||
},
|
||||
removed: null
|
||||
);
|
||||
|
||||
await client.OnAsync("controller/playQueue",
|
||||
added: (s, args, obj) =>
|
||||
{
|
||||
if (args.Path.Contains("Id"))
|
||||
{
|
||||
ReloadPlayQueue();
|
||||
}
|
||||
},
|
||||
changed: (s, args, obj) =>
|
||||
{
|
||||
if (args.Path.Contains("Id"))
|
||||
{
|
||||
ReloadPlayQueue();
|
||||
}
|
||||
},
|
||||
removed: null
|
||||
);
|
||||
|
||||
await client.OnAsync("controller/state",
|
||||
added: (s, args, obj) =>
|
||||
{
|
||||
RemoteStateChanged(args.Data);
|
||||
},
|
||||
changed: (s, args, obj) =>
|
||||
{
|
||||
RemoteStateChanged(args.Data);
|
||||
},
|
||||
removed: null
|
||||
);
|
||||
}
|
||||
|
||||
private void ReloadPlayQueue()
|
||||
{
|
||||
bool autoPlay = PlayQueue.Count() == 0;
|
||||
var response = client.Get("controller/playQueue");
|
||||
var dict = response.ResultAs<Dictionary<string, FirebaseSong>>();
|
||||
|
||||
PlayQueue.Clear();
|
||||
if (dict.Count() > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, FirebaseSong> entry in dict)
|
||||
{
|
||||
entry.Value.FirebaseId = entry.Key;
|
||||
}
|
||||
|
||||
var array = dict.Values.OrderBy(s => s.Order).ToArray();
|
||||
PlayQueue.AddRange(array);
|
||||
if (autoPlay)
|
||||
{
|
||||
GetNextSong();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CurrentSongChanged()
|
||||
{
|
||||
var response = client.Get("controller/currentSong");
|
||||
var dict = response.ResultAs<Dictionary<string, FirebaseSong>>();
|
||||
|
||||
var song = dict.Values.FirstOrDefault();
|
||||
if (song != null)
|
||||
{
|
||||
SongChanged(new ControllerSongChangedEventArgs(false, song));
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoteStateChanged(string state)
|
||||
{
|
||||
PlayerState s = PlayerState.Play;
|
||||
if(state.ToLower() == "pause")
|
||||
{
|
||||
s = PlayerState.Pause;
|
||||
}
|
||||
else if (state.ToLower() == "stop")
|
||||
{
|
||||
s = PlayerState.Stop;
|
||||
}
|
||||
else if (state == "next")
|
||||
{
|
||||
s = PlayerState.Next;
|
||||
}
|
||||
StateChanged(new ControllerStateChangedEventArgs(s));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
31
KaraokePlayer/Classes/Interfaces.cs
Normal file
31
KaraokePlayer/Classes/Interfaces.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using KaraokePlayer.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KaraokePlayer.Interfaces
|
||||
{
|
||||
public interface ISong
|
||||
{
|
||||
int Id { get; set; }
|
||||
int Order { get; set; }
|
||||
string Title { get; set; }
|
||||
string Artist { get; set; }
|
||||
FileType FileType { get; set; }
|
||||
string Path { get; set; }
|
||||
}
|
||||
|
||||
public interface IController
|
||||
{
|
||||
int Id { get; set; }
|
||||
List<ISong> PlayQueue { get; set; }
|
||||
void GetNextSong();
|
||||
void RemoveSong(ISong song);
|
||||
void Play();
|
||||
void Pause();
|
||||
void Stop();
|
||||
void Next();
|
||||
}
|
||||
}
|
||||
38
KaraokePlayer/Classes/PlayerDelegates.cs
Normal file
38
KaraokePlayer/Classes/PlayerDelegates.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using KaraokePlayer.Enums;
|
||||
using KaraokePlayer.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KaraokePlayer.Classes
|
||||
{
|
||||
public class ControllerStateChangedEventArgs: EventArgs
|
||||
{
|
||||
public ControllerStateChangedEventArgs(PlayerState state )
|
||||
{
|
||||
State = state;
|
||||
}
|
||||
public PlayerState State { get; }
|
||||
}
|
||||
public class ControllerSongChangedEventArgs
|
||||
{
|
||||
public ControllerSongChangedEventArgs(ISong song)
|
||||
{
|
||||
ShouldPlay = true;
|
||||
Song = song;
|
||||
}
|
||||
public ControllerSongChangedEventArgs(bool shouldPlay, ISong song)
|
||||
{
|
||||
ShouldPlay = shouldPlay;
|
||||
Song = song;
|
||||
}
|
||||
public ISong Song { get; }
|
||||
public bool ShouldPlay { get; }
|
||||
}
|
||||
|
||||
public delegate void ControllerStateChangedEventHandler(ControllerStateChangedEventArgs args);
|
||||
public delegate void ControllerSongChangedEventHandler(ControllerSongChangedEventArgs args);
|
||||
|
||||
}
|
||||
@ -12,6 +12,21 @@
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -42,16 +57,46 @@
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="FireSharp, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FireSharp.2.0.4\lib\portable-net45+sl5+wp8+win8\FireSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MaterialSkin, Version=0.0.3.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>lib\MaterialSkin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@ -61,12 +106,12 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="taglib-sharp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>lib\taglib-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Classes\Enums.cs" />
|
||||
<Compile Include="Classes\FirebaseController.cs" />
|
||||
<Compile Include="Classes\Interfaces.cs" />
|
||||
<Compile Include="Classes\PlayerDelegates.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -75,6 +120,12 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SongInfoForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SongInfoForm.Designer.cs">
|
||||
<DependentUpon>SongInfoForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -88,6 +139,9 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="SongInfoForm.resx">
|
||||
<DependentUpon>SongInfoForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="lib\vlc\plugins\plugins.dat" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
@ -412,15 +466,23 @@
|
||||
<Folder Include="lib\presets\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\herse.models\Herse.Models.csproj">
|
||||
<Project>{bde9bc7b-db3d-4a28-9902-b5d8d1965e5c}</Project>
|
||||
<Name>Herse.Models</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CdgPlayer\CdgPlayer.csproj">
|
||||
<Project>{a5324295-6bd2-4415-92cd-6ea77d708e00}</Project>
|
||||
<Name>CdgPlayer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>XCOPY "$(ProjectDir)lib" "$(TargetDir)lib\" /S /y /c</PostBuildEvent>
|
||||
|
||||
207
KaraokePlayer/MainForm.Designer.cs
generated
207
KaraokePlayer/MainForm.Designer.cs
generated
@ -30,24 +30,6 @@
|
||||
{
|
||||
this.karaokeCDGPlayer = new KaraokePlayer.KaraokeVideoPlayer();
|
||||
this.karaokeMP4Player = new KaraokePlayer.KaraokeVideoPlayer();
|
||||
this.btnPlay = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
this.btnBrowse = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnStop = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
this.btnPlayQueue = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.materialListBox1 = new MaterialSkin.Controls.MaterialListBox();
|
||||
this.materialSingleLineTextField1 = new MaterialSkin.Controls.MaterialSingleLineTextField();
|
||||
this.browseDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// karaokeCDGPlayer
|
||||
@ -56,7 +38,7 @@
|
||||
this.karaokeCDGPlayer.isCDG = true;
|
||||
this.karaokeCDGPlayer.Location = new System.Drawing.Point(0, 0);
|
||||
this.karaokeCDGPlayer.Name = "karaokeCDGPlayer";
|
||||
this.karaokeCDGPlayer.Size = new System.Drawing.Size(472, 458);
|
||||
this.karaokeCDGPlayer.Size = new System.Drawing.Size(1024, 768);
|
||||
this.karaokeCDGPlayer.TabIndex = 0;
|
||||
//
|
||||
// karaokeMP4Player
|
||||
@ -65,203 +47,24 @@
|
||||
this.karaokeMP4Player.isCDG = false;
|
||||
this.karaokeMP4Player.Location = new System.Drawing.Point(0, 0);
|
||||
this.karaokeMP4Player.Name = "karaokeMP4Player";
|
||||
this.karaokeMP4Player.Size = new System.Drawing.Size(472, 458);
|
||||
this.karaokeMP4Player.Size = new System.Drawing.Size(1024, 768);
|
||||
this.karaokeMP4Player.TabIndex = 0;
|
||||
//
|
||||
// btnPlay
|
||||
//
|
||||
this.btnPlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPlay.Depth = 0;
|
||||
this.btnPlay.Location = new System.Drawing.Point(542, 3);
|
||||
this.btnPlay.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.btnPlay.Name = "btnPlay";
|
||||
this.btnPlay.Size = new System.Drawing.Size(81, 37);
|
||||
this.btnPlay.TabIndex = 1;
|
||||
this.btnPlay.Text = "Play";
|
||||
this.btnPlay.UseVisualStyleBackColor = true;
|
||||
this.btnPlay.Click += new System.EventHandler(this.materialRaisedButton1_Click);
|
||||
//
|
||||
// btnBrowse
|
||||
//
|
||||
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBrowse.Depth = 0;
|
||||
this.btnBrowse.Location = new System.Drawing.Point(368, 3);
|
||||
this.btnBrowse.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.btnBrowse.Name = "btnBrowse";
|
||||
this.btnBrowse.Size = new System.Drawing.Size(81, 37);
|
||||
this.btnBrowse.TabIndex = 2;
|
||||
this.btnBrowse.Text = "Browse";
|
||||
this.btnBrowse.UseVisualStyleBackColor = true;
|
||||
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 0);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 71);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(719, 513);
|
||||
this.tableLayoutPanel1.TabIndex = 5;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnStop);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnPlay);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnPlayQueue);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnBrowse);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 467);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(713, 43);
|
||||
this.flowLayoutPanel1.TabIndex = 6;
|
||||
//
|
||||
// btnStop
|
||||
//
|
||||
this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnStop.Depth = 0;
|
||||
this.btnStop.Location = new System.Drawing.Point(629, 3);
|
||||
this.btnStop.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.btnStop.Name = "btnStop";
|
||||
this.btnStop.Size = new System.Drawing.Size(81, 37);
|
||||
this.btnStop.TabIndex = 4;
|
||||
this.btnStop.Text = "Stop";
|
||||
this.btnStop.UseVisualStyleBackColor = true;
|
||||
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
|
||||
//
|
||||
// btnPlayQueue
|
||||
//
|
||||
this.btnPlayQueue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPlayQueue.Depth = 0;
|
||||
this.btnPlayQueue.Location = new System.Drawing.Point(455, 3);
|
||||
this.btnPlayQueue.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.btnPlayQueue.Name = "btnPlayQueue";
|
||||
this.btnPlayQueue.Size = new System.Drawing.Size(81, 37);
|
||||
this.btnPlayQueue.TabIndex = 3;
|
||||
this.btnPlayQueue.Text = "Play Queue";
|
||||
this.btnPlayQueue.UseVisualStyleBackColor = true;
|
||||
this.btnPlayQueue.Click += new System.EventHandler(this.btnPlayQueue_Click);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(3, 3);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.karaokeCDGPlayer);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.karaokeMP4Player);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(713, 458);
|
||||
this.splitContainer1.SplitterDistance = 237;
|
||||
this.splitContainer1.TabIndex = 6;
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tableLayoutPanel2.ColumnCount = 1;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.Controls.Add(this.materialListBox1, 0, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.materialSingleLineTextField1, 0, 0);
|
||||
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 2;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(237, 458);
|
||||
this.tableLayoutPanel2.TabIndex = 7;
|
||||
//
|
||||
// materialListBox1
|
||||
//
|
||||
this.materialListBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.materialListBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.materialListBox1.Depth = 0;
|
||||
this.materialListBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.materialListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
|
||||
this.materialListBox1.Font = new System.Drawing.Font("Roboto", 24F);
|
||||
this.materialListBox1.FormattingEnabled = true;
|
||||
this.materialListBox1.Items.AddRange(new object[] {
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4"});
|
||||
this.materialListBox1.Location = new System.Drawing.Point(3, 32);
|
||||
this.materialListBox1.MouseLocation = new System.Drawing.Point(-1, -1);
|
||||
this.materialListBox1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.materialListBox1.Name = "materialListBox1";
|
||||
this.materialListBox1.Size = new System.Drawing.Size(231, 423);
|
||||
this.materialListBox1.TabIndex = 5;
|
||||
this.materialListBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.materialListBox1_MouseDoubleClick);
|
||||
//
|
||||
// materialSingleLineTextField1
|
||||
//
|
||||
this.materialSingleLineTextField1.Depth = 0;
|
||||
this.materialSingleLineTextField1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.materialSingleLineTextField1.Hint = "";
|
||||
this.materialSingleLineTextField1.Location = new System.Drawing.Point(3, 3);
|
||||
this.materialSingleLineTextField1.MaxLength = 32767;
|
||||
this.materialSingleLineTextField1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.materialSingleLineTextField1.Name = "materialSingleLineTextField1";
|
||||
this.materialSingleLineTextField1.PasswordChar = '\0';
|
||||
this.materialSingleLineTextField1.SelectedText = "";
|
||||
this.materialSingleLineTextField1.SelectionLength = 0;
|
||||
this.materialSingleLineTextField1.SelectionStart = 0;
|
||||
this.materialSingleLineTextField1.Size = new System.Drawing.Size(231, 23);
|
||||
this.materialSingleLineTextField1.TabIndex = 6;
|
||||
this.materialSingleLineTextField1.TabStop = false;
|
||||
this.materialSingleLineTextField1.UseSystemPasswordChar = false;
|
||||
this.materialSingleLineTextField1.TextChanged += new System.EventHandler(this.materialSingleLineTextField1_TextChanged);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(743, 596);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.ClientSize = new System.Drawing.Size(1024, 768);
|
||||
this.Controls.Add(this.karaokeMP4Player);
|
||||
this.Controls.Add(this.karaokeCDGPlayer);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "Karaoke Player";
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnPlay;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnBrowse;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.FolderBrowserDialog browseDialog;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private KaraokeVideoPlayer karaokeCDGPlayer;
|
||||
private KaraokeVideoPlayer karaokeMP4Player;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private MaterialSkin.Controls.MaterialListBox materialListBox1;
|
||||
private MaterialSkin.Controls.MaterialSingleLineTextField materialSingleLineTextField1;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnPlayQueue;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnStop;
|
||||
}
|
||||
}
|
||||
@ -5,18 +5,21 @@ using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Herse.Models;
|
||||
using System.IO.Compression;
|
||||
using System.Windows.Forms;
|
||||
using KaraokePlayer.Interfaces;
|
||||
using KaraokePlayer.Classes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KaraokePlayer
|
||||
{
|
||||
public partial class MainForm : MaterialForm
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
HerseDb db = new HerseDb();
|
||||
private readonly MaterialSkinManager _materialSkinManager;
|
||||
private List<Song> _fileList;
|
||||
private Song currentSong = null;
|
||||
private SongInfoForm songInfoForm = new SongInfoForm();
|
||||
private delegate void Action();
|
||||
private KaraokeVideoPlayer currentPlayer = null;
|
||||
private IController controller;
|
||||
private ISong currentSong;
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -24,78 +27,96 @@ namespace KaraokePlayer
|
||||
karaokeMP4Player.setup(false, true);
|
||||
karaokeCDGPlayer.songEndedHandler += new KaraokePlayer.KaraokeVideoPlayer.SongEndedEventHandler(this.karaokePlayerSongEnded);
|
||||
karaokeMP4Player.songEndedHandler += new KaraokePlayer.KaraokeVideoPlayer.SongEndedEventHandler(this.karaokePlayerSongEnded);
|
||||
// Initialize MaterialSkinManager
|
||||
_materialSkinManager = MaterialSkinManager.Instance;
|
||||
_materialSkinManager.AddFormToManage(this);
|
||||
//_materialSkinManager.Theme = new DarkTheme();
|
||||
_materialSkinManager.ColorScheme = new ColorScheme(Primary.Green600, Primary.Green700, Primary.Green200, Accent.Red100, TextShade.WHITE);
|
||||
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
this.ShowInTaskbar = false;
|
||||
karaokeCDGPlayer.Dock = DockStyle.Fill;
|
||||
karaokeMP4Player.Dock = DockStyle.Fill;
|
||||
|
||||
controller = new FirebaseController(
|
||||
stateChanged: (args) =>
|
||||
{
|
||||
if(args.State == Enums.PlayerState.Play)
|
||||
{
|
||||
this.Invoke(new Action(()=> { play(); }));
|
||||
}
|
||||
else if (args.State == Enums.PlayerState.Pause)
|
||||
{
|
||||
this.Invoke(new Action(() => { pause(); }));
|
||||
}
|
||||
else if (args.State == Enums.PlayerState.Next)
|
||||
{
|
||||
this.Invoke(new Action(() => { next(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() => { stop(); }));
|
||||
}
|
||||
},
|
||||
songChanged: (args) =>
|
||||
{
|
||||
this.Invoke(new Action(() => { stop(); }));
|
||||
currentSong = args.Song;
|
||||
this.Invoke(new Action(() => { previewSong(); }));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void materialRaisedButton1_Click(object sender, System.EventArgs e)
|
||||
private async void previewSong()
|
||||
{
|
||||
playSelectedFile();
|
||||
songInfoForm.Update(currentSong);
|
||||
songInfoForm.Show();
|
||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||
controller.Play();
|
||||
songInfoForm.Hide();
|
||||
}
|
||||
|
||||
private void btnBrowse_Click(object sender, EventArgs e)
|
||||
private void karaokePlayerSongEnded(object sender, EventArgs e)
|
||||
{
|
||||
if (browseDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
next();
|
||||
}
|
||||
|
||||
private void next()
|
||||
{
|
||||
controller.RemoveSong(currentSong);
|
||||
controller.GetNextSong();
|
||||
}
|
||||
|
||||
private void stop()
|
||||
{
|
||||
if (currentPlayer == null) return;
|
||||
currentPlayer.Stop();
|
||||
}
|
||||
private void pause()
|
||||
{
|
||||
if (currentPlayer == null) return;
|
||||
currentPlayer.Pause();
|
||||
}
|
||||
|
||||
private void play()
|
||||
{
|
||||
if (currentSong == null) return;
|
||||
if (currentPlayer != null && currentPlayer.isPaused)
|
||||
{
|
||||
var files = GetFiles(browseDialog.SelectedPath, "*.cdg|*.mp4|*.zip", searchOption: System.IO.SearchOption.AllDirectories);
|
||||
var filtered = files.Where(f => f.Length < 248).ToList();
|
||||
|
||||
_fileList = filtered.Select(file => CreateSongForPath(file)).ToList();
|
||||
materialListBox1.DataSource = _fileList;
|
||||
materialListBox1.DisplayMember = "Description";
|
||||
|
||||
currentPlayer.Resume();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void materialListBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
int index = this.materialListBox1.IndexFromPoint(e.Location);
|
||||
if (index != System.Windows.Forms.ListBox.NoMatches)
|
||||
{
|
||||
playSelectedFile();
|
||||
}
|
||||
}
|
||||
|
||||
private void materialSingleLineTextField1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
materialListBox1.DataSource = _fileList.Where(
|
||||
file => Regex.IsMatch(file.FullPath, materialSingleLineTextField1.Text, RegexOptions.IgnoreCase)).ToList();
|
||||
}
|
||||
|
||||
public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
string[] searchPatterns = searchPattern.Split('|');
|
||||
List<string> files = new List<string>();
|
||||
foreach (string sp in searchPatterns)
|
||||
files.AddRange(System.IO.Directory.GetFiles(path, sp, searchOption));
|
||||
files.Sort();
|
||||
return files.ToArray();
|
||||
}
|
||||
|
||||
public void playSelectedFile()
|
||||
{
|
||||
btnStop_Click(null, null);
|
||||
|
||||
Song file = (Song)materialListBox1.SelectedItem;
|
||||
currentSong = file;
|
||||
if (file.Extension == ".cdg")
|
||||
if (currentSong.FileType == Enums.FileType.CDG)
|
||||
{
|
||||
currentPlayer = karaokeCDGPlayer;
|
||||
karaokeCDGPlayer.Play(new Uri(Path.ChangeExtension(file.FullPath, ".mp3")));
|
||||
karaokeCDGPlayer.Play(new Uri(Path.ChangeExtension(currentSong.Path, ".mp3")));
|
||||
karaokeCDGPlayer.Visible = true;
|
||||
karaokeMP4Player.Visible = false;
|
||||
karaokeMP4Player.Stop();
|
||||
}
|
||||
else if (file.Extension == ".zip")
|
||||
else if (currentSong.FileType == Enums.FileType.ZIP)
|
||||
{
|
||||
string playPath = null;
|
||||
string extractPath = Path.Combine(Directory.GetCurrentDirectory(), "temp");
|
||||
DeleteDirectory(extractPath);
|
||||
Directory.CreateDirectory(extractPath);
|
||||
using (ZipArchive archive = ZipFile.OpenRead(file.FullPath))
|
||||
using (ZipArchive archive = ZipFile.OpenRead(currentSong.Path))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
@ -117,31 +138,14 @@ namespace KaraokePlayer
|
||||
}
|
||||
else {
|
||||
currentPlayer = karaokeMP4Player;
|
||||
karaokeMP4Player.Play(new Uri(file.FullPath));
|
||||
karaokeMP4Player.Play(new Uri(currentSong.Path));
|
||||
karaokeMP4Player.Visible = true;
|
||||
karaokeCDGPlayer.Visible = false;
|
||||
karaokeCDGPlayer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void karaokePlayerSongEnded(object sender, EventArgs e)
|
||||
{
|
||||
//here
|
||||
}
|
||||
|
||||
private void btnStop_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentPlayer == null) return;
|
||||
currentPlayer.Stop();
|
||||
}
|
||||
|
||||
private Song CreateSongForPath(string path)
|
||||
{
|
||||
Song song = new Song(path);
|
||||
return song;
|
||||
}
|
||||
|
||||
public void DeleteDirectory(string target_dir)
|
||||
|
||||
private void DeleteDirectory(string target_dir)
|
||||
{
|
||||
if (!Directory.Exists(target_dir)) { return; }
|
||||
string[] files = Directory.GetFiles(target_dir);
|
||||
@ -160,12 +164,5 @@ namespace KaraokePlayer
|
||||
|
||||
Directory.Delete(target_dir, false);
|
||||
}
|
||||
|
||||
private void btnPlayQueue_Click(object sender, EventArgs e)
|
||||
{
|
||||
_fileList = db.Songs.Where(s => s.Id > 0).OrderBy(s=>s.Artist).ThenBy(s=>s.Title).ToList();
|
||||
materialListBox1.DataSource = _fileList;
|
||||
materialListBox1.DisplayMember = "Description";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
67
KaraokePlayer/SongInfoForm.Designer.cs
generated
Normal file
67
KaraokePlayer/SongInfoForm.Designer.cs
generated
Normal file
@ -0,0 +1,67 @@
|
||||
using KaraokePlayer.Interfaces;
|
||||
|
||||
namespace KaraokePlayer
|
||||
{
|
||||
partial class SongInfoForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.previewLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// previewLabel
|
||||
//
|
||||
this.previewLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.previewLabel.Font = new System.Drawing.Font("Century Gothic", 60F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.previewLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.previewLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.previewLabel.Margin = new System.Windows.Forms.Padding(3, 100, 3, 0);
|
||||
this.previewLabel.Name = "previewLabel";
|
||||
this.previewLabel.Padding = new System.Windows.Forms.Padding(0, 100, 0, 0);
|
||||
this.previewLabel.Size = new System.Drawing.Size(1008, 729);
|
||||
this.previewLabel.TabIndex = 0;
|
||||
this.previewLabel.Text = "This is the first line\r\n\r\nAnd this is the second line.";
|
||||
this.previewLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// SongInfoForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(1008, 729);
|
||||
this.Controls.Add(this.previewLabel);
|
||||
this.Name = "SongInfoForm";
|
||||
this.Text = "SongInfoForm";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label previewLabel;
|
||||
}
|
||||
}
|
||||
29
KaraokePlayer/SongInfoForm.cs
Normal file
29
KaraokePlayer/SongInfoForm.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using KaraokePlayer.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace KaraokePlayer
|
||||
{
|
||||
public partial class SongInfoForm : Form
|
||||
{
|
||||
public SongInfoForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
this.ShowInTaskbar = false;
|
||||
}
|
||||
|
||||
public void Update(ISong song)
|
||||
{
|
||||
previewLabel.Text = "Up Next:" + "\r\n\r\n" + song.Artist + "\r\n\r\n\r\n" + song.Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
KaraokePlayer/SongInfoForm.resx
Normal file
120
KaraokePlayer/SongInfoForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
|
||||
<package id="FireSharp" version="2.0.4" targetFramework="net46" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net46" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net46" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net46" />
|
||||
<package id="Microsoft.Bcl.Compression" version="3.9.85" targetFramework="net46" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net46" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net46" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user