Skip to content

Commit 4e5325e

Browse files
committed
chore: fix warnings
1 parent 66b42e9 commit 4e5325e

34 files changed

Lines changed: 469 additions & 220 deletions

TelegramDownloader/Controllers/FileController.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.AspNetCore.Http.Features;
1+
#nullable disable
2+
using Microsoft.AspNetCore.Http.Features;
23
using Microsoft.AspNetCore.Mvc;
34

45
using MongoDB.Driver;
@@ -526,8 +527,8 @@ public async Task<IActionResult> GetFileStream(string idChannel, string idFile,
526527
Response.StatusCode = StatusCodes.Status206PartialContent; // StatusCodes.Status206PartialContent;
527528
Response.ContentType = mimeType;
528529
Response.Headers["Content-Disposition"] = $"inline; filename=\"{HttpUtility.UrlEncode(fileName)}\"";
529-
Response.Headers.Add("Content-Range", $"bytes {(initialFrom >= totalLength ? totalLength - 1 : initialFrom)}-{(initialFrom >= totalLength ? totalLength - 1 : initialFrom + Response.ContentLength - 1)}/{totalLength}");
530-
Response.Headers.Add("Accept-Ranges", "bytes");
530+
Response.Headers["Content-Range"] = $"bytes {(initialFrom >= totalLength ? totalLength - 1 : initialFrom)}-{(initialFrom >= totalLength ? totalLength - 1 : initialFrom + Response.ContentLength - 1)}/{totalLength}";
531+
Response.Headers["Accept-Ranges"] = "bytes";
531532

532533
//if (Request.Headers.ContainsKey("Range"))
533534
//{

TelegramDownloader/Data/FileService.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BlazorBootstrap;
1+
#nullable disable
2+
using BlazorBootstrap;
23
using Microsoft.AspNetCore.Components.Forms;
34
using Microsoft.AspNetCore.StaticFiles;
45
using MongoDB.Driver;
@@ -873,7 +874,7 @@ public virtual async Task downloadFromTelegram(string dbName, int messageId, str
873874
try
874875
{
875876
model.channelName = _ts.getChatName(Convert.ToInt64(dbName));
876-
} catch(Exception ex) {
877+
} catch {
877878
model.channelName = "Public or Shared";
878879
}
879880
var tcs = new TaskCompletionSource<bool>();
@@ -1280,10 +1281,10 @@ public async Task<String> CreateStrmFiles(string path, string dbName, string hos
12801281
{
12811282
Directory.Delete(basePath, true);
12821283
}
1283-
catch (Exception ex)
1284+
catch
12841285
{
12851286
}
1286-
1287+
12871288
Directory.CreateDirectory(basePath);
12881289
List<BsonFileManagerModel> filesAndFolders = await _db.getAllChildFilesInDirectory(dbName, path);
12891290
foreach (BsonFileManagerModel file in filesAndFolders)
@@ -1797,7 +1798,7 @@ public static string getMimeType(string extension)
17971798
{
17981799
return MIMETypesDictionary[extension.Replace(".", "")] ?? "application/octet-stream";
17991800
}
1800-
catch (Exception e)
1801+
catch
18011802
{
18021803
return "application/octet-stream";
18031804
}

TelegramDownloader/Data/FileServiceV2.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BlazorBootstrap;
1+
#nullable disable
2+
using BlazorBootstrap;
23
using Microsoft.AspNetCore.Components.Forms;
34
using Microsoft.AspNetCore.StaticFiles;
45
using MongoDB.Driver;
@@ -129,7 +130,7 @@ public async Task downloadFromTelegramV2(string dbName, int messageId, string de
129130
{
130131
model.channelName = _ts.getChatName(Convert.ToInt64(dbName));
131132
}
132-
catch (Exception ex)
133+
catch
133134
{
134135
model.channelName = "Public or Shared";
135136
}

TelegramDownloader/Data/IFileService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Syncfusion.Blazor.FileManager;
1+
#nullable disable
2+
using Syncfusion.Blazor.FileManager;
23
using Syncfusion.Blazor.Inputs;
34
using System.Dynamic;
45
using TelegramDownloader.Models;

TelegramDownloader/Data/ITelegramService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BlazorBootstrap;
1+
#nullable disable
2+
using BlazorBootstrap;
23
using TelegramDownloader.Models;
34
using TL;
45
using WTelegram;

TelegramDownloader/Data/TelegramService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BlazorBootstrap;
1+
#nullable disable
2+
using BlazorBootstrap;
23
using Microsoft.AspNetCore.Components;
34
using Microsoft.AspNetCore.Components.Forms;
45
using Syncfusion.Blazor.Inputs;
@@ -225,7 +226,7 @@ public async Task<string> checkAuth(string number, bool isPhone = false)
225226
}
226227

227228
_logger.LogInformation("Checking authentication - IsPhone: {IsPhone}", isPhone);
228-
if (client.UserId != null && number == null)
229+
if (client.UserId != 0 && number == null)
229230
{
230231
UserData ud = await UserService.getUserDataFromFile();
231232
if (ud != null)
@@ -888,7 +889,6 @@ public async Task<Byte[]> DownloadFileStream(Message message, long offset, int l
888889
_logger.LogDebug("DownloadFileStream - Offset: {Offset}, Limit: {Limit}", offset, limit);
889890
int totalLimit = limit;
890891
long currentOffset = offset;
891-
Byte[] response;
892892

893893
if (message is Message msg && msg.media is MessageMediaDocument doc)
894894
{
@@ -953,7 +953,7 @@ public async Task<Byte[]> DownloadFileStream(Message message, long offset, int l
953953
return memoryStream.ToArray();
954954
}
955955
}
956-
catch (Exception e)
956+
catch
957957
{
958958
throw new InvalidOperationException("Unexpected file type returned.");
959959
}

TelegramDownloader/Models/DownloadModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Diagnostics.Tracing;
1+
#nullable disable
2+
using System.Diagnostics.Tracing;
23
using System.Xml.Linq;
34
using System;
45
using TelegramDownloader.Data;

TelegramDownloader/Models/FileModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using MongoDB.Bson.Serialization.Attributes;
1+
#nullable disable
2+
using MongoDB.Bson.Serialization.Attributes;
23
using MongoDB.Bson;
34
using Syncfusion.Blazor.FileManager;
45
using TelegramDownloader.Data.db;

TelegramDownloader/Models/GitHub/GithubVersionModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace TelegramDownloader.Models.GitHub
1+
#nullable disable
2+
namespace TelegramDownloader.Models.GitHub
23
{
34
public class GithubVersionModel
45
{

TelegramDownloader/Models/LoginModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using TL;
1+
#nullable disable
2+
using TL;
23

34
namespace TelegramDownloader.Models
45
{

0 commit comments

Comments
 (0)