Compare commits
No commits in common. "43734e0993ea10dbb89e84af6579e059d869d547" and "6d0ed4606d4a7618f63496d6f17c82a111521950" have entirely different histories.
43734e0993
...
6d0ed4606d
|
@ -1,405 +1,80 @@
|
||||||
# globs
|
# ---> VisualStudioCode
|
||||||
Makefile.in
|
.vscode/*
|
||||||
*.userprefs
|
!.vscode/settings.json
|
||||||
*.usertasks
|
!.vscode/tasks.json
|
||||||
config.make
|
!.vscode/launch.json
|
||||||
config.status
|
!.vscode/extensions.json
|
||||||
aclocal.m4
|
*.code-workspace
|
||||||
install-sh
|
|
||||||
autom4te.cache/
|
# Local History for Visual Studio Code
|
||||||
*.tar.gz
|
.history/
|
||||||
tarballs/
|
|
||||||
test-results/
|
# ---> macOS
|
||||||
|
# General
|
||||||
# Mac bundle stuff
|
.DS_Store
|
||||||
*.dmg
|
.AppleDouble
|
||||||
*.app
|
.LSOverride
|
||||||
|
|
||||||
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
# Icon must end with two \r
|
||||||
# General
|
Icon
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
# Thumbnails
|
||||||
.LSOverride
|
._*
|
||||||
|
|
||||||
# Icon must end with two \r
|
# Files that might appear in the root of a volume
|
||||||
Icon
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
# Thumbnails
|
.TemporaryItems
|
||||||
._*
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
# Files that might appear in the root of a volume
|
.com.apple.timemachine.donotpresent
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
# Directories potentially created on remote AFP share
|
||||||
.Spotlight-V100
|
.AppleDB
|
||||||
.TemporaryItems
|
.AppleDesktop
|
||||||
.Trashes
|
Network Trash Folder
|
||||||
.VolumeIcon.icns
|
Temporary Items
|
||||||
.com.apple.timemachine.donotpresent
|
.apdisk
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
# ---> Linux
|
||||||
.AppleDB
|
*~
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
Temporary Items
|
.fuse_hidden*
|
||||||
.apdisk
|
|
||||||
|
# KDE directory preferences
|
||||||
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
|
.directory
|
||||||
# Windows thumbnail cache files
|
|
||||||
Thumbs.db
|
# Linux trash folder which might appear on any partition or disk
|
||||||
ehthumbs.db
|
.Trash-*
|
||||||
ehthumbs_vista.db
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
# Dump file
|
.nfs*
|
||||||
*.stackdump
|
|
||||||
|
# ---> Windows
|
||||||
# Folder config file
|
# Windows thumbnail cache files
|
||||||
[Dd]esktop.ini
|
Thumbs.db
|
||||||
|
Thumbs.db:encryptable
|
||||||
# Recycle Bin used on file shares
|
ehthumbs.db
|
||||||
$RECYCLE.BIN/
|
ehthumbs_vista.db
|
||||||
|
|
||||||
# Windows Installer files
|
# Dump file
|
||||||
*.cab
|
*.stackdump
|
||||||
*.msi
|
|
||||||
*.msix
|
# Folder config file
|
||||||
*.msm
|
[Dd]esktop.ini
|
||||||
*.msp
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
# Windows shortcuts
|
$RECYCLE.BIN/
|
||||||
*.lnk
|
|
||||||
|
# Windows Installer files
|
||||||
# content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
*.cab
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
*.msi
|
||||||
## files generated by popular Visual Studio add-ons.
|
*.msix
|
||||||
##
|
*.msm
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
*.msp
|
||||||
|
|
||||||
# User-specific files
|
# Windows shortcuts
|
||||||
*.suo
|
*.lnk
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUNIT
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
|
||||||
.JustCode
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
17
VCinema.sln
17
VCinema.sln
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 15
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCinemaApi", "VCinema\VCinemaApi.csproj", "{CF731C3C-2EB8-4C7A-B0BA-556B5CB74106}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{CF731C3C-2EB8-4C7A-B0BA-556B5CB74106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{CF731C3C-2EB8-4C7A-B0BA-556B5CB74106}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{CF731C3C-2EB8-4C7A-B0BA-556B5CB74106}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{CF731C3C-2EB8-4C7A-B0BA-556B5CB74106}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
|
@ -1,15 +0,0 @@
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Hubs
|
|
||||||
{
|
|
||||||
public interface IVCinemaHub
|
|
||||||
{
|
|
||||||
public Screen CreateScreen(string name, string source);
|
|
||||||
public void DeleteScreen(int screenId);
|
|
||||||
public Screen WatchScreen(int screenId);
|
|
||||||
public void LeaveScreen();
|
|
||||||
public Watcher SetWatcherName(string name);
|
|
||||||
public Screen SetPlayState(bool playing);
|
|
||||||
public void SetPlayState(bool playing, int playOffset);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.SignalR;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
using VCinemaApi.Repositories;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Hubs
|
|
||||||
{
|
|
||||||
public class VCinemaHub : Hub<IVCinemaHub>
|
|
||||||
{
|
|
||||||
private readonly IScreenRepository _screenRepository;
|
|
||||||
private readonly IWatcherRepository _watcherRepository;
|
|
||||||
|
|
||||||
public VCinemaHub(IScreenRepository screenRepository, IWatcherRepository watcherRepository)
|
|
||||||
{
|
|
||||||
_screenRepository = screenRepository;
|
|
||||||
_watcherRepository = watcherRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task OnConnectedAsync()
|
|
||||||
{
|
|
||||||
_watcherRepository.AddWatcher(Context.ConnectionId);
|
|
||||||
await base.OnConnectedAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task OnDisconnectedAsync(Exception exception)
|
|
||||||
{
|
|
||||||
_watcherRepository.DeleteWatcherByConnectionId(Context.ConnectionId);
|
|
||||||
await base.OnDisconnectedAsync(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen CreateScreen(string name, string source)
|
|
||||||
{
|
|
||||||
return _screenRepository.AddScreen(name, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteScreen(int screenId)
|
|
||||||
{
|
|
||||||
_screenRepository.DeleteScreenById(screenId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen WatchScreen(int screenId)
|
|
||||||
{
|
|
||||||
var watcher = _watcherRepository.SetWatcherScreenByConnectionId(Context.ConnectionId, screenId);
|
|
||||||
return watcher.Screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LeaveScreen()
|
|
||||||
{
|
|
||||||
_watcherRepository.UnsetWatcherScreenByConnectionId(Context.ConnectionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher SetWatcherName(string name)
|
|
||||||
{
|
|
||||||
return _watcherRepository.SetWatcherNameByConnectionId(Context.ConnectionId, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen SetPlayState(bool playing)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen SetPlayState(bool playing, int playOffset)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Models
|
|
||||||
{
|
|
||||||
public class Screen
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int ScreenId { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[Required]
|
|
||||||
public string Source { get; set; }
|
|
||||||
|
|
||||||
public DateTime PlayStateUpdated { get; set; }
|
|
||||||
public bool PlayState { get; set; }
|
|
||||||
public int PlayOffset { get; set; }
|
|
||||||
|
|
||||||
public ICollection<Watcher> Watchers { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
namespace VCinemaApi.Models
|
|
||||||
{
|
|
||||||
public class VCinemaContext : DbContext
|
|
||||||
{
|
|
||||||
public VCinemaContext(DbContextOptions<VCinemaContext> options): base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public DbSet<Watcher> Watchers { get; set; }
|
|
||||||
public DbSet<Screen> Screens { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Models
|
|
||||||
{
|
|
||||||
public class Watcher
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int WatcherId { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string ConnectionId { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
public Screen Screen { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
|
|
||||||
namespace VCinemaApi
|
|
||||||
{
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
CreateHostBuilder(args).Build().Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
||||||
Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
|
||||||
{
|
|
||||||
webBuilder.UseStartup<Startup>();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:36425",
|
|
||||||
"sslPort": 44359
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"launchUrl": "weatherforecast",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"VCinema": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"launchUrl": "weatherforecast",
|
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public interface IScreenRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Screen> GetScreens();
|
|
||||||
Screen GetScreenById(int id);
|
|
||||||
Screen AddScreen(string name, string source);
|
|
||||||
void DeleteScreenById(int id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public interface IWatcherRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Watcher> GetWatchersByScreenId(int screenId);
|
|
||||||
Watcher GetWatcherByConnectionId(string connectionId);
|
|
||||||
Watcher AddWatcher(string connectionId);
|
|
||||||
Watcher SetWatcherNameByConnectionId(string connectionId, string name);
|
|
||||||
Watcher SetWatcherScreenByConnectionId(string connectionId, int screenId);
|
|
||||||
Watcher UnsetWatcherScreenByConnectionId(string connectionId);
|
|
||||||
void DeleteWatcherByConnectionId(string connectionId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public class MockScreenRepository : IScreenRepository
|
|
||||||
{
|
|
||||||
public IEnumerable<Screen> GetScreens()
|
|
||||||
{
|
|
||||||
return new List<Screen>
|
|
||||||
{
|
|
||||||
new Screen {
|
|
||||||
ScreenId = 1,
|
|
||||||
Name = "Kirby's screen",
|
|
||||||
Source = "https://vcinema.b-cdn.net/shrek.mp4",
|
|
||||||
PlayStateUpdated = new DateTime(2020, 9, 21, 21, 02, 57),
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 1337
|
|
||||||
},
|
|
||||||
new Screen {
|
|
||||||
ScreenId = 2,
|
|
||||||
Name = "Sid's screen",
|
|
||||||
Source = "https://vcinema.b-cdn.net/weeb.mp4",
|
|
||||||
PlayStateUpdated = new DateTime(2020, 9, 21, 21, 03, 22),
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 69
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen GetScreenById(int id)
|
|
||||||
{
|
|
||||||
return new Screen
|
|
||||||
{
|
|
||||||
ScreenId = id,
|
|
||||||
Name = "Kirby's screen",
|
|
||||||
Source = "https://vcinema.b-cdn.net/shrek.mp4",
|
|
||||||
PlayStateUpdated = DateTime.UtcNow,
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 1337
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen AddScreen(string name, string source)
|
|
||||||
{
|
|
||||||
return new Screen
|
|
||||||
{
|
|
||||||
ScreenId = 1,
|
|
||||||
Name = name,
|
|
||||||
Source = source,
|
|
||||||
PlayStateUpdated = DateTime.UtcNow,
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 1337
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteScreenById(int screenId)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public class MockWatcherRepository : IWatcherRepository
|
|
||||||
{
|
|
||||||
public IEnumerable<Watcher> GetWatchersByScreenId(int screenId)
|
|
||||||
{
|
|
||||||
var screen = new Screen
|
|
||||||
{
|
|
||||||
ScreenId = 1,
|
|
||||||
Name = "Kirby's screen",
|
|
||||||
Source = "https://vcinema.b-cdn.net/shrek.mp4",
|
|
||||||
PlayStateUpdated = new DateTime(2020, 9, 21, 21, 02, 57),
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 1337
|
|
||||||
};
|
|
||||||
|
|
||||||
return new List<Watcher>
|
|
||||||
{
|
|
||||||
new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = "dJSbEc73n6YjGIhj-SZz1Q",
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = screen
|
|
||||||
},
|
|
||||||
new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 2,
|
|
||||||
ConnectionId = "rNA9Jn7ytYPzQfFJ-j3NBa",
|
|
||||||
Name = "Jack",
|
|
||||||
Screen = screen
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher GetWatcherByConnectionId(string connectionId)
|
|
||||||
{
|
|
||||||
return new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = "dJSbEc73n6YjGIhj-SZz1Q",
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher AddWatcher(string connectionId)
|
|
||||||
{
|
|
||||||
return new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = connectionId,
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher SetWatcherName(string connectionId, string name)
|
|
||||||
{
|
|
||||||
return new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = connectionId,
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher SetWatcherScreen(string connectionId, int screenId)
|
|
||||||
{
|
|
||||||
return new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = connectionId,
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = new Screen
|
|
||||||
{
|
|
||||||
ScreenId = screenId,
|
|
||||||
Name = "Kirby's screen",
|
|
||||||
Source = "https://vcinema.b-cdn.net/shrek.mp4",
|
|
||||||
PlayStateUpdated = new DateTime(2020, 9, 21, 21, 02, 57),
|
|
||||||
PlayState = true,
|
|
||||||
PlayOffset = 1337
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher UnsetWatcherScreen(string connectionId)
|
|
||||||
{
|
|
||||||
return new Watcher
|
|
||||||
{
|
|
||||||
WatcherId = 1,
|
|
||||||
ConnectionId = connectionId,
|
|
||||||
Name = "Kirby",
|
|
||||||
Screen = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteWatcher(string connectionId)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public class ScreenRepository : IScreenRepository
|
|
||||||
{
|
|
||||||
private readonly VCinemaContext _context;
|
|
||||||
|
|
||||||
public ScreenRepository(VCinemaContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Screen> GetScreens()
|
|
||||||
{
|
|
||||||
return _context.Screens.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen GetScreenById(int id)
|
|
||||||
{
|
|
||||||
return _context.Screens.Find(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Screen AddScreen(string name, string source)
|
|
||||||
{
|
|
||||||
var screen = new Screen
|
|
||||||
{
|
|
||||||
Name = name,
|
|
||||||
Source = source
|
|
||||||
};
|
|
||||||
|
|
||||||
_context.Screens.Add(screen);
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteScreenById(int screenId)
|
|
||||||
{
|
|
||||||
var screen = GetScreenById(screenId);
|
|
||||||
_context.Screens.Remove(screen);
|
|
||||||
_context.SaveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
|
|
||||||
namespace VCinemaApi.Repositories
|
|
||||||
{
|
|
||||||
public class WatcherRepository : IWatcherRepository
|
|
||||||
{
|
|
||||||
private readonly VCinemaContext _context;
|
|
||||||
|
|
||||||
public WatcherRepository(VCinemaContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Watcher> GetWatchersByScreenId(int screenId)
|
|
||||||
{
|
|
||||||
return _context.Watchers.Where(watcher => watcher.Screen.ScreenId == screenId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher GetWatcherByConnectionId(string connectionId)
|
|
||||||
{
|
|
||||||
return _context.Watchers.SingleOrDefault(watcher => watcher.ConnectionId == connectionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher AddWatcher(string connectionId)
|
|
||||||
{
|
|
||||||
var watcher = new Watcher()
|
|
||||||
{
|
|
||||||
ConnectionId = connectionId,
|
|
||||||
};
|
|
||||||
|
|
||||||
_context.Watchers.Add(watcher);
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return watcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher SetWatcherNameByConnectionId(string connectionId, string name)
|
|
||||||
{
|
|
||||||
var watcher = GetWatcherByConnectionId(connectionId);
|
|
||||||
|
|
||||||
watcher.Name = name;
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return watcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher SetWatcherScreenByConnectionId(string connectionId, int screenId)
|
|
||||||
{
|
|
||||||
var watcher = GetWatcherByConnectionId(connectionId);
|
|
||||||
var screen = _context.Screens.Find(screenId);
|
|
||||||
|
|
||||||
watcher.Screen = screen;
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return watcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watcher UnsetWatcherScreenByConnectionId(string connectionId)
|
|
||||||
{
|
|
||||||
var watcher = GetWatcherByConnectionId(connectionId);
|
|
||||||
|
|
||||||
watcher.Screen = null;
|
|
||||||
_context.SaveChanges();
|
|
||||||
|
|
||||||
return watcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteWatcherByConnectionId(string connectionId)
|
|
||||||
{
|
|
||||||
var watcher = GetWatcherByConnectionId(connectionId);
|
|
||||||
_context.Watchers.Remove(watcher);
|
|
||||||
_context.SaveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using VCinemaApi.Hubs;
|
|
||||||
using VCinemaApi.Models;
|
|
||||||
using VCinemaApi.Repositories;
|
|
||||||
|
|
||||||
namespace VCinemaApi
|
|
||||||
{
|
|
||||||
public class Startup
|
|
||||||
{
|
|
||||||
public Startup(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
Configuration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddDbContext<VCinemaContext>(options => options.UseInMemoryDatabase("VCinema"));
|
|
||||||
services.AddScoped<IScreenRepository, ScreenRepository>();
|
|
||||||
services.AddScoped<IWatcherRepository, WatcherRepository>();
|
|
||||||
services.AddControllers();
|
|
||||||
services.AddSignalR();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
||||||
{
|
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
//app.UseHttpsRedirection();
|
|
||||||
app.UseDefaultFiles();
|
|
||||||
app.UseStaticFiles();
|
|
||||||
app.UseRouting();
|
|
||||||
app.UseAuthorization();
|
|
||||||
app.UseEndpoints(endpoints =>
|
|
||||||
{
|
|
||||||
endpoints.MapHub<VCinemaHub>("/vcinemahub");
|
|
||||||
endpoints.MapControllers();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'VCinema' " />
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Models\" />
|
|
||||||
<Folder Include="Hubs\" />
|
|
||||||
<Folder Include="wwwroot\" />
|
|
||||||
<Folder Include="wwwroot\js\" />
|
|
||||||
<Folder Include="Repositories\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.8" />
|
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.8" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft": "Warning",
|
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft": "Warning",
|
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"version": "1.0",
|
|
||||||
"defaultProvider": "unpkg",
|
|
||||||
"libraries": [
|
|
||||||
{
|
|
||||||
"library": "@microsoft/signalr@latest",
|
|
||||||
"destination": "wwwroot/js/signalr",
|
|
||||||
"files": [
|
|
||||||
"dist/browser/signalr.js",
|
|
||||||
"dist/browser/signalr.min.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title></title>
|
|
||||||
<script src="/js/signalr/dist/browser/signalr.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
Hello, World! :-)
|
|
||||||
<script>
|
|
||||||
var connection = new signalR.HubConnectionBuilder().withUrl("/vcinemahub").build();
|
|
||||||
|
|
||||||
connection.on("GetScreens", function (obj) {
|
|
||||||
console.log(obj);
|
|
||||||
});
|
|
||||||
|
|
||||||
connection.start();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue