Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
lieuwex committed Feb 5, 2014
1 parent 791b429 commit 57170b5
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/MataTest/MataTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{653C7DCD-7373-4BB6-923F-016B60C3C4B5}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MataTest</RootNamespace>
<AssemblyName>MataTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>MataTest.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MataSharp\MataSharp.csproj">
<Project>{b91a05f8-d1ae-4a48-9c3f-07d404378aa1}</Project>
<Name>MataSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
96 changes: 96 additions & 0 deletions src/MataTest/Program.cs
Original file line number Diff line number Diff line change
@@ -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<MagisterPerson>() { mata.Person },
CC = new List<MagisterPerson>() { 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<MagisterPerson>() { mata.Person };
ForwardMSG.Send();
#endregion
#endregion
}
#endregion
Console.ReadLine();
}
}
}
Binary file added src/MataTest/bin/Debug/MataTest.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions src/MataTest/bin/Debug/MataTest.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Binary file added src/MataTest/bin/Debug/MataTest.pdb
Binary file not shown.
Binary file added src/MataTest/bin/Debug/MataTest.vshost.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions src/MataTest/bin/Debug/MataTest.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
11 changes: 11 additions & 0 deletions src/MataTest/bin/Debug/MataTest.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
11 changes: 11 additions & 0 deletions src/MataTest/obj/Debug/MataTest.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
Binary file added src/MataTest/obj/Debug/MataTest.exe
Binary file not shown.
Binary file added src/MataTest/obj/Debug/MataTest.pdb
Binary file not shown.
10 changes: 10 additions & 0 deletions src/MataTest/obj/Release/MataTest.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
Binary file added src/MataTest/obj/Release/MataTest.exe
Binary file not shown.
Binary file added src/MataTest/obj/Release/MataTest.pdb
Binary file not shown.

0 comments on commit 57170b5

Please sign in to comment.