-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
SnackTime.Core/Episodes/EpisodesProvider.cs → ...e.Core/Media/Episodes/EpisodesProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
SnackTime.Core/Series/SeriesProvider.cs → ...kTime.Core/Media/Series/SeriesProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace SnackTime.Core.Process | ||
{ | ||
public class ProcessManager : IProcessManager | ||
{ | ||
private readonly Dictionary<string, System.Diagnostics.Process> _process; | ||
|
||
public ProcessManager() | ||
{ | ||
_process = new Dictionary<string, System.Diagnostics.Process>(); | ||
} | ||
|
||
|
||
public void StartProcess(string path, string[] args = null) | ||
{ | ||
if (IsProcessRunning(path)) return; | ||
|
||
var process = System.Diagnostics.Process.Start(path, string.Join(" ", args)); | ||
_process.Add(path, process); | ||
System.Diagnostics.Process.Start(path, string.Join(" ", args)); | ||
} | ||
|
||
public bool IsProcessRunning(string path) | ||
{ | ||
if (!_process.ContainsKey(path)) | ||
return false; | ||
|
||
if (!_process[path].HasExited) return true; | ||
|
||
_process.Remove(path); | ||
return false; | ||
return GetProcessFromPath(path) == null; | ||
} | ||
|
||
public void StopProcess(string path) | ||
public System.Diagnostics.Process GetProcessFromPath(string path) | ||
{ | ||
if (IsProcessRunning(path)) | ||
_process[path].Kill(); | ||
var processes = System.Diagnostics.Process.GetProcesses(); | ||
return processes.Where(process => | ||
{ | ||
try | ||
{ | ||
if (process.MainModule.FileName == path) | ||
{ | ||
return true; | ||
} | ||
} | ||
catch | ||
{ | ||
// ignored | ||
} | ||
|
||
return false; | ||
}).SingleOrDefault(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using System.Threading; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace SnackTime.Core.Settings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,8 @@ | |
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Media" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters