Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #18 from Bililive/dev
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
Genteure authored Nov 24, 2018
2 parents e20f091 + 792316d commit fdd088b
Show file tree
Hide file tree
Showing 16 changed files with 360 additions and 257 deletions.
Binary file modified CI/appveyor_deploy.ps1
Binary file not shown.
5 changes: 4 additions & 1 deletion DGJv3/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ class Config
public bool IsUserPrior { get; set; } = true;

[JsonProperty("lrd")]
public bool IsLogRedirectDanmaku { get; set; } = true;
public bool IsLogRedirectDanmaku { get; set; } = false;

[JsonProperty("ldll")]
public int LogDanmakuLengthLimit { get; set; } = 20;

[JsonProperty("plst")]
public SongInfo[] Playlist { get; set; } = new SongInfo[0];
Expand Down
34 changes: 24 additions & 10 deletions DGJv3/DGJMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ namespace DGJv3
{
public class DGJMain : DMPlugin
{
private DGJWindow window;
private readonly DGJWindow window;

private VersionChecker versionChecker;

public DGJMain()
{
try
{
var info = Directory.CreateDirectory(Utilities.BinDirectoryPath);
info.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
}
catch (Exception) { }
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;

this.PluginName = "点歌姬";
this.PluginVer = BuildInfo.Version;
this.PluginDesc = "使用弹幕点播歌曲";
this.PluginAuth = "Genteure";
this.PluginCont = "[email protected]";
PluginName = "点歌姬";
PluginVer = BuildInfo.Version;
PluginDesc = "使用弹幕点播歌曲";
PluginAuth = "Genteure";
PluginCont = "[email protected]";

try
{
Expand Down Expand Up @@ -59,23 +65,31 @@ public override void Admin()

public override void DeInit() => window.DeInit();


private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
AssemblyName assemblyName = new AssemblyName(args.Name);

var path = assemblyName.Name + ".dll";
if (assemblyName.CultureInfo?.Equals(CultureInfo.InvariantCulture) == false) path = String.Format(@"{0}\{1}", assemblyName.CultureInfo, path);
string filepath = Path.Combine(Utilities.BinDirectoryPath, path);

if (assemblyName.CultureInfo?.Equals(CultureInfo.InvariantCulture) == false)
{ path = string.Format(@"{0}\{1}", assemblyName.CultureInfo, path); }

using (Stream stream = executingAssembly.GetManifestResourceStream(path))
{
if (stream == null) return null;
if (stream == null) { return null; }

var assemblyRawBytes = new byte[stream.Length];
stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length);
return Assembly.Load(assemblyRawBytes);
try
{
File.WriteAllBytes(filepath, assemblyRawBytes);
}
catch (Exception) { }
}

return Assembly.LoadFrom(filepath);
}
}
}
76 changes: 41 additions & 35 deletions DGJv3/DGJWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<RowDefinition Height="110"/>
</Grid.RowDefinitions>

<ListView ItemsSource="{Binding Songs}" Grid.RowSpan="2">
<ListView ItemsSource="{Binding Songs}">
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="移除" Command="{Binding RemoveSongCommmand}"
Expand Down Expand Up @@ -104,29 +104,31 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListView ItemsSource="{Binding Playlist}">
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="移除" Command="{Binding RemovePlaylistInfoCommmand}"
<GroupBox Header="空闲歌单">
<ListView ItemsSource="{Binding Playlist}" Margin="-5">
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="移除" Command="{Binding RemovePlaylistInfoCommmand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"/>
<MenuItem Header="清空全部" Command="{Binding ClearPlaylistCommand}"/>
</ContextMenu>
</ListView.ContextMenu>
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="歌名" DisplayMemberBinding="{Binding Name}"/>
<GridViewColumn Header="歌手" DisplayMemberBinding="{Binding SingersText}"/>
</GridView>
</ListView.View>
</ListView>
<MenuItem Header="清空全部" Command="{Binding ClearPlaylistCommand}"/>
</ContextMenu>
</ListView.ContextMenu>
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="歌名" DisplayMemberBinding="{Binding Name}"/>
<GridViewColumn Header="歌手" DisplayMemberBinding="{Binding SingersText}"/>
</GridView>
</ListView.View>
</ListView>
</GroupBox>
<StackPanel Margin="5" Grid.Row="1" Orientation="Horizontal">
<Button HorizontalAlignment="Center" VerticalAlignment="Center"
<Button HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
materialDesign:DialogHost.DialogClosingAttached="DialogAddSongs">
<Button.CommandParameter>
<StackPanel Margin="16">
<TextBlock FontSize="16">歌名</TextBlock>
<TextBox x:Name="AddSongsTextBox"></TextBox>
<TextBox x:Name="AddSongsTextBox" Style="{StaticResource MaterialDesignTextBox}"></TextBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Expand All @@ -151,7 +153,7 @@
<Button.CommandParameter>
<StackPanel Margin="16">
<TextBlock FontSize="16">歌名</TextBlock>
<TextBox x:Name="AddSongPlaylistTextBox"></TextBox>
<TextBox x:Name="AddSongPlaylistTextBox" Style="{StaticResource MaterialDesignTextBox}"></TextBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Expand All @@ -176,10 +178,10 @@
<Button.CommandParameter>
<StackPanel Margin="16">
<TextBlock FontSize="16">
歌单ID(在你网页浏览你的歌单时,可以在网址栏看到一长串数字,那就是歌单ID啦)
<LineBreak/>
歌单ID<LineBreak/>
(在你网页浏览你的歌单时,可以在网址栏看到一长串数字,那就是歌单ID啦)
</TextBlock>
<TextBox x:Name="AddPlaylistTextBox"></TextBox>
<TextBox x:Name="AddPlaylistTextBox" Style="{StaticResource MaterialDesignTextBox}"></TextBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Expand Down Expand Up @@ -269,28 +271,28 @@
<StackPanel Margin="20 0" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal">
<Button Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Command="{Binding PlayPauseCommand}">
<Grid>
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconPlay"
<materialDesign:PackIcon Width="24" Height="24" Kind="Play"
Visibility="{Binding IsPlaying,Converter={StaticResource EqualsVisibilityConverter},ConverterParameter={StaticResource False}}"/>
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconPause"
<materialDesign:PackIcon Width="24" Height="24" Kind="Pause"
Visibility="{Binding IsPlaying,Converter={StaticResource EqualsVisibilityConverter},ConverterParameter={StaticResource True}}"/>
</Grid>
</Button>
<Button Margin="8 0" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Command="{Binding NextCommand}">
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconSkipNext"/>
<materialDesign:PackIcon Width="24" Height="24" Kind="SkipNext"/>
</Button>
<TextBlock FontSize="24" TextAlignment="Center" VerticalAlignment="Center">
<TextBlock Width="80" Text="{Binding CurrentTime,StringFormat=mm\\:ss}" TextAlignment="Right"/>
/
<TextBlock Width="80" Text="{Binding TotalTime,StringFormat=mm\\:ss}" TextAlignment="Left"/>
</TextBlock>
<materialDesign:PackIcon x:Name="PackIconVolumeHigh" Width="24" Height="24" VerticalAlignment="Center" Margin="15,10,0,0"/>
<materialDesign:PackIcon x:Name="PackIconVolumeHigh" Width="24" Height="24" Kind="VolumeHigh" VerticalAlignment="Center" Margin="15,10,0,0"/>
<Slider Style="{StaticResource MaterialDesignDiscreteSlider}" Value="{Binding Volume,Converter={StaticResource PlayerVolumeConverter}}"
Width="150" Orientation="Horizontal" Minimum="0" Maximum="100" VerticalAlignment="Center"/>
<!-- 设置开始 -->
<materialDesign:PopupBox Margin="30,0,0,0" DataContext="{Binding ElementName=DGJRootWindow,Path=DataContext}"
StaysOpen="True" PlacementMode="TopAndAlignCentres">
<materialDesign:PopupBox.ToggleContent>
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconSettings"/>
<materialDesign:PackIcon Width="24" Height="24" Kind="Settings"/>
</materialDesign:PopupBox.ToggleContent>
<Grid Margin="8">
<Grid.RowDefinitions>
Expand All @@ -309,14 +311,18 @@
<TextBlock TextAlignment="Center" VerticalAlignment="Center">用户点歌优先于空闲歌单播放</TextBlock>
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding IsLogRedirectDanmaku}" Checked="ToggleButton_OnChecked"/>
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding IsLogRedirectDanmaku}" x:Name="LogRedirectToggleButton" Checked="LogRedirectToggleButton_OnChecked"/>
<TextBlock TextAlignment="Center" VerticalAlignment="Center">点歌反馈发送到弹幕(需要登录中心)</TextBlock>
</StackPanel>
<TextBox Text="{Binding DanmuHandler.MaxTotalSongNum,UpdateSourceTrigger=PropertyChanged,Delay=200}"
materialDesign:HintAssist.Hint="总共最大点歌数量" materialDesign:HintAssist.IsFloating="True"/>
<TextBox Text="{Binding DanmuHandler.MaxPersonSongNum,UpdateSourceTrigger=PropertyChanged,Delay=200}"
materialDesign:HintAssist.Hint="单人最大点歌数量" materialDesign:HintAssist.IsFloating="True"/>

<TextBox Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding DanmuHandler.MaxTotalSongNum,UpdateSourceTrigger=PropertyChanged,Delay=200}"
materialDesign:HintAssist.Hint="总共最大点歌数量" materialDesign:HintAssist.IsFloating="True"/>
<TextBox Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding DanmuHandler.MaxPersonSongNum,UpdateSourceTrigger=PropertyChanged,Delay=200}"
materialDesign:HintAssist.Hint="单人最大点歌数量" materialDesign:HintAssist.IsFloating="True"/>
<TextBox Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding LogDanmakuLengthLimit,UpdateSourceTrigger=PropertyChanged,Delay=200}"
materialDesign:HintAssist.Hint="弹幕长度限制" materialDesign:HintAssist.IsFloating="True"/>
</StackPanel>
</Grid>
</materialDesign:PopupBox>
Expand All @@ -325,7 +331,7 @@
<materialDesign:PopupBox StaysOpen="True" PlacementMode="TopAndAlignCentres" Margin="8,0"
DataContext="{Binding ElementName=DGJRootWindow,Path=DataContext}">
<materialDesign:PopupBox.ToggleContent>
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconFilterRemove"/>
<materialDesign:PackIcon Width="24" Height="24" Kind="FilterRemove"/>
</materialDesign:PopupBox.ToggleContent>
<Grid Margin="8">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -382,7 +388,7 @@
<ComboBox Width="120" ItemsSource="{Binding Source={local:Enumeration {x:Type local:BlackListType}}}"
DisplayMemberPath="Description" SelectedValuePath="Value" x:Name="AddBlacklistComboBox"
materialDesign:HintAssist.Hint="黑名单类型" materialDesign:HintAssist.IsFloating="True"/>
<TextBox x:Name="AddBlacklistTextBox" materialDesign:HintAssist.Hint="黑名单内容" materialDesign:HintAssist.IsFloating="True"/>
<TextBox x:Name="AddBlacklistTextBox" Style="{StaticResource MaterialDesignFloatingHintTextBox}" materialDesign:HintAssist.Hint="黑名单内容" materialDesign:HintAssist.IsFloating="True"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Expand All @@ -409,7 +415,7 @@
<materialDesign:PopupBox StaysOpen="True" PlacementMode="TopAndAlignCentres"
DataContext="{Binding ElementName=DGJRootWindow,Path=DataContext}">
<materialDesign:PopupBox.ToggleContent>
<materialDesign:PackIcon Width="24" Height="24" x:Name="PackIconFileDocument"/>
<materialDesign:PackIcon Width="24" Height="24" Kind="FileDocument"/>
</materialDesign:PopupBox.ToggleContent>
<Grid Margin="8" Width="800" Height="400">
<Grid.RowDefinitions>
Expand Down
Loading

0 comments on commit fdd088b

Please sign in to comment.