Skip to content

Commit

Permalink
新增播放器初始化时根据直播流自动适配横屏和竖屏;清理冗余using内容
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Sep 10, 2024
1 parent 8b3ebb8 commit 30b9218
Show file tree
Hide file tree
Showing 29 changed files with 90 additions and 317 deletions.
18 changes: 6 additions & 12 deletions Desktop/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System.Configuration;
using System.Data;
using System.Windows;
using Server;
using Core;
using Core.LogModule;
using Core;
using static Server.Program;
using static Core.Network.Methods.User.UserInfo;
using Wpf.Ui;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Hosting;
using System.IO;
using System.Windows;
using Wpf.Ui;
using static Server.Program;



Expand Down
14 changes: 0 additions & 14 deletions Desktop/DataSource/LoginStatus.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
using Core;
using Core.LogModule;
using Core.RuntimeObject;
using Desktop.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Wpf.Ui.Controls;
using static Core.Network.Methods.Room;

namespace Desktop.DataSource
{
Expand Down
12 changes: 0 additions & 12 deletions Desktop/DataSource/RetrieveData.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
using Core;
using Core.LogModule;
using Core.RuntimeObject;
using Desktop.Models;
using Desktop.Views.Pages;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Wpf.Ui.Controls;
using static Core.Network.Methods.Room;
using static Desktop.Views.Pages.DataPage;



Expand Down
12 changes: 3 additions & 9 deletions Desktop/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
global using Application = System.Windows.Application;
global using Timer = System.Threading.Timer;
global using UserControl = System.Windows.Controls.UserControl;
global using MessageBox = System.Windows.MessageBox;
global using Color = System.Windows.Media.Color;
global using ColorConverter = System.Windows.Media.ColorConverter;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
global using MessageBox = System.Windows.MessageBox;
global using Timer = System.Threading.Timer;
global using UserControl = System.Windows.Controls.UserControl;
14 changes: 0 additions & 14 deletions Desktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
using Core;
using Core.LogModule;
using Core.RuntimeObject;
using Desktop.Models;
using Desktop.Views.Pages;
using Desktop.Views.Windows;
using Masuit.Tools.Win32;
using Microsoft.Extensions.DependencyInjection;
using Notification.Wpf;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
using static Core.RuntimeObject.Detect;
using static Core.Tools.DokiDoki;
using static Server.WebAppServices.Api.get_system_resources;

namespace Desktop
{
Expand Down
5 changes: 1 addition & 4 deletions Desktop/Models/DataCard.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System.ComponentModel;
using System.Windows;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using static Core.RuntimeObject.RoomCardClass;

namespace Desktop.Models
{
Expand Down
7 changes: 1 addition & 6 deletions Desktop/Models/HomePageModels.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;

namespace Desktop.Models
{
Expand Down
7 changes: 1 addition & 6 deletions Desktop/Models/ToolsPageModels.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;

namespace Desktop.Models
{
Expand Down
7 changes: 1 addition & 6 deletions Desktop/Models/VlcPlayModels.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Windows;

namespace Desktop.Models
Expand Down
11 changes: 2 additions & 9 deletions Desktop/NetWork/Basics.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Desktop.NetWork
namespace Desktop.NetWork
{
public class Basics
{

}
}
20 changes: 4 additions & 16 deletions Desktop/NetWork/Get.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
using AngleSharp.Dom;
using Core.LogModule;
using Core.RuntimeObject;
using Core.LogModule;
using Newtonsoft.Json;
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Desktop.NetWork
{
Expand Down Expand Up @@ -53,7 +41,7 @@ public static T GetBody<T>(string url, Dictionary<string, string> _dic = null)

using (HttpClient _httpClient = new HttpClient())
{
_httpClient.Timeout = new TimeSpan(0,0,8);
_httpClient.Timeout = new TimeSpan(0, 0, 8);
HttpResponseMessage response = _httpClient.GetAsync($"{url}?{Parameter}").Result;
response.EnsureSuccessStatusCode();
string responseBody = response.Content.ReadAsStringAsync().Result;
Expand All @@ -65,7 +53,7 @@ public static T GetBody<T>(string url, Dictionary<string, string> _dic = null)
{
GetErrorCount++;
if (GetErrorCount > 30)
{
{
Log.Warn(nameof(GetBody), $"触发DesktopTips={GetErrorCount}");
GetErrorCount = 0;
}
Expand All @@ -78,7 +66,7 @@ public static T GetBody<T>(string url, Dictionary<string, string> _dic = null)
{
Log.Warn(nameof(GetBody), $"发起Get请求出错,URL:[{url}],错误堆栈:\r\n{ex.ToString()}", ex, false);
}

return default;
}
}
Expand Down
13 changes: 1 addition & 12 deletions Desktop/NetWork/Post.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
using AngleSharp.Io;
using Core.LogModule;
using Core.RuntimeObject;
using Core.LogModule;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Desktop.NetWork
{
Expand Down
14 changes: 1 addition & 13 deletions Desktop/Views/Control/CardControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
using Core;
using Core.LogModule;
using Core.RuntimeObject;
using Desktop.Models;
using Desktop.Views.Windows;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Wpf.Ui.Controls;

namespace Desktop.Views.Control
Expand Down Expand Up @@ -208,7 +196,7 @@ private void Snapshot_Task_Click(object sender, RoutedEventArgs e)
};
Task.Run(() =>
{
var message = NetWork.Post.PostBody<(bool state, string message)>($"{Config.Core_RunConfig._DesktopIP}:{Config.Core_RunConfig._DesktopPort}/api/rec_task/generate_snapshot", dic,new TimeSpan(0,1,0)).Result;
var message = NetWork.Post.PostBody<(bool state, string message)>($"{Config.Core_RunConfig._DesktopIP}:{Config.Core_RunConfig._DesktopPort}/api/rec_task/generate_snapshot", dic, new TimeSpan(0, 1, 0)).Result;
if (!message.state)
{
Log.Info(nameof(Snapshot_Task_Click), $"生成直播间录制快照失败,原因:{message.message}");
Expand Down
15 changes: 1 addition & 14 deletions Desktop/Views/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;

namespace Desktop.Views.Pages
{
Expand Down
23 changes: 6 additions & 17 deletions Desktop/Views/Pages/DataPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System;
using System.Collections;
using System.Collections.Generic;
using Core;
using Core.LogModule;
using Desktop.Models;
using Desktop.Views.Windows;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.Metrics;
using System.IO;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Core;
using Core.LogModule;
using Desktop.Models;
using Desktop.Views.Windows;
using Masuit.Tools;
using Microsoft.AspNetCore.Http.HttpResults;
using Newtonsoft.Json;
using Wpf.Ui;
using Wpf.Ui.Controls;
using static Core.Network.Methods.Follow;
using MenuItem = Wpf.Ui.Controls.MenuItem;
Expand Down Expand Up @@ -197,7 +186,7 @@ public static void UpdatePageCount(int PageCount)

public static void Refresher(object state)
{
DataSource.RetrieveData.UI_RoomCards.RefreshRoomCards();
DataSource.RetrieveData.UI_RoomCards.RefreshRoomCards();
}
public class SortableObservableCollection<T> : ObservableCollection<T>
{
Expand Down Expand Up @@ -265,7 +254,7 @@ private void ScreenName_Click(object sender, RoutedEventArgs e)

private void ScreenName()
{
if (!string.IsNullOrEmpty(ScreenNameBox.Text))
if (!string.IsNullOrEmpty(ScreenNameBox.Text))
{
screen_name = ScreenNameBox.Text;
}
Expand Down
14 changes: 5 additions & 9 deletions Desktop/Views/Pages/DefaultPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
using Core;
using Core.LogModule;
using Desktop.Models;
using SixLabors.ImageSharp.Drawing;
using System.Collections.ObjectModel;
using System.Net.Sockets;
using System.Net;
using System.Windows;
using System.Net.Sockets;
using static Server.WebAppServices.Api.get_system_resources;
using Castle.DynamicProxy;

namespace Desktop.Views.Pages;

Expand Down Expand Up @@ -114,7 +110,7 @@ public static void UpdateAnnouncement(object state)
Log.Warn(nameof(UpdateAnnouncement), "更新公告出现错误,错误堆栈已写文本记录文件", ex, false);
}
}

/// <summary>
/// 检测代理状态
/// </summary>
Expand All @@ -127,7 +123,7 @@ public static void ProxyDetection(object state)
if (defaultProxy != null)
{
var proxyUri = defaultProxy.GetProxy(new Uri(Config.Core_RunConfig._LiveDomainName));
if(proxyUri==null)
if (proxyUri == null)
{
SetProxyState("正常,未检测到代理");
return;
Expand Down Expand Up @@ -156,7 +152,7 @@ public static void IpvDetection(object state)
{
try
{
string url = Config.Core_RunConfig._LiveDomainName.ToLower().Replace("https://", "").Replace("http://","");
string url = Config.Core_RunConfig._LiveDomainName.ToLower().Replace("https://", "").Replace("http://", "");
IPHostEntry hostEntry = Dns.GetHostEntry(url);
foreach (IPAddress ipAddress in hostEntry.AddressList)
{
Expand All @@ -176,7 +172,7 @@ public static void IpvDetection(object state)
Log.Info(nameof(IpvDetection), $"当前为IPv6访问状态", false);
break;
}

tempSocket.Close();
break;
}
Expand Down
Loading

0 comments on commit 30b9218

Please sign in to comment.