000
This commit is contained in:
commit
2028bf5967
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
/packages/
|
||||||
|
riderModule.iml
|
||||||
|
/_ReSharper.Caches/
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "DTLib"]
|
||||||
|
path = DTLib
|
||||||
|
url = https://github.com/Timerix22/DTLib.git
|
||||||
13
.idea/.idea.VkAudioDownloader/.idea/.gitignore
vendored
Normal file
13
.idea/.idea.VkAudioDownloader/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/.idea.VkAudioDownloader.iml
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
6
.idea/.idea.VkAudioDownloader/.idea/encodings.xml
Normal file
6
.idea/.idea.VkAudioDownloader/.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/.idea.VkAudioDownloader/.idea/indexLayout.xml
Normal file
8
.idea/.idea.VkAudioDownloader/.idea/indexLayout.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.VkAudioDownloader/.idea/misc.xml
Normal file
6
.idea/.idea.VkAudioDownloader/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="com.jetbrains.rider.android.RiderAndroidMiscFileCreationComponent">
|
||||||
|
<option name="ENSURE_MISC_FILE_EXISTS" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.VkAudioDownloader/.idea/vcs.xml
Normal file
6
.idea/.idea.VkAudioDownloader/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1
DTLib
Submodule
1
DTLib
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f6d045ae2d97691d67bfa82a26e9c100bb3215a1
|
||||||
13
VkAudioDownloader.CLI/Program.cs
Normal file
13
VkAudioDownloader.CLI/Program.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
|
using VkAudioDownloader;
|
||||||
|
|
||||||
|
|
||||||
|
var client = new VkClient(new VkClientConfig()
|
||||||
|
{
|
||||||
|
AppId = 51473647,
|
||||||
|
Login = "aaa",
|
||||||
|
Password = "aaa"
|
||||||
|
});
|
||||||
|
client.Connect();
|
||||||
|
Console.WriteLine(client.Api.Token);
|
||||||
14
VkAudioDownloader.CLI/VkAudioDownloader.CLI.csproj
Normal file
14
VkAudioDownloader.CLI/VkAudioDownloader.CLI.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\VkAudioDownloader\VkAudioDownloader.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
34
VkAudioDownloader.sln
Normal file
34
VkAudioDownloader.sln
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VkAudioDownloader", "VkAudioDownloader\VkAudioDownloader.csproj", "{5F117DA9-78F4-4362-AD98-0231B81511E9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VkAudioDownloader.CLI", "VkAudioDownloader.CLI\VkAudioDownloader.CLI.csproj", "{5ECC83C5-B53F-4CA7-ABDE-E2ACE8F48FED}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib", "DTLib\DTLib\DTLib.csproj", "{5A02279F-F246-4101-BAA7-71EC5FAF2CAF}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib.Dtsod", "DTLib\DTLib.Dtsod\DTLib.Dtsod.csproj", "{F6FA6507-8A20-43F8-9D88-4CB2F049780D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5F117DA9-78F4-4362-AD98-0231B81511E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5F117DA9-78F4-4362-AD98-0231B81511E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5F117DA9-78F4-4362-AD98-0231B81511E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5F117DA9-78F4-4362-AD98-0231B81511E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5ECC83C5-B53F-4CA7-ABDE-E2ACE8F48FED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5ECC83C5-B53F-4CA7-ABDE-E2ACE8F48FED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5ECC83C5-B53F-4CA7-ABDE-E2ACE8F48FED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5ECC83C5-B53F-4CA7-ABDE-E2ACE8F48FED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5A02279F-F246-4101-BAA7-71EC5FAF2CAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5A02279F-F246-4101-BAA7-71EC5FAF2CAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5A02279F-F246-4101-BAA7-71EC5FAF2CAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5A02279F-F246-4101-BAA7-71EC5FAF2CAF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F6FA6507-8A20-43F8-9D88-4CB2F049780D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F6FA6507-8A20-43F8-9D88-4CB2F049780D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F6FA6507-8A20-43F8-9D88-4CB2F049780D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F6FA6507-8A20-43F8-9D88-4CB2F049780D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
4
VkAudioDownloader.sln.DotSettings.user
Normal file
4
VkAudioDownloader.sln.DotSettings.user
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||||
|
<Assembly Path="C:\Users\User\.nuget\packages\vknet\1.72.0\lib\net6.0\VkNet.dll" />
|
||||||
|
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
||||||
18
VkAudioDownloader/VkAudioDownloader.csproj
Normal file
18
VkAudioDownloader/VkAudioDownloader.csproj
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="VkNet" Version="1.72.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DTLib\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
||||||
|
<ProjectReference Include="..\DTLib\DTLib\DTLib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
45
VkAudioDownloader/VkClient.cs
Normal file
45
VkAudioDownloader/VkClient.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
global using DTLib;
|
||||||
|
global using DTLib.Extensions;
|
||||||
|
using DTLib.Logging;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using VkNet;
|
||||||
|
using VkNet.Enums.Filters;
|
||||||
|
using VkNet.Model;
|
||||||
|
|
||||||
|
namespace VkAudioDownloader;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class VkClient : IDisposable
|
||||||
|
{
|
||||||
|
public VkApi Api;
|
||||||
|
public VkClientConfig Config;
|
||||||
|
|
||||||
|
public VkClient(VkClientConfig conf)
|
||||||
|
{
|
||||||
|
Config = conf;
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
//services.AddSingleton<LoggerService>();
|
||||||
|
Api = new VkApi(services);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Connect()
|
||||||
|
{
|
||||||
|
Api.Authorize(new ApiAuthParams
|
||||||
|
{
|
||||||
|
ApplicationId = Config.AppId,
|
||||||
|
Login = Config.Login,
|
||||||
|
Password = Config.Password,
|
||||||
|
Settings = Settings.Audio
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Disposed = false;
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (Disposed) return;
|
||||||
|
Api.Dispose();
|
||||||
|
Disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
VkAudioDownloader/VkClientConfig.cs
Normal file
31
VkAudioDownloader/VkClientConfig.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
global using DTLib.Dtsod;
|
||||||
|
|
||||||
|
namespace VkAudioDownloader;
|
||||||
|
|
||||||
|
public class VkClientConfig
|
||||||
|
{
|
||||||
|
/// account password
|
||||||
|
public string Password;
|
||||||
|
/// account login (email/phone number)
|
||||||
|
public string Login;
|
||||||
|
/// vk app id from https://vk.com/apps?act=manage
|
||||||
|
public ulong AppId;
|
||||||
|
|
||||||
|
|
||||||
|
public static VkClientConfig FromDtsod(DtsodV23 dtsod) =>
|
||||||
|
new VkClientConfig
|
||||||
|
{
|
||||||
|
Password = dtsod["password"],
|
||||||
|
Login = dtsod["login"],
|
||||||
|
AppId = dtsod["app_id"]
|
||||||
|
};
|
||||||
|
|
||||||
|
public DtsodV23 ToDtsod() =>
|
||||||
|
new DtsodV23
|
||||||
|
{
|
||||||
|
{ "password", Password },
|
||||||
|
{ "login", Login },
|
||||||
|
{ "app_id", AppId }
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user