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,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<section name="MegaKeep.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="MegaKeep.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||||
</startup>
|
</startup>
|
||||||
<userSettings>
|
<userSettings>
|
||||||
<MegaKeep.Properties.Settings>
|
<MegaKeep.Properties.Settings>
|
||||||
<setting name="Location" serializeAs="String">
|
<setting name="Location" serializeAs="String">
|
||||||
<value />
|
<value/>
|
||||||
</setting>
|
</setting>
|
||||||
</MegaKeep.Properties.Settings>
|
</MegaKeep.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
|
@ -12,24 +12,23 @@ namespace MegaKeep
|
|||||||
{
|
{
|
||||||
private string _local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
private string _local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
private string[] commandlineArgs = { };
|
private string[] commandlineArgs = { };
|
||||||
public MegaKeep()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
public MegaKeep(string[] args)
|
public MegaKeep(string[] args)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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))
|
||||||
{
|
{
|
||||||
commandlineArgs = args;
|
Properties.Settings.Default.Location = txtFile;
|
||||||
var txtFileIndex = Array.IndexOf(args, "--txtFile") + 1;
|
Properties.Settings.Default.Save();
|
||||||
var txtFile = args[txtFileIndex];
|
txtPath.Text = txtFile;
|
||||||
if (File.Exists(txtFile))
|
|
||||||
{
|
|
||||||
Properties.Settings.Default.Location = txtFile;
|
|
||||||
Properties.Settings.Default.Save();
|
|
||||||
txtPath.Text = txtFile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ namespace MegaKeep
|
|||||||
// first make sure megacmd is found
|
// first make sure megacmd is found
|
||||||
if (!File.Exists(_local + "\\MEGAcmd\\mega-login.bat"))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +66,8 @@ namespace MegaKeep
|
|||||||
|
|
||||||
// run the processes in a task so it doesn't freeze the ui
|
// run the processes in a task so it doesn't freeze the ui
|
||||||
await Task.Run(() => Work(lines));
|
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();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ namespace MegaKeep
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Log("Logging in to " + user + "...");
|
Log("Logging into " + user + "...");
|
||||||
|
|
||||||
login.Start();
|
login.Start();
|
||||||
var result = login.StandardOutput.ReadToEnd();
|
var result = login.StandardOutput.ReadToEnd();
|
||||||
@ -127,7 +127,6 @@ namespace MegaKeep
|
|||||||
|
|
||||||
if (res == "Logging out..." + Environment.NewLine)
|
if (res == "Logging out..." + Environment.NewLine)
|
||||||
{
|
{
|
||||||
// success
|
|
||||||
result = "Success";
|
result = "Success";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -148,6 +147,7 @@ namespace MegaKeep
|
|||||||
foreach (var line in lines)
|
foreach (var line in lines)
|
||||||
{
|
{
|
||||||
var info = line.Split(':');
|
var info = line.Split(':');
|
||||||
|
|
||||||
// check line format
|
// check line format
|
||||||
if (info.Length != 2)
|
if (info.Length != 2)
|
||||||
{
|
{
|
||||||
@ -155,6 +155,7 @@ namespace MegaKeep
|
|||||||
Log("Colon (:) seperator not found. Error: " + line);
|
Log("Colon (:) seperator not found. Error: " + line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = info[0];
|
var user = info[0];
|
||||||
var pass = info[1];
|
var pass = info[1];
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ namespace MegaKeep
|
|||||||
// login was successful
|
// login was successful
|
||||||
Log("Login succeeded. Logging out...");
|
Log("Login succeeded. Logging out...");
|
||||||
}
|
}
|
||||||
else if (loginResult.Contains("Login failed"))
|
else if (loginResult.Contains("Failed"))
|
||||||
{
|
{
|
||||||
Log("Failed: " + loginResult);
|
Log("Failed: " + loginResult);
|
||||||
break; // just move on to the next account
|
break; // just move on to the next account
|
||||||
@ -234,7 +235,7 @@ namespace MegaKeep
|
|||||||
|
|
||||||
private void Log(string txt)
|
private void Log(string txt)
|
||||||
{
|
{
|
||||||
this.Invoke((MethodInvoker) delegate
|
this.Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
var time = "[" + DateTime.Now.ToString("hh:mm:ss tt") + "] ";
|
var time = "[" + DateTime.Now.ToString("hh:mm:ss tt") + "] ";
|
||||||
|
|
||||||
@ -246,9 +247,8 @@ namespace MegaKeep
|
|||||||
{
|
{
|
||||||
// if started with arg "--cli" simulate button click in UI
|
// if started with arg "--cli" simulate button click in UI
|
||||||
if (commandlineArgs.Contains("--cli"))
|
if (commandlineArgs.Contains("--cli"))
|
||||||
{
|
|
||||||
btnRun.PerformClick();
|
btnRun.PerformClick();
|
||||||
}
|
|
||||||
txtPath.Text = Properties.Settings.Default.Location;
|
txtPath.Text = Properties.Settings.Default.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,11 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>MegaKeep</RootNamespace>
|
<RootNamespace>MegaKeep</RootNamespace>
|
||||||
<AssemblyName>MegaKeep</AssemblyName>
|
<AssemblyName>MegaKeep</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<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.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// 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.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
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.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 {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
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.
|
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
|
## Contributing
|
||||||
|
|
||||||
When making a pull request, please provide a thorough explanation of what you added/fixed. Suggestions are welcome in the form of issues.
|
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