Skip to content

Commit

Permalink
Merge pull request #30 from U2FsdGVkX1/pmcenter-lazer
Browse files Browse the repository at this point in the history
use Camel-Case and fix linebreaks & OCD fix
  • Loading branch information
Elepover authored Apr 7, 2020
2 parents 2bf23a1 + 203c029 commit 1ae2df7
Show file tree
Hide file tree
Showing 77 changed files with 90 additions and 90 deletions.
2 changes: 1 addition & 1 deletion pmcenter/BotCommands/SwitchLangCodeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task<bool> ExecuteAsync(TelegramBotClient botClient, Update update)
// update configurations
Vars.CurrentConf.LangURL = Mirror.LocaleFileURL.Replace("$channel", Vars.CompileChannel);
// start downloading
_ = await Conf.SaveConf(IsAutoSave: true).ConfigureAwait(false);
_ = await Conf.SaveConf(isAutoSave: true).ConfigureAwait(false);
await DownloadFileAsync(
new Uri(Vars.CurrentConf.LangURL),
Path.Combine(
Expand Down
2 changes: 1 addition & 1 deletion pmcenter/BotCommands/SwitchLangCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<bool> ExecuteAsync(TelegramBotClient botClient, Update update)
var LangURL = update.Message.Text.Split(" ")[1];
Vars.CurrentConf.LangURL = LangURL;
// save conf
_ = await Conf.SaveConf(IsAutoSave: true);
_ = await Conf.SaveConf(isAutoSave: true);
await DownloadFileAsync(
new Uri(LangURL),
Path.Combine(Vars.AppDirectory, "pmcenter_locale.json")
Expand Down
2 changes: 1 addition & 1 deletion pmcenter/CommandLineProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public static async Task RunCommand(string CommandLine)
_ = await CmdLineRouter.Execute(CommandLine).ConfigureAwait(false);
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLineRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ public async Task<bool> Execute(string cmdLine)
return false;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/BackupCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public Task<bool> Process()
return Task.FromResult(true);
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/HelpCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public Task<bool> Process()
return Task.FromResult(true);
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/InfoCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public async Task<bool> Process()
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/NonServiceModeCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public async Task<bool> Process()
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/ResetCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public async Task<bool> Process()
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/SetupWizardCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public async Task<bool> Process()
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/CommandLines/UpdateCmdLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public async Task<bool> Process()
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.BanObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public BanObj()
public long UID { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.ConfObj.New.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public ConfObj()
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.ConfObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public partial class ConfObj
public List<MessageIDLink> MessageLinks;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.GetConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public static async Task<ConfObj> GetConf(string Filename)
return JsonConvert.DeserializeObject<ConfObj>(SettingsText);
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.InitConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public static async Task InitConf()
Log("Integrity test finished!", "CONF");
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.KillIllegalChars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ public static string KillIllegalChars(string Input)
return Input.Replace("/", "-").Replace("<", "-").Replace(">", "-").Replace(":", "-").Replace("\"", "-").Replace("/", "-").Replace("\\", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.LocaleList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public LocaleList()
public List<LocaleMirror> Locales { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.LocaleMirror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public LocaleMirror()
public string LocaleNameNative { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.MessageIDLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public MessageIDLink()
public bool IsFromOwner { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.RateData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public RateData()
public int MessageCount { get; set; }
}
}
}
}
6 changes: 3 additions & 3 deletions pmcenter/Configurations/Conf.ReadConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace pmcenter
{
public partial class Conf
{
public static async Task<bool> ReadConf(bool Apply = true)
public static async Task<bool> ReadConf(bool apply = true)
{ // DO NOT HANDLE ERRORS HERE. THE CALLING METHOD WILL HANDLE THEM.
var Temp = await GetConf(Vars.ConfFile).ConfigureAwait(false);
if (Apply) { Vars.CurrentConf = Temp; }
if (apply) { Vars.CurrentConf = Temp; }
return true;
}
}
}
}
8 changes: 4 additions & 4 deletions pmcenter/Configurations/Conf.SaveConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ namespace pmcenter
{
public partial class Conf
{
public static async Task<bool> SaveConf(bool IsInvalid = false, bool IsAutoSave = false)
public static async Task<bool> SaveConf(bool isInvalid = false, bool isAutoSave = false)
{ // DO NOT HANDLE ERRORS HERE.
string Text = JsonConvert.SerializeObject(Vars.CurrentConf, Formatting.Indented);
await System.IO.File.WriteAllTextAsync(Vars.ConfFile, Text).ConfigureAwait(false);
if (IsAutoSave)
if (isAutoSave)
{
Log("Autosave complete.", "CONF");
}
if (IsInvalid)
if (isInvalid)
{
Log("We've detected an invalid configurations file and have reset it.", "CONF", LogLevel.WARN);
Log("Please reconfigure it and try to start pmcenter again.", "CONF", LogLevel.WARN);
Expand All @@ -24,4 +24,4 @@ public static async Task<bool> SaveConf(bool IsInvalid = false, bool IsAutoSave
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.Socks5Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public Socks5Proxy()
public string ProxyPass { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public Stats()
public int TotalForwardedFromOwner { get; set; }
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.SwitchBlocking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static bool SwitchBlocking()
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.SwitchNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static bool SwitchNotifications()
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Conf.SwitchPaused.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static bool SwitchPaused()
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Lang.InitLang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public static async Task InitLang()
Log("Integrity test finished!", "LANG");
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Lang.Language.New.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ public Language()
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Configurations/Lang.Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ public partial class Language
public string Message_NetCore31Required;
}
}
}
}
6 changes: 3 additions & 3 deletions pmcenter/Configurations/Lang.ReadLang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace pmcenter
{
public partial class Lang
{
public static async Task<bool> ReadLang(bool Apply = true)
public static async Task<bool> ReadLang(bool apply = true)
{ // DO NOT HANDLE ERRORS HERE. THE CALLING METHOD WILL HANDLE THEM.
var SettingsText = await File.ReadAllTextAsync(Vars.LangFile).ConfigureAwait(false);
var Temp = JsonConvert.DeserializeObject<Language>(SettingsText);
if (Apply) { Vars.CurrentLang = Temp; }
if (apply) { Vars.CurrentLang = Temp; }
return true;
}
}
}
}
6 changes: 3 additions & 3 deletions pmcenter/Configurations/Lang.SaveLang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ namespace pmcenter
{
public partial class Lang
{
public static async Task<bool> SaveLang(bool IsInvalid = false)
public static async Task<bool> SaveLang(bool isInvalid = false)
{ // DO NOT HANDLE ERRORS HERE.
var Text = JsonConvert.SerializeObject(Vars.CurrentLang, Formatting.Indented);
var Writer = new StreamWriter(File.Create(Vars.LangFile), System.Text.Encoding.UTF8);
await Writer.WriteAsync(Text).ConfigureAwait(false);
await Writer.FlushAsync().ConfigureAwait(false);
Writer.Close();
if (IsInvalid)
if (isInvalid)
{
Log("We've detected an invalid language file and have reset it.", "LANG", LogLevel.WARN);
Log("Please reconfigure it and try to start pmcenter again.", "LANG", LogLevel.WARN);
Expand All @@ -23,4 +23,4 @@ public static async Task<bool> SaveLang(bool IsInvalid = false)
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/EventHandlers/CtrlCHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public static void CtrlCHandler(object sender, ConsoleCancelEventArgs e)
ExitApp(130);
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/EventHandlers/GlobalErrorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ private static void L(string log)
Console.Error.WriteLine(log);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public static BanObj GetBanObjByID(long UID)
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public static MessageIDLink GetLinkByOwnerMsgID(long OwnerSessionMsgID)
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public static MessageIDLink GetLinkByUserMsgID(long UserSessionMsgID)
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public static int GetRateDataIndexByID(long UID)
return -1;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Methods/Database/Checking/Methods.IsBanned.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public static bool IsBanned(long UID)
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static bool IsKeywordBanned(string Sentence)
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public static bool IsOwnerRetractionAvailable(int OwnerSessionMsgID)
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public static bool IsRateDataTracking(long UID)
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public static bool IsUserRetractionAvailable(int UserSessionMsgID)
return false;
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Methods/Database/Writing/Methods.AddRateLimit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public static void AddRateLimit(long UID)
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Methods/Database/Writing/Methods.BanUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public static void BanUser(long UID)
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Methods/Database/Writing/Methods.UnbanUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public static void UnbanUser(long UID)
}
}
}
}
}
2 changes: 1 addition & 1 deletion pmcenter/Methods/Methods.BoolStr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ public static string BoolStr(bool Input)
return Input ? "true" : "false";
}
}
}
}
Loading

0 comments on commit 1ae2df7

Please sign in to comment.