-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
271 changed files
with
27,169 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Submodule MyDownloader
added at
863468
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="MyDownloader.App.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="MyDownloader.Core.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="MyDownloader.Extension.AntiVirus.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="MyDownloader.Extension.Notifications.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="MyDownloader.Extension.Protocols.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
<section name="MyDownloader.Extension.Scheduler.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
|
||
<userSettings> | ||
|
||
<MyDownloader.App.Settings> | ||
<setting name="ViewTransDetails" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="ViewToolbar" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="ViewGrid" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
</MyDownloader.App.Settings> | ||
|
||
<MyDownloader.Core.Settings> | ||
<setting name="MinSegmentSize" serializeAs="String"> | ||
<value>200000</value> | ||
</setting> | ||
<setting name="MinSegmentLeftToStartNewSegment" serializeAs="String"> | ||
<value>30</value> | ||
</setting> | ||
<setting name="RetryDelay" serializeAs="String"> | ||
<value>5</value> | ||
</setting> | ||
<setting name="MaxRetries" serializeAs="String"> | ||
<value>10</value> | ||
</setting> | ||
<setting name="MaxSegments" serializeAs="String"> | ||
<value>5</value> | ||
</setting> | ||
</MyDownloader.Core.Settings> | ||
|
||
<MyDownloader.Extension.AntiVirus.Settings> | ||
<setting name="CheckFileWithAV" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="AVFileName" serializeAs="String"> | ||
<value></value> | ||
</setting> | ||
<setting name="FileTypes" serializeAs="String"> | ||
<value>.exe;.com</value> | ||
</setting> | ||
<setting name="AVParameter" serializeAs="String"> | ||
<value>-a</value> | ||
</setting> | ||
</MyDownloader.Extension.AntiVirus.Settings> | ||
|
||
<MyDownloader.Extension.Scheduler.Settings> | ||
<setting name="MaxJobs" serializeAs="String"> | ||
<value>5</value> | ||
</setting> | ||
<setting name="WorkOnlyOnSpecifiedTimes" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="TimesToWork" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</MyDownloader.Extension.Scheduler.Settings> | ||
|
||
<MyDownloader.Extension.Protocols.Settings> | ||
<setting name="UseProxy" serializeAs="String"> | ||
<value>False</value> | ||
</setting> | ||
<setting name="ProxyAddress" serializeAs="String"> | ||
<value></value> | ||
</setting> | ||
<setting name="ProxyPort" serializeAs="String"> | ||
<value>80</value> | ||
</setting> | ||
<setting name="ProxyUserName" serializeAs="String"> | ||
<value></value> | ||
</setting> | ||
<setting name="ProxyPassword" serializeAs="String"> | ||
<value></value> | ||
</setting> | ||
<setting name="ProxyDomain" serializeAs="String"> | ||
<value></value> | ||
</setting> | ||
<setting name="ProxyByPassOnLocal" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
</MyDownloader.Extension.Protocols.Settings> | ||
|
||
<MyDownloader.Extension.Notifications.Settings> | ||
<setting name="DownloadAddedSound" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DownloadRemovedSound" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DownloadEndedSound" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="ShowBallon" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="BallonTimeout" serializeAs="String"> | ||
<value>3000</value> | ||
</setting> | ||
</MyDownloader.Extension.Notifications.Settings> | ||
|
||
</userSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
using MyDownloader.App; | ||
using MyDownloader.App.UI; | ||
using MyDownloader.App.SingleInstancing; | ||
|
||
using MyDownloader.Core; | ||
using MyDownloader.Core.Extensions; | ||
using MyDownloader.Core.UI; | ||
|
||
using MyDownloader.Extension; | ||
using MyDownloader.Extension.AntiVirus; | ||
using MyDownloader.Extension.Protocols; | ||
using MyDownloader.Extension.Notifications; | ||
using MyDownloader.Extension.Video; | ||
using MyDownloader.Extension.AutoDownloads; | ||
using MyDownloader.Extension.SpeedLimit; | ||
using MyDownloader.Extension.PersistedList; | ||
using MyDownloader.Extension.WindowsIntegration; | ||
|
||
namespace MyDownloader.App | ||
{ | ||
[Serializable] | ||
public class App : IApp | ||
{ | ||
#region Singleton | ||
|
||
private static App instance = new App(); | ||
|
||
public static App Instance | ||
{ | ||
get | ||
{ | ||
return instance; | ||
} | ||
} | ||
|
||
private App() | ||
{ | ||
AppManager.Instance.Initialize(this); | ||
|
||
extensions = new List<IExtension>(); | ||
|
||
extensions.Add(new CoreExtention()); | ||
extensions.Add(new HttpFtpProtocolExtension()); | ||
extensions.Add(new VideoDownloadExtension()); | ||
extensions.Add(new SpeedLimitExtension()); | ||
extensions.Add(new PersistedListExtension()); | ||
extensions.Add(new AntiVirusExtension()); | ||
extensions.Add(new NotificationsExtension()); | ||
extensions.Add(new AutoDownloadsExtension()); | ||
extensions.Add(new WindowsIntegrationExtension()); | ||
} | ||
|
||
#endregion | ||
|
||
#region Fields | ||
|
||
private List<IExtension> extensions; | ||
private SingleInstanceTracker tracker = null; | ||
private bool disposed = false; | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
public Form MainForm | ||
{ | ||
get | ||
{ | ||
return (MainForm)tracker.Enforcer; | ||
} | ||
} | ||
|
||
public NotifyIcon NotifyIcon | ||
{ | ||
get | ||
{ | ||
return ((UI.MainForm)MainForm).notifyIcon; | ||
} | ||
} | ||
|
||
public List<IExtension> Extensions | ||
{ | ||
get | ||
{ | ||
return extensions; | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public IExtension GetExtensionByType(Type type) | ||
{ | ||
for (int i = 0; i < this.extensions.Count; i++) | ||
{ | ||
if (this.extensions[i].GetType() == type) | ||
{ | ||
return this.extensions[i]; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
private ISingleInstanceEnforcer GetSingleInstanceEnforcer() | ||
{ | ||
return new MainForm(); | ||
} | ||
|
||
public void InitExtensions() | ||
{ | ||
for (int i = 0; i < Extensions.Count; i++) | ||
{ | ||
if (Extensions[i] is IInitializable) | ||
{ | ||
((IInitializable)Extensions[i]).Init(); | ||
} | ||
} | ||
|
||
} | ||
public void Dispose() | ||
{ | ||
if (!disposed) | ||
{ | ||
disposed = true; | ||
for (int i = 0; i < Extensions.Count; i++) | ||
{ | ||
if (Extensions[i] is IDisposable) | ||
{ | ||
try | ||
{ | ||
((IDisposable)Extensions[i]).Dispose(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Debug.WriteLine(ex.ToString()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void Start(string[] args) | ||
{ | ||
Application.EnableVisualStyles(); | ||
Application.SetCompatibleTextRenderingDefault(false); | ||
|
||
try | ||
{ | ||
// Attempt to create a tracker | ||
tracker = new SingleInstanceTracker("SingleInstanceSample", new SingleInstanceEnforcerRetriever(GetSingleInstanceEnforcer)); | ||
|
||
// If this is the first instance of the application, run the main form | ||
if (tracker.IsFirstInstance) | ||
{ | ||
try | ||
{ | ||
MainForm form = (MainForm)tracker.Enforcer; | ||
|
||
//form.downloadList1.AddDownloadURLs(ResourceLocation.FromURLArray(args), 1, null, 0); | ||
|
||
if (Array.IndexOf<string>(args, "/as") >= 0) | ||
{ | ||
form.WindowState = FormWindowState.Minimized; | ||
} | ||
|
||
form.Load += delegate(object sender, EventArgs e) | ||
{ | ||
InitExtensions(); | ||
|
||
if (form.WindowState == FormWindowState.Minimized) | ||
{ | ||
form.HideForm(); | ||
} | ||
|
||
if (args.Length > 0) | ||
{ | ||
form.OnMessageReceived(new MessageEventArgs(args)); | ||
} | ||
}; | ||
|
||
form.FormClosing += delegate(object sender, FormClosingEventArgs e) | ||
{ | ||
Dispose(); | ||
}; | ||
|
||
Application.Run(form); | ||
} | ||
finally | ||
{ | ||
Dispose(); | ||
} | ||
} | ||
else | ||
{ | ||
// This is not the first instance of the application, so do nothing but send a message to the first instance | ||
if (args.Length > 0) | ||
{ | ||
tracker.SendMessageToFirstInstance(args); | ||
} | ||
} | ||
} | ||
catch (SingleInstancingException ex) | ||
{ | ||
MessageBox.Show("Could not create a SingleInstanceTracker object:\n" + ex.Message + "\nApplication will now terminate.\n" + ex.InnerException.ToString()); | ||
|
||
return; | ||
} | ||
finally | ||
{ | ||
if (tracker != null) | ||
tracker.Dispose(); | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace MyDownloader.App.Controls | ||
{ | ||
[Serializable()] | ||
public class Block | ||
{ | ||
private float _blockSize = 0; | ||
private float _percentProgress = 0; | ||
|
||
public Block(float BlockSize, float PercentProgress) | ||
{ | ||
this.BlockSize = BlockSize; | ||
this.PercentProgress = PercentProgress; | ||
} | ||
|
||
public float BlockSize | ||
{ | ||
get { return _blockSize; } | ||
set { _blockSize = value; } | ||
} | ||
|
||
public float PercentProgress | ||
{ | ||
get { return _percentProgress; } | ||
set { _percentProgress = value; } | ||
} | ||
} | ||
} |
Oops, something went wrong.