diff --git a/src/MataTest/MataTest.csproj b/src/MataTest/MataTest.csproj new file mode 100644 index 0000000..1ff0733 --- /dev/null +++ b/src/MataTest/MataTest.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {653C7DCD-7373-4BB6-923F-016B60C3C4B5} + Exe + Properties + MataTest + MataTest + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + MataTest.Program + + + + + + + + + + + + + + + + + + + + {b91a05f8-d1ae-4a48-9c3f-07d404378aa1} + MataSharp + + + + + \ No newline at end of file diff --git a/src/MataTest/Program.cs b/src/MataTest/Program.cs new file mode 100644 index 0000000..8bd0e44 --- /dev/null +++ b/src/MataTest/Program.cs @@ -0,0 +1,96 @@ +//MataSharp Showcase/Test Program. +using System; +using System.Linq; +using System.Collections.Generic; +using MataSharp; + +namespace MataTest +{ + class Program + { + static void Main(string[] args) + { + #region MagisterSchool + Console.WriteLine("Typ gedeelte van je school in: "); + var schools = MagisterSchool.GetSchools(Console.ReadLine()); + + for (int i = 0; i < schools.Count; i++) + Console.WriteLine(i + ": " + schools[i].Name + " " + schools[i].URL); + + MagisterSchool school = schools[Convert.ToInt32(Console.ReadLine())]; + #endregion + + Console.Write("UserName: "); var userName = Console.ReadLine(); + Console.Write("Password: "); var password = Console.ReadLine(); + + #region Mata + using (Mata mata = new Mata(school, userName, password)) + { + #region GeneralInformation + Console.WriteLine("User's Name: " + mata.Name); + Console.WriteLine("User's ID: " + mata.UserID); + #endregion + + //Let's pull 20 messages already! + //WARNING ALWAYS USE .Take(int). OR ELSE YOU WILL PICK UP 750 MESSAGES! + var twentyMessages = mata.Inbox.Messages.Take(20); + + twentyMessages.First(m => m.Attachments.Count != 0).Attachments[0].Download(true); + + var utilitiesTest = mata.GetDigitalSchoolUtilities(); + + var homeWork = mata.GetHomework(); + foreach (var homework in homeWork) + Console.WriteLine(homework.Start.DayOfWeek + " " + homework.BeginBySchoolHour + " " + homework.ClassAbbreviation + " " + homework.Content + "\n"); + + var studyGuides = mata.GetStudyGuides(); + + var assignmentTest = mata.GetAssignments().Where(x => x.Versions.Any(y => y.HandedInAttachments.Count != 0) && x.Attachments.Count != 0); //Because we all love linq so much + foreach (var assignment in assignmentTest) + { + Console.WriteLine(assignment.Description); + assignment.Attachments.ForEach(a => a.Download(true)); + } + assignmentTest.ElementAt(0).Attachments.ForEach(a => a.Download(true)); + + new MagisterMessage() + { + Subject = "Hallotjees :D", + Body = "TESSST D:", + Recipients = new List() { mata.Person }, + CC = new List() { mata.Person }, + }.Send(); + + #region Message + var Inbox = mata.Inbox; + + var allUnreadMessages = Inbox.Messages.WhereUnread(); + + //Console.WriteLine("Last unread message in inbox: " + allUnreadMessages[0].Content); + Console.WriteLine("Unread Messages in inbox: " + allUnreadMessages.Count); + + MagisterMessage msg = Inbox.Messages.First(m => m.Attachments.Count() != 0); //Take first message with at least 1 attachment. :) + Console.WriteLine("First message in inbox with at least 1 attachment: " + msg.Body); + Console.WriteLine("It's attachment count: " + msg.Attachments.Count()); + Console.WriteLine(""); + + #region Attachments + foreach (Attachment attachment in msg.Attachments) + { + Console.WriteLine("Attachment's name: " + attachment.Name + ", MIME Type: " + attachment.MIME); + attachment.Download(true); //Download the attachment and add the UserID infront of the file name. + } + #endregion + + #region ForwardMessage + var ForwardMSG = msg.CreateForwardMessage(); + ForwardMSG.Recipients = new List() { mata.Person }; + ForwardMSG.Send(); + #endregion + #endregion + } + #endregion + Console.ReadLine(); + } + } +} diff --git a/src/MataTest/bin/Debug/MataTest.exe b/src/MataTest/bin/Debug/MataTest.exe new file mode 100644 index 0000000..0a8b3ce Binary files /dev/null and b/src/MataTest/bin/Debug/MataTest.exe differ diff --git a/src/MataTest/bin/Debug/MataTest.exe.config b/src/MataTest/bin/Debug/MataTest.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/src/MataTest/bin/Debug/MataTest.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/MataTest/bin/Debug/MataTest.pdb b/src/MataTest/bin/Debug/MataTest.pdb new file mode 100644 index 0000000..2a8bb22 Binary files /dev/null and b/src/MataTest/bin/Debug/MataTest.pdb differ diff --git a/src/MataTest/bin/Debug/MataTest.vshost.exe b/src/MataTest/bin/Debug/MataTest.vshost.exe new file mode 100644 index 0000000..c0dfecc Binary files /dev/null and b/src/MataTest/bin/Debug/MataTest.vshost.exe differ diff --git a/src/MataTest/bin/Debug/MataTest.vshost.exe.config b/src/MataTest/bin/Debug/MataTest.vshost.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/src/MataTest/bin/Debug/MataTest.vshost.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/MataTest/bin/Debug/MataTest.vshost.exe.manifest b/src/MataTest/bin/Debug/MataTest.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/src/MataTest/bin/Debug/MataTest.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/MataTest/obj/Debug/MataTest.csproj.FileListAbsolute.txt b/src/MataTest/obj/Debug/MataTest.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ea2539e --- /dev/null +++ b/src/MataTest/obj/Debug/MataTest.csproj.FileListAbsolute.txt @@ -0,0 +1,11 @@ +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.exe.config +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.exe +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.pdb +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.dll +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\Newtonsoft.Json.dll +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.pdb +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.xml +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\Newtonsoft.Json.xml +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.csprojResolveAssemblyReference.cache +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.exe +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.pdb diff --git a/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache b/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..634ff25 Binary files /dev/null and b/src/MataTest/obj/Debug/MataTest.csprojResolveAssemblyReference.cache differ diff --git a/src/MataTest/obj/Debug/MataTest.exe b/src/MataTest/obj/Debug/MataTest.exe new file mode 100644 index 0000000..0a8b3ce Binary files /dev/null and b/src/MataTest/obj/Debug/MataTest.exe differ diff --git a/src/MataTest/obj/Debug/MataTest.pdb b/src/MataTest/obj/Debug/MataTest.pdb new file mode 100644 index 0000000..2a8bb22 Binary files /dev/null and b/src/MataTest/obj/Debug/MataTest.pdb differ diff --git a/src/MataTest/obj/Release/MataTest.csproj.FileListAbsolute.txt b/src/MataTest/obj/Release/MataTest.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..4edfe02 --- /dev/null +++ b/src/MataTest/obj/Release/MataTest.csproj.FileListAbsolute.txt @@ -0,0 +1,10 @@ +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\MataTest.exe.config +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\MataTest.exe +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\MataTest.pdb +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\MataSharp.dll +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\Newtonsoft.Json.dll +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\MataSharp.pdb +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Release\Newtonsoft.Json.xml +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Release\MataTest.csprojResolveAssemblyReference.cache +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Release\MataTest.exe +C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Release\MataTest.pdb diff --git a/src/MataTest/obj/Release/MataTest.csprojResolveAssemblyReference.cache b/src/MataTest/obj/Release/MataTest.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..f847641 Binary files /dev/null and b/src/MataTest/obj/Release/MataTest.csprojResolveAssemblyReference.cache differ diff --git a/src/MataTest/obj/Release/MataTest.exe b/src/MataTest/obj/Release/MataTest.exe new file mode 100644 index 0000000..a587c13 Binary files /dev/null and b/src/MataTest/obj/Release/MataTest.exe differ diff --git a/src/MataTest/obj/Release/MataTest.pdb b/src/MataTest/obj/Release/MataTest.pdb new file mode 100644 index 0000000..ef54e26 Binary files /dev/null and b/src/MataTest/obj/Release/MataTest.pdb differ