diff --git a/src/Avalonia.Gif/Avalonia.Gif.csproj b/src/Avalonia.Gif/Avalonia.Gif.csproj deleted file mode 100644 index b83b9fb..0000000 --- a/src/Avalonia.Gif/Avalonia.Gif.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - net7.0 - latest - true - enable - - - - - - - diff --git a/src/Avalonia.Gif/BgWorkerCommand.cs b/src/Avalonia.Gif/BgWorkerCommand.cs deleted file mode 100644 index d561685..0000000 --- a/src/Avalonia.Gif/BgWorkerCommand.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Avalonia.Gif -{ - internal enum BgWorkerCommand - { - Null, - Play, - Pause, - Dispose - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/BgWorkerState.cs b/src/Avalonia.Gif/BgWorkerState.cs deleted file mode 100644 index ab3bc38..0000000 --- a/src/Avalonia.Gif/BgWorkerState.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Avalonia.Gif -{ - internal enum BgWorkerState - { - Null, - Start, - Running, - Paused, - Complete, - Dispose - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/BlockTypes.cs b/src/Avalonia.Gif/Decoding/BlockTypes.cs deleted file mode 100644 index ca2cc7a..0000000 --- a/src/Avalonia.Gif/Decoding/BlockTypes.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Avalonia.Gif.Decoding -{ - internal enum BlockTypes - { - Empty = 0, - Extension = 0x21, - ImageDescriptor = 0x2C, - Trailer = 0x3B, - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/ExtensionType.cs b/src/Avalonia.Gif/Decoding/ExtensionType.cs deleted file mode 100644 index ad7878b..0000000 --- a/src/Avalonia.Gif/Decoding/ExtensionType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Avalonia.Gif.Decoding -{ - internal enum ExtensionType - { - GraphicsControl = 0xF9, - Application = 0xFF - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/FrameDisposal.cs b/src/Avalonia.Gif/Decoding/FrameDisposal.cs deleted file mode 100644 index 178a3c5..0000000 --- a/src/Avalonia.Gif/Decoding/FrameDisposal.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Avalonia.Gif.Decoding -{ - public enum FrameDisposal - { - Unknown = 0, - Leave = 1, - Background = 2, - Restore = 3 - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifColor.cs b/src/Avalonia.Gif/Decoding/GifColor.cs deleted file mode 100644 index 7534cc1..0000000 --- a/src/Avalonia.Gif/Decoding/GifColor.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Runtime.InteropServices; - -namespace Avalonia.Gif -{ - [StructLayout(LayoutKind.Explicit)] - public readonly struct GifColor - { - [FieldOffset(3)] - public readonly byte A; - - [FieldOffset(2)] - public readonly byte R; - - [FieldOffset(1)] - public readonly byte G; - - [FieldOffset(0)] - public readonly byte B; - - /// - /// A struct that represents a ARGB color and is aligned as - /// a BGRA bytefield in memory. - /// - /// Red - /// Green - /// Blue - /// Alpha - public GifColor(byte r, byte g, byte b, byte a = byte.MaxValue) - { - A = a; - R = r; - G = g; - B = b; - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifDecoder.cs b/src/Avalonia.Gif/Decoding/GifDecoder.cs deleted file mode 100644 index 4a31742..0000000 --- a/src/Avalonia.Gif/Decoding/GifDecoder.cs +++ /dev/null @@ -1,657 +0,0 @@ -// This source file's Lempel-Ziv-Welch algorithm is derived from Chromium's Android GifPlayer -// as seen here (https://github.com/chromium/chromium/blob/master/third_party/gif_player/src/jp/tomorrowkey/android/gifplayer) -// Licensed under the Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0) -// Copyright (C) 2015 The Gifplayer Authors. All Rights Reserved. - -// The rest of the source file is licensed under MIT License. -// Copyright (C) 2018 Jumar A. Macato, All Rights Reserved. - -using Avalonia.Media.Imaging; -using System; -using System.Buffers; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using static Avalonia.Gif.Extensions.StreamExtensions; - -namespace Avalonia.Gif.Decoding -{ - public sealed class GifDecoder : IDisposable - { - private static readonly ReadOnlyMemory G87AMagic - = "GIF87a"u8.ToArray().AsMemory(); - - private static readonly ReadOnlyMemory G89AMagic - = "GIF89a"u8.ToArray().AsMemory(); - - private static readonly ReadOnlyMemory NetscapeMagic - = "NETSCAPE2.0"u8.ToArray().AsMemory(); - - private static readonly TimeSpan FrameDelayThreshold = TimeSpan.FromMilliseconds(10); - private static readonly TimeSpan FrameDelayDefault = TimeSpan.FromMilliseconds(100); - private static readonly GifColor TransparentColor = new(0, 0, 0, 0); - private static readonly int MaxTempBuf = 768; - private static readonly int MaxStackSize = 4096; - private static readonly int MaxBits = 4097; - - private readonly Stream _fileStream; - private readonly CancellationToken _currentCtsToken; - private readonly bool _hasFrameBackups; - - private int _gctSize, _bgIndex, _prevFrame = -1, _backupFrame = -1; - private bool _gctUsed; - - private GifRect _gifDimensions; - - // private ulong _globalColorTable; - private readonly int _backBufferBytes; - private GifColor[] _bitmapBackBuffer; - - private short[] _prefixBuf; - private byte[] _suffixBuf; - private byte[] _pixelStack; - private byte[] _indexBuf; - private byte[] _backupFrameIndexBuf; - private volatile bool _hasNewFrame; - - public GifHeader Header { get; private set; } - - public readonly List Frames = new(); - - public PixelSize Size => new PixelSize(Header.Dimensions.Width, Header.Dimensions.Height); - - public GifDecoder(Stream fileStream, CancellationToken currentCtsToken) - { - _fileStream = fileStream; - _currentCtsToken = currentCtsToken; - - ProcessHeaderData(); - ProcessFrameData(); - - Header.IterationCount = Header.Iterations switch - { - -1 => new GifRepeatBehavior { Count = 1 }, - 0 => new GifRepeatBehavior { LoopForever = true }, - > 0 => new GifRepeatBehavior { Count = Header.Iterations }, - _ => Header.IterationCount - }; - - var pixelCount = _gifDimensions.TotalPixels; - - _hasFrameBackups = Frames - .Any(f => f.FrameDisposalMethod == FrameDisposal.Restore); - - _bitmapBackBuffer = new GifColor[pixelCount]; - _indexBuf = new byte[pixelCount]; - - if (_hasFrameBackups) - _backupFrameIndexBuf = new byte[pixelCount]; - - _prefixBuf = new short[MaxStackSize]; - _suffixBuf = new byte[MaxStackSize]; - _pixelStack = new byte[MaxStackSize + 1]; - - _backBufferBytes = pixelCount * Marshal.SizeOf(typeof(GifColor)); - } - - public void Dispose() - { - Frames.Clear(); - - _bitmapBackBuffer = null; - _prefixBuf = null; - _suffixBuf = null; - _pixelStack = null; - _indexBuf = null; - _backupFrameIndexBuf = null; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int PixCoord(int x, int y) => x + y * _gifDimensions.Width; - - static readonly (int Start, int Step)[] Pass = - { - (0, 8), - (4, 8), - (2, 4), - (1, 2) - }; - - private void ClearImage() - { - Array.Fill(_bitmapBackBuffer, TransparentColor); - //ClearArea(_gifDimensions); - - _prevFrame = -1; - _backupFrame = -1; - } - - public void RenderFrame(int fIndex, WriteableBitmap writeableBitmap, bool forceClear = false) - { - if (_currentCtsToken.IsCancellationRequested) - return; - - if (fIndex < 0 | fIndex >= Frames.Count) - return; - - if (_prevFrame == fIndex) - return; - - if (fIndex == 0 || forceClear || fIndex < _prevFrame) - ClearImage(); - - DisposePreviousFrame(); - - _prevFrame++; - - // render intermediate frame - for (int idx = _prevFrame; idx < fIndex; ++idx) - { - var prevFrame = Frames[idx]; - - if (prevFrame.FrameDisposalMethod == FrameDisposal.Restore) - continue; - - if (prevFrame.FrameDisposalMethod == FrameDisposal.Background) - { - ClearArea(prevFrame.Dimensions); - continue; - } - - RenderFrameAt(idx, writeableBitmap); - } - - RenderFrameAt(fIndex, writeableBitmap); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void RenderFrameAt(int idx, WriteableBitmap writeableBitmap) - { - var tmpB = ArrayPool.Shared.Rent(MaxTempBuf); - - var curFrame = Frames[idx]; - DecompressFrameToIndexBuffer(curFrame, _indexBuf, tmpB); - - if (_hasFrameBackups & curFrame.ShouldBackup) - { - Buffer.BlockCopy(_indexBuf, 0, _backupFrameIndexBuf, 0, curFrame.Dimensions.TotalPixels); - _backupFrame = idx; - } - - DrawFrame(curFrame, _indexBuf); - - _prevFrame = idx; - _hasNewFrame = true; - - using var lockedBitmap = writeableBitmap.Lock(); - WriteBackBufToFb(lockedBitmap.Address); - - ArrayPool.Shared.Return(tmpB); - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DrawFrame(GifFrame curFrame, Memory frameIndexSpan) - { - var activeColorTable = - curFrame.IsLocalColorTableUsed ? curFrame.LocalColorTable : Header.GlobarColorTable; - - var cX = curFrame.Dimensions.X; - var cY = curFrame.Dimensions.Y; - var cH = curFrame.Dimensions.Height; - var cW = curFrame.Dimensions.Width; - var tC = curFrame.TransparentColorIndex; - var hT = curFrame.HasTransparency; - - if (curFrame.IsInterlaced) - { - for (var i = 0; i < 4; i++) - { - var curPass = Pass[i]; - var y = curPass.Start; - while (y < cH) - { - DrawRow(y); - y += curPass.Step; - } - } - } - else - { - for (var i = 0; i < cH; i++) - DrawRow(i); - } - - //for (var row = 0; row < cH; row++) - void DrawRow(int row) - { - // Get the starting point of the current row on frame's index stream. - var indexOffset = row * cW; - - // Get the target backbuffer offset from the frames coords. - var targetOffset = PixCoord(cX, row + cY); - var len = _bitmapBackBuffer.Length; - - for (var i = 0; i < cW; i++) - { - var indexColor = frameIndexSpan.Span[indexOffset + i]; - - if (activeColorTable == null || targetOffset >= len || - indexColor > activeColorTable.Length) return; - - if (!(hT & indexColor == tC)) - _bitmapBackBuffer[targetOffset] = activeColorTable[indexColor]; - - targetOffset++; - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DisposePreviousFrame() - { - if (_prevFrame == -1) - return; - - var prevFrame = Frames[_prevFrame]; - - switch (prevFrame.FrameDisposalMethod) - { - case FrameDisposal.Background: - ClearArea(prevFrame.Dimensions); - break; - case FrameDisposal.Restore: - if (_hasFrameBackups && _backupFrame != -1) - DrawFrame(Frames[_backupFrame], _backupFrameIndexBuf); - else - ClearArea(prevFrame.Dimensions); - break; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void ClearArea(GifRect area) - { - for (var y = 0; y < area.Height; y++) - { - var targetOffset = PixCoord(area.X, y + area.Y); - for (var x = 0; x < area.Width; x++) - _bitmapBackBuffer[targetOffset + x] = TransparentColor; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecompressFrameToIndexBuffer(GifFrame curFrame, Span indexSpan, byte[] tempBuf) - { - _fileStream.Position = curFrame.LzwStreamPosition; - var totalPixels = curFrame.Dimensions.TotalPixels; - - // Initialize GIF data stream decoder. - var dataSize = curFrame.LzwMinCodeSize; - var clear = 1 << dataSize; - var endOfInformation = clear + 1; - var available = clear + 2; - var oldCode = -1; - var codeSize = dataSize + 1; - var codeMask = (1 << codeSize) - 1; - - for (var code = 0; code < clear; code++) - { - _prefixBuf[code] = 0; - _suffixBuf[code] = (byte)code; - } - - // Decode GIF pixel stream. - int bits, first, top, pixelIndex; - var datum = bits = first = top = pixelIndex = 0; - - while (pixelIndex < totalPixels) - { - var blockSize = _fileStream.ReadBlock(tempBuf); - - if (blockSize == 0) - break; - - var blockPos = 0; - - while (blockPos < blockSize) - { - datum += tempBuf[blockPos] << bits; - blockPos++; - - bits += 8; - - while (bits >= codeSize) - { - // Get the next code. - var code = datum & codeMask; - datum >>= codeSize; - bits -= codeSize; - - // Interpret the code - if (code == clear) - { - // Reset decoder. - codeSize = dataSize + 1; - codeMask = (1 << codeSize) - 1; - available = clear + 2; - oldCode = -1; - continue; - } - - // Check for explicit end-of-stream - if (code == endOfInformation) - return; - - if (oldCode == -1) - { - indexSpan[pixelIndex++] = _suffixBuf[code]; - oldCode = code; - first = code; - continue; - } - - var inCode = code; - if (code >= available) - { - _pixelStack[top++] = (byte)first; - code = oldCode; - - if (top == MaxBits) - ThrowException(); - } - - while (code >= clear) - { - if (code >= MaxBits || code == _prefixBuf[code]) - ThrowException(); - - _pixelStack[top++] = _suffixBuf[code]; - code = _prefixBuf[code]; - - if (top == MaxBits) - ThrowException(); - } - - first = _suffixBuf[code]; - _pixelStack[top++] = (byte)first; - - // Add new code to the dictionary - if (available < MaxStackSize) - { - _prefixBuf[available] = (short)oldCode; - _suffixBuf[available] = (byte)first; - available++; - - if ((available & codeMask) == 0 && available < MaxStackSize) - { - codeSize++; - codeMask += available; - } - } - - oldCode = inCode; - - // Drain the pixel stack. - do - { - indexSpan[pixelIndex++] = _pixelStack[--top]; - } while (top > 0); - } - } - } - - while (pixelIndex < totalPixels) - indexSpan[pixelIndex++] = 0; // clear missing pixels - - void ThrowException() => throw new LzwDecompressionException(); - } - - /// - /// Directly copies the struct array to a bitmap IntPtr. - /// - private void WriteBackBufToFb(IntPtr targetPointer) - { - if (_currentCtsToken.IsCancellationRequested) - return; - - if (!(_hasNewFrame & _bitmapBackBuffer != null)) return; - - unsafe - { - fixed (void* src = &_bitmapBackBuffer[0]) - Buffer.MemoryCopy(src, targetPointer.ToPointer(), (uint)_backBufferBytes, - (uint)_backBufferBytes); - _hasNewFrame = false; - } - } - - /// - /// Processes GIF Header. - /// - private void ProcessHeaderData() - { - var str = _fileStream; - var tmpB = ArrayPool.Shared.Rent(MaxTempBuf); - var tempBuf = tmpB.AsSpan(); - - var _ = str.Read(tmpB, 0, 6); - - if (!tempBuf[..3].SequenceEqual(G87AMagic[..3].Span)) - throw new InvalidGifStreamException("Not a GIF stream."); - - if (!(tempBuf[..6].SequenceEqual(G87AMagic.Span) | - tempBuf[..6].SequenceEqual(G89AMagic.Span))) - throw new InvalidGifStreamException("Unsupported GIF Version: " + - Encoding.ASCII.GetString(tempBuf[..6].ToArray())); - - ProcessScreenDescriptor(tmpB); - - Header = new GifHeader - { - Dimensions = _gifDimensions, - HasGlobalColorTable = _gctUsed, - // GlobalColorTableCacheID = _globalColorTable, - GlobarColorTable = ProcessColorTable(ref str, tmpB, _gctSize), - GlobalColorTableSize = _gctSize, - BackgroundColorIndex = _bgIndex, - HeaderSize = _fileStream.Position - }; - - ArrayPool.Shared.Return(tmpB); - } - - /// - /// Parses colors from file stream to target color table. - /// - private static GifColor[] ProcessColorTable(ref Stream stream, byte[] rawBufSpan, int nColors) - { - var nBytes = 3 * nColors; - var target = new GifColor[nColors]; - - var n = stream.Read(rawBufSpan, 0, nBytes); - - if (n < nBytes) - throw new InvalidOperationException("Wrong color table bytes."); - - int i = 0, j = 0; - - while (i < nColors) - { - var r = rawBufSpan[j++]; - var g = rawBufSpan[j++]; - var b = rawBufSpan[j++]; - target[i++] = new GifColor(r, g, b); - } - - return target; - } - - /// - /// Parses screen and other GIF descriptors. - /// - private void ProcessScreenDescriptor(byte[] tempBuf) - { - var width = _fileStream.ReadUShortS(tempBuf); - var height = _fileStream.ReadUShortS(tempBuf); - - var packed = _fileStream.ReadByteS(tempBuf); - - _gctUsed = (packed & 0x80) != 0; - _gctSize = 2 << (packed & 7); - _bgIndex = _fileStream.ReadByteS(tempBuf); - - _gifDimensions = new GifRect(0, 0, width, height); - _fileStream.Skip(1); - } - - /// - /// Parses all frame data. - /// - private void ProcessFrameData() - { - _fileStream.Position = Header.HeaderSize; - - var tempBuf = ArrayPool.Shared.Rent(MaxTempBuf); - - var terminate = false; - var curFrame = 0; - - Frames.Add(new GifFrame()); - - do - { - var blockType = (BlockTypes)_fileStream.ReadByteS(tempBuf); - - switch (blockType) - { - case BlockTypes.Empty: - break; - - case BlockTypes.Extension: - ProcessExtensions(ref curFrame, tempBuf); - break; - - case BlockTypes.ImageDescriptor: - ProcessImageDescriptor(ref curFrame, tempBuf); - _fileStream.SkipBlocks(tempBuf); - break; - - case BlockTypes.Trailer: - Frames.RemoveAt(Frames.Count - 1); - terminate = true; - break; - - default: - _fileStream.SkipBlocks(tempBuf); - break; - } - - // Break the loop when the stream is not valid anymore. - if (_fileStream.Position >= _fileStream.Length & terminate == false) - throw new InvalidProgramException("Reach the end of the filestream without trailer block."); - } while (!terminate); - - ArrayPool.Shared.Return(tempBuf); - } - - /// - /// Parses GIF Image Descriptor Block. - /// - private void ProcessImageDescriptor(ref int curFrame, byte[] tempBuf) - { - var str = _fileStream; - var currentFrame = Frames[curFrame]; - - // Parse frame dimensions. - var frameX = str.ReadUShortS(tempBuf); - var frameY = str.ReadUShortS(tempBuf); - var frameW = str.ReadUShortS(tempBuf); - var frameH = str.ReadUShortS(tempBuf); - - frameW = (ushort)Math.Min(frameW, _gifDimensions.Width - frameX); - frameH = (ushort)Math.Min(frameH, _gifDimensions.Height - frameY); - - currentFrame.Dimensions = new GifRect(frameX, frameY, frameW, frameH); - - // Unpack interlace and lct info. - var packed = str.ReadByteS(tempBuf); - currentFrame.IsInterlaced = (packed & 0x40) != 0; - currentFrame.IsLocalColorTableUsed = (packed & 0x80) != 0; - currentFrame.LocalColorTableSize = (int)Math.Pow(2, (packed & 0x07) + 1); - - if (currentFrame.IsLocalColorTableUsed) - currentFrame.LocalColorTable = - ProcessColorTable(ref str, tempBuf, currentFrame.LocalColorTableSize); - - currentFrame.LzwMinCodeSize = str.ReadByteS(tempBuf); - currentFrame.LzwStreamPosition = str.Position; - - curFrame += 1; - Frames.Add(new GifFrame()); - } - - /// - /// Parses GIF Extension Blocks. - /// - private void ProcessExtensions(ref int curFrame, byte[] tempBuf) - { - var extType = (ExtensionType)_fileStream.ReadByteS(tempBuf); - - switch (extType) - { - case ExtensionType.GraphicsControl: - - _fileStream.ReadBlock(tempBuf); - var currentFrame = Frames[curFrame]; - var packed = tempBuf[0]; - - currentFrame.FrameDisposalMethod = (FrameDisposal)((packed & 0x1c) >> 2); - - if (currentFrame.FrameDisposalMethod != FrameDisposal.Restore - && currentFrame.FrameDisposalMethod != FrameDisposal.Background) - currentFrame.ShouldBackup = true; - - currentFrame.HasTransparency = (packed & 1) != 0; - - currentFrame.FrameDelay = - TimeSpan.FromMilliseconds(SpanToShort(tempBuf.AsSpan(1)) * 10); - - if (currentFrame.FrameDelay <= FrameDelayThreshold) - currentFrame.FrameDelay = FrameDelayDefault; - - currentFrame.TransparentColorIndex = tempBuf[3]; - break; - - case ExtensionType.Application: - var blockLen = _fileStream.ReadBlock(tempBuf); - var _ = tempBuf.AsSpan(0, blockLen); - var blockHeader = tempBuf.AsSpan(0, NetscapeMagic.Length); - - if (blockHeader.SequenceEqual(NetscapeMagic.Span)) - { - var count = 1; - - while (count > 0) - count = _fileStream.ReadBlock(tempBuf); - - var iterationCount = SpanToShort(tempBuf.AsSpan(1)); - - Header.Iterations = iterationCount; - } - else - _fileStream.SkipBlocks(tempBuf); - - break; - - default: - _fileStream.SkipBlocks(tempBuf); - break; - } - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifFrame.cs b/src/Avalonia.Gif/Decoding/GifFrame.cs deleted file mode 100644 index e15a201..0000000 --- a/src/Avalonia.Gif/Decoding/GifFrame.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Avalonia.Gif.Decoding -{ - public class GifFrame - { - public bool HasTransparency, IsInterlaced, IsLocalColorTableUsed; - public byte TransparentColorIndex; - public int LzwMinCodeSize, LocalColorTableSize; - public long LzwStreamPosition; - public TimeSpan FrameDelay; - public FrameDisposal FrameDisposalMethod; - public bool ShouldBackup; - public GifRect Dimensions; - public GifColor[] LocalColorTable; - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifHeader.cs b/src/Avalonia.Gif/Decoding/GifHeader.cs deleted file mode 100644 index d02dbc9..0000000 --- a/src/Avalonia.Gif/Decoding/GifHeader.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed under the MIT License. -// Copyright (C) 2018 Jumar A. Macato, All Rights Reserved. - -namespace Avalonia.Gif.Decoding -{ - public class GifHeader - { - public bool HasGlobalColorTable; - public int GlobalColorTableSize; - public ulong GlobalColorTableCacheId; - public int BackgroundColorIndex; - public long HeaderSize; - internal int Iterations = -1; - public GifRepeatBehavior IterationCount; - public GifRect Dimensions; - private GifColor[] _globarColorTable; - public GifColor[] GlobarColorTable; - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifRect.cs b/src/Avalonia.Gif/Decoding/GifRect.cs deleted file mode 100644 index 0ed9308..0000000 --- a/src/Avalonia.Gif/Decoding/GifRect.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace Avalonia.Gif.Decoding -{ - public readonly struct GifRect - { - public int X { get; } - public int Y { get; } - public int Width { get; } - public int Height { get; } - public int TotalPixels { get; } - - public GifRect(int x, int y, int width, int height) - { - X = x; - Y = y; - Width = width; - Height = height; - TotalPixels = width * height; - } - - public static bool operator ==(GifRect a, GifRect b) - { - return a.X == b.X && - a.Y == b.Y && - a.Width == b.Width && - a.Height == b.Height; - } - public static bool operator !=(GifRect a, GifRect b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - if (obj == null || GetType() != obj.GetType()) - return false; - - return this == (GifRect)obj; - } - - public override int GetHashCode() - { - return X.GetHashCode() ^ Y.GetHashCode() | Width.GetHashCode() ^ Height.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/GifRepeatBehavior.cs b/src/Avalonia.Gif/Decoding/GifRepeatBehavior.cs deleted file mode 100644 index 4b27a7b..0000000 --- a/src/Avalonia.Gif/Decoding/GifRepeatBehavior.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Avalonia.Gif.Decoding -{ - public class GifRepeatBehavior - { - public bool LoopForever { get; set; } - public int? Count { get; set; } - } -} diff --git a/src/Avalonia.Gif/Decoding/InvalidGifStreamException.cs b/src/Avalonia.Gif/Decoding/InvalidGifStreamException.cs deleted file mode 100644 index 73c3124..0000000 --- a/src/Avalonia.Gif/Decoding/InvalidGifStreamException.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed under the MIT License. -// Copyright (C) 2018 Jumar A. Macato, All Rights Reserved. - -using System; -using System.Runtime.Serialization; - -namespace Avalonia.Gif.Decoding -{ - [Serializable] - public class InvalidGifStreamException : Exception - { - public InvalidGifStreamException() - { - } - - public InvalidGifStreamException(string message) : base(message) - { - } - - public InvalidGifStreamException(string message, Exception innerException) : base(message, innerException) - { - } - - protected InvalidGifStreamException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Decoding/LzwDecompressionException.cs b/src/Avalonia.Gif/Decoding/LzwDecompressionException.cs deleted file mode 100644 index 2e74aaf..0000000 --- a/src/Avalonia.Gif/Decoding/LzwDecompressionException.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed under the MIT License. -// Copyright (C) 2018 Jumar A. Macato, All Rights Reserved. - -using System; -using System.Runtime.Serialization; - -namespace Avalonia.Gif.Decoding -{ - [Serializable] - public class LzwDecompressionException : Exception - { - public LzwDecompressionException() - { - } - - public LzwDecompressionException(string message) : base(message) - { - } - - public LzwDecompressionException(string message, Exception innerException) : base(message, innerException) - { - } - - protected LzwDecompressionException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/Extensions/StreamExtensions.cs b/src/Avalonia.Gif/Extensions/StreamExtensions.cs deleted file mode 100644 index d05bc63..0000000 --- a/src/Avalonia.Gif/Extensions/StreamExtensions.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.CompilerServices; - -namespace Avalonia.Gif.Extensions -{ - [DebuggerStepThrough] - internal static class StreamExtensions - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ushort SpanToShort(Span b) => (ushort)(b[0] | (b[1] << 8)); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Skip(this Stream stream, long count) - { - stream.Position += count; - } - - /// - /// Read a Gif block from stream while advancing the position. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int ReadBlock(this Stream stream, byte[] tempBuf) - { - stream.Read(tempBuf, 0, 1); - - var blockLength = (int)tempBuf[0]; - - if (blockLength > 0) - stream.Read(tempBuf, 0, blockLength); - - // Guard against infinite loop. - if (stream.Position >= stream.Length) - throw new InvalidGifStreamException("Reach the end of the filestream without trailer block."); - - return blockLength; - } - - /// - /// Skips GIF blocks until it encounters an empty block. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void SkipBlocks(this Stream stream, byte[] tempBuf) - { - int blockLength; - do - { - stream.Read(tempBuf, 0, 1); - - blockLength = tempBuf[0]; - stream.Position += blockLength; - - // Guard against infinite loop. - if (stream.Position >= stream.Length) - throw new InvalidGifStreamException("Reach the end of the filestream without trailer block."); - - } while (blockLength > 0); - } - - /// - /// Read a from stream by providing a temporary buffer. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ushort ReadUShortS(this Stream stream, byte[] tempBuf) - { - stream.Read(tempBuf, 0, 2); - return SpanToShort(tempBuf); - } - - /// - /// Read a from stream by providing a temporary buffer. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte ReadByteS(this Stream stream, byte[] tempBuf) - { - stream.Read(tempBuf, 0, 1); - var finalVal = tempBuf[0]; - return finalVal; - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/GifImage.cs b/src/Avalonia.Gif/GifImage.cs deleted file mode 100644 index 26c96a9..0000000 --- a/src/Avalonia.Gif/GifImage.cs +++ /dev/null @@ -1,276 +0,0 @@ -using Avalonia.Animation; -using Avalonia.Controls; -using Avalonia.Logging; -using Avalonia.Media; -using Avalonia.Rendering.Composition; -using Avalonia.VisualTree; -using System; -using System.IO; -using System.Numerics; - -namespace Avalonia.Gif -{ - public class GifImage : Control - { - public static readonly StyledProperty SourceUriRawProperty = - AvaloniaProperty.Register("SourceUriRaw"); - - public static readonly StyledProperty SourceUriProperty = - AvaloniaProperty.Register("SourceUri"); - - public static readonly StyledProperty SourceStreamProperty = - AvaloniaProperty.Register("SourceStream"); - - public static readonly StyledProperty IterationCountProperty = - AvaloniaProperty.Register("IterationCount", IterationCount.Infinite); - - private GifInstance? _gifInstance; - - public static readonly StyledProperty StretchDirectionProperty = - AvaloniaProperty.Register("StretchDirection"); - - public static readonly StyledProperty StretchProperty = - AvaloniaProperty.Register("Stretch"); - - private CompositionCustomVisual? _customVisual; - - private object? _initialSource = null; - - protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) - { - switch (change.Property.Name) - { - case nameof(SourceUriRaw): - case nameof(SourceUri): - case nameof(SourceStream): - SourceChanged(change); - break; - case nameof(Stretch): - case nameof(StretchDirection): - InvalidateArrange(); - InvalidateMeasure(); - Update(); - break; - case nameof(IterationCount): - IterationCountChanged(change); - break; - case nameof(Bounds): - Update(); - break; - } - - base.OnPropertyChanged(change); - } - - public string SourceUriRaw - { - get => GetValue(SourceUriRawProperty); - set => SetValue(SourceUriRawProperty, value); - } - - public Uri SourceUri - { - get => GetValue(SourceUriProperty); - set => SetValue(SourceUriProperty, value); - } - - public Stream SourceStream - { - get => GetValue(SourceStreamProperty); - set => SetValue(SourceStreamProperty, value); - } - - public IterationCount IterationCount - { - get => GetValue(IterationCountProperty); - set => SetValue(IterationCountProperty, value); - } - - public StretchDirection StretchDirection - { - get => GetValue(StretchDirectionProperty); - set => SetValue(StretchDirectionProperty, value); - } - - public Stretch Stretch - { - get => GetValue(StretchProperty); - set => SetValue(StretchProperty, value); - } - - private static void IterationCountChanged(AvaloniaPropertyChangedEventArgs e) - { - var image = e.Sender as GifImage; - if (image is null || e.NewValue is not IterationCount iterationCount) - return; - - image.IterationCount = iterationCount; - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - var compositor = ElementComposition.GetElementVisual(this)?.Compositor; - if (compositor == null || _customVisual?.Compositor == compositor) - return; - _customVisual = compositor.CreateCustomVisual(new CustomVisualHandler()); - ElementComposition.SetElementChildVisual(this, _customVisual); - _customVisual.SendHandlerMessage(CustomVisualHandler.StartMessage); - - if (_initialSource is not null) - { - UpdateGifInstance(_initialSource); - _initialSource = null; - } - - Update(); - base.OnAttachedToVisualTree(e); - } - - - private void Update() - { - if (_customVisual is null || _gifInstance is null) - return; - - var dpi = this.GetVisualRoot()?.RenderScaling ?? 1.0; - var sourceSize = _gifInstance.GifPixelSize.ToSize(dpi); - var viewPort = new Rect(Bounds.Size); - - var scale = Stretch.CalculateScaling(Bounds.Size, sourceSize, StretchDirection); - var scaledSize = sourceSize * scale; - var destRect = viewPort - .CenterRect(new Rect(scaledSize)) - .Intersect(viewPort); - - if (Stretch == Stretch.None) - { - _customVisual.Size = new Vector2((float)sourceSize.Width, (float)sourceSize.Height); - } - else - { - _customVisual.Size = new Vector2((float)destRect.Size.Width, (float)destRect.Size.Height); - } - - _customVisual.Offset = new Vector3((float)destRect.Position.X, (float)destRect.Position.Y, 0); - } - - private class CustomVisualHandler : CompositionCustomVisualHandler - { - private TimeSpan _animationElapsed; - private TimeSpan? _lastServerTime; - private GifInstance? _currentInstance; - private bool _running; - - public static readonly object StopMessage = new(), StartMessage = new(); - - public override void OnMessage(object message) - { - if (message == StartMessage) - { - _running = true; - _lastServerTime = null; - RegisterForNextAnimationFrameUpdate(); - } - else if (message == StopMessage) - { - _running = false; - } - else if (message is GifInstance instance) - { - _currentInstance?.Dispose(); - _currentInstance = instance; - } - } - - public override void OnAnimationFrameUpdate() - { - if (!_running) return; - Invalidate(); - RegisterForNextAnimationFrameUpdate(); - } - - public override void OnRender(ImmediateDrawingContext drawingContext) - { - if (_running) - { - if (_lastServerTime.HasValue) _animationElapsed += (CompositionNow - _lastServerTime.Value); - _lastServerTime = CompositionNow; - } - - try - { - if (_currentInstance is null || _currentInstance.IsDisposed) return; - - var bitmap = _currentInstance.ProcessFrameTime(_animationElapsed); - if (bitmap is not null) - { - drawingContext.DrawBitmap(bitmap, new Rect(_currentInstance.GifPixelSize.ToSize(1)), - GetRenderBounds()); - } - } - catch (Exception e) - { - Logger.Sink?.Log(LogEventLevel.Error, "GifImage Renderer ", this, e.ToString()); - - } - } - } - - /// - /// Measures the control. - /// - /// The available size. - /// The desired size of the control. - protected override Size MeasureOverride(Size availableSize) - { - var result = new Size(); - var scaling = this.GetVisualRoot()?.RenderScaling ?? 1.0; - if (_gifInstance != null) - { - result = Stretch.CalculateSize(availableSize, _gifInstance.GifPixelSize.ToSize(scaling), - StretchDirection); - } - - return result; - } - - /// - protected override Size ArrangeOverride(Size finalSize) - { - if (_gifInstance is null) return new Size(); - var scaling = this.GetVisualRoot()?.RenderScaling ?? 1.0; - var sourceSize = _gifInstance.GifPixelSize.ToSize(scaling); - var result = Stretch.CalculateSize(finalSize, sourceSize); - return result; - } - - - private void SourceChanged(AvaloniaPropertyChangedEventArgs e) - { - if (e.NewValue is null || (e.NewValue is string value && !Uri.IsWellFormedUriString(value, UriKind.Absolute))) - { - return; - } - - if (_customVisual is null) - { - _initialSource = e.NewValue; - return; - } - - UpdateGifInstance(e.NewValue); - - InvalidateArrange(); - InvalidateMeasure(); - Update(); - } - - private void UpdateGifInstance(object source) - { - _gifInstance?.Dispose(); - _gifInstance = new GifInstance(source); - _gifInstance.IterationCount = IterationCount; - _customVisual?.SendHandlerMessage(_gifInstance); - } - } -} diff --git a/src/Avalonia.Gif/GifInstance.cs b/src/Avalonia.Gif/GifInstance.cs deleted file mode 100644 index c582453..0000000 --- a/src/Avalonia.Gif/GifInstance.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Avalonia.Animation; -using Avalonia.Gif.Decoding; -using Avalonia.Media.Imaging; -using Avalonia.Platform; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; - -namespace Avalonia.Gif -{ - public class GifInstance : IDisposable - { - public IterationCount IterationCount { get; set; } - public bool AutoStart { get; private set; } = true; - private readonly GifDecoder _gifDecoder; - private readonly WriteableBitmap? _targetBitmap; - private TimeSpan _totalTime; - private readonly List _frameTimes; - private uint _iterationCount; - private int _currentFrameIndex; - private readonly List _colorTableIdList; - - public CancellationTokenSource CurrentCts { get; } - - internal GifInstance(object newValue) : this(newValue switch - { - Stream s => s, - Uri u => GetStreamFromUri(u), - string str => GetStreamFromString(str), - _ => throw new InvalidDataException("Unsupported source object") - }) - { } - - public GifInstance(string uri) : this(GetStreamFromString(uri)) - { } - - public GifInstance(Uri uri) : this(GetStreamFromUri(uri)) - { } - - public GifInstance(Stream currentStream) - { - if (!currentStream.CanSeek) - throw new InvalidDataException("The provided stream is not seekable."); - - if (!currentStream.CanRead) - throw new InvalidOperationException("Can't read the stream provided."); - - currentStream.Seek(0, SeekOrigin.Begin); - - CurrentCts = new CancellationTokenSource(); - - _gifDecoder = new GifDecoder(currentStream, CurrentCts.Token); - var pixSize = new PixelSize(_gifDecoder.Header.Dimensions.Width, _gifDecoder.Header.Dimensions.Height); - - _targetBitmap = new WriteableBitmap(pixSize, new Vector(96, 96), PixelFormat.Bgra8888, AlphaFormat.Opaque); - GifPixelSize = pixSize; - - _totalTime = TimeSpan.Zero; - - _frameTimes = _gifDecoder.Frames.Select(frame => - { - _totalTime = _totalTime.Add(frame.FrameDelay); - return _totalTime; - }).ToList(); - - _gifDecoder.RenderFrame(0, _targetBitmap); - } - - private static Stream GetStreamFromString(string str) - { - if (!Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out var res)) - { - throw new InvalidCastException("The string provided can't be converted to URI."); - } - - return GetStreamFromUri(res); - } - - private static Stream GetStreamFromUri(Uri uri) - { - var uriString = uri.OriginalString.Trim(); - - if (!uriString.StartsWith("resm") && !uriString.StartsWith("avares")) - throw new InvalidDataException( - "The URI provided is not currently supported."); - - return AssetLoader.Open(uri); - } - - public int GifFrameCount => _frameTimes.Count; - - public PixelSize GifPixelSize { get; } - - public void Dispose() - { - IsDisposed = true; - CurrentCts.Cancel(); - _targetBitmap?.Dispose(); - } - - public bool IsDisposed { get; private set; } - - - public WriteableBitmap? ProcessFrameTime(TimeSpan stopwatchElapsed) - { - if (!IterationCount.IsInfinite && _iterationCount > IterationCount.Value) - { - return null; - } - - if (CurrentCts.IsCancellationRequested || _targetBitmap is null) - { - return null; - } - - var elapsedTicks = stopwatchElapsed.Ticks; - var timeModulus = TimeSpan.FromTicks(elapsedTicks % _totalTime.Ticks); - var targetFrame = _frameTimes.FirstOrDefault(x => timeModulus < x); - var currentFrame = _frameTimes.IndexOf(targetFrame); - if (currentFrame == -1) currentFrame = 0; - - if (_currentFrameIndex == currentFrame) - return _targetBitmap; - - _iterationCount = (uint)(elapsedTicks / _totalTime.Ticks); - - return ProcessFrameIndex(currentFrame); - } - - internal WriteableBitmap ProcessFrameIndex(int frameIndex) - { - _gifDecoder.RenderFrame(frameIndex, _targetBitmap); - _currentFrameIndex = frameIndex; - - return _targetBitmap; - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Gif/InvalidGifStreamException.cs b/src/Avalonia.Gif/InvalidGifStreamException.cs deleted file mode 100644 index dc10557..0000000 --- a/src/Avalonia.Gif/InvalidGifStreamException.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Avalonia.Gif -{ - [Serializable] - internal class InvalidGifStreamException : Exception - { - public InvalidGifStreamException() - { - } - - public InvalidGifStreamException(string message) : base(message) - { - } - - public InvalidGifStreamException(string message, Exception innerException) : base(message, innerException) - { - } - - protected InvalidGifStreamException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/Login/TestLoginInfo.cs b/src/BiliSharp.UnitTest/Api/Login/TestLoginInfo.cs deleted file mode 100644 index 84c50d0..0000000 --- a/src/BiliSharp.UnitTest/Api/Login/TestLoginInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using BiliSharp.Api.Login; - -namespace BiliSharp.UnitTest.Api.Login; - -public class TestLoginInfo -{ - [Fact] - public void TestGetNavigationInfo_Default() - { - Cookies.GetMyCookies(); - - long mid = 42018135; - var info = LoginInfo.GetNavigationInfo(); - Assert.Equal(mid, info.Data.Mid); - } - - [Fact] - public void TestGetLoginInfoStat_Default() - { - Cookies.GetMyCookies(); - - var stat = LoginInfo.GetLoginInfoStat(); - Assert.NotNull(stat); - } - - [Fact] - public void TestGetMyCoin_Default() - { - Cookies.GetMyCookies(); - - var coin = LoginInfo.GetMyCoin(); - Assert.NotNull(coin); - } - -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/Login/TestLoginNotice.cs b/src/BiliSharp.UnitTest/Api/Login/TestLoginNotice.cs deleted file mode 100644 index 1130ec4..0000000 --- a/src/BiliSharp.UnitTest/Api/Login/TestLoginNotice.cs +++ /dev/null @@ -1,16 +0,0 @@ -using BiliSharp.Api.Login; - -namespace BiliSharp.UnitTest.Api.Login; - -public class TestLoginNotice -{ - [Fact] - public void TestGetLoginNotice_Default() - { - Cookies.GetMyCookies(); - - long mid = 42018135; - var notice = LoginNotice.GetLoginNotice(mid); - Assert.Equal(mid, notice.Data.Mid); - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/Login/TestLoginQR.cs b/src/BiliSharp.UnitTest/Api/Login/TestLoginQR.cs deleted file mode 100644 index 4c21328..0000000 --- a/src/BiliSharp.UnitTest/Api/Login/TestLoginQR.cs +++ /dev/null @@ -1,23 +0,0 @@ -using BiliSharp.Api.Login; - -namespace BiliSharp.UnitTest.Api.Login; - -public class TestLoginQR -{ - [Fact] - public void TestGenerateQRCode_Default() - { - var qrcode = LoginQR.GenerateQRCode(); - Assert.NotNull(qrcode.Data); - } - - [Fact] - public void TestPollQRCode_Default() - { - var qrcode = LoginQR.GenerateQRCode(); - Assert.NotNull(qrcode.Data); - - var poll = LoginQR.PollQRCode(qrcode.Data.QrcodeKey); - Assert.NotNull(poll.Data); - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/Sign/TestWbiSign.cs b/src/BiliSharp.UnitTest/Api/Sign/TestWbiSign.cs deleted file mode 100644 index 93231b8..0000000 --- a/src/BiliSharp.UnitTest/Api/Sign/TestWbiSign.cs +++ /dev/null @@ -1,87 +0,0 @@ -using BiliSharp.Api.Sign; - -namespace BiliSharp.UnitTest.Api.Sign -{ - public class TestWbiSign - { - [Fact] - public void TestParametersToQuery_Default() - { - var parameters = new Dictionary - { - { "fourk", 1 }, - { "fnver", 0 }, - { "fnval", 4048 }, - { "cid", 405595939 }, - { "qn", 120 }, - { "bvid", "BV1Sg411F7cb" }, - { "aid", 505421421 } - }; - string expected = "fourk=1&fnver=0&fnval=4048&cid=405595939&qn=120&bvid=BV1Sg411F7cb&aid=505421421"; - - string query = WbiSign.ParametersToQuery(parameters); - Assert.Equal(expected, query); - } - - [Fact] - public void TestParametersToQuery_Empty() - { - var parameters = new Dictionary(); - string query = WbiSign.ParametersToQuery(parameters); - Assert.Equal("", query); - } - - [Fact] - public void TestKeys_Default() - { - var key1 = WbiSign.GetKey(); - Assert.NotNull(key1); - - string imgKey = "34478ba821254d9d93542680e3b86100"; - string subKey = "7e16a90d190a4355a78fd00b32a38de6"; - var keys = new Tuple(imgKey, subKey); - WbiSign.SetKey(keys); - - var key2 = WbiSign.GetKey(); - Assert.Equal(imgKey, key2.Item1); - Assert.Equal(subKey, key2.Item2); - } - - [Fact] - public void TestEncodeWbi_Default() - { - var parameters = new Dictionary - { - { "fourk", 1 }, - { "fnver", 0 }, - { "fnval", 4048 }, - { "cid", 405595939 }, - { "qn", 120 }, - { "bvid", "BV1Sg411F7cb" }, - { "aid", 505421421 } - }; - - var wbi = WbiSign.EncodeWbi(parameters); - Assert.NotNull(wbi["w_rid"]); - } - - [Fact] - public void TestEncodeWbi_Default2() - { - var parameters = new Dictionary - { - { "fourk", 1 }, - { "fnver", 0 }, - { "fnval", 4048 }, - { "cid", 405595939 }, - { "qn", 120 }, - { "bvid", "BV1Sg411F7cb" }, - { "aid", 505421421 } - }; - - var wbi = WbiSign.EncodeWbi(parameters, "653657f524a547ac981ded72ea172057", "6e4909c702f846728e64f6007736a338"); - Assert.NotNull(wbi["w_rid"]); - } - - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/User/TestNickname.cs b/src/BiliSharp.UnitTest/Api/User/TestNickname.cs deleted file mode 100644 index 9712b06..0000000 --- a/src/BiliSharp.UnitTest/Api/User/TestNickname.cs +++ /dev/null @@ -1,25 +0,0 @@ -using BiliSharp.Api.User; - -namespace BiliSharp.UnitTest.Api.User -{ - public class TestNickname - { - [Fact] - public void TestCheckNickname_Default() - { - Equal("downkyi", 0); - Equal("maozedong", 40002); - Equal("//", 40004); - Equal("test0000000000000", 40005); - Equal("0", 40006); - Equal("test", 40014); - } - - private static void Equal(string nickname, int code) - { - var response = Nickname.CheckNickname(nickname); - Assert.Equal(code, response.Code); - } - - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/User/TestUserInfo.cs b/src/BiliSharp.UnitTest/Api/User/TestUserInfo.cs deleted file mode 100644 index 5b65f53..0000000 --- a/src/BiliSharp.UnitTest/Api/User/TestUserInfo.cs +++ /dev/null @@ -1,70 +0,0 @@ -using BiliSharp.Api.Login; -using BiliSharp.Api.Sign; -using BiliSharp.Api.User; - -namespace BiliSharp.UnitTest.Api.User -{ - public class TestUserInfo - { - [Fact] - public void TestGetUserInfo_Default() - { - Cookies.GetMyCookies(); - - // 设置wbi keys - var info = LoginInfo.GetNavigationInfo(); - var imgKey = info.Data.WbiImg.ImgUrl.Split('/').ToList().Last().Split('.')[0]; - var subKey = info.Data.WbiImg.SubUrl.Split('/').ToList().Last().Split('.')[0]; - var keys = new Tuple(imgKey, subKey); - WbiSign.SetKey(keys); - - long mid = 42018135; - var userInfo = UserInfo.GetUserInfo(mid); - - Assert.Equal(mid, userInfo.Data.Mid); - } - - [Fact] - public void TestGetUserCard_Default() - { - Cookies.GetMyCookies(); - - long mid = 42018135; - var userCard = UserInfo.GetUserCard(mid); - - Assert.Equal(mid.ToString(), userCard.Data.Card.Mid); - } - - [Fact] - public void TestGetMyInfo_Default() - { - Cookies.GetMyCookies(); - - long mid = 42018135; - var myInfo = UserInfo.GetMyInfo(); - - Assert.Equal(mid, myInfo.Data.Mid); - } - - [Fact] - public void TestGetUserCards_Default() - { - Cookies.GetMyCookies(); - - // https://api.vc.bilibili.com/account/v1/user/cards?uids=314521322,206840230,49246269 - List ids = new() - { - 314521322, - 206840230, - 49246269 - }; - var users = UserInfo.GetUserCards(ids); - - foreach (var user in users.Data) - { - Assert.Contains(user.Mid, ids); - } - } - - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/Api/Video/TestVideoInfo.cs b/src/BiliSharp.UnitTest/Api/Video/TestVideoInfo.cs deleted file mode 100644 index 2ff7549..0000000 --- a/src/BiliSharp.UnitTest/Api/Video/TestVideoInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using BiliSharp.Api.Login; -using BiliSharp.Api.Sign; -using BiliSharp.Api.Video; - -namespace BiliSharp.UnitTest.Api.Video -{ - public class TestVideoInfo - { - [Fact] - public void TestGetVideoViewInfo_Default() - { - // 设置wbi keys - var info = LoginInfo.GetNavigationInfo(); - var imgKey = info.Data.WbiImg.ImgUrl.Split('/').ToList().Last().Split('.')[0]; - var subKey = info.Data.WbiImg.SubUrl.Split('/').ToList().Last().Split('.')[0]; - var keys = new Tuple(imgKey, subKey); - WbiSign.SetKey(keys); - - string bvid = "BV1Pu4y1y7FA"; - long aid = 915570400; - var videoInfo = VideoInfo.GetVideoViewInfo(bvid, aid); - - Assert.Equal(bvid, videoInfo.Data.View.Bvid); - Assert.Equal(aid, videoInfo.Data.View.Aid); - } - - } -} \ No newline at end of file diff --git a/src/BiliSharp.UnitTest/BiliSharp.UnitTest.csproj b/src/BiliSharp.UnitTest/BiliSharp.UnitTest.csproj deleted file mode 100644 index 93c83b6..0000000 --- a/src/BiliSharp.UnitTest/BiliSharp.UnitTest.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - net7.0 - enable - enable - - false - true - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - diff --git a/src/BiliSharp.UnitTest/Cookies.cs b/src/BiliSharp.UnitTest/Cookies.cs deleted file mode 100644 index f437dda..0000000 --- a/src/BiliSharp.UnitTest/Cookies.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Net; - -namespace BiliSharp.UnitTest; - -public static class Cookies -{ - /// - /// 解析从浏览器获取的cookies,用于设置cookie - /// - /// - /// - public static CookieContainer ParseCookieByString(string str) - { - var cookieContainer = new CookieContainer(); - - var cookies = str.Replace(" ", "").Split(";"); - foreach (var cookie in cookies) - { - DateTime dateTime = DateTime.Now; - dateTime = dateTime.AddMonths(12); - - var temp = cookie.Split("="); - var name = temp[0]; - var value = temp[1]; - - // 添加cookie - cookieContainer.Add(new Cookie(name, value, "/", ".bilibili.com") { Expires = dateTime }); - } - return cookieContainer; - } - - public static void GetMyCookies() - { - string cookiesStr = "DedeUserID=42018135; " + - "DedeUserID__ckMd5=44e22fa30fe34ac4; " + - "SESSDATA=32c16297%2C1700815953%2Cb11cd%2A51; " + - "bili_jct=98dbd091dc07d8f9b69ba3845974e7c8; " + - "sid=6vomjg3u"; - var cookies = ParseCookieByString(cookiesStr); - BiliManager.Instance().SetCookies(cookies); - } - -} diff --git a/src/BiliSharp.UnitTest/Usings.cs b/src/BiliSharp.UnitTest/Usings.cs deleted file mode 100644 index 8c927eb..0000000 --- a/src/BiliSharp.UnitTest/Usings.cs +++ /dev/null @@ -1 +0,0 @@ -global using Xunit; \ No newline at end of file diff --git a/src/BiliSharp/Api/Login/LoginInfo.cs b/src/BiliSharp/Api/Login/LoginInfo.cs deleted file mode 100644 index 6f204c2..0000000 --- a/src/BiliSharp/Api/Login/LoginInfo.cs +++ /dev/null @@ -1,40 +0,0 @@ -using BiliSharp.Api.Models.Login; - -namespace BiliSharp.Api.Login -{ - /// - /// 登录基本信息 - /// - public static class LoginInfo - { - /// - /// 导航栏用户信息 - /// - /// - public static NavigationLoginInfo GetNavigationInfo() - { - string url = "https://api.bilibili.com/x/web-interface/nav"; - return Utils.GetData(url); - } - - /// - /// 登录用户状态数(双端) - /// - /// - public static LoginInfoStat GetLoginInfoStat() - { - string url = "https://api.bilibili.com/x/web-interface/nav/stat"; - return Utils.GetData(url); - } - - /// - /// 获取硬币数 - /// - /// - public static MyCoin GetMyCoin() - { - string url = "https://account.bilibili.com/site/getCoin"; - return Utils.GetData(url); - } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Login/LoginNotice.cs b/src/BiliSharp/Api/Login/LoginNotice.cs deleted file mode 100644 index c896248..0000000 --- a/src/BiliSharp/Api/Login/LoginNotice.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace BiliSharp.Api.Login -{ - /// - /// 登录记录 - /// - public static class LoginNotice - { - /// - /// 查询登录记录 - /// - /// - public static Models.Login.LoginNotice GetLoginNotice(long mid) - { - string url = $"https://api.bilibili.com/x/safecenter/login_notice?mid={mid}"; - return Utils.GetData(url); - } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Login/LoginQR.cs b/src/BiliSharp/Api/Login/LoginQR.cs deleted file mode 100644 index e5fc29b..0000000 --- a/src/BiliSharp/Api/Login/LoginQR.cs +++ /dev/null @@ -1,30 +0,0 @@ -using BiliSharp.Api.Models.Login; - -namespace BiliSharp.Api.Login -{ - /// - /// 二维码登录 - /// - public static class LoginQR - { - /// - /// 申请二维码(web端) - /// - /// - public static LoginQRCode GenerateQRCode() - { - string url = "https://passport.bilibili.com/x/passport-login/web/qrcode/generate"; - return Utils.GetData(url); - } - - /// - /// 扫码登录(web端) - /// - /// - public static LoginQRCodePoll PollQRCode(string qrcodeKey) - { - string url = $"https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key={qrcodeKey}"; - return Utils.GetData(url); - } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/LoginInfoStat.cs b/src/BiliSharp/Api/Models/Login/LoginInfoStat.cs deleted file mode 100644 index eaa79cc..0000000 --- a/src/BiliSharp/Api/Models/Login/LoginInfoStat.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://api.bilibili.com/x/web-interface/nav/stat - /// - public class LoginInfoStat - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public LoginInfoStatData Data { get; set; } - } - - /// - /// - /// - public class LoginInfoStatData - { - /// - /// - /// - [JsonPropertyName("following")] - public int Following { get; set; } - - /// - /// - /// - [JsonPropertyName("follower")] - public int Follower { get; set; } - - /// - /// - /// - [JsonPropertyName("dynamic_count")] - public int DynamicCount { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/LoginNotice.cs b/src/BiliSharp/Api/Models/Login/LoginNotice.cs deleted file mode 100644 index 453c1bf..0000000 --- a/src/BiliSharp/Api/Models/Login/LoginNotice.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://api.bilibili.com/x/safecenter/login_notice?mid= - /// - public class LoginNotice - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public LoginNoticeData Data { get; set; } - } - - /// - /// - /// - public class LoginNoticeData - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("device_name")] - public string DeviceName { get; set; } - - /// - /// - /// - [JsonPropertyName("login_type")] - public string LoginType { get; set; } - - /// - /// - /// - [JsonPropertyName("login_time")] - public string LoginTime { get; set; } - - /// - /// - /// - [JsonPropertyName("location")] - public string Location { get; set; } - - /// - /// - /// - [JsonPropertyName("ip")] - public string Ip { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/LoginQRCode.cs b/src/BiliSharp/Api/Models/Login/LoginQRCode.cs deleted file mode 100644 index 40921fb..0000000 --- a/src/BiliSharp/Api/Models/Login/LoginQRCode.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://passport.bilibili.com/x/passport-login/web/qrcode/generate - /// - public class LoginQRCode - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public LoginQRCodeData Data { get; set; } - } - - /// - /// - /// - public class LoginQRCodeData - { - /// - /// - /// - [JsonPropertyName("url")] - public string Url { get; set; } - - /// - /// - /// - [JsonPropertyName("qrcode_key")] - public string QrcodeKey { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/LoginQRCodePoll.cs b/src/BiliSharp/Api/Models/Login/LoginQRCodePoll.cs deleted file mode 100644 index e183d69..0000000 --- a/src/BiliSharp/Api/Models/Login/LoginQRCodePoll.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key= - /// - public class LoginQRCodePoll - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public LoginQRCodePollData Data { get; set; } - } - - /// - /// - /// - public class LoginQRCodePollData - { - /// - /// - /// - [JsonPropertyName("url")] - public string Url { get; set; } - - /// - /// - /// - [JsonPropertyName("refresh_token")] - public string RefreshToken { get; set; } - - /// - /// - /// - [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } - - /// - /// - /// - [JsonPropertyName("code")] - public long Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/MyCoin.cs b/src/BiliSharp/Api/Models/Login/MyCoin.cs deleted file mode 100644 index b7a9d7a..0000000 --- a/src/BiliSharp/Api/Models/Login/MyCoin.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://account.bilibili.com/site/getCoin - /// - public class MyCoin - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public bool Status { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public MyCoinData Data { get; set; } - } - - /// - /// - /// - public class MyCoinData - { - /// - /// - /// - [JsonPropertyName("money")] - public int Money { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Login/NavigationLoginInfo.cs b/src/BiliSharp/Api/Models/Login/NavigationLoginInfo.cs deleted file mode 100644 index 6475320..0000000 --- a/src/BiliSharp/Api/Models/Login/NavigationLoginInfo.cs +++ /dev/null @@ -1,556 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Login -{ - /// - /// https://api.bilibili.com/x/web-interface/nav - /// - public class NavigationLoginInfo - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public NavigationLoginInfoData Data { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoData - { - /// - /// - /// - [JsonPropertyName("isLogin")] - public bool Islogin { get; set; } - - /// - /// - /// - [JsonPropertyName("email_verified")] - public int EmailVerified { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_type")] - public int FaceNftType { get; set; } - - /// - /// - /// - [JsonPropertyName("level_info")] - public NavigationLoginInfoDataLevelInfo LevelInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("mobile_verified")] - public int MobileVerified { get; set; } - - /// - /// - /// - [JsonPropertyName("money")] - public int Money { get; set; } - - /// - /// - /// - [JsonPropertyName("moral")] - public int Moral { get; set; } - - /// - /// - /// - [JsonPropertyName("official")] - public NavigationLoginInfoDataOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("officialVerify")] - public NavigationLoginInfoDataOfficialverify Officialverify { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public NavigationLoginInfoDataPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("scores")] - public int Scores { get; set; } - - /// - /// - /// - [JsonPropertyName("uname")] - public string Uname { get; set; } - - /// - /// - /// - [JsonPropertyName("vipDueDate")] - public long Vipduedate { get; set; } - - /// - /// - /// - [JsonPropertyName("vipStatus")] - public int Vipstatus { get; set; } - - /// - /// - /// - [JsonPropertyName("vipType")] - public int Viptype { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_theme_type")] - public int VipThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_label")] - public NavigationLoginInfoDataVipLabel VipLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_avatar_subscript")] - public int VipAvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_nickname_color")] - public string VipNicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public NavigationLoginInfoDataVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("wallet")] - public NavigationLoginInfoDataWallet Wallet { get; set; } - - /// - /// - /// - [JsonPropertyName("has_shop")] - public bool HasShop { get; set; } - - /// - /// - /// - [JsonPropertyName("shop_url")] - public string ShopUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("allowance_count")] - public int AllowanceCount { get; set; } - - /// - /// - /// - [JsonPropertyName("answer_status")] - public int AnswerStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - - /// - /// - /// - [JsonPropertyName("wbi_img")] - public NavigationLoginInfoDataWbiImg WbiImg { get; set; } - - /// - /// - /// - [JsonPropertyName("is_jury")] - public bool IsJury { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataLevelInfo - { - /// - /// - /// - [JsonPropertyName("current_level")] - public int CurrentLevel { get; set; } - - /// - /// - /// - [JsonPropertyName("current_min")] - public int CurrentMin { get; set; } - - /// - /// - /// - [JsonPropertyName("current_exp")] - public int CurrentExp { get; set; } - - /// - /// - /// - [JsonPropertyName("next_exp")] - public object NextExp { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataOfficialverify - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public NavigationLoginInfoDataVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataWallet - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("bcoin_balance")] - public int BcoinBalance { get; set; } - - /// - /// - /// - [JsonPropertyName("coupon_balance")] - public int CouponBalance { get; set; } - - /// - /// - /// - [JsonPropertyName("coupon_due_time")] - public int CouponDueTime { get; set; } - } - - /// - /// - /// - public class NavigationLoginInfoDataWbiImg - { - /// - /// - /// - [JsonPropertyName("img_url")] - public string ImgUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("sub_url")] - public string SubUrl { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/User/MyInfo.cs b/src/BiliSharp/Api/Models/User/MyInfo.cs deleted file mode 100644 index cfb71cd..0000000 --- a/src/BiliSharp/Api/Models/User/MyInfo.cs +++ /dev/null @@ -1,652 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.User -{ - /// - /// https://api.bilibili.com/x/space/myinfo - /// - public class MyInfo - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public MyInfoData Data { get; set; } - } - - /// - /// - /// - public class MyInfoData - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("sex")] - public string Sex { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("sign")] - public string Sign { get; set; } - - /// - /// - /// - [JsonPropertyName("rank")] - public int Rank { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public int Level { get; set; } - - /// - /// - /// - [JsonPropertyName("jointime")] - public int Jointime { get; set; } - - /// - /// - /// - [JsonPropertyName("moral")] - public int Moral { get; set; } - - /// - /// - /// - [JsonPropertyName("silence")] - public int Silence { get; set; } - - /// - /// - /// - [JsonPropertyName("email_status")] - public int EmailStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tel_status")] - public int TelStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("identification")] - public int Identification { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public MyInfoDataVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public MyInfoDataPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("nameplate")] - public MyInfoDataNameplate Nameplate { get; set; } - - /// - /// - /// - [JsonPropertyName("official")] - public MyInfoDataOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("birthday")] - public long Birthday { get; set; } - - /// - /// - /// - [JsonPropertyName("is_tourist")] - public int IsTourist { get; set; } - - /// - /// - /// - [JsonPropertyName("is_fake_account")] - public int IsFakeAccount { get; set; } - - /// - /// - /// - [JsonPropertyName("pin_prompting")] - public int PinPrompting { get; set; } - - /// - /// - /// - [JsonPropertyName("is_deleted")] - public int IsDeleted { get; set; } - - /// - /// - /// - [JsonPropertyName("in_reg_audit")] - public int InRegAudit { get; set; } - - /// - /// - /// - [JsonPropertyName("is_rip_user")] - public bool IsRipUser { get; set; } - - /// - /// - /// - [JsonPropertyName("profession")] - public MyInfoDataProfession Profession { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_new")] - public int FaceNftNew { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - - /// - /// - /// - [JsonPropertyName("honours")] - public MyInfoDataHonours Honours { get; set; } - - /// - /// - /// - [JsonPropertyName("digital_id")] - public string DigitalId { get; set; } - - /// - /// - /// - [JsonPropertyName("digital_type")] - public int DigitalType { get; set; } - - /// - /// - /// - [JsonPropertyName("level_exp")] - public MyInfoDataLevelExp LevelExp { get; set; } - - /// - /// - /// - [JsonPropertyName("coins")] - public int Coins { get; set; } - - /// - /// - /// - [JsonPropertyName("following")] - public int Following { get; set; } - - /// - /// - /// - [JsonPropertyName("follower")] - public int Follower { get; set; } - } - - /// - /// - /// - public class MyInfoDataVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public MyInfoDataVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - } - - /// - /// - /// - public class MyInfoDataVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class MyInfoDataPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class MyInfoDataNameplate - { - /// - /// - /// - [JsonPropertyName("nid")] - public int Nid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("image_small")] - public string ImageSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public string Level { get; set; } - - /// - /// - /// - [JsonPropertyName("condition")] - public string Condition { get; set; } - } - - /// - /// - /// - public class MyInfoDataOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class MyInfoDataProfession - { - /// - /// - /// - [JsonPropertyName("id")] - public int Id { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("show_name")] - public string ShowName { get; set; } - - /// - /// - /// - [JsonPropertyName("is_show")] - public int IsShow { get; set; } - - /// - /// - /// - [JsonPropertyName("category_one")] - public string CategoryOne { get; set; } - - /// - /// - /// - [JsonPropertyName("realname")] - public string Realname { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("department")] - public string Department { get; set; } - } - - /// - /// - /// - public class MyInfoDataHonours - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("colour")] - public MyInfoDataHonoursColour Colour { get; set; } - - /// - /// - /// - [JsonPropertyName("tags")] - public object Tags { get; set; } - } - - /// - /// - /// - public class MyInfoDataHonoursColour - { - /// - /// - /// - [JsonPropertyName("dark")] - public string Dark { get; set; } - - /// - /// - /// - [JsonPropertyName("normal")] - public string Normal { get; set; } - } - - /// - /// - /// - public class MyInfoDataLevelExp - { - /// - /// - /// - [JsonPropertyName("current_level")] - public int CurrentLevel { get; set; } - - /// - /// - /// - [JsonPropertyName("current_min")] - public int CurrentMin { get; set; } - - /// - /// - /// - [JsonPropertyName("current_exp")] - public int CurrentExp { get; set; } - - /// - /// - /// - [JsonPropertyName("next_exp")] - public int NextExp { get; set; } - - /// - /// - /// - [JsonPropertyName("level_up")] - public long LevelUp { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/User/Nickname.cs b/src/BiliSharp/Api/Models/User/Nickname.cs deleted file mode 100644 index 8c08569..0000000 --- a/src/BiliSharp/Api/Models/User/Nickname.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.User -{ - /// - /// https://passport.bilibili.com/web/generic/check/nickname?nickName=hahaha - /// - public class Nickname - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/User/UserCard.cs b/src/BiliSharp/Api/Models/User/UserCard.cs deleted file mode 100644 index 090b0c3..0000000 --- a/src/BiliSharp/Api/Models/User/UserCard.cs +++ /dev/null @@ -1,599 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.User -{ - /// - /// https://api.bilibili.com/x/web-interface/card?mid=314521322&photo=true - /// - public class UserCard - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public UserCardData Data { get; set; } - } - - /// - /// - /// - public class UserCardData - { - /// - /// - /// - [JsonPropertyName("card")] - public UserCardDataCard Card { get; set; } - - /// - /// - /// - [JsonPropertyName("space")] - public UserCardDataSpace Space { get; set; } - - /// - /// - /// - [JsonPropertyName("following")] - public bool Following { get; set; } - - /// - /// - /// - [JsonPropertyName("archive_count")] - public int ArchiveCount { get; set; } - - /// - /// - /// - [JsonPropertyName("article_count")] - public int ArticleCount { get; set; } - - /// - /// - /// - [JsonPropertyName("follower")] - public long Follower { get; set; } - - /// - /// - /// - [JsonPropertyName("like_num")] - public long LikeNum { get; set; } - } - - /// - /// - /// - public class UserCardDataCard - { - /// - /// - /// - [JsonPropertyName("mid")] - public string Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("approve")] - public bool Approve { get; set; } - - /// - /// - /// - [JsonPropertyName("sex")] - public string Sex { get; set; } - - /// - /// - /// - [JsonPropertyName("rank")] - public string Rank { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_type")] - public int FaceNftType { get; set; } - - /// - /// - /// - [JsonPropertyName("DisplayRank")] - public string Displayrank { get; set; } - - /// - /// - /// - [JsonPropertyName("regtime")] - public int Regtime { get; set; } - - /// - /// - /// - [JsonPropertyName("spacesta")] - public int Spacesta { get; set; } - - /// - /// - /// - [JsonPropertyName("birthday")] - public string Birthday { get; set; } - - /// - /// - /// - [JsonPropertyName("place")] - public string Place { get; set; } - - /// - /// - /// - [JsonPropertyName("description")] - public string Description { get; set; } - - /// - /// - /// - [JsonPropertyName("article")] - public int Article { get; set; } - - /// - /// - /// - [JsonPropertyName("attentions")] - public List Attentions { get; set; } - - /// - /// - /// - [JsonPropertyName("fans")] - public long Fans { get; set; } - - /// - /// - /// - [JsonPropertyName("friend")] - public int Friend { get; set; } - - /// - /// - /// - [JsonPropertyName("attention")] - public int Attention { get; set; } - - /// - /// - /// - [JsonPropertyName("sign")] - public string Sign { get; set; } - - /// - /// - /// - [JsonPropertyName("level_info")] - public UserCardDataCardLevelInfo LevelInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public UserCardDataCardPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("nameplate")] - public UserCardDataCardNameplate Nameplate { get; set; } - - /// - /// - /// - [JsonPropertyName("Official")] - public UserCardDataCardOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("official_verify")] - public UserCardDataCardOfficialVerify OfficialVerify { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public UserCardDataCardVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - } - - /// - /// - /// - public class UserCardDataCardLevelInfo - { - /// - /// - /// - [JsonPropertyName("current_level")] - public int CurrentLevel { get; set; } - - /// - /// - /// - [JsonPropertyName("current_min")] - public int CurrentMin { get; set; } - - /// - /// - /// - [JsonPropertyName("current_exp")] - public int CurrentExp { get; set; } - - /// - /// - /// - [JsonPropertyName("next_exp")] - public int NextExp { get; set; } - } - - /// - /// - /// - public class UserCardDataCardPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class UserCardDataCardNameplate - { - /// - /// - /// - [JsonPropertyName("nid")] - public int Nid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("image_small")] - public string ImageSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public string Level { get; set; } - - /// - /// - /// - [JsonPropertyName("condition")] - public string Condition { get; set; } - } - - /// - /// - /// - public class UserCardDataCardOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class UserCardDataCardOfficialVerify - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - } - - /// - /// - /// - public class UserCardDataCardVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public UserCardDataCardVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("vipType")] - public int Viptype { get; set; } - - /// - /// - /// - [JsonPropertyName("vipStatus")] - public int Vipstatus { get; set; } - } - - /// - /// - /// - public class UserCardDataCardVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class UserCardDataSpace - { - /// - /// - /// - [JsonPropertyName("s_img")] - public string SImg { get; set; } - - /// - /// - /// - [JsonPropertyName("l_img")] - public string LImg { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/User/UserCards.cs b/src/BiliSharp/Api/Models/User/UserCards.cs deleted file mode 100644 index 2ce52fe..0000000 --- a/src/BiliSharp/Api/Models/User/UserCards.cs +++ /dev/null @@ -1,443 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.User -{ - /// - /// https://api.vc.bilibili.com/account/v1/user/cards?uids=314521322,206840230,49246269 - /// - public class UserCards - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("msg")] - public string Msg { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public List Data { get; set; } - } - - /// - /// - /// - public class UserCardsData - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("sex")] - public string Sex { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("sign")] - public string Sign { get; set; } - - /// - /// - /// - [JsonPropertyName("rank")] - public int Rank { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public int Level { get; set; } - - /// - /// - /// - [JsonPropertyName("silence")] - public int Silence { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public UserCardsDataVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public UserCardsDataPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("nameplate")] - public UserCardsDataNameplate Nameplate { get; set; } - - /// - /// - /// - [JsonPropertyName("official")] - public UserCardsDataOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("birthday")] - public long Birthday { get; set; } - - /// - /// - /// - [JsonPropertyName("is_fake_account")] - public int IsFakeAccount { get; set; } - - /// - /// - /// - [JsonPropertyName("is_deleted")] - public int IsDeleted { get; set; } - - /// - /// - /// - [JsonPropertyName("in_reg_audit")] - public int InRegAudit { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_new")] - public int FaceNftNew { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - - /// - /// - /// - [JsonPropertyName("digital_id")] - public string DigitalId { get; set; } - - /// - /// - /// - [JsonPropertyName("digital_type")] - public int DigitalType { get; set; } - } - - /// - /// - /// - public class UserCardsDataVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public UserCardsDataVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_due_date")] - public long TvDueDate { get; set; } - } - - /// - /// - /// - public class UserCardsDataVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class UserCardsDataPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class UserCardsDataNameplate - { - /// - /// - /// - [JsonPropertyName("nid")] - public int Nid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("image_small")] - public string ImageSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public string Level { get; set; } - - /// - /// - /// - [JsonPropertyName("condition")] - public string Condition { get; set; } - } - - /// - /// - /// - public class UserCardsDataOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/User/UserSpaceInfo.cs b/src/BiliSharp/Api/Models/User/UserSpaceInfo.cs deleted file mode 100644 index 5c5ae1f..0000000 --- a/src/BiliSharp/Api/Models/User/UserSpaceInfo.cs +++ /dev/null @@ -1,827 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.User -{ - /// - /// https://api.bilibili.com/x/space/acc/info?mid= - /// - public class UserSpaceInfo - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public UserSpaceInfoData Data { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoData - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("sex")] - public string Sex { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_type")] - public int FaceNftType { get; set; } - - /// - /// - /// - [JsonPropertyName("sign")] - public string Sign { get; set; } - - /// - /// - /// - [JsonPropertyName("rank")] - public int Rank { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public int Level { get; set; } - - /// - /// - /// - [JsonPropertyName("jointime")] - public int Jointime { get; set; } - - /// - /// - /// - [JsonPropertyName("moral")] - public int Moral { get; set; } - - /// - /// - /// - [JsonPropertyName("silence")] - public int Silence { get; set; } - - /// - /// - /// - [JsonPropertyName("coins")] - public int Coins { get; set; } - - /// - /// - /// - [JsonPropertyName("fans_badge")] - public bool FansBadge { get; set; } - - /// - /// - /// - [JsonPropertyName("fans_medal")] - public UserSpaceInfoDataFansMedal FansMedal { get; set; } - - /// - /// - /// - [JsonPropertyName("official")] - public UserSpaceInfoDataOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public UserSpaceInfoDataVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public UserSpaceInfoDataPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("nameplate")] - public UserSpaceInfoDataNameplate Nameplate { get; set; } - - /// - /// - /// - [JsonPropertyName("user_honour_info")] - public UserSpaceInfoDataUserHonourInfo UserHonourInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("is_followed")] - public bool IsFollowed { get; set; } - - /// - /// - /// - [JsonPropertyName("top_photo")] - public string TopPhoto { get; set; } - - /// - /// - /// - [JsonPropertyName("theme")] - public UserSpaceInfoDataTheme Theme { get; set; } - - /// - /// - /// - [JsonPropertyName("sys_notice")] - public UserSpaceInfoDataSysNotice SysNotice { get; set; } - - /// - /// - /// - [JsonPropertyName("live_room")] - public UserSpaceInfoDataLiveRoom LiveRoom { get; set; } - - /// - /// - /// - [JsonPropertyName("birthday")] - public string Birthday { get; set; } - - /// - /// - /// - [JsonPropertyName("school")] - public UserSpaceInfoDataSchool School { get; set; } - - /// - /// - /// - [JsonPropertyName("profession")] - public UserSpaceInfoDataProfession Profession { get; set; } - - /// - /// - /// - [JsonPropertyName("tags")] - public object Tags { get; set; } - - /// - /// - /// - [JsonPropertyName("series")] - public UserSpaceInfoDataSeries Series { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - - /// - /// - /// - [JsonPropertyName("mcn_info")] - public object McnInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("gaia_res_type")] - public int GaiaResType { get; set; } - - /// - /// - /// - [JsonPropertyName("gaia_data")] - public object GaiaData { get; set; } - - /// - /// - /// - [JsonPropertyName("is_risk")] - public bool IsRisk { get; set; } - - /// - /// - /// - [JsonPropertyName("elec")] - public UserSpaceInfoDataElec Elec { get; set; } - - /// - /// - /// - [JsonPropertyName("contract")] - public UserSpaceInfoDataContract Contract { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataFansMedal - { - /// - /// - /// - [JsonPropertyName("show")] - public bool Show { get; set; } - - /// - /// - /// - [JsonPropertyName("wear")] - public bool Wear { get; set; } - - /// - /// - /// - [JsonPropertyName("medal")] - public object Medal { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public UserSpaceInfoDataVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataNameplate - { - /// - /// - /// - [JsonPropertyName("nid")] - public int Nid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("image_small")] - public string ImageSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public string Level { get; set; } - - /// - /// - /// - [JsonPropertyName("condition")] - public string Condition { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataUserHonourInfo - { - /// - /// - /// - [JsonPropertyName("mid")] - public int Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("colour")] - public object Colour { get; set; } - - /// - /// - /// - [JsonPropertyName("tags")] - public List Tags { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataTheme - { } - - /// - /// - /// - public class UserSpaceInfoDataSysNotice - { } - - /// - /// - /// - public class UserSpaceInfoDataLiveRoom - { - /// - /// - /// - [JsonPropertyName("roomStatus")] - public int Roomstatus { get; set; } - - /// - /// - /// - [JsonPropertyName("liveStatus")] - public int Livestatus { get; set; } - - /// - /// - /// - [JsonPropertyName("url")] - public string Url { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("cover")] - public string Cover { get; set; } - - /// - /// - /// - [JsonPropertyName("roomid")] - public long Roomid { get; set; } - - /// - /// - /// - [JsonPropertyName("roundStatus")] - public int Roundstatus { get; set; } - - /// - /// - /// - [JsonPropertyName("broadcast_type")] - public int BroadcastType { get; set; } - - /// - /// - /// - [JsonPropertyName("watched_show")] - public UserSpaceInfoDataLiveRoomWatchedShow WatchedShow { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataLiveRoomWatchedShow - { - /// - /// - /// - [JsonPropertyName("switch")] - public bool Switch { get; set; } - - /// - /// - /// - [JsonPropertyName("num")] - public int Num { get; set; } - - /// - /// - /// - [JsonPropertyName("text_small")] - public string TextSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("text_large")] - public string TextLarge { get; set; } - - /// - /// - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } - - /// - /// - /// - [JsonPropertyName("icon_location")] - public string IconLocation { get; set; } - - /// - /// - /// - [JsonPropertyName("icon_web")] - public string IconWeb { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataSchool - { - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataProfession - { - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("department")] - public string Department { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("is_show")] - public int IsShow { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataSeries - { - /// - /// - /// - [JsonPropertyName("user_upgrade_status")] - public int UserUpgradeStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("show_upgrade_window")] - public bool ShowUpgradeWindow { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataElec - { - /// - /// - /// - [JsonPropertyName("show_info")] - public UserSpaceInfoDataElecShowInfo ShowInfo { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataElecShowInfo - { - /// - /// - /// - [JsonPropertyName("show")] - public bool Show { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } - - /// - /// - /// - [JsonPropertyName("jump_url")] - public string JumpUrl { get; set; } - } - - /// - /// - /// - public class UserSpaceInfoDataContract - { - /// - /// - /// - [JsonPropertyName("is_display")] - public bool IsDisplay { get; set; } - - /// - /// - /// - [JsonPropertyName("is_follow_display")] - public bool IsFollowDisplay { get; set; } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Models/Video/VideoView.cs b/src/BiliSharp/Api/Models/Video/VideoView.cs deleted file mode 100644 index 33694b3..0000000 --- a/src/BiliSharp/Api/Models/Video/VideoView.cs +++ /dev/null @@ -1,3257 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace BiliSharp.Api.Models.Video -{ - /// - /// https://api.bilibili.com/x/web-interface/wbi/view/detail?platform=web&bvid=BV1Pu4y1y7FA&aid=872233698&need_operation_card=1&web_rm_repeat=1&need_elec=1&out_referer=&page_no=1&p=1&web_location=1446382&w_rid=b9d75e9f42896cc2093f022e5e9b1fd2&wts=1694017091 - /// - public class VideoView - { - /// - /// - /// - [JsonPropertyName("code")] - public int Code { get; set; } - - /// - /// - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// - /// - [JsonPropertyName("ttl")] - public int Ttl { get; set; } - - /// - /// - /// - [JsonPropertyName("data")] - public VideoViewData Data { get; set; } - } - - /// - /// - /// - public class VideoViewData - { - /// - /// - /// - [JsonPropertyName("View")] - public VideoViewDataView View { get; set; } - - /// - /// - /// - [JsonPropertyName("Card")] - public VideoViewDataCard Card { get; set; } - - /// - /// - /// - [JsonPropertyName("Tags")] - public List Tags { get; set; } - - /// - /// - /// - [JsonPropertyName("Reply")] - public VideoViewDataReply Reply { get; set; } - - /// - /// - /// - [JsonPropertyName("Related")] - public List Related { get; set; } - - /// - /// - /// - [JsonPropertyName("Spec")] - public object Spec { get; set; } - - /// - /// - /// - [JsonPropertyName("hot_share")] - public VideoViewDataHotShare HotShare { get; set; } - - /// - /// - /// - [JsonPropertyName("elec")] - public VideoViewDataElec Elec { get; set; } - - /// - /// - /// - [JsonPropertyName("recommend")] - public object Recommend { get; set; } - - /// - /// - /// - //[JsonPropertyName("view_addit")] - //public VideoViewDataViewAddit ViewAddit { get; set; } - - /// - /// - /// - [JsonPropertyName("guide")] - public object Guide { get; set; } - - /// - /// - /// - [JsonPropertyName("query_tags")] - public object QueryTags { get; set; } - - /// - /// - /// - [JsonPropertyName("is_old_user")] - public bool IsOldUser { get; set; } - } - - /// - /// - /// - public class VideoViewDataView - { - /// - /// - /// - [JsonPropertyName("bvid")] - public string Bvid { get; set; } - - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("videos")] - public int Videos { get; set; } - - /// - /// - /// - [JsonPropertyName("tid")] - public int Tid { get; set; } - - /// - /// - /// - [JsonPropertyName("tname")] - public string Tname { get; set; } - - /// - /// - /// - [JsonPropertyName("copyright")] - public int Copyright { get; set; } - - /// - /// - /// - [JsonPropertyName("pic")] - public string Pic { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("pubdate")] - public long Pubdate { get; set; } - - /// - /// - /// - [JsonPropertyName("ctime")] - public long Ctime { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("desc_v2")] - public List DescV2 { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("duration")] - public int Duration { get; set; } - - /// - /// - /// - [JsonPropertyName("mission_id")] - public long MissionId { get; set; } - - /// - /// - /// - [JsonPropertyName("rights")] - public VideoViewDataViewRights Rights { get; set; } - - /// - /// - /// - [JsonPropertyName("owner")] - public VideoViewDataViewOwner Owner { get; set; } - - /// - /// - /// - [JsonPropertyName("stat")] - public VideoViewDataViewStat Stat { get; set; } - - /// - /// - /// - [JsonPropertyName("dynamic")] - public string Dynamic { get; set; } - - /// - /// - /// - [JsonPropertyName("cid")] - public long Cid { get; set; } - - /// - /// - /// - [JsonPropertyName("dimension")] - public VideoViewDataViewDimension Dimension { get; set; } - - /// - /// - /// - [JsonPropertyName("season_id")] - public long SeasonId { get; set; } - - /// - /// - /// - [JsonPropertyName("premiere")] - public object Premiere { get; set; } - - /// - /// - /// - [JsonPropertyName("teenage_mode")] - public int TeenageMode { get; set; } - - /// - /// - /// - [JsonPropertyName("is_chargeable_season")] - public bool IsChargeableSeason { get; set; } - - /// - /// - /// - [JsonPropertyName("is_story")] - public bool IsStory { get; set; } - - /// - /// - /// - [JsonPropertyName("is_upower_exclusive")] - public bool IsUpowerExclusive { get; set; } - - /// - /// - /// - [JsonPropertyName("is_upower_play")] - public bool IsUpowerPlay { get; set; } - - /// - /// - /// - [JsonPropertyName("enable_vt")] - public int EnableVt { get; set; } - - /// - /// - /// - [JsonPropertyName("vt_display")] - public string VtDisplay { get; set; } - - /// - /// - /// - [JsonPropertyName("no_cache")] - public bool NoCache { get; set; } - - /// - /// - /// - [JsonPropertyName("pages")] - public List Pages { get; set; } - - /// - /// - /// - [JsonPropertyName("subtitle")] - public VideoViewDataViewSubtitle Subtitle { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public VideoViewDataViewLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("staff")] - public List Staff { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_season")] - public VideoViewDataViewUgcSeason UgcSeason { get; set; } - - /// - /// - /// - [JsonPropertyName("is_season_display")] - public bool IsSeasonDisplay { get; set; } - - /// - /// - /// - [JsonPropertyName("user_garb")] - public VideoViewDataViewUserGarb UserGarb { get; set; } - - /// - /// - /// - [JsonPropertyName("honor_reply")] - public VideoViewDataViewHonorReply HonorReply { get; set; } - - /// - /// - /// - [JsonPropertyName("like_icon")] - public string LikeIcon { get; set; } - - /// - /// - /// - [JsonPropertyName("need_jump_bv")] - public bool NeedJumpBv { get; set; } - - /// - /// - /// - [JsonPropertyName("disable_show_up_info")] - public bool DisableShowUpInfo { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewDescV2 - { - /// - /// - /// - [JsonPropertyName("raw_text")] - public string RawText { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("biz_id")] - public int BizId { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewRights - { - /// - /// - /// - [JsonPropertyName("bp")] - public int Bp { get; set; } - - /// - /// - /// - [JsonPropertyName("elec")] - public int Elec { get; set; } - - /// - /// - /// - [JsonPropertyName("download")] - public int Download { get; set; } - - /// - /// - /// - [JsonPropertyName("movie")] - public int Movie { get; set; } - - /// - /// - /// - [JsonPropertyName("pay")] - public int Pay { get; set; } - - /// - /// - /// - [JsonPropertyName("hd5")] - public int Hd5 { get; set; } - - /// - /// - /// - [JsonPropertyName("no_reprint")] - public int NoReprint { get; set; } - - /// - /// - /// - [JsonPropertyName("autoplay")] - public int Autoplay { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay")] - public int UgcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("is_cooperation")] - public int IsCooperation { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay_preview")] - public int UgcPayPreview { get; set; } - - /// - /// - /// - [JsonPropertyName("no_background")] - public int NoBackground { get; set; } - - /// - /// - /// - [JsonPropertyName("clean_mode")] - public int CleanMode { get; set; } - - /// - /// - /// - [JsonPropertyName("is_stein_gate")] - public int IsSteinGate { get; set; } - - /// - /// - /// - [JsonPropertyName("is_360")] - public int Is360 { get; set; } - - /// - /// - /// - [JsonPropertyName("no_share")] - public int NoShare { get; set; } - - /// - /// - /// - [JsonPropertyName("arc_pay")] - public int ArcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("free_watch")] - public int FreeWatch { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewOwner - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewStat - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("view")] - public long View { get; set; } - - /// - /// - /// - [JsonPropertyName("danmaku")] - public int Danmaku { get; set; } - - /// - /// - /// - [JsonPropertyName("reply")] - public int Reply { get; set; } - - /// - /// - /// - [JsonPropertyName("favorite")] - public int Favorite { get; set; } - - /// - /// - /// - [JsonPropertyName("coin")] - public int Coin { get; set; } - - /// - /// - /// - [JsonPropertyName("share")] - public int Share { get; set; } - - /// - /// - /// - [JsonPropertyName("now_rank")] - public int NowRank { get; set; } - - /// - /// - /// - [JsonPropertyName("his_rank")] - public int HisRank { get; set; } - - /// - /// - /// - [JsonPropertyName("like")] - public int Like { get; set; } - - /// - /// - /// - [JsonPropertyName("dislike")] - public int Dislike { get; set; } - - /// - /// - /// - [JsonPropertyName("evaluation")] - public string Evaluation { get; set; } - - /// - /// - /// - [JsonPropertyName("argue_msg")] - public string ArgueMsg { get; set; } - - /// - /// - /// - [JsonPropertyName("vt")] - public int Vt { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewDimension - { - /// - /// - /// - [JsonPropertyName("width")] - public int Width { get; set; } - - /// - /// - /// - [JsonPropertyName("height")] - public int Height { get; set; } - - /// - /// - /// - [JsonPropertyName("rotate")] - public int Rotate { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewPages - { - /// - /// - /// - [JsonPropertyName("cid")] - public long Cid { get; set; } - - /// - /// - /// - [JsonPropertyName("page")] - public int Page { get; set; } - - /// - /// - /// - [JsonPropertyName("from")] - public string From { get; set; } - - /// - /// - /// - [JsonPropertyName("part")] - public string Part { get; set; } - - /// - /// - /// - [JsonPropertyName("duration")] - public int Duration { get; set; } - - /// - /// - /// - [JsonPropertyName("vid")] - public string Vid { get; set; } - - /// - /// - /// - [JsonPropertyName("weblink")] - public string Weblink { get; set; } - - /// - /// - /// - [JsonPropertyName("dimension")] - public VideoViewDataViewPagesDimension Dimension { get; set; } - - /// - /// - /// - [JsonPropertyName("first_frame")] - public string FirstFrame { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewPagesDimension - { - /// - /// - /// - [JsonPropertyName("width")] - public int Width { get; set; } - - /// - /// - /// - [JsonPropertyName("height")] - public int Height { get; set; } - - /// - /// - /// - [JsonPropertyName("rotate")] - public int Rotate { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewSubtitle - { - /// - /// - /// - [JsonPropertyName("allow_submit")] - public bool AllowSubmit { get; set; } - - /// - /// - /// - [JsonPropertyName("list")] - public List List { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewLabel - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewStaff - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public VideoViewDataViewStaffVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("official")] - public VideoViewDataViewStaffOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("follower")] - public long Follower { get; set; } - - /// - /// - /// - [JsonPropertyName("label_style")] - public int LabelStyle { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewStaffVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public long DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public VideoViewDataViewStaffVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_due_date")] - public int TvDueDate { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewStaffVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewStaffOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeason - { - /// - /// - /// - [JsonPropertyName("id")] - public long Id { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("cover")] - public string Cover { get; set; } - - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("intro")] - public string Intro { get; set; } - - /// - /// - /// - [JsonPropertyName("sign_state")] - public int SignState { get; set; } - - /// - /// - /// - [JsonPropertyName("attribute")] - public int Attribute { get; set; } - - /// - /// - /// - [JsonPropertyName("sections")] - public List Sections { get; set; } - - /// - /// - /// - [JsonPropertyName("stat")] - public VideoViewDataViewUgcSeasonStat Stat { get; set; } - - /// - /// - /// - [JsonPropertyName("ep_count")] - public int EpCount { get; set; } - - /// - /// - /// - [JsonPropertyName("season_type")] - public int SeasonType { get; set; } - - /// - /// - /// - [JsonPropertyName("is_pay_season")] - public bool IsPaySeason { get; set; } - - /// - /// - /// - [JsonPropertyName("enable_vt")] - public int EnableVt { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSections - { - /// - /// - /// - [JsonPropertyName("season_id")] - public long SeasonId { get; set; } - - /// - /// - /// - [JsonPropertyName("id")] - public long Id { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("episodes")] - public List Episodes { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodes - { - /// - /// - /// - [JsonPropertyName("season_id")] - public long SeasonId { get; set; } - - /// - /// - /// - [JsonPropertyName("section_id")] - public long SectionId { get; set; } - - /// - /// - /// - [JsonPropertyName("id")] - public long Id { get; set; } - - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("cid")] - public long Cid { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("attribute")] - public int Attribute { get; set; } - - /// - /// - /// - [JsonPropertyName("arc")] - public VideoViewDataViewUgcSeasonSectionsEpisodesArc Arc { get; set; } - - /// - /// - /// - [JsonPropertyName("page")] - public VideoViewDataViewUgcSeasonSectionsEpisodesPage Page { get; set; } - - /// - /// - /// - [JsonPropertyName("bvid")] - public string Bvid { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesArc - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("videos")] - public int Videos { get; set; } - - /// - /// - /// - [JsonPropertyName("type_id")] - public int TypeId { get; set; } - - /// - /// - /// - [JsonPropertyName("type_name")] - public string TypeName { get; set; } - - /// - /// - /// - [JsonPropertyName("copyright")] - public int Copyright { get; set; } - - /// - /// - /// - [JsonPropertyName("pic")] - public string Pic { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("pubdate")] - public long Pubdate { get; set; } - - /// - /// - /// - [JsonPropertyName("ctime")] - public long Ctime { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("duration")] - public int Duration { get; set; } - - /// - /// - /// - [JsonPropertyName("rights")] - public VideoViewDataViewUgcSeasonSectionsEpisodesArcRights Rights { get; set; } - - /// - /// - /// - [JsonPropertyName("author")] - public VideoViewDataViewUgcSeasonSectionsEpisodesArcAuthor Author { get; set; } - - /// - /// - /// - [JsonPropertyName("stat")] - public VideoViewDataViewUgcSeasonSectionsEpisodesArcStat Stat { get; set; } - - /// - /// - /// - [JsonPropertyName("dynamic")] - public string Dynamic { get; set; } - - /// - /// - /// - [JsonPropertyName("dimension")] - public VideoViewDataViewUgcSeasonSectionsEpisodesArcDimension Dimension { get; set; } - - /// - /// - /// - [JsonPropertyName("desc_v2")] - public object DescV2 { get; set; } - - /// - /// - /// - [JsonPropertyName("is_chargeable_season")] - public bool IsChargeableSeason { get; set; } - - /// - /// - /// - [JsonPropertyName("is_blooper")] - public bool IsBlooper { get; set; } - - /// - /// - /// - [JsonPropertyName("enable_vt")] - public int EnableVt { get; set; } - - /// - /// - /// - [JsonPropertyName("vt_display")] - public string VtDisplay { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesArcRights - { - /// - /// - /// - [JsonPropertyName("bp")] - public int Bp { get; set; } - - /// - /// - /// - [JsonPropertyName("elec")] - public int Elec { get; set; } - - /// - /// - /// - [JsonPropertyName("download")] - public int Download { get; set; } - - /// - /// - /// - [JsonPropertyName("movie")] - public int Movie { get; set; } - - /// - /// - /// - [JsonPropertyName("pay")] - public int Pay { get; set; } - - /// - /// - /// - [JsonPropertyName("hd5")] - public int Hd5 { get; set; } - - /// - /// - /// - [JsonPropertyName("no_reprint")] - public int NoReprint { get; set; } - - /// - /// - /// - [JsonPropertyName("autoplay")] - public int Autoplay { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay")] - public int UgcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("is_cooperation")] - public int IsCooperation { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay_preview")] - public int UgcPayPreview { get; set; } - - /// - /// - /// - [JsonPropertyName("arc_pay")] - public int ArcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("free_watch")] - public int FreeWatch { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesArcAuthor - { - /// - /// - /// - [JsonPropertyName("mid")] - public int Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesArcStat - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("view")] - public long View { get; set; } - - /// - /// - /// - [JsonPropertyName("danmaku")] - public int Danmaku { get; set; } - - /// - /// - /// - [JsonPropertyName("reply")] - public int Reply { get; set; } - - /// - /// - /// - [JsonPropertyName("fav")] - public int Fav { get; set; } - - /// - /// - /// - [JsonPropertyName("coin")] - public int Coin { get; set; } - - /// - /// - /// - [JsonPropertyName("share")] - public int Share { get; set; } - - /// - /// - /// - [JsonPropertyName("now_rank")] - public int NowRank { get; set; } - - /// - /// - /// - [JsonPropertyName("his_rank")] - public int HisRank { get; set; } - - /// - /// - /// - [JsonPropertyName("like")] - public long Like { get; set; } - - /// - /// - /// - [JsonPropertyName("dislike")] - public int Dislike { get; set; } - - /// - /// - /// - [JsonPropertyName("evaluation")] - public string Evaluation { get; set; } - - /// - /// - /// - [JsonPropertyName("argue_msg")] - public string ArgueMsg { get; set; } - - /// - /// - /// - [JsonPropertyName("vt")] - public int Vt { get; set; } - - /// - /// - /// - [JsonPropertyName("vv")] - public long Vv { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesArcDimension - { - /// - /// - /// - [JsonPropertyName("width")] - public int Width { get; set; } - - /// - /// - /// - [JsonPropertyName("height")] - public int Height { get; set; } - - /// - /// - /// - [JsonPropertyName("rotate")] - public int Rotate { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesPage - { - /// - /// - /// - [JsonPropertyName("cid")] - public long Cid { get; set; } - - /// - /// - /// - [JsonPropertyName("page")] - public int Page { get; set; } - - /// - /// - /// - [JsonPropertyName("from")] - public string From { get; set; } - - /// - /// - /// - [JsonPropertyName("part")] - public string Part { get; set; } - - /// - /// - /// - [JsonPropertyName("duration")] - public int Duration { get; set; } - - /// - /// - /// - [JsonPropertyName("vid")] - public string Vid { get; set; } - - /// - /// - /// - [JsonPropertyName("weblink")] - public string Weblink { get; set; } - - /// - /// - /// - [JsonPropertyName("dimension")] - public VideoViewDataViewUgcSeasonSectionsEpisodesPageDimension Dimension { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonSectionsEpisodesPageDimension - { - /// - /// - /// - [JsonPropertyName("width")] - public int Width { get; set; } - - /// - /// - /// - [JsonPropertyName("height")] - public int Height { get; set; } - - /// - /// - /// - [JsonPropertyName("rotate")] - public int Rotate { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUgcSeasonStat - { - /// - /// - /// - [JsonPropertyName("season_id")] - public long SeasonId { get; set; } - - /// - /// - /// - [JsonPropertyName("view")] - public long View { get; set; } - - /// - /// - /// - [JsonPropertyName("danmaku")] - public int Danmaku { get; set; } - - /// - /// - /// - [JsonPropertyName("reply")] - public int Reply { get; set; } - - /// - /// - /// - [JsonPropertyName("fav")] - public long Fav { get; set; } - - /// - /// - /// - [JsonPropertyName("coin")] - public long Coin { get; set; } - - /// - /// - /// - [JsonPropertyName("share")] - public long Share { get; set; } - - /// - /// - /// - [JsonPropertyName("now_rank")] - public int NowRank { get; set; } - - /// - /// - /// - [JsonPropertyName("his_rank")] - public int HisRank { get; set; } - - /// - /// - /// - [JsonPropertyName("like")] - public long Like { get; set; } - - /// - /// - /// - [JsonPropertyName("vt")] - public int Vt { get; set; } - - /// - /// - /// - [JsonPropertyName("vv")] - public int Vv { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewUserGarb - { - /// - /// - /// - [JsonPropertyName("url_image_ani_cut")] - public string UrlImageAniCut { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewHonorReply - { - /// - /// - /// - [JsonPropertyName("honor")] - public List Honor { get; set; } - } - - /// - /// - /// - public class VideoViewDataViewHonorReplyHonor - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("weekly_recommend_num")] - public int WeeklyRecommendNum { get; set; } - } - - /// - /// - /// - public class VideoViewDataCard - { - /// - /// - /// - [JsonPropertyName("card")] - public VideoViewDataCardCard Card { get; set; } - - /// - /// - /// - [JsonPropertyName("space")] - public VideoViewDataCardSpace Space { get; set; } - - /// - /// - /// - [JsonPropertyName("following")] - public bool Following { get; set; } - - /// - /// - /// - [JsonPropertyName("archive_count")] - public int ArchiveCount { get; set; } - - /// - /// - /// - [JsonPropertyName("article_count")] - public int ArticleCount { get; set; } - - /// - /// - /// - [JsonPropertyName("follower")] - public long Follower { get; set; } - - /// - /// - /// - [JsonPropertyName("like_num")] - public long LikeNum { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCard - { - /// - /// - /// - [JsonPropertyName("mid")] - public string Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("approve")] - public bool Approve { get; set; } - - /// - /// - /// - [JsonPropertyName("sex")] - public string Sex { get; set; } - - /// - /// - /// - [JsonPropertyName("rank")] - public string Rank { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft")] - public int FaceNft { get; set; } - - /// - /// - /// - [JsonPropertyName("face_nft_type")] - public int FaceNftType { get; set; } - - /// - /// - /// - [JsonPropertyName("DisplayRank")] - public string Displayrank { get; set; } - - /// - /// - /// - [JsonPropertyName("regtime")] - public int Regtime { get; set; } - - /// - /// - /// - [JsonPropertyName("spacesta")] - public int Spacesta { get; set; } - - /// - /// - /// - [JsonPropertyName("birthday")] - public string Birthday { get; set; } - - /// - /// - /// - [JsonPropertyName("place")] - public string Place { get; set; } - - /// - /// - /// - [JsonPropertyName("description")] - public string Description { get; set; } - - /// - /// - /// - [JsonPropertyName("article")] - public int Article { get; set; } - - /// - /// - /// - [JsonPropertyName("attentions")] - public List Attentions { get; set; } - - /// - /// - /// - [JsonPropertyName("fans")] - public long Fans { get; set; } - - /// - /// - /// - [JsonPropertyName("friend")] - public int Friend { get; set; } - - /// - /// - /// - [JsonPropertyName("attention")] - public int Attention { get; set; } - - /// - /// - /// - [JsonPropertyName("sign")] - public string Sign { get; set; } - - /// - /// - /// - [JsonPropertyName("level_info")] - public VideoViewDataCardCardLevelInfo LevelInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("pendant")] - public VideoViewDataCardCardPendant Pendant { get; set; } - - /// - /// - /// - [JsonPropertyName("nameplate")] - public VideoViewDataCardCardNameplate Nameplate { get; set; } - - /// - /// - /// - [JsonPropertyName("Official")] - public VideoViewDataCardCardOfficial Official { get; set; } - - /// - /// - /// - [JsonPropertyName("official_verify")] - public VideoViewDataCardCardOfficialVerify OfficialVerify { get; set; } - - /// - /// - /// - [JsonPropertyName("vip")] - public VideoViewDataCardCardVip Vip { get; set; } - - /// - /// - /// - [JsonPropertyName("is_senior_member")] - public int IsSeniorMember { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardLevelInfo - { - /// - /// - /// - [JsonPropertyName("current_level")] - public int CurrentLevel { get; set; } - - /// - /// - /// - [JsonPropertyName("current_min")] - public int CurrentMin { get; set; } - - /// - /// - /// - [JsonPropertyName("current_exp")] - public int CurrentExp { get; set; } - - /// - /// - /// - [JsonPropertyName("next_exp")] - public int NextExp { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardPendant - { - /// - /// - /// - [JsonPropertyName("pid")] - public int Pid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("expire")] - public int Expire { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance")] - public string ImageEnhance { get; set; } - - /// - /// - /// - [JsonPropertyName("image_enhance_frame")] - public string ImageEnhanceFrame { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardNameplate - { - /// - /// - /// - [JsonPropertyName("nid")] - public int Nid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("image")] - public string Image { get; set; } - - /// - /// - /// - [JsonPropertyName("image_small")] - public string ImageSmall { get; set; } - - /// - /// - /// - [JsonPropertyName("level")] - public string Level { get; set; } - - /// - /// - /// - [JsonPropertyName("condition")] - public string Condition { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardOfficial - { - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardOfficialVerify - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardVip - { - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("status")] - public int Status { get; set; } - - /// - /// - /// - [JsonPropertyName("due_date")] - public int DueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vip_pay_type")] - public int VipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("theme_type")] - public int ThemeType { get; set; } - - /// - /// - /// - [JsonPropertyName("label")] - public VideoViewDataCardCardVipLabel Label { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript")] - public int AvatarSubscript { get; set; } - - /// - /// - /// - [JsonPropertyName("nickname_color")] - public string NicknameColor { get; set; } - - /// - /// - /// - [JsonPropertyName("role")] - public int Role { get; set; } - - /// - /// - /// - [JsonPropertyName("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_status")] - public int TvVipStatus { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_vip_pay_type")] - public int TvVipPayType { get; set; } - - /// - /// - /// - [JsonPropertyName("tv_due_date")] - public int TvDueDate { get; set; } - - /// - /// - /// - [JsonPropertyName("vipType")] - public int Viptype { get; set; } - - /// - /// - /// - [JsonPropertyName("vipStatus")] - public int Vipstatus { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardCardVipLabel - { - /// - /// - /// - [JsonPropertyName("path")] - public string Path { get; set; } - - /// - /// - /// - [JsonPropertyName("text")] - public string Text { get; set; } - - /// - /// - /// - [JsonPropertyName("label_theme")] - public string LabelTheme { get; set; } - - /// - /// - /// - [JsonPropertyName("text_color")] - public string TextColor { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_style")] - public int BgStyle { get; set; } - - /// - /// - /// - [JsonPropertyName("bg_color")] - public string BgColor { get; set; } - - /// - /// - /// - [JsonPropertyName("border_color")] - public string BorderColor { get; set; } - - /// - /// - /// - [JsonPropertyName("use_img_label")] - public bool UseImgLabel { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans")] - public string ImgLabelUriHans { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant")] - public string ImgLabelUriHant { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hans_static")] - public string ImgLabelUriHansStatic { get; set; } - - /// - /// - /// - [JsonPropertyName("img_label_uri_hant_static")] - public string ImgLabelUriHantStatic { get; set; } - } - - /// - /// - /// - public class VideoViewDataCardSpace - { - /// - /// - /// - [JsonPropertyName("s_img")] - public string SImg { get; set; } - - /// - /// - /// - [JsonPropertyName("l_img")] - public string LImg { get; set; } - } - - /// - /// - /// - public class VideoViewDataTags - { - /// - /// - /// - [JsonPropertyName("tag_id")] - public int TagId { get; set; } - - /// - /// - /// - [JsonPropertyName("tag_name")] - public string TagName { get; set; } - - /// - /// - /// - [JsonPropertyName("cover")] - public string Cover { get; set; } - - /// - /// - /// - [JsonPropertyName("head_cover")] - public string HeadCover { get; set; } - - /// - /// - /// - [JsonPropertyName("content")] - public string Content { get; set; } - - /// - /// - /// - [JsonPropertyName("short_content")] - public string ShortContent { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("ctime")] - public int Ctime { get; set; } - - /// - /// - /// - [JsonPropertyName("count")] - public VideoViewDataTagsCount Count { get; set; } - - /// - /// - /// - [JsonPropertyName("is_atten")] - public int IsAtten { get; set; } - - /// - /// - /// - [JsonPropertyName("likes")] - public int Likes { get; set; } - - /// - /// - /// - [JsonPropertyName("hates")] - public int Hates { get; set; } - - /// - /// - /// - [JsonPropertyName("attribute")] - public int Attribute { get; set; } - - /// - /// - /// - [JsonPropertyName("liked")] - public int Liked { get; set; } - - /// - /// - /// - [JsonPropertyName("hated")] - public int Hated { get; set; } - - /// - /// - /// - [JsonPropertyName("extra_attr")] - public int ExtraAttr { get; set; } - - /// - /// - /// - [JsonPropertyName("music_id")] - public string MusicId { get; set; } - - /// - /// - /// - [JsonPropertyName("tag_type")] - public string TagType { get; set; } - - /// - /// - /// - [JsonPropertyName("is_activity")] - public bool IsActivity { get; set; } - - /// - /// - /// - [JsonPropertyName("color")] - public string Color { get; set; } - - /// - /// - /// - [JsonPropertyName("alpha")] - public int Alpha { get; set; } - - /// - /// - /// - [JsonPropertyName("is_season")] - public bool IsSeason { get; set; } - - /// - /// - /// - [JsonPropertyName("subscribed_count")] - public int SubscribedCount { get; set; } - - /// - /// - /// - [JsonPropertyName("archive_count")] - public string ArchiveCount { get; set; } - - /// - /// - /// - [JsonPropertyName("featured_count")] - public int FeaturedCount { get; set; } - - /// - /// - /// - [JsonPropertyName("jump_url")] - public string JumpUrl { get; set; } - } - - /// - /// - /// - public class VideoViewDataTagsCount - { - /// - /// - /// - [JsonPropertyName("view")] - public int View { get; set; } - - /// - /// - /// - [JsonPropertyName("use")] - public int Use { get; set; } - - /// - /// - /// - [JsonPropertyName("atten")] - public int Atten { get; set; } - } - - /// - /// - /// - public class VideoViewDataReply - { - /// - /// - /// - [JsonPropertyName("page")] - public object Page { get; set; } - - /// - /// - /// - [JsonPropertyName("replies")] - public List Replies { get; set; } - } - - /// - /// - /// - public class VideoViewDataReplyReplies - { - /// - /// - /// - [JsonPropertyName("rpid")] - public int Rpid { get; set; } - - /// - /// - /// - [JsonPropertyName("oid")] - public int Oid { get; set; } - - /// - /// - /// - [JsonPropertyName("type")] - public int Type { get; set; } - - /// - /// - /// - [JsonPropertyName("mid")] - public int Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("root")] - public int Root { get; set; } - - /// - /// - /// - [JsonPropertyName("parent")] - public int Parent { get; set; } - - /// - /// - /// - [JsonPropertyName("dialog")] - public int Dialog { get; set; } - - /// - /// - /// - [JsonPropertyName("count")] - public int Count { get; set; } - - /// - /// - /// - [JsonPropertyName("rcount")] - public int Rcount { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("fansgrade")] - public int Fansgrade { get; set; } - - /// - /// - /// - [JsonPropertyName("attr")] - public int Attr { get; set; } - - /// - /// - /// - [JsonPropertyName("ctime")] - public int Ctime { get; set; } - - /// - /// - /// - [JsonPropertyName("like")] - public int Like { get; set; } - - /// - /// - /// - [JsonPropertyName("action")] - public int Action { get; set; } - - /// - /// - /// - [JsonPropertyName("content")] - public object Content { get; set; } - - /// - /// - /// - [JsonPropertyName("replies")] - public object Replies { get; set; } - - /// - /// - /// - [JsonPropertyName("assist")] - public int Assist { get; set; } - - /// - /// - /// - [JsonPropertyName("show_follow")] - public bool ShowFollow { get; set; } - } - - /// - /// - /// - public class VideoViewDataRelated - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("videos")] - public int Videos { get; set; } - - /// - /// - /// - [JsonPropertyName("tid")] - public int Tid { get; set; } - - /// - /// - /// - [JsonPropertyName("tname")] - public string Tname { get; set; } - - /// - /// - /// - [JsonPropertyName("copyright")] - public int Copyright { get; set; } - - /// - /// - /// - [JsonPropertyName("pic")] - public string Pic { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("pubdate")] - public long Pubdate { get; set; } - - /// - /// - /// - [JsonPropertyName("ctime")] - public long Ctime { get; set; } - - /// - /// - /// - [JsonPropertyName("desc")] - public string Desc { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("duration")] - public int Duration { get; set; } - - /// - /// - /// - [JsonPropertyName("mission_id")] - public long MissionId { get; set; } - - /// - /// - /// - [JsonPropertyName("rights")] - public VideoViewDataRelatedRights Rights { get; set; } - - /// - /// - /// - [JsonPropertyName("owner")] - public VideoViewDataRelatedOwner Owner { get; set; } - - /// - /// - /// - [JsonPropertyName("stat")] - public VideoViewDataRelatedStat Stat { get; set; } - - /// - /// - /// - [JsonPropertyName("dynamic")] - public string Dynamic { get; set; } - - /// - /// - /// - [JsonPropertyName("cid")] - public long Cid { get; set; } - - /// - /// - /// - [JsonPropertyName("dimension")] - public VideoViewDataRelatedDimension Dimension { get; set; } - - /// - /// - /// - [JsonPropertyName("season_id")] - public long SeasonId { get; set; } - - /// - /// - /// - [JsonPropertyName("short_link_v2")] - public string ShortLinkV2 { get; set; } - - /// - /// - /// - [JsonPropertyName("up_from_v2")] - public int UpFromV2 { get; set; } - - /// - /// - /// - [JsonPropertyName("first_frame")] - public string FirstFrame { get; set; } - - /// - /// - /// - [JsonPropertyName("pub_location")] - public string PubLocation { get; set; } - - /// - /// - /// - [JsonPropertyName("bvid")] - public string Bvid { get; set; } - - /// - /// - /// - [JsonPropertyName("season_type")] - public int SeasonType { get; set; } - - /// - /// - /// - [JsonPropertyName("is_ogv")] - public bool IsOgv { get; set; } - - /// - /// - /// - [JsonPropertyName("ogv_info")] - public object OgvInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("rcmd_reason")] - public string RcmdReason { get; set; } - - /// - /// - /// - [JsonPropertyName("enable_vt")] - public int EnableVt { get; set; } - } - - /// - /// - /// - public class VideoViewDataRelatedRights - { - /// - /// - /// - [JsonPropertyName("bp")] - public int Bp { get; set; } - - /// - /// - /// - [JsonPropertyName("elec")] - public int Elec { get; set; } - - /// - /// - /// - [JsonPropertyName("download")] - public int Download { get; set; } - - /// - /// - /// - [JsonPropertyName("movie")] - public int Movie { get; set; } - - /// - /// - /// - [JsonPropertyName("pay")] - public int Pay { get; set; } - - /// - /// - /// - [JsonPropertyName("hd5")] - public int Hd5 { get; set; } - - /// - /// - /// - [JsonPropertyName("no_reprint")] - public int NoReprint { get; set; } - - /// - /// - /// - [JsonPropertyName("autoplay")] - public int Autoplay { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay")] - public int UgcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("is_cooperation")] - public int IsCooperation { get; set; } - - /// - /// - /// - [JsonPropertyName("ugc_pay_preview")] - public int UgcPayPreview { get; set; } - - /// - /// - /// - [JsonPropertyName("no_background")] - public int NoBackground { get; set; } - - /// - /// - /// - [JsonPropertyName("arc_pay")] - public int ArcPay { get; set; } - - /// - /// - /// - [JsonPropertyName("pay_free_watch")] - public int PayFreeWatch { get; set; } - } - - /// - /// - /// - public class VideoViewDataRelatedOwner - { - /// - /// - /// - [JsonPropertyName("mid")] - public long Mid { get; set; } - - /// - /// - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// - /// - [JsonPropertyName("face")] - public string Face { get; set; } - } - - /// - /// - /// - public class VideoViewDataRelatedStat - { - /// - /// - /// - [JsonPropertyName("aid")] - public long Aid { get; set; } - - /// - /// - /// - [JsonPropertyName("view")] - public long View { get; set; } - - /// - /// - /// - [JsonPropertyName("danmaku")] - public int Danmaku { get; set; } - - /// - /// - /// - [JsonPropertyName("reply")] - public int Reply { get; set; } - - /// - /// - /// - [JsonPropertyName("favorite")] - public int Favorite { get; set; } - - /// - /// - /// - [JsonPropertyName("coin")] - public int Coin { get; set; } - - /// - /// - /// - [JsonPropertyName("share")] - public int Share { get; set; } - - /// - /// - /// - [JsonPropertyName("now_rank")] - public int NowRank { get; set; } - - /// - /// - /// - [JsonPropertyName("his_rank")] - public int HisRank { get; set; } - - /// - /// - /// - [JsonPropertyName("like")] - public long Like { get; set; } - - /// - /// - /// - [JsonPropertyName("dislike")] - public int Dislike { get; set; } - - /// - /// - /// - [JsonPropertyName("vt")] - public int Vt { get; set; } - - /// - /// - /// - [JsonPropertyName("vv")] - public long Vv { get; set; } - } - - /// - /// - /// - public class VideoViewDataRelatedDimension - { - /// - /// - /// - [JsonPropertyName("width")] - public int Width { get; set; } - - /// - /// - /// - [JsonPropertyName("height")] - public int Height { get; set; } - - /// - /// - /// - [JsonPropertyName("rotate")] - public int Rotate { get; set; } - } - - /// - /// - /// - public class VideoViewDataHotShare - { - /// - /// - /// - [JsonPropertyName("show")] - public bool Show { get; set; } - - /// - /// - /// - [JsonPropertyName("list")] - public List List { get; set; } - } - - /// - /// - /// - public class VideoViewDataElec - { - /// - /// - /// - [JsonPropertyName("show_info")] - public VideoViewDataElecShowInfo ShowInfo { get; set; } - - /// - /// - /// - [JsonPropertyName("av_count")] - public int AvCount { get; set; } - - /// - /// - /// - [JsonPropertyName("count")] - public int Count { get; set; } - - /// - /// - /// - [JsonPropertyName("total_count")] - public int TotalCount { get; set; } - - /// - /// - /// - [JsonPropertyName("special_day")] - public int SpecialDay { get; set; } - - /// - /// - /// - [JsonPropertyName("display_num")] - public int DisplayNum { get; set; } - } - - /// - /// - /// - public class VideoViewDataElecShowInfo - { - /// - /// - /// - [JsonPropertyName("show")] - public bool Show { get; set; } - - /// - /// - /// - [JsonPropertyName("state")] - public int State { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("jump_url")] - public string JumpUrl { get; set; } - - /// - /// - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } - - /// - /// - /// - [JsonPropertyName("high_level")] - public VideoViewDataElecShowInfoHighLevel HighLevel { get; set; } - } - - /// - /// - /// - public class VideoViewDataElecShowInfoHighLevel - { - /// - /// - /// - [JsonPropertyName("privilege_type")] - public int PrivilegeType { get; set; } - - /// - /// - /// - [JsonPropertyName("level_str")] - public string LevelStr { get; set; } - - /// - /// - /// - [JsonPropertyName("title")] - public string Title { get; set; } - - /// - /// - /// - [JsonPropertyName("intro")] - public string Intro { get; set; } - - /// - /// - /// - [JsonPropertyName("open")] - public bool Open { get; set; } - } - - /// - /// - /// - //public class VideoViewDataViewAddit - //{ - // /// - // /// - // /// - // [JsonPropertyName("63")] - // public bool 63 { get; set; } - - // /// - // /// - // /// - // [JsonPropertyName("64")] - // public bool 64 { get; set; } - - // /// - // /// - // /// - // [JsonPropertyName("69")] - // public bool 69 { get; set; } - - // /// - // /// - // /// - // [JsonPropertyName("71")] - // public bool 71 { get; set; } - - // /// - // /// - // /// - // [JsonPropertyName("72")] - // public bool 72 { get; set; } - //} -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Sign/WbiSign.cs b/src/BiliSharp/Api/Sign/WbiSign.cs deleted file mode 100644 index 43e4937..0000000 --- a/src/BiliSharp/Api/Sign/WbiSign.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Text.RegularExpressions; - -namespace BiliSharp.Api.Sign -{ - public static class WbiSign - { - private static Tuple Keys; - - /// - /// 打乱重排实时口令 - /// - /// - /// - private static string GetMixinKey(string origin) - { - int[] mixinKeyEncTab = new int[] - { - 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, - 33, 9, 42, 19, 29, 28, 14, 39,12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, - 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, - 36, 20, 34, 44, 52 - }; - - var temp = new StringBuilder(); - foreach (var i in mixinKeyEncTab) - { - temp.Append(origin[i]); - } - return temp.ToString()[..32]; - } - - /// - /// 将字典参数转为字符串 - /// - /// - /// - public static string ParametersToQuery(Dictionary parameters) - { - var keys = parameters.Keys.ToList(); - var queryList = new List(); - foreach (var item in keys) - { - var value = parameters[item]; - queryList.Add($"{item}={value}"); - } - return string.Join("&", queryList); - } - - /// - /// 返回imgKey,subKey - /// - /// - public static Tuple GetKey() - { - // 当Keys为null时,返回一个硬编码的key, - // 这个key无效,只为了保证不报错 - return Keys ?? new Tuple("653657f524a547ac981ded72ea172057", "6e4909c702f846728e64f6007736a338"); - } - - /// - /// 设置imgKey,subKey - /// - /// - public static void SetKey(Tuple keys) - { - Keys = keys; - } - - /// - /// Wbi签名,返回所有参数字典 - /// - /// - /// - public static Dictionary EncodeWbi(Dictionary parameters) - { - return EncodeWbi(parameters, GetKey().Item1, GetKey().Item2); - } - - /// - /// Wbi签名,返回所有参数字典 - /// - /// - /// - /// - /// - public static Dictionary EncodeWbi(Dictionary parameters, string imgKey, string subKey) - { - var mixinKey = GetMixinKey(imgKey + subKey); - - var chrFilter = new Regex("[!'()*]"); - - var newParameters = new Dictionary - { - { "wts", (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds } - }; - - foreach (var para in parameters) - { - var key = para.Key; - var value = para.Value.ToString(); - - var encodedValue = chrFilter.Replace(value, ""); - - newParameters.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(encodedValue)); - } - - var keys = newParameters.Keys.ToList(); - keys.Sort(); - - var queryList = new List(); - foreach (var item in keys) - { - var value = newParameters[item]; - queryList.Add($"{item}={value}"); - } - - var queryString = string.Join("&", queryList); - var md5Hasher = MD5.Create(); - var hashStr = queryString + mixinKey; - var hashedQueryString = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(hashStr)); - var wbiSign = BitConverter.ToString(hashedQueryString).Replace("-", "").ToLower(); - - newParameters.Add("w_rid", wbiSign); - return newParameters; - } - - } -} diff --git a/src/BiliSharp/Api/User/Nickname.cs b/src/BiliSharp/Api/User/Nickname.cs deleted file mode 100644 index ddcab9e..0000000 --- a/src/BiliSharp/Api/User/Nickname.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace BiliSharp.Api.User -{ - /// - /// 检查昵称是否可注册 - /// - public static class Nickname - { - /// - /// 检查昵称 - /// - /// - /// - public static Models.User.Nickname CheckNickname(string nickname) - { - string url = $"https://passport.bilibili.com/web/generic/check/nickname?nickName={nickname}"; - return Utils.GetData(url); - } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/User/UserInfo.cs b/src/BiliSharp/Api/User/UserInfo.cs deleted file mode 100644 index b89f3e2..0000000 --- a/src/BiliSharp/Api/User/UserInfo.cs +++ /dev/null @@ -1,66 +0,0 @@ -using BiliSharp.Api.Models.User; -using BiliSharp.Api.Sign; -using System.Collections.Generic; - -namespace BiliSharp.Api.User -{ - /// - /// 用户基本信息 - /// - public static class UserInfo - { - /// - /// 用户空间详细信息 - /// - /// - public static UserSpaceInfo GetUserInfo(long mid) - { - var parameters = new Dictionary - { - { "mid", mid } - }; - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/space/wbi/acc/info?{query}"; - return Utils.GetData(url); - } - - /// - /// 用户名片信息 - /// - /// - /// - /// - public static UserCard GetUserCard(long mid, bool isPhoto = false) - { - string url = $"https://api.bilibili.com/x/web-interface/card?mid={mid}&photo={isPhoto}"; - return Utils.GetData(url); - } - - /// - /// 登录用户空间详细信息 - /// - /// - public static MyInfo GetMyInfo() - { - string url = "https://api.bilibili.com/x/space/myinfo"; - return Utils.GetData(url); - } - - /// - /// 多用户详细信息 - /// - /// - /// - public static UserCards GetUserCards(List ids) - { - string url = "https://api.vc.bilibili.com/account/v1/user/cards?uids="; - foreach (long id in ids) - { - url += $"{id},"; - } - url = url.TrimEnd(','); - - return Utils.GetData(url); - } - } -} \ No newline at end of file diff --git a/src/BiliSharp/Api/Video/VideoInfo.cs b/src/BiliSharp/Api/Video/VideoInfo.cs deleted file mode 100644 index cf29210..0000000 --- a/src/BiliSharp/Api/Video/VideoInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using BiliSharp.Api.Models.Video; -using BiliSharp.Api.Sign; -using System.Collections.Generic; - -namespace BiliSharp.Api.Video -{ - /// - /// 视频基本信息 - /// - public static class VideoInfo - { - /// - /// 获取视频超详细信息(web端) - /// - /// - /// - /// - public static VideoView GetVideoViewInfo(string bvid, long aid) - { - var parameters = new Dictionary - { - { "platform", "web" }, - //{ "need_operation_card", 1 }, - //{ "web_location", 1446382 }, - { "need_elec", 1 }, - { "aid", aid }, - { "bvid", bvid }, - }; - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/web-interface/wbi/view/detail?{query}"; - return Utils.GetData(url); - } - - } -} diff --git a/src/BiliSharp/BiliManager.cs b/src/BiliSharp/BiliManager.cs deleted file mode 100644 index 2aaabf2..0000000 --- a/src/BiliSharp/BiliManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Net; - -namespace BiliSharp -{ - public class BiliManager - { - private static readonly BiliManager _instance = new BiliManager(); - private string _userAgent; - private CookieContainer _cookies; - - private BiliManager() { } - - public static BiliManager Instance() - { - return _instance; - } - - /// - /// 设置cookies - /// - /// - /// - public BiliManager SetCookies(CookieContainer cookies) - { - _cookies = cookies; - return this; - } - - /// - /// 获取cookies - /// - /// - public CookieContainer GetCookies() { return _cookies; } - - /// - /// 设置userAgent - /// - /// - /// - public BiliManager SetUserAgent(string userAgent) - { - _userAgent = userAgent; - return this; - } - - /// - /// 获取userAgent - /// - /// - public string GetUserAgent() { return _userAgent; } - - } -} \ No newline at end of file diff --git a/src/BiliSharp/BiliSharp.csproj b/src/BiliSharp/BiliSharp.csproj deleted file mode 100644 index c675825..0000000 --- a/src/BiliSharp/BiliSharp.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - netstandard2.1 - - - - - - - diff --git a/src/BiliSharp/Utils.cs b/src/BiliSharp/Utils.cs deleted file mode 100644 index 7ff2142..0000000 --- a/src/BiliSharp/Utils.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Net; -using System.Text.Json; - -namespace BiliSharp -{ - internal static class Utils - { - internal static T GetData(string url) - { - string referer = "https://www.bilibili.com"; - string userAgent = BiliManager.Instance().GetUserAgent(); - CookieContainer cookies = BiliManager.Instance().GetCookies(); - - string response = WebClient.RequestWeb(url, referer, userAgent, cookies); - - try - { - var obj = JsonSerializer.Deserialize(response); - return obj; - } - catch (Exception) - { - return default; - } - } - - } -} \ No newline at end of file diff --git a/src/BiliSharp/WebClient.cs b/src/BiliSharp/WebClient.cs deleted file mode 100644 index 9d8a0c5..0000000 --- a/src/BiliSharp/WebClient.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Net; -using System.Text; - -namespace BiliSharp -{ - internal static class WebClient - { - /// - /// 发送get或post请求 - /// - /// - /// - /// - /// - /// - /// - /// - /// - internal static string RequestWeb(string url, string referer = null, string userAgent = null, CookieContainer cookies = null, string method = "GET", Dictionary parameters = null, int retry = 3) - { - // 重试次数 - if (retry <= 0) { return ""; } - - // post请求,发送参数 - if (method == "POST" && parameters != null) - { - var builder = new StringBuilder(); - int i = 0; - foreach (var item in parameters) - { - if (i > 0) - { - builder.Append('&'); - } - - builder.AppendFormat("{0}={1}", item.Key, item.Value); - i++; - } - - url += "?" + builder.ToString(); - } - - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = method; - request.Timeout = 60 * 1000; - - request.ContentType = "application/json,text/html,application/xhtml+xml,application/xml;charset=UTF-8"; - request.Headers["accept-language"] = "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"; - request.Headers["accept-encoding"] = "gzip, deflate, br"; - - // userAgent - if (userAgent != null) - { - request.UserAgent = userAgent; - } - else - { - request.UserAgent = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"; - } - - // referer - if (referer != null) - { - request.Referer = referer; - } - - // 构造cookie - if (!url.Contains("getLogin")) - { - //request.Headers["origin"] = "https://www.bilibili.com"; - - if (cookies != null) - { - request.CookieContainer = cookies; - } - } - - string html = string.Empty; - using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) - { - if (response.ContentEncoding.ToLower().Contains("gzip")) - { - using var stream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress); - using var reader = new StreamReader(stream, Encoding.UTF8); - html = reader.ReadToEnd(); - } - else if (response.ContentEncoding.ToLower().Contains("deflate")) - { - using var stream = new DeflateStream(response.GetResponseStream(), CompressionMode.Decompress); - using var reader = new StreamReader(stream, Encoding.UTF8); - html = reader.ReadToEnd(); - } - else if (response.ContentEncoding.ToLower().Contains("br")) - { - using var stream = new BrotliStream(response.GetResponseStream(), CompressionMode.Decompress); - using var reader = new StreamReader(stream, Encoding.UTF8); - html = reader.ReadToEnd(); - } - else - { - using var stream = response.GetResponseStream(); - using var reader = new StreamReader(stream, Encoding.UTF8); - html = reader.ReadToEnd(); - } - } - - return html; - } - catch (Exception) - { - return RequestWeb(url, referer, userAgent, cookies, method, parameters, retry - 1); - } - } - } -} \ No newline at end of file diff --git a/src/Downkyi.sln b/src/Downkyi.sln index de1498f..eb4fd0f 100644 --- a/src/Downkyi.sln +++ b/src/Downkyi.sln @@ -9,12 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Downkyi.UI", "Downkyi.UI\Do EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Downkyi.Core", "Downkyi.Core\Downkyi.Core.csproj", "{5CED42DB-2155-45D0-B195-57BB894CB97B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BiliSharp", "BiliSharp\BiliSharp.csproj", "{199B3491-51F0-460D-AB90-191B7DD377D6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BiliSharp.UnitTest", "BiliSharp.UnitTest\BiliSharp.UnitTest.csproj", "{107D1B61-6936-45A0-B4AF-3776C736649A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Gif", "Avalonia.Gif\Avalonia.Gif.csproj", "{0E32DD42-C1C8-45A4-9572-8D963D85B0EF}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,18 +27,6 @@ Global {5CED42DB-2155-45D0-B195-57BB894CB97B}.Debug|Any CPU.Build.0 = Debug|Any CPU {5CED42DB-2155-45D0-B195-57BB894CB97B}.Release|Any CPU.ActiveCfg = Release|Any CPU {5CED42DB-2155-45D0-B195-57BB894CB97B}.Release|Any CPU.Build.0 = Release|Any CPU - {199B3491-51F0-460D-AB90-191B7DD377D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {199B3491-51F0-460D-AB90-191B7DD377D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {199B3491-51F0-460D-AB90-191B7DD377D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {199B3491-51F0-460D-AB90-191B7DD377D6}.Release|Any CPU.Build.0 = Release|Any CPU - {107D1B61-6936-45A0-B4AF-3776C736649A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {107D1B61-6936-45A0-B4AF-3776C736649A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {107D1B61-6936-45A0-B4AF-3776C736649A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {107D1B61-6936-45A0-B4AF-3776C736649A}.Release|Any CPU.Build.0 = Release|Any CPU - {0E32DD42-C1C8-45A4-9572-8D963D85B0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E32DD42-C1C8-45A4-9572-8D963D85B0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E32DD42-C1C8-45A4-9572-8D963D85B0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E32DD42-C1C8-45A4-9572-8D963D85B0EF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/third_party/Avalonia.GIF-11rc1.zip b/third_party/Avalonia.GIF-11rc1.zip deleted file mode 100644 index 75c53c8..0000000 Binary files a/third_party/Avalonia.GIF-11rc1.zip and /dev/null differ diff --git a/third_party/Avalonia.Gif.1.0.0.nupkg b/third_party/Avalonia.Gif.1.0.0.nupkg new file mode 100644 index 0000000..a192b5b Binary files /dev/null and b/third_party/Avalonia.Gif.1.0.0.nupkg differ diff --git a/third_party/Downkyi.BiliSharp.0.0.2.nupkg b/third_party/Downkyi.BiliSharp.0.0.2.nupkg new file mode 100644 index 0000000..6cac24a Binary files /dev/null and b/third_party/Downkyi.BiliSharp.0.0.2.nupkg differ