add invalid key warning

This commit is contained in:
Samuel Tulach 2020-06-25 14:53:35 +02:00
parent afb27233f8
commit d556a5d739
10 changed files with 51 additions and 20 deletions

View File

@ -11,6 +11,9 @@
"UploadForm_Info": "Informace o souboru",
"UploadForm_Upload": "Nahrát",
"UploadForm_Cancel": "Zrušit",
"UploadForm_NoApiKey": "Nepřidali jste API klíč. Jděte to nastavení a přidejte ho.",
"UploadForm_InvalidLength": "Přidali jste API klíč, ale nemá správnou délku. Měl by mít 64 znaků.",
"UploadForm_InvalidKey": "Špatný API klíč",
"Message_Idle": "Nic.",
"Message_Init": "Inicializace...",
"Message_Check": "Kontrola...",

View File

@ -1,21 +1,24 @@
{
"MainForm_DragFile": "Drag file here",
"MainForm_More": "More",
"SettingsForm_Title": "Settings",
"SettingsForm_General": "General settings",
"SettingsForm_Key": "API key",
"SettingsForm_Get": "Get API key",
"SettingsForm_Language": "Language",
"SettingsForm_Save": "Save",
"SettingsForm_Open": "Open settings file",
"UploadForm_Info": "File information",
"UploadForm_Upload": "Upload",
"UploadForm_Cancel": "Cancel",
"Message_Idle": "Idle.",
"Message_Init": "Initializing...",
"Message_Check": "Checking...",
"Message_Upload": "Uploading...",
"Message_NoLink": "No permalink found in response!",
"Message_NoSettings": "No settings file exists.",
"Message_Saved": "Settings saved."
}
"MainForm_DragFile": "Drag file here",
"MainForm_More": "More",
"SettingsForm_Title": "Settings",
"SettingsForm_General": "General settings",
"SettingsForm_Key": "API key",
"SettingsForm_Get": "Get API key",
"SettingsForm_Language": "Language",
"SettingsForm_Save": "Save",
"SettingsForm_Open": "Open settings file",
"UploadForm_Info": "File information",
"UploadForm_Upload": "Upload",
"UploadForm_Cancel": "Cancel",
"UploadForm_NoApiKey": "You have not entered an API key. Please go to settings and add one.",
"UploadForm_InvalidLength": "You have entered an API key, but the key does not have valid length. Key should contain 64 characters.",
"UploadForm_InvalidKey": "Invalid API key",
"Message_Idle": "Idle.",
"Message_Init": "Initializing...",
"Message_Check": "Checking...",
"Message_Upload": "Uploading...",
"Message_NoLink": "No permalink found in response!",
"Message_NoSettings": "No settings file exists.",
"Message_Saved": "Settings saved."
}

View File

@ -11,6 +11,9 @@
"UploadForm_Info": "Informations sur le fichier",
"UploadForm_Upload": "Mettre en ligne",
"UploadForm_Cancel": "Annuler",
"UploadForm_NoApiKey": "You have not entered an API key. Please go to settings and add one.",
"UploadForm_InvalidLength": "You have entered an API key, but the key does not have valid length. Key should contain 64 characters.",
"UploadForm_InvalidKey": "Invalid API key",
"Message_Idle": "Prêt.",
"Message_Init": "Initialisation...",
"Message_Check": "Vérification...",

View File

@ -11,6 +11,9 @@
"UploadForm_Info": "Dateiinformationen",
"UploadForm_Upload": "Hochladen",
"UploadForm_Cancel": "Abbrechen",
"UploadForm_NoApiKey": "You have not entered an API key. Please go to settings and add one.",
"UploadForm_InvalidLength": "You have entered an API key, but the key does not have valid length. Key should contain 64 characters.",
"UploadForm_InvalidKey": "Invalid API key",
"Message_Idle": "Leerlauf.",
"Message_Init": "Initialisieren ...",
"Message_Check": "Überprüfen ...",

View File

@ -11,6 +11,9 @@
"UploadForm_Info": "Информация о файле",
"UploadForm_Upload": "Отправить",
"UploadForm_Cancel": "Отмена",
"UploadForm_NoApiKey": "You have not entered an API key. Please go to settings and add one.",
"UploadForm_InvalidLength": "You have entered an API key, but the key does not have valid length. Key should contain 64 characters.",
"UploadForm_InvalidKey": "Invalid API key",
"Message_Idle": "Ожидание.",
"Message_Init": "Инициализация...",
"Message_Check": "Проверка...",

Binary file not shown.

View File

@ -23,6 +23,9 @@ namespace uploader
public string UploadForm_Info = "File information";
public string UploadForm_Upload = "Upload";
public string UploadForm_Cancel = "Cancel";
public string UploadForm_NoApiKey = "You have not entered an API key. Please go to settings and add one.";
public string UploadForm_InvalidLength = "You have entered an API key, but the key does not have valid length. Key should contain 64 characters.";
public string UploadForm_InvalidKey = "Invalid API key";
public string Message_Idle = "Idle.";
public string Message_Init = "Initializing...";

View File

@ -26,6 +26,7 @@ namespace uploader
{
// Set working directory to exe location because of language files
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
//LocalizationHelper.Export();
var settings = Settings.LoadSettings();
if (!string.IsNullOrEmpty(settings.Language))

View File

@ -64,6 +64,18 @@ namespace uploader
private void Upload()
{
if (string.IsNullOrEmpty(_settings.ApiKey))
{
MessageBox.Show(LocalizationHelper.Base.UploadForm_NoApiKey, LocalizationHelper.Base.UploadForm_InvalidKey, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (_settings.ApiKey.Length != 64)
{
MessageBox.Show(LocalizationHelper.Base.UploadForm_InvalidLength, LocalizationHelper.Base.UploadForm_InvalidKey, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
ChangeStatus(LocalizationHelper.Base.Message_Init);
_client = new RestClient("https://www.virustotal.com");
// TODO: check if file exists

Binary file not shown.