diff --git a/LANCommander/LANCommander.csproj b/LANCommander/LANCommander.csproj index a19fcde..5e95cfd 100644 --- a/LANCommander/LANCommander.csproj +++ b/LANCommander/LANCommander.csproj @@ -10,6 +10,16 @@ + + WINDOWS + + + LINUX + + + MACOS + + @@ -64,6 +74,12 @@ + + + PreserveNewest + + + Never diff --git a/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor b/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor index 310c10c..488e315 100644 --- a/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor +++ b/LANCommander/Pages/Dashboard/Charts/NetworkDownloadRate.razor @@ -65,6 +65,7 @@ private async Task RefreshData() { + #if WINDOWS var category = new PerformanceCounterCategory("Network Interface"); foreach (var instance in category.GetInstanceNames()) @@ -83,5 +84,6 @@ await Chart.ChangeData(Data.SelectMany(x => x.Value.Select((y, i) => new { value = y, index = i, series = x.Key })), true); } catch { } + #endif } } diff --git a/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor b/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor index 7fcf5d2..55498a2 100644 --- a/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor +++ b/LANCommander/Pages/Dashboard/Charts/NetworkUploadRate.razor @@ -65,6 +65,7 @@ private async Task RefreshData() { + #if WINDOWS var category = new PerformanceCounterCategory("Network Interface"); foreach (var instance in category.GetInstanceNames()) @@ -83,5 +84,6 @@ await Chart.ChangeData(Data.SelectMany(x => x.Value.Select((y, i) => new { value = y, index = i, series = x.Key })), true); } catch { } + #endif } } diff --git a/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor b/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor index 927fb32..774bdfd 100644 --- a/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor +++ b/LANCommander/Pages/Dashboard/Charts/ProcessorUtilization.razor @@ -68,6 +68,7 @@ private async Task RefreshData() { + #if WINDOWS Data = Data.ShiftArrayAndInsert((double)Math.Ceiling(PerformanceCounter.NextValue()), TimerHistory); try @@ -75,5 +76,6 @@ await Chart.ChangeData(Data.Select((x, i) => new { value = x, index = i }), true); } catch { } + #endif } } diff --git a/LANCommander/Services/GameService.cs b/LANCommander/Services/GameService.cs index 32118bb..0f4b3f8 100644 --- a/LANCommander/Services/GameService.cs +++ b/LANCommander/Services/GameService.cs @@ -120,6 +120,7 @@ namespace LANCommander.Services return File.ReadAllBytes(cachedPath); else { + #if WINDOWS if (game.Archives == null || game.Archives.Count == 0) throw new FileNotFoundException(); @@ -127,31 +128,38 @@ namespace LANCommander.Services Bitmap bitmap = null; - var iconReference = ArchiveService.ReadFile(archive.ObjectKey, game.Icon); - - if (IsWinPEFile(iconReference)) + try { - var tmp = System.IO.Path.GetTempFileName(); + var iconReference = ArchiveService.ReadFile(archive.ObjectKey, game.Icon); - System.IO.File.WriteAllBytes(tmp, iconReference); - - var icon = System.Drawing.Icon.ExtractAssociatedIcon(tmp); - - bitmap = icon.ToBitmap(); - } - else - { - using (var ms = new MemoryStream(iconReference)) + if (IsWinPEFile(iconReference)) { - bitmap = (Bitmap)Bitmap.FromStream(ms); + var tmp = System.IO.Path.GetTempFileName(); + + System.IO.File.WriteAllBytes(tmp, iconReference); + + var icon = System.Drawing.Icon.ExtractAssociatedIcon(tmp); + + bitmap = icon.ToBitmap(); } + else + { + using (var ms = new MemoryStream(iconReference)) + { + bitmap = (Bitmap)Bitmap.FromStream(ms); + } + } + + var iconPng = ConvertToPng(bitmap); + + File.WriteAllBytes(cachedPath, iconPng); + + return iconPng; } + catch (Exception ex) { } + #endif - var iconPng = ConvertToPng(bitmap); - - File.WriteAllBytes(cachedPath, iconPng); - - return iconPng; + return File.ReadAllBytes("favicon.png"); } } diff --git a/LANCommander/favicon.png b/LANCommander/favicon.png new file mode 100644 index 0000000..9456ec0 Binary files /dev/null and b/LANCommander/favicon.png differ diff --git a/LANCommander/wwwroot/favicon.png b/LANCommander/wwwroot/favicon.png new file mode 100644 index 0000000..9456ec0 Binary files /dev/null and b/LANCommander/wwwroot/favicon.png differ