├── SjUpdater
├── Resources
│ ├── Entypo.ttf
│ ├── icon3.ico
│ ├── Entypo-license.txt
│ └── WindowsIcons-license.txt
├── Utils
│ ├── StaticInstance.cs
│ ├── Native.cs
│ ├── timehelper.cs
│ ├── UploadCache.cs
│ ├── RegexValidationRule.cs
│ ├── StringToFaviconConverter.cs
│ ├── GridViewWidthCalulationMultiConverter.cs
│ ├── ExtensionMethods.cs
│ ├── ThreadPool.cs
│ ├── PropertyChangedImpl.cs
│ ├── GlobalMutex.cs
│ ├── SimpleCommand.cs
│ ├── GridViewColumnVisibilityManager.cs
│ ├── EnumText.cs
│ ├── Crc64.cs
│ ├── CachedImage.cs
│ ├── Stats.cs
│ └── FavIcon.cs
├── Model
│ ├── ShowData.cs
│ ├── DownloadData.cs
│ ├── SeasonData.cs
│ ├── UploadData.cs
│ ├── ShowCategory.cs
│ ├── FavEpisodeData.cs
│ ├── FavSeasonData.cs
│ ├── ClassDiagram1.cd
│ └── ShowCategorySetting.cs
├── Provider
│ ├── ProviderManager.cs
│ ├── IProvider.cs
│ └── TMDb.cs
├── packages.config
├── MultiDownloadSelectionCell.xaml.cs
├── MultiDownloadSelectionHeader.xaml.cs
├── App.config
├── App.xaml.cs
├── XML
│ ├── CustomXmlAttributes.cs
│ ├── CustomXmlSerializerBase.cs
│ └── XmlSerialization.cs
├── MultiDownloadSelectionCell.xaml
├── App.xaml
├── SpecialDownloadList.xaml.cs
├── NotificationBalloon.xaml.cs
├── DownloadPopupList.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── app.manifest
│ └── Resources.resx
├── Updater
│ ├── UpdateWindow.xaml
│ ├── UpdaterViewModel.cs
│ └── UpdateWindow.xaml.cs
├── MultiDownloadSelectionHeader.xaml
├── ViewModel
│ ├── MultiSelectionViewModel.cs
│ ├── SeasonViewModel.cs
│ ├── MainWindowViewModel.cs
│ └── ShowTileViewModel.cs
├── SpecialDownloadList.xaml
├── MultiDownloadSelectionGrid.xaml
├── NotificationBalloon.xaml
└── DownloadPopupList.xaml
├── updaterhasher
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── Program.cs
└── updaterhasher.csproj
├── SjUpdater.sln.DotSettings
├── README.md
├── SjUpdater.sln
└── .gitignore
/SjUpdater/Resources/Entypo.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dreamcooled/sjupdater/HEAD/SjUpdater/Resources/Entypo.ttf
--------------------------------------------------------------------------------
/SjUpdater/Resources/icon3.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dreamcooled/sjupdater/HEAD/SjUpdater/Resources/icon3.ico
--------------------------------------------------------------------------------
/SjUpdater/Resources/Entypo-license.txt:
--------------------------------------------------------------------------------
1 | Entypo (http://www.entypo.com/) is created by Daniel Bruce and released under the Creative Commons, Share Alike/Attribution license.
2 |
3 | http://creativecommons.org/licenses/by-sa/3.0/
--------------------------------------------------------------------------------
/updaterhasher/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/StaticInstance.cs:
--------------------------------------------------------------------------------
1 | namespace SjUpdater.Utils
2 | {
3 | public static class StaticInstance
4 | {
5 | public static ThreadPool ThreadPool { get; }
6 |
7 | static StaticInstance()
8 | {
9 | ThreadPool = new ThreadPool();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/Native.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace SjUpdater.Utils
4 | {
5 | static public class Native
6 | {
7 | [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
8 | static public extern int memcmp(byte[] b1, byte[] b2, long count);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/SjUpdater/Model/ShowData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SjUpdater.Model
4 | {
5 | public class ShowData
6 |
7 | {
8 | public ShowData()
9 | {
10 | Name = "";
11 | Url = "";
12 | }
13 | public String Name { get; set; }
14 | public String Url { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/SjUpdater/Model/DownloadData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace SjUpdater.Model
5 | {
6 | public class DownloadData
7 | {
8 | public DownloadData()
9 | {
10 | Title = "";
11 | Upload = null;
12 | Links = new Dictionary();
13 | }
14 | public String Title { get; set; }
15 | public Dictionary Links { get; internal set; }
16 | public UploadData Upload { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/timehelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics;
3 |
4 | namespace SjUpdater.Utils
5 | {
6 | public static class timehelper
7 | {
8 | public static List dateTimes = new List();
9 |
10 | private static Stopwatch sw;
11 |
12 | static timehelper()
13 | {
14 | sw = Stopwatch.StartNew();
15 | }
16 |
17 | public static void Add()
18 | {
19 | dateTimes.Add(sw.Elapsed.TotalSeconds);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/SjUpdater.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | STP
--------------------------------------------------------------------------------
/SjUpdater/Provider/ProviderManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SjUpdater.Provider
8 | {
9 | public static class ProviderManager
10 | {
11 | private static readonly IProvider Provider;
12 |
13 | static ProviderManager()
14 | {
15 | Provider = new TMDb();
16 | }
17 |
18 | public static IProvider GetProvider()
19 | {
20 | return Provider;
21 | }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/SjUpdater/Model/SeasonData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SjUpdater.Model
4 | {
5 | public class SeasonData
6 | {
7 | public SeasonData()
8 | {
9 | Title = "";
10 | Description = "";
11 | Url = "";
12 | CoverUrl = "";
13 | Show = null;
14 | }
15 | public String Title { get; set; }
16 | public String Description { get; set; }
17 | public String Url { get; set; }
18 | public String CoverUrl { get; set; }
19 | public ShowData Show { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/SjUpdater/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SjUpdater/MultiDownloadSelectionCell.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace SjUpdater
17 | {
18 | ///
19 | /// Interaction logic for MultiDownloadSelectionCell.xaml
20 | ///
21 | public partial class MultiDownloadSelectionCell : UserControl
22 | {
23 | public MultiDownloadSelectionCell()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/SjUpdater/MultiDownloadSelectionHeader.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace SjUpdater
17 | {
18 | ///
19 | /// Interaction logic for MultiDownloadSelectionHeader.xaml
20 | ///
21 | public partial class MultiDownloadSelectionHeader : UserControl
22 | {
23 | public MultiDownloadSelectionHeader()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/UploadCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using SjUpdater.Model;
8 |
9 | namespace SjUpdater.Utils
10 | {
11 | public class UploadCache
12 | {
13 | private readonly ConcurrentDictionary _uploadCache = new ConcurrentDictionary();
14 | public UploadData GetUniqueUploadData(UploadData u)
15 | {
16 | if (u == null) return null;
17 | int k = u.GetHashCode();
18 | UploadData v;
19 | if (_uploadCache.TryGetValue(k, out v) && v.Equals(u))
20 | {
21 | return v;
22 | }
23 | _uploadCache.TryAdd(k, u);
24 | return u;
25 | }
26 |
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/RegexValidationRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Text.RegularExpressions;
4 | using System.Windows.Controls;
5 |
6 | namespace SjUpdater.Utils
7 | {
8 | public class RegexValidationRule : ValidationRule
9 | {
10 | public override ValidationResult Validate(object value, CultureInfo cultureInfo)
11 | {
12 | String s = (String) value;
13 | if (!string.IsNullOrWhiteSpace(s))
14 | {
15 |
16 | try
17 | {
18 | Regex.Match("", s);
19 | }
20 | catch (ArgumentException ex)
21 | {
22 | return new ValidationResult(false, ex.Message);
23 | }
24 |
25 | }
26 | return new ValidationResult(true, "Ok");
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/SjUpdater/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/StringToFaviconConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Data;
8 | using System.Windows.Media;
9 |
10 | namespace SjUpdater.Utils
11 | {
12 | public class StringToFaviconConverter : IValueConverter
13 | {
14 | public object Convert(object value, Type targetType,
15 | object parameter, CultureInfo culture)
16 | {
17 | if (targetType != typeof(FavIcon) || value.GetType() != typeof(string))
18 | {
19 | // throw new ArgumentException();
20 | }
21 | return new FavIcon(value as String);
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType,
25 | object parameter, CultureInfo culture)
26 | {
27 | return null;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/SjUpdater/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Net;
4 | using System.Reflection;
5 | using System.Windows;
6 | using SjUpdater.Utils;
7 |
8 | namespace SjUpdater
9 | {
10 | ///
11 | /// Interaktionslogik für "App.xaml"
12 | ///
13 | public partial class App : Application
14 | {
15 | protected override void OnStartup(StartupEventArgs e)
16 | {
17 | Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
18 |
19 | if (!GlobalMutex.TryGetMutex()) {
20 | Environment.Exit(0);
21 | } else {
22 | base.OnStartup(e);
23 | }
24 |
25 | ServicePointManager.DefaultConnectionLimit = 25;
26 | }
27 |
28 | protected override void OnExit(ExitEventArgs e)
29 | {
30 | GlobalMutex.ReleaseMutex();
31 | base.OnExit(e);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/SjUpdater/XML/CustomXmlAttributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SjUpdater.XML
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
6 | public class XmlIgnoreBaseTypeAttribute : Attribute
7 | {
8 | }
9 |
10 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
11 | public class CustomXmlSerializationOptionsAttribute : Attribute
12 | {
13 | public CustomXmlSerializer.SerializationOptions SerializationOptions = new CustomXmlSerializer.SerializationOptions();
14 |
15 | public CustomXmlSerializationOptionsAttribute(bool useTypeCache, bool useGraphSerialization)
16 | {
17 | SerializationOptions.UseTypeCache = useTypeCache;
18 | SerializationOptions.UseGraphSerialization = useGraphSerialization;
19 | }
20 | }
21 |
22 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
23 | public class XmlSerializeAsCustomTypeAttribute : Attribute
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SjUpdater/MultiDownloadSelectionCell.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/SjUpdater/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | [](https://github.com/Dreamcooled/sjupdater/releases)
3 | [](https://github.com/Dreamcooled/sjupdater/blob/master/LICENSE.md)
4 | [](https://github.com/Dreamcooled/sjupdater/issues)
5 | # SjUpdater
6 |
7 | An Updater and Linkaggregator for Serienjunkies.org written in C#/WPF.
8 | Any contribution would be highly appreciated.
9 |
10 |
11 |
12 | #### Download
13 | Binaries of current version (needs .NET 4.5): [](https://github.com/Dreamcooled/sjupdater/releases/latest)
14 |
15 |
16 |
17 | #### Screenshots
18 |
19 | 
20 | 
21 | 
22 | 
23 | 
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/GridViewWidthCalulationMultiConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 |
10 | //Code taken from: http://stackoverflow.com/questions/5573152/how-to-resize-a-certain-control-based-on-window-size-in-wpf#5573895
11 |
12 | namespace SjUpdater.Utils
13 | {
14 | public class GridViewWidthCalulationMultiConverter : IMultiValueConverter
15 | {
16 | public object Convert(object[] values, Type targetType,
17 | object parameter, CultureInfo culture)
18 | {
19 | // do some sort of calculation
20 | double totalWindowWidth;
21 | double otherColumnsTotalWidth = 0;
22 | double.TryParse(values[0].ToString(), out totalWindowWidth);
23 | var arrayOfColumns = values[1] as IList;
24 |
25 | for (int i = 0; i < arrayOfColumns.Count - 1; i++)
26 | {
27 | otherColumnsTotalWidth += arrayOfColumns[i].ActualWidth;
28 | }
29 |
30 | return (totalWindowWidth - otherColumnsTotalWidth) < 0 ?
31 | 0 : (totalWindowWidth - otherColumnsTotalWidth);
32 | }
33 |
34 | public object[] ConvertBack(object value, Type[] targetTypes,
35 | object parameter, CultureInfo culture)
36 | {
37 | throw new NotImplementedException();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/updaterhasher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("updaterhasher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("updaterhasher")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("da482963-3395-42e5-bde9-a87bd29af0f6")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/updaterhasher/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Security.Cryptography;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 |
7 | namespace updaterhasher
8 | {
9 | internal class Program
10 | {
11 | [STAThread]
12 | private static void Main(string[] args)
13 | {
14 | Console.ForegroundColor = ConsoleColor.Red;
15 | Console.WriteLine("Warning: Filenames cannot have spaces yet");
16 | Console.WriteLine("Warning: Sub Directories are not support yet");
17 |
18 | Console.ResetColor();
19 | Console.WriteLine("\nDrag'n Drop a Folder");
20 | string path = Console.ReadLine().Replace("\"", "");
21 |
22 | string[] files = Directory.GetFiles(path);
23 |
24 | string text = "";
25 |
26 | Console.WriteLine();
27 |
28 | foreach (var file in files)
29 | {
30 | MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
31 |
32 | byte[] hashBytes;
33 | using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
34 | {
35 | hashBytes = md5.ComputeHash(fs);
36 | }
37 |
38 | string filetext = Path.GetFileName(file) + ":" + BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
39 |
40 | Console.WriteLine(filetext);
41 |
42 | text += filetext + "\n";
43 | }
44 |
45 | Clipboard.SetText(text);
46 | Console.WriteLine("\nText copied to Clipboard");
47 | Thread.Sleep(3500);
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/SjUpdater.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2027
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SjUpdater", "SjUpdater\SjUpdater.csproj", "{96123159-7974-4FEB-BD8C-7AB562DF3E01}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "updaterhasher", "updaterhasher\updaterhasher.csproj", "{89B40DD8-7928-4B21-B792-89AF030F6B55}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {96123159-7974-4FEB-BD8C-7AB562DF3E01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {96123159-7974-4FEB-BD8C-7AB562DF3E01}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {96123159-7974-4FEB-BD8C-7AB562DF3E01}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {96123159-7974-4FEB-BD8C-7AB562DF3E01}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {89B40DD8-7928-4B21-B792-89AF030F6B55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {89B40DD8-7928-4B21-B792-89AF030F6B55}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {89B40DD8-7928-4B21-B792-89AF030F6B55}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {89B40DD8-7928-4B21-B792-89AF030F6B55}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {A06120FB-BCF3-4AD1-9400-C5601E971262}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SjUpdater/Utils/ExtensionMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 |
5 | namespace SjUpdater.Utils
6 | {
7 | public static class ExtensionMethods
8 | {
9 | ///
10 | /// Checks whether 2 byte arrays equals
11 | ///
12 | ///
13 | ///
14 | ///
15 | public static bool Memcmp(this byte[] array, byte[] array2)
16 | {
17 | if (array.Length != array2.Length)
18 | return false;
19 |
20 | return Native.memcmp(array, array2, array.Length) == 0;
21 | }
22 |
23 | public static Comparer CreateMultiple(params Comparer[] comparers )
24 | {
25 | return Comparer.Create(delegate(T x, T y)
26 | {
27 | foreach (var comparer in comparers)
28 | {
29 | int i = comparer.Compare(x, y);
30 | if (i != 0) return i;
31 | }
32 | return 0;
33 | });
34 | }
35 |
36 | public static void Sort(this ObservableCollection source, Comparer comparer, bool desc = false)
37 | {
38 | if (source == null) return;
39 |
40 | for (int i = source.Count - 1; i >= 0; i--)
41 | {
42 | for (int j = 1; j <= i; j++)
43 | {
44 | TSource o1 = source[j - 1];
45 | TSource o2 = source[j];
46 | int comparison = comparer.Compare(o1, o2);
47 | if (desc && comparison < 0)
48 | source.Move(j, j - 1);
49 | else if (!desc && comparison > 0)
50 | source.Move(j - 1, j);
51 | }
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/SjUpdater/SpecialDownloadList.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace SjUpdater
18 | {
19 | ///
20 | /// Interaction logic for SpecialDownloadList.xaml
21 | ///
22 | public partial class SpecialDownloadList : UserControl
23 | {
24 | public SpecialDownloadList()
25 | {
26 | InitializeComponent();
27 | }
28 | public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource",
29 | typeof(IEnumerable), typeof(SpecialDownloadList), new FrameworkPropertyMetadata(null));
30 |
31 | public IEnumerable ItemsSource
32 | {
33 | get
34 | {
35 | return (IEnumerable)GetValue(SpecialDownloadList.ItemsSourceProperty);
36 | }
37 | set
38 | {
39 | this.SetValue(SpecialDownloadList.ItemsSourceProperty, value);
40 | }
41 | }
42 |
43 | public static readonly DependencyProperty DownloadCommandProperty = DependencyProperty.Register("DownloadCommand",
44 | typeof(ICommand), typeof(SpecialDownloadList), new FrameworkPropertyMetadata(null));
45 |
46 | public ICommand DownloadCommand
47 | {
48 | get
49 | {
50 | return (ICommand)GetValue(SpecialDownloadList.DownloadCommandProperty);
51 | }
52 | set
53 | {
54 | this.SetValue(SpecialDownloadList.DownloadCommandProperty, value);
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/SjUpdater/Model/UploadData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace SjUpdater.Model
6 | {
7 | [Flags]
8 | public enum UploadLanguage
9 | {
10 | German = 1,
11 | English = 2,
12 | Any = German + English
13 | }
14 | public class UploadData
15 | {
16 | public UploadData()
17 | {
18 | Uploader = "";
19 | Format = "";
20 | Size = "";
21 | Runtime = "";
22 | Language = 0;
23 | Subbed = false;
24 | Season = null;
25 | Favorized = false;
26 | }
27 |
28 | public String Uploader { get; set; }
29 | public String Format { get; set; }
30 | public String Size { get; set; }
31 | public String Runtime { get; set; }
32 | public UploadLanguage Language { get; set; }
33 | public SeasonData Season { get; set; }
34 | public bool Subbed { get; set; }
35 |
36 | public bool Favorized { get; set; } //Todo: move to Fav* class, since it's user data
37 |
38 | public static IEnumerable LanguagesValues
39 | {
40 | get
41 | {
42 | return Enum.GetValues(typeof(UploadLanguage))
43 | .Cast();
44 | }
45 | }
46 |
47 | public override bool Equals(object obj)
48 | {
49 | var u2 = obj as UploadData;
50 | if (u2 == null) return false;
51 | return Uploader == u2.Uploader && Format == u2.Format && Size == u2.Size && Runtime == u2.Runtime &&
52 | Language == u2.Language &&
53 | (Season == u2.Season || (Season != null && u2.Season != null && Season.Url == u2.Season.Url));
54 | }
55 |
56 | public override int GetHashCode()
57 | {
58 | return Uploader.GetHashCode() ^ Format.GetHashCode() ^ Size.GetHashCode() ^ Runtime.GetHashCode() ^
59 | Language.GetHashCode() ^ ((Season==null)?0:Season.Url.GetHashCode());
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/SjUpdater/NotificationBalloon.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using Hardcodet.Wpf.TaskbarNotification;
15 | using MahApps.Metro.Controls;
16 | using SjUpdater.Model;
17 | using SjUpdater.Utils;
18 | using SjUpdater.ViewModel;
19 |
20 | namespace SjUpdater
21 | {
22 | ///
23 | /// Interaktionslogik für NotificationBalloon.xaml
24 | ///
25 | public partial class NotificationBalloon :UserControl
26 | {
27 | public ICommand ShowClickedCommand { get; private set; }
28 | public NotificationBalloon(IEnumerable list)
29 | {
30 | InitializeComponent();
31 | ShowClickedCommand = new SimpleCommand