fix: some build & linter warnings

This commit is contained in:
ZavaruKitsu
2022-10-08 19:15:51 +03:00
parent 3f0d109fe2
commit a731e2a8d0
159 changed files with 2738 additions and 3742 deletions
+8 -11
View File
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
using TelegramBotBase.Sessions;
@@ -13,9 +10,9 @@ namespace TelegramBotBase.Args
/// </summary>
public class BotCommandEventArgs : EventArgs
{
public String Command { get; set; }
public string Command { get; set; }
public List<String> Parameters { get; set; }
public List<string> Parameters { get; set; }
public long DeviceId { get; set; }
@@ -32,13 +29,13 @@ namespace TelegramBotBase.Args
}
public BotCommandEventArgs(String Command, List<String> Parameters, Message Message, long DeviceId, DeviceSession Device)
public BotCommandEventArgs(string command, List<string> parameters, Message message, long deviceId, DeviceSession device)
{
this.Command = Command;
this.Parameters = Parameters;
this.OriginalMessage = Message;
this.DeviceId = DeviceId;
this.Device = Device;
this.Command = command;
this.Parameters = parameters;
OriginalMessage = message;
this.DeviceId = deviceId;
this.Device = device;
}
}
+9 -13
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Controls.Hybrid;
using TelegramBotBase.Form;
@@ -29,21 +25,21 @@ namespace TelegramBotBase.Args
public ButtonClickedEventArgs(ButtonBase button)
{
this.Button = button;
this.Index = -1;
Button = button;
Index = -1;
}
public ButtonClickedEventArgs(ButtonBase button, int Index)
public ButtonClickedEventArgs(ButtonBase button, int index)
{
this.Button = button;
this.Index = Index;
Button = button;
this.Index = index;
}
public ButtonClickedEventArgs(ButtonBase button, int Index, ButtonRow row)
public ButtonClickedEventArgs(ButtonBase button, int index, ButtonRow row)
{
this.Button = button;
this.Index = Index;
this.Row = row;
Button = button;
this.Index = index;
Row = row;
}
}
}
@@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using TelegramBotBase.Controls.Hybrid;
using TelegramBotBase.Form;
namespace TelegramBotBase.Args
{
public class CheckedChangedEventArgs : EventArgs
{
/// <summary>
/// Contains the index of the row where the button is inside.
/// Contains the index of the row where the button is inside.
/// Contains -1 when it is a layout button or not found.
/// </summary>
public int Index { get; set; }
@@ -32,11 +29,11 @@ namespace TelegramBotBase.Args
}
public CheckedChangedEventArgs(ButtonRow row, int Index, bool Checked)
public CheckedChangedEventArgs(ButtonRow row, int index, bool @checked)
{
this.Row = row;
this.Index = Index;
this.Checked = Checked;
Row = row;
this.Index = index;
this.Checked = @checked;
}
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Telegram.Bot.Types.Enums;
using TelegramBotBase.Base;
@@ -14,8 +12,8 @@ namespace TelegramBotBase.Args
public GroupChangedEventArgs(MessageType type, MessageResult message)
{
this.Type = type;
this.OriginalMessage = message;
Type = type;
OriginalMessage = message;
}
+1 -5
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TelegramBotBase.Args
{
@@ -12,7 +8,7 @@ namespace TelegramBotBase.Args
public InitEventArgs(params object[] args)
{
this.Args = args;
Args = args;
}
}
}
+10 -18
View File
@@ -1,42 +1,34 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TelegramBotBase.Args
{
public class LoadStateEventArgs
{
public Dictionary<String,object> Values { get; set; }
public Dictionary<string,object> Values { get; set; }
public LoadStateEventArgs()
{
Values = new Dictionary<string, object>();
}
public List<String> Keys
{
get
{
return Values.Keys.ToList();
}
}
public List<string> Keys => Values.Keys.ToList();
public String Get(String key)
public string Get(string key)
{
return Values[key].ToString();
}
public int GetInt(String key)
public int GetInt(string key)
{
int i = 0;
var i = 0;
if (int.TryParse(Values[key].ToString(), out i))
return i;
return 0;
}
public double GetDouble(String key)
public double GetDouble(string key)
{
double d = 0;
if (double.TryParse(Values[key].ToString(), out d))
@@ -45,16 +37,16 @@ namespace TelegramBotBase.Args
return 0;
}
public bool GetBool(String key)
public bool GetBool(string key)
{
bool b = false;
var b = false;
if (bool.TryParse(Values[key].ToString(), out b))
return b;
return false;
}
public object GetObject(String key)
public object GetObject(string key)
{
return Values[key];
}
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using TelegramBotBase.Base;
@@ -18,15 +17,15 @@ namespace TelegramBotBase.Args
public MemberChangeEventArgs()
{
this.Members = new List<User>();
Members = new List<User>();
}
public MemberChangeEventArgs(MessageType type, MessageResult result, params User[] members)
{
this.Type = type;
this.Result = result;
this.Members = members.ToList();
Type = type;
Result = result;
Members = members.ToList();
}
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
namespace TelegramBotBase.Args
namespace TelegramBotBase.Args
{
public class MessageDeletedEventArgs
{
@@ -16,7 +9,7 @@ namespace TelegramBotBase.Args
public MessageDeletedEventArgs(int messageId)
{
this.MessageId = messageId;
MessageId = messageId;
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Sessions;
namespace TelegramBotBase.Base
@@ -16,11 +12,11 @@ namespace TelegramBotBase.Base
public MessageResult Message { get; set; }
public MessageIncomeEventArgs(long DeviceId, DeviceSession Device, MessageResult message)
public MessageIncomeEventArgs(long deviceId, DeviceSession device, MessageResult message)
{
this.DeviceId = DeviceId;
this.Device = Device;
this.Message = message;
this.DeviceId = deviceId;
this.Device = device;
Message = message;
}
@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
using Telegram.Bot.Types;
namespace TelegramBotBase.Args
{
public class MessageReceivedEventArgs
{
public int MessageId
{
get
{
return this.Message.MessageId;
}
}
public int MessageId => Message.MessageId;
public Message Message { get; set; }
public MessageReceivedEventArgs(Message m)
{
this.Message = m;
Message = m;
}
}
+4 -14
View File
@@ -1,21 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
namespace TelegramBotBase.Args
{
public class MessageSentEventArgs : EventArgs
{
public int MessageId
{
get
{
return this.Message.MessageId;
}
}
public int MessageId => Message.MessageId;
public Message Message { get; set; }
@@ -25,10 +15,10 @@ namespace TelegramBotBase.Args
public Type Origin { get; set; }
public MessageSentEventArgs(Message message, Type Origin)
public MessageSentEventArgs(Message message, Type origin)
{
this.Message = message;
this.Origin = Origin;
Message = message;
this.Origin = origin;
}
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace TelegramBotBase.Args
namespace TelegramBotBase.Args
{
public class PromptDialogCompletedEventArgs
{
public object Tag { get; set; }
public String Value { get; set; }
public string Value { get; set; }
}
}
+2 -4
View File
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace TelegramBotBase.Args
{
@@ -9,10 +7,10 @@ namespace TelegramBotBase.Args
public int CurrentView { get; set; }
public RenderViewEventArgs(int ViewIndex)
public RenderViewEventArgs(int viewIndex)
{
CurrentView = ViewIndex;
CurrentView = viewIndex;
}
+7 -9
View File
@@ -1,38 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
namespace TelegramBotBase.Args
{
public class SaveStateEventArgs
{
public Dictionary<String, object> Values { get; set; }
public Dictionary<string, object> Values { get; set; }
public SaveStateEventArgs()
{
Values = new Dictionary<string, object>();
}
public void Set(String key, String value)
public void Set(string key, string value)
{
Values[key] = value;
}
public void SetInt(String key, int value)
public void SetInt(string key, int value)
{
Values[key] = value;
}
public void SetBool(String key, bool value)
public void SetBool(string key, bool value)
{
Values[key] = value;
}
public void SetDouble(String key, double value)
public void SetDouble(string key, double value)
{
Values[key] = value;
}
public void SetObject(String key, object value)
public void SetObject(string key, object value)
{
Values[key] = value;
}
+2 -7
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TelegramBotBase.Base;
using TelegramBotBase.Sessions;
using TelegramBotBase.Base;
namespace TelegramBotBase.Args
{
@@ -14,7 +9,7 @@ namespace TelegramBotBase.Args
public SaveStatesEventArgs(StateContainer states)
{
this.States = states;
States = states;
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Sessions;
namespace TelegramBotBase.Base
@@ -13,10 +9,10 @@ namespace TelegramBotBase.Base
public DeviceSession Device { get; set; }
public SessionBeginEventArgs(long DeviceId, DeviceSession Device)
public SessionBeginEventArgs(long deviceId, DeviceSession device)
{
this.DeviceId = DeviceId;
this.Device = Device;
this.DeviceId = deviceId;
this.Device = device;
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TelegramBotBase.Sessions;
namespace TelegramBotBase.Args
@@ -10,7 +6,7 @@ namespace TelegramBotBase.Args
public class SystemExceptionEventArgs : EventArgs
{
public String Command { get; set; }
public string Command { get; set; }
public long DeviceId { get; set; }
@@ -24,12 +20,12 @@ namespace TelegramBotBase.Args
}
public SystemExceptionEventArgs(String Command, long DeviceId, DeviceSession Device, Exception error)
public SystemExceptionEventArgs(string command, long deviceId, DeviceSession device, Exception error)
{
this.Command = Command;
this.DeviceId = DeviceId;
this.Device = Device;
this.Error = error;
this.Command = command;
this.DeviceId = deviceId;
this.Device = device;
Error = error;
}
}
+10 -14
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types;
using TelegramBotBase.Sessions;
@@ -10,13 +6,13 @@ namespace TelegramBotBase.Args
{
public class UnhandledCallEventArgs : EventArgs
{
public String Command { get; set; }
public string Command { get; set; }
public long DeviceId { get; set; }
public DeviceSession Device {get;set;}
public String RawData { get; set; }
public string RawData { get; set; }
public int MessageId { get; set; }
@@ -27,18 +23,18 @@ namespace TelegramBotBase.Args
public UnhandledCallEventArgs()
{
this.Handled = false;
Handled = false;
}
public UnhandledCallEventArgs(String Command,String RawData, long DeviceId, int MessageId, Message message, DeviceSession Device) : this()
public UnhandledCallEventArgs(string command,string rawData, long deviceId, int messageId, Message message, DeviceSession device) : this()
{
this.Command = Command;
this.RawData = RawData;
this.DeviceId = DeviceId;
this.MessageId = MessageId;
this.Message = message;
this.Device = Device;
this.Command = command;
this.RawData = rawData;
this.DeviceId = deviceId;
this.MessageId = messageId;
Message = message;
this.Device = device;
}
}