Compare commits

...

14 commits

10 changed files with 126 additions and 20 deletions

70
.github/workflows/codeql-analysis.yml vendored Normal file
View file

@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '43 14 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View file

@ -234,19 +234,45 @@ namespace DML.AppCore.Classes
var serverName = "unknown";
string nickname = null;
var socketTextChannel = message.Channel as SocketTextChannel;
if (socketTextChannel != null)
if (fileName.Contains("%guild%") || fileName.Contains("%nickname%"))
{
serverName = socketTextChannel.Guild.Name;
serverName = Path.GetInvalidFileNameChars()
.Aggregate(serverName, (current, c) => current.Replace(c, ' '));
nickname = socketTextChannel.GetUser(message.Author.Id).Nickname;
var socketTextChannel = message.Channel as SocketTextChannel;
if (socketTextChannel != null)
{
// fetch servername
serverName = socketTextChannel.Guild.Name;
serverName = Path.GetInvalidFileNameChars()
.Aggregate(serverName, (current, c) => current.Replace(c, ' '));
// fetch nickname
if (fileName.Contains("%nickname%"))
{
var serverUser =
socketTextChannel.GetUser(message.Author
.Id); // can be null if user left the server
if (serverUser != null)
{
nickname = serverUser.Nickname;
if (!string.IsNullOrEmpty(nickname))
nickname = Path.GetInvalidFileNameChars()
.Aggregate(nickname, (current, c) => current.Replace(c, ' '));
}
}
}
}
// fetch channelname
var channelName = message.Channel.Name;
channelName = Path.GetInvalidFileNameChars()
.Aggregate(channelName, (current, c) => current.Replace(c, ' '));
// fetch username
var username = message.Author.Username;
username = Path.GetInvalidFileNameChars()
.Aggregate(username, (current, c) => current.Replace(c, ' '));
fileName =
fileName.Replace("%guild%", serverName)
.Replace("%channel%", channelName)
@ -254,9 +280,9 @@ namespace DML.AppCore.Classes
.Replace("%name%", a.Filename)
.Replace("%id%", a.Id.ToString())
.Replace("%userid%", message.Author.Id.ToString())
.Replace("%username%", message.Author.Username)
.Replace("%username%", username)
.Replace("%nickname%",
!string.IsNullOrEmpty(nickname) ? nickname : message.Author.Username);
!string.IsNullOrEmpty(nickname) ? nickname : username);
if (extensionRequired)
fileName += Path.GetExtension(a.Filename);

View file

@ -38,8 +38,8 @@
<Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.3.1.6\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
@ -142,8 +142,8 @@
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Linq.Async, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Async.5.0.0\lib\net461\System.Linq.Async.dll</HintPath>
<Reference Include="System.Linq.Async, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Async.4.1.1\lib\net461\System.Linq.Async.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>

View file

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]

View file

@ -62,6 +62,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.9" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="5.0.1" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="Microsoft.Win32.Registry" version="5.0.0" targetFramework="net461" />
@ -12,7 +12,7 @@
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Collections.Immutable" version="5.0.0" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" requireReinstallation="true" />
<package id="System.Linq.Async" version="5.0.0" targetFramework="net461" />
<package id="System.Linq.Async" version="4.1.1" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />

View file

@ -65,6 +65,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -42,8 +42,8 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.3.1.6\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="5.0.1" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />

View file

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Discord Media Loader"
#define MyAppVersion "1.5.0.0"
#define MyAppVersion "1.5.3.0"
#define MyAppPublisher "Serraniel"
#define MyAppURL "https://github.com/Serraniel/DiscordMediaLoader"
#define MyAppExeName "Discord Media Loader.exe"
@ -134,6 +134,8 @@ Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media L
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.IO.MemoryMappedFiles.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.IO.Pipes.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.IO.UnmanagedMemoryStream.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.Linq.Async.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.Linq.Async.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.Linq.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.Linq.Expressions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Daniel\Documents\Projects\Discord Media Loader\Discord Media Loader\bin\Release\System.Linq.Parallel.dll"; DestDir: "{app}"; Flags: ignoreversion