Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
显示用户隐藏信息
Browse files Browse the repository at this point in the history
  • Loading branch information
lzghzr committed Oct 16, 2017
1 parent dce3b1d commit 600bb1f
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 10 deletions.
6 changes: 3 additions & 3 deletions ShowUID/ShowUID.cs → AddUID/AddUID.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using BilibiliDM_PluginFramework;

namespace ShowUID
namespace AddUID
{
public class ShowUID : DMPlugin
public class AddUID : DMPlugin
{
public ShowUID()
public AddUID()
{
ReceivedDanmaku += B_ReceivedDanmaku;
PluginAuth = "lzblzr";
Expand Down
8 changes: 5 additions & 3 deletions ShowUID/ShowUID.csproj → AddUID/AddUID.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
<ProjectGuid>{16963E13-5741-4B7E-8295-A4706A0D9542}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShowUID</RootNamespace>
<AssemblyName>ShowUID</AssemblyName>
<RootNamespace>AddUID</RootNamespace>
<AssemblyName>AddUID</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -37,7 +39,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ShowUID.cs" />
<Compile Include="AddUID.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ShowUID")]
[assembly: AssemblyTitle("AddUID")]
[assembly: AssemblyDescription("在用户名后添加UID")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
Expand All @@ -31,5 +31,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
35 changes: 35 additions & 0 deletions ShowInfo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ShowInfo")]
[assembly: AssemblyDescription("显示投喂用户的隐藏信息")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("30d14085-4d54-4a80-b59b-9881ee1dff66")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
98 changes: 98 additions & 0 deletions ShowInfo/ShowInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using System;
using System.Text.RegularExpressions;
using BilibiliDM_PluginFramework;

namespace ShowInfo
{
public class ShowInfo : DMPlugin
{
public ShowInfo()
{
ReceivedDanmaku += B_ReceivedDanmaku;
PluginAuth = "lzblzr";
PluginName = "用户信息";
PluginDesc = "显示投喂用户的隐藏信息";
PluginCont = "[email protected]";
PluginVer = "v1.0.0";
}
private void B_ReceivedDanmaku(object sender, ReceivedDanmakuArgs e)
{
if (e.Danmaku.MsgType == MsgTypeEnum.GiftSend)
{
string rawData = e.Danmaku.RawData;

string defaultLog;
string userLog = defaultLog = e.Danmaku.UserName + " 剩余";

Regex gold = new Regex("\"gold\":\"?(\\d+)");
Match hasGold = gold.Match(rawData);
if (hasGold.Success)
{
string value = hasGold.Groups[1].Value;
if (value != "0")
userLog += String.Format(" {0}金瓜子", value);
}

Regex silver = new Regex("\"silver\":\"?(\\d+)");
Match hasSilver = silver.Match(rawData);
if (hasSilver.Success)
{
string value = hasSilver.Groups[1].Value;
if (value != "0")
userLog += String.Format(" {0}银瓜子", value);
}

Regex package = new Regex("\"eventNum\":\"?(\\d+)");
Match hasPackage = package.Match(rawData);
if (hasPackage.Success)
{
string value = hasPackage.Groups[1].Value;
if (value != "0")
userLog += String.Format(" {0}{1}", value, e.Danmaku.GiftName);
}

Regex normalCapsule = new Regex("\"normal\":{ \"coin\":\"?(\\d+)");
Match hasNormalCapsule = normalCapsule.Match(rawData);
if (hasNormalCapsule.Success)
{
string value = hasNormalCapsule.Groups[1].Value;
if (value != "0")
userLog += String.Format(" {0}普通扭蛋", value);
}

Regex colorfulCapsule = new Regex("\"colorful\":{ \"coin\":\"?(\\d+)");
Match hascClorfulCapsule = colorfulCapsule.Match(rawData);
if (hascClorfulCapsule.Success)
{
string value = hascClorfulCapsule.Groups[1].Value;
if (value != "0")
userLog += String.Format(" {0}梦幻扭蛋", value);
}

if (userLog != defaultLog)
Log(userLog);
}
}
public override void Admin()
{
base.Admin();
Console.WriteLine("不要点啦, 没用的");
Log("不要点啦, 没用的");
AddDM("不要点啦, 没用的", true);
}
public override void Start()
{
base.Start();
Console.WriteLine("插件已启用");
Log("插件已启用");
AddDM("插件已启用", true);
}
public override void Stop()
{
base.Stop();
Console.WriteLine("插件已禁用");
Log("插件已禁用");
AddDM("插件已禁用", true);
}
}
}
45 changes: 45 additions & 0 deletions ShowInfo/ShowInfo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{30D14085-4D54-4A80-B59B-9881EE1DFF66}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShowInfo</RootNamespace>
<AssemblyName>ShowInfo</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BilibiliDM_PluginFramework">
<HintPath>..\BilibiliDM_PluginFramework\BilibiliDM_PluginFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ShowInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
8 changes: 7 additions & 1 deletion bililive_dm_plugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowUID", "ShowUID\ShowUID.csproj", "{16963E13-5741-4B7E-8295-A4706A0D9542}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddUID", "AddUID\AddUID.csproj", "{16963E13-5741-4B7E-8295-A4706A0D9542}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoldSilver", "GoldSilver\GoldSilver.csproj", "{1B1AAED6-3040-4E49-AAF5-AE144F7A277B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowInfo", "ShowInfo\ShowInfo.csproj", "{30D14085-4D54-4A80-B59B-9881EE1DFF66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B1AAED6-3040-4E49-AAF5-AE144F7A277B}.Release|Any CPU.Build.0 = Release|Any CPU
{30D14085-4D54-4A80-B59B-9881EE1DFF66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30D14085-4D54-4A80-B59B-9881EE1DFF66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30D14085-4D54-4A80-B59B-9881EE1DFF66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30D14085-4D54-4A80-B59B-9881EE1DFF66}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 600bb1f

Please sign in to comment.