Added setup and minor fixes

This commit is contained in:
Vova
2024-01-30 18:35:11 +02:00
parent 9b8e8a835a
commit 3dfeea71f0
6 changed files with 13963 additions and 4 deletions
+6
View File
@@ -7,12 +7,18 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ApplicationIcon>icon.ico</ApplicationIcon>
<AssemblyName>TV Player</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Assets\bkGround.jpg" /> <None Remove="Assets\bkGround.jpg" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="LibVLCSharp" Version="3.8.2"> <PackageReference Include="LibVLCSharp" Version="3.8.2">
+7 -4
View File
@@ -5,7 +5,8 @@ namespace TV_Player.ViewModels
{ {
public static class SettingsModel public static class SettingsModel
{ {
private const string _filePath = "settings.json"; private static readonly string AppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TVPlayer");
private static readonly string SettingsFilePath = Path.Combine(AppDataFolder, "settings.json");
public static string PlaylistURL { get; set; } public static string PlaylistURL { get; set; }
public static bool StartFullScreen { get; set; } public static bool StartFullScreen { get; set; }
@@ -31,8 +32,10 @@ namespace TV_Player.ViewModels
// Serialize the object to JSON // Serialize the object to JSON
string json = JsonConvert.SerializeObject(dataToSerialize, Formatting.Indented); string json = JsonConvert.SerializeObject(dataToSerialize, Formatting.Indented);
if (!Directory.Exists(AppDataFolder))
Directory.CreateDirectory(AppDataFolder);
// Save the JSON to a file // Save the JSON to a file
File.WriteAllText(_filePath, json); File.WriteAllText(SettingsFilePath, json);
} }
public static void LoadSettings() public static void LoadSettings()
@@ -46,10 +49,10 @@ namespace TV_Player.ViewModels
StartFromLastScreen = default(bool), StartFromLastScreen = default(bool),
StartFullScreen = default(bool) StartFullScreen = default(bool)
}; };
if (File.Exists(_filePath)) if (File.Exists(SettingsFilePath))
{ {
// Read the JSON content from the file // Read the JSON content from the file
string json = File.ReadAllText(_filePath); string json = File.ReadAllText(SettingsFilePath);
loadedData = JsonConvert.DeserializeAnonymousType(json, loadedData); loadedData = JsonConvert.DeserializeAnonymousType(json, loadedData);
} }
// Assign the values to the properties // Assign the values to the properties
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

+4
View File
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TV Player WPF", "TV Player
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TV Player MAUI", "TV Player\TV Player MAUI.csproj", "{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TV Player MAUI", "TV Player\TV Player MAUI.csproj", "{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}"
EndProject EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TVPlayerSetup", "TVPlayerSetup\TVPlayerSetup.vdproj", "{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -23,6 +25,8 @@ Global
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Build.0 = Release|Any CPU {4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Build.0 = Release|Any CPU
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Deploy.0 = Release|Any CPU {4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Deploy.0 = Release|Any CPU
{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}.Debug|Any CPU.ActiveCfg = Debug
{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
File diff suppressed because it is too large Load Diff