mirror of
https://github.com/xCryptic/MegaKeep.git
synced 2024-11-22 01:52:30 +01:00
Cleaned code, Updated .Net Framework and Updated Readme
thanks to the contributors jogerj & CrazyOldWizard
This commit is contained in:
parent
b76965bf63
commit
efc0889d78
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
@ -6,7 +6,7 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<MegaKeep.Properties.Settings>
|
||||
|
@ -12,18 +12,18 @@ namespace MegaKeep
|
||||
{
|
||||
private string _local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
private string[] commandlineArgs = { };
|
||||
public MegaKeep()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public MegaKeep(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (args.Length > 0)
|
||||
{
|
||||
|
||||
if (args.Length == 0)
|
||||
return;
|
||||
|
||||
commandlineArgs = args;
|
||||
var txtFileIndex = Array.IndexOf(args, "--txtFile") + 1;
|
||||
var txtFile = args[txtFileIndex];
|
||||
|
||||
if (File.Exists(txtFile))
|
||||
{
|
||||
Properties.Settings.Default.Location = txtFile;
|
||||
@ -31,7 +31,6 @@ namespace MegaKeep
|
||||
txtPath.Text = txtFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnRun_ClickAsync(object sender, EventArgs e)
|
||||
{
|
||||
@ -40,7 +39,7 @@ namespace MegaKeep
|
||||
// first make sure megacmd is found
|
||||
if (!File.Exists(_local + "\\MEGAcmd\\mega-login.bat"))
|
||||
{
|
||||
Log("mega-login.bat was not found, please install it to the default dirctory: https://mega.nz/cmd");
|
||||
Log("mega-login.bat was not found, please install it to the default directory: https://mega.nz/cmd");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -67,7 +66,8 @@ namespace MegaKeep
|
||||
|
||||
// run the processes in a task so it doesn't freeze the ui
|
||||
await Task.Run(() => Work(lines));
|
||||
if (commandlineArgs.Contains("--cli"))// if running in cli mode, closes window after running work.
|
||||
|
||||
if (commandlineArgs.Contains("--cli")) // if running in cli mode, closes window after running work
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@ -127,7 +127,6 @@ namespace MegaKeep
|
||||
|
||||
if (res == "Logging out..." + Environment.NewLine)
|
||||
{
|
||||
// success
|
||||
result = "Success";
|
||||
break;
|
||||
}
|
||||
@ -148,6 +147,7 @@ namespace MegaKeep
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var info = line.Split(':');
|
||||
|
||||
// check line format
|
||||
if (info.Length != 2)
|
||||
{
|
||||
@ -155,6 +155,7 @@ namespace MegaKeep
|
||||
Log("Colon (:) seperator not found. Error: " + line);
|
||||
continue;
|
||||
}
|
||||
|
||||
var user = info[0];
|
||||
var pass = info[1];
|
||||
|
||||
@ -174,7 +175,7 @@ namespace MegaKeep
|
||||
// login was successful
|
||||
Log("Login succeeded. Logging out...");
|
||||
}
|
||||
else if (loginResult.Contains("Login failed"))
|
||||
else if (loginResult.Contains("Failed"))
|
||||
{
|
||||
Log("Failed: " + loginResult);
|
||||
break; // just move on to the next account
|
||||
@ -246,9 +247,8 @@ namespace MegaKeep
|
||||
{
|
||||
// if started with arg "--cli" simulate button click in UI
|
||||
if (commandlineArgs.Contains("--cli"))
|
||||
{
|
||||
btnRun.PerformClick();
|
||||
}
|
||||
|
||||
txtPath.Text = Properties.Settings.Default.Location;
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,11 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MegaKeep</RootNamespace>
|
||||
<AssemblyName>MegaKeep</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
2
MegaKeep/Properties/Resources.Designer.cs
generated
2
MegaKeep/Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace MegaKeep.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
2
MegaKeep/Properties/Settings.Designer.cs
generated
2
MegaKeep/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace MegaKeep.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
@ -15,6 +15,13 @@ You must have MEGAcmd installed and running on your machine. You can download th
|
||||
|
||||
Create a text file (.txt) of all your mega accounts and passwords in a `user:pass` format with one account per line. Then locate that file and run the program.
|
||||
|
||||
## Command Line
|
||||
|
||||
You are also able to start the program via command line.
|
||||
|
||||
`--cli` will auto-click the run button and run whatever file is already loaded
|
||||
`--txtFile "C:\path\to\txtfile.txt"` will load the text file into the program
|
||||
|
||||
## Contributing
|
||||
|
||||
When making a pull request, please provide a thorough explanation of what you added/fixed. Suggestions are welcome in the form of issues.
|
||||
|
Loading…
Reference in New Issue
Block a user