Skip to content

Commit

Permalink
1.修复了直播列表“修改”按钮修改后会导致修改的房间/频道被删除问题
Browse files Browse the repository at this point in the history
2.修复了添加和修改房间/频道设置的时候会重置直播状态的问题
3.修复了“关于”列表中,蒂蒂媞薇立绘过于死板的问题。增加了新的表情。
  • Loading branch information
CHKZL committed Sep 12, 2019
1 parent 75eab98 commit a74698a
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 163 deletions.
13 changes: 7 additions & 6 deletions Auxiliary/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,20 @@ private void 下载过程中事件(object sender, DownloadProgressChangedEventAr
// public event EventHandler<EventArgs> DownOk;
private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
{
if (e.Cancelled == false)
{
DownIofo.备注 = "下载完成";
DownIofo.下载状态 = false;
}
else if (e.Error.Message.Contains("请求被中止"))

if (e.Error.Message.Contains("请求被中止"))
{
DownIofo.备注 = "用户取消,停止下载";
if(!DownIofo.播放状态&&DownIofo.是否是播放任务)
{
DownIofo.备注 = "播放窗口关闭";
}
}
else if (e.Cancelled == false&& !bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号))
{
DownIofo.备注 = "直播停止,下载完成下载完成";
DownIofo.下载状态 = true;
}
else
{
if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号))
Expand Down
2 changes: 1 addition & 1 deletion Auxiliary/MMPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MMPU
public static string 直播缓存目录 = MMPU.getFiles("Livefile");
public static int 直播更新时间 = int.Parse(MMPU.getFiles("RoomTime"));
public static string 下载储存目录 = MMPU.getFiles("file");
public static string 版本号 = "2.0.1.3";
public static string 版本号 = "2.0.1.4";
public static bool 第一次打开播放窗口 = true;
public static int 默认音量= int.Parse(MMPU.getFiles("DefaultVolume"));
public static int 缩小功能 = int.Parse(MMPU.getFiles("Zoom"));
Expand Down
23 changes: 21 additions & 2 deletions Auxiliary/bilibili.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ public static bool 是否正在直播(string RoomId)
}
catch (Exception)
{
return false;
try
{
roomHtml = wc.DownloadData(roomWebPageUrl);
}
catch (Exception)
{
return false;
}

}

//解析返回结果
Expand All @@ -160,7 +168,18 @@ public static bool 是否正在直播(string RoomId)
}
catch (Exception)
{
return false;
try
{
var roomJson = Encoding.UTF8.GetString(roomHtml);
var result = JObject.Parse(roomJson);
return result["data"]["live_status"].ToString() == "1" ? true : false;
}
catch (Exception)
{

return false;
}

}
}

Expand Down
112 changes: 75 additions & 37 deletions DDTV_New/AddMonitoringList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,61 +118,99 @@ private void BT1_Click(object sender, RoutedEventArgs e)
}
新增V信息 NEWV = new 新增V信息() { CN_Name = 中文名称.Text, LA_Name = 官方名称.Text, Platform = 平台.SelectedItem.ToString(), GUID = 唯一码.Text };
new Task(() => { MMPU.TcpSend(20001, JsonConvert.SerializeObject(NEWV), true); }).Start();

RoomBox rlc = JsonConvert.DeserializeObject<RoomBox>(ReadConfigFile(RoomConfigFile));
RoomBox RB = new RoomBox();
RB.data = new List<RoomCadr>();
if(rlc.data!=null)

RoomBox rlc = JsonConvert.DeserializeObject<RoomBox>(ReadConfigFile(RoomConfigFile));
RoomBox RB = new RoomBox();
RB.data = new List<RoomCadr>();
if (rlc.data != null)
{
foreach (var item in rlc.data)
{
foreach (var item in rlc.data)
RB.data.Add(item);
if (RoomInit.根据唯一码获取直播状态(item.RoomNumber))
{
RB.data.Add(item);
if (RoomInit.根据唯一码获取直播状态(item.RoomNumber))
{
RB.data[RB.data.Count() - 1].LiveStatus = false;
}
RB.data[RB.data.Count() - 1].LiveStatus = true;
}
}
RB.data.Add(new RoomCadr { Name = 中文名称.Text, RoomNumber = 唯一码.Text, Types = 平台.SelectedItem.ToString(), RemindStatus = true, status = false, VideoStatus = false, OfficialName = 官方名称.Text, LiveStatus = RoomInit.根据唯一码获取直播状态(GUID) });
string JOO = JsonConvert.SerializeObject(RB);
MMPU.储存文本(JOO, RoomConfigFile);
InitializeRoomList();
//更新房间列表(平台.SelectedItem.ToString(), 唯一码.Text,1);
//MessageBox.Show("添加成功");

}
RB.data.Add(new RoomCadr { Name = 中文名称.Text,RoomNumber = 唯一码.Text, Types = 平台.SelectedItem.ToString(), RemindStatus = true, status = false, VideoStatus = false, OfficialName = 官方名称.Text, LiveStatus = RoomInit.根据唯一码获取直播状态(GUID) });
string JOO = JsonConvert.SerializeObject(RB);
MMPU.储存文本(JOO, RoomConfigFile);
InitializeRoomList();
//更新房间列表(平台.SelectedItem.ToString(), 唯一码.Text,1);
//MessageBox.Show("添加成功");

}
else if(this.Title=="修改单推属性")
{

var rlc2 = JsonConvert.DeserializeObject<RoomBox>(ReadConfigFile(RoomConfigFile));
新增V信息 NEWV = new 新增V信息() { CN_Name = 中文名称.Text, LA_Name = 官方名称.Text, Platform = 平台.SelectedItem.ToString(), GUID = 唯一码.Text };
new Task(() => { MMPU.TcpSend(20001, JsonConvert.SerializeObject(NEWV), true); }).Start();

RoomBox rlc = JsonConvert.DeserializeObject<RoomBox>(ReadConfigFile(RoomConfigFile));
RoomBox RB = new RoomBox();
RB.data = new List<RoomCadr>();
int rlclen = 房间主表.Count()-1;
for (int i =0;i< rlclen; i++)
if (rlc.data != null)
{
if(房间主表[i].唯一码==GUID)
foreach (var item in rlc.data)
{
房间主表.Remove(房间主表[i]);
i--;
RB.data.Add(new RoomCadr { Name = 中文名称.Text, RoomNumber = 唯一码.Text, Types = 平台.SelectedItem.ToString(), RemindStatus = false, status = false, VideoStatus = false, OfficialName = 官方名称.Text,LiveStatus= RoomInit.根据唯一码获取直播状态(GUID) });
}
else
{
RB.data.Add(new RoomCadr(){ LiveStatus= 房间主表[i] .直播状态,Name= 房间主表[i] .名称,OfficialName= 房间主表[i] .原名,RoomNumber= 房间主表[i] .唯一码,VideoStatus= 房间主表[i] .是否录制,Types= 房间主表[i] .平台, RemindStatus= 房间主表[i] .是否提醒,status=false });
if (RoomInit.根据唯一码获取直播状态(房间主表[i].唯一码))
if (item.RoomNumber == GUID)
{
RB.data[RB.data.Count() - 1].LiveStatus = true;
RB.data.Add(item);
RB.data[RB.data.Count() - 1].Name = 中文名称.Text;
RB.data[RB.data.Count() - 1].OfficialName = 官方名称.Text;
RB.data[RB.data.Count() - 1].Types = 平台.SelectedItem.ToString();
}
else
{
RB.data.Add(item);
if (RoomInit.根据唯一码获取直播状态(item.RoomNumber))
{
RB.data[RB.data.Count() - 1].LiveStatus = true;
}
}
}
}
新增V信息 NEWV = new 新增V信息() { CN_Name = 中文名称.Text, LA_Name = 官方名称.Text, Platform = 平台.SelectedItem.ToString(), GUID = 唯一码.Text };

new Task(() => { MMPU.TcpSend(20001, JsonConvert.SerializeObject(NEWV), true); }).Start();

string JOO = JsonConvert.SerializeObject(RB);
MMPU.储存文本(JOO, RoomConfigFile);
InitializeRoomList();
//MessageBox.Show("修改成功");

//var rlc2 = JsonConvert.DeserializeObject<RoomBox>(ReadConfigFile(RoomConfigFile));
//RoomBox RB = new RoomBox();
//RB.data = new List<RoomCadr>();
//int rlclen = 房间主表.Count()-1;
//int 覆盖的编号 = 0;
//for (int i =0;i< rlclen; i++)
//{
// if(房间主表[i].唯一码==GUID)
// {
// 覆盖的编号 = i;
// //房间主表.Remove(房间主表[i]);
// //i--;
// RB.data.Add(new RoomCadr { Name = 中文名称.Text, RoomNumber = 唯一码.Text, Types = 平台.SelectedItem.ToString(), RemindStatus = false, status = false, VideoStatus = false, OfficialName = 官方名称.Text,LiveStatus= RoomInit.根据唯一码获取直播状态(GUID) });
// }
// else
// {
// RB.data.Add(new RoomCadr(){ LiveStatus= 房间主表[i] .直播状态,Name= 房间主表[i] .名称,OfficialName= 房间主表[i] .原名,RoomNumber= 房间主表[i] .唯一码,VideoStatus= 房间主表[i] .是否录制,Types= 房间主表[i] .平台, RemindStatus= 房间主表[i] .是否提醒,status=false });
// if (RoomInit.根据唯一码获取直播状态(房间主表[i].唯一码))
// {
// RB.data[RB.data.Count() - 1].LiveStatus = true;
// }
// }
//}
//房间主表.Clear();
//foreach (var item in RB.data)
//{
// 房间主表.Add(new RL { 名称=item.Name,原名=item.OfficialName,唯一码=item.RoomNumber,平台=item.Types,是否录制=item.VideoStatus,是否提醒=item.RemindStatus,直播状态=item.LiveStatus});
//}

//新增V信息 NEWV = new 新增V信息() { CN_Name = 中文名称.Text, LA_Name = 官方名称.Text, Platform = 平台.SelectedItem.ToString(), GUID = 唯一码.Text };

//new Task(() => { MMPU.TcpSend(20001, JsonConvert.SerializeObject(NEWV), true); }).Start();
//string JOO = JsonConvert.SerializeObject(RB);
//MMPU.储存文本(JOO, RoomConfigFile);
//InitializeRoomList();
////MessageBox.Show("修改成功");

}
this.Close();
}
Expand Down
Binary file modified DDTV_New/DDTV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 3 additions & 41 deletions DDTV_New/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,47 +194,8 @@
<Grid x:Name="关于层" IsEnabled="False" Visibility="Collapsed">
<Label Content="想不到应该写些什么,不过我先放一个蒂蒂媞薇在这里。" Margin="10,54,0,0" FontSize="18" />
<Label Content="她没有怎么,只是觉得你们应该都看看.jpg" Margin="10,85,0,-31" FontSize="18" />
<Image Margin="575,85,3,5" Source="DDTV.png" Stretch="Fill"/>
<Label Content="?????" HorizontalAlignment="Left" Margin="682,64,0,0" VerticalAlignment="Top" Foreground="#FF4B4B4B" FontSize="40" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="15.533"/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<Label Content="?" HorizontalAlignment="Left" Margin="521,187,0,0" VerticalAlignment="Top" Foreground="#FF4B4B4B" FontSize="40" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-32.143"/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<Label Content="?" HorizontalAlignment="Left" Margin="613,102,0,0" VerticalAlignment="Top" Foreground="#FF4B4B4B" FontSize="40" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="36.519"/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<Label Content="???" HorizontalAlignment="Left" Margin="523,304,0,0" VerticalAlignment="Top" Foreground="#FF4B4B4B" FontSize="40" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-2.726"/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<Image Source="DDTV.png" Stretch="Fill" Margin="459,50,3,5"/>

</Grid>
<Grid x:Name="top层">
<Image x:Name="top" Source="res/img/top.png" Margin="0,-2,0,477" Height="40" Width="800"/>
Expand All @@ -252,5 +213,6 @@
<Label Content="执行操作中...." VerticalAlignment="Center" HorizontalAlignment="Center" Height="515" Width="800" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" FontSize="40" />
</Grid>


</Grid>
</Window>
8 changes: 5 additions & 3 deletions DDTV_New/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ public void 公告项目启动()
{
if (MMPU.版本号 != MMPU.TcpSend(20011, "{}", true))
{
System.Windows.MessageBox.Show("检测到版本更新,更新公告:\n" + MMPU.TcpSend(20012, "{}", true));
MessageBoxResult dr = System.Windows.MessageBox.Show("检测到版本更新,更新公告:\n" + MMPU.TcpSend(20012, "{}", true)+ "\n\n点击确定跳转到补丁(大约1MB)下载网页,点击取消忽略", "有新版本", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (dr == MessageBoxResult.OK)
{
System.Diagnostics.Process.Start("https://github.com/CHKZL/DDTV2/releases/latest");
}
}
}
}
Expand Down Expand Up @@ -364,8 +368,6 @@ public void InitRoomList()
}));

}

MMPU.setFiles("RoomTime", ((int)((double)i * (double)0.6)).ToString());
this.Dispatcher.Invoke(new Action(delegate
{
ppnum.Content = i - 1;
Expand Down
73 changes: 0 additions & 73 deletions DDTV_New/res/desktop.ini

This file was deleted.

0 comments on commit a74698a

Please sign in to comment.