Skip to content

Commit 57170b5

Browse files
committed
Update Program.cs
1 parent 791b429 commit 57170b5

16 files changed

+207
-0
lines changed

src/MataTest/MataTest.csproj

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{653C7DCD-7373-4BB6-923F-016B60C3C4B5}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MataTest</RootNamespace>
11+
<AssemblyName>MataTest</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<StartupObject>MataTest.Program</StartupObject>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
<Reference Include="System.Xml.Linq" />
41+
<Reference Include="System.Data.DataSetExtensions" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Xml" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<Compile Include="Program.cs" />
48+
<Compile Include="Properties\AssemblyInfo.cs" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<None Include="App.config" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<ProjectReference Include="..\MataSharp\MataSharp.csproj">
55+
<Project>{b91a05f8-d1ae-4a48-9c3f-07d404378aa1}</Project>
56+
<Name>MataSharp</Name>
57+
</ProjectReference>
58+
</ItemGroup>
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
61+
Other similar extension points exist, see Microsoft.Common.targets.
62+
<Target Name="BeforeBuild">
63+
</Target>
64+
<Target Name="AfterBuild">
65+
</Target>
66+
-->
67+
</Project>

src/MataTest/Program.cs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//MataSharp Showcase/Test Program.
2+
using System;
3+
using System.Linq;
4+
using System.Collections.Generic;
5+
using MataSharp;
6+
7+
namespace MataTest
8+
{
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
#region MagisterSchool
14+
Console.WriteLine("Typ gedeelte van je school in: ");
15+
var schools = MagisterSchool.GetSchools(Console.ReadLine());
16+
17+
for (int i = 0; i < schools.Count; i++)
18+
Console.WriteLine(i + ": " + schools[i].Name + " " + schools[i].URL);
19+
20+
MagisterSchool school = schools[Convert.ToInt32(Console.ReadLine())];
21+
#endregion
22+
23+
Console.Write("UserName: "); var userName = Console.ReadLine();
24+
Console.Write("Password: "); var password = Console.ReadLine();
25+
26+
#region Mata
27+
using (Mata mata = new Mata(school, userName, password))
28+
{
29+
#region GeneralInformation
30+
Console.WriteLine("User's Name: " + mata.Name);
31+
Console.WriteLine("User's ID: " + mata.UserID);
32+
#endregion
33+
34+
//Let's pull 20 messages already!
35+
//WARNING ALWAYS USE .Take(int). OR ELSE YOU WILL PICK UP 750 MESSAGES!
36+
var twentyMessages = mata.Inbox.Messages.Take(20);
37+
38+
twentyMessages.First(m => m.Attachments.Count != 0).Attachments[0].Download(true);
39+
40+
var utilitiesTest = mata.GetDigitalSchoolUtilities();
41+
42+
var homeWork = mata.GetHomework();
43+
foreach (var homework in homeWork)
44+
Console.WriteLine(homework.Start.DayOfWeek + " " + homework.BeginBySchoolHour + " " + homework.ClassAbbreviation + " " + homework.Content + "\n");
45+
46+
var studyGuides = mata.GetStudyGuides();
47+
48+
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
49+
foreach (var assignment in assignmentTest)
50+
{
51+
Console.WriteLine(assignment.Description);
52+
assignment.Attachments.ForEach(a => a.Download(true));
53+
}
54+
assignmentTest.ElementAt(0).Attachments.ForEach(a => a.Download(true));
55+
56+
new MagisterMessage()
57+
{
58+
Subject = "Hallotjees :D",
59+
Body = "TESSST D:",
60+
Recipients = new List<MagisterPerson>() { mata.Person },
61+
CC = new List<MagisterPerson>() { mata.Person },
62+
}.Send();
63+
64+
#region Message
65+
var Inbox = mata.Inbox;
66+
67+
var allUnreadMessages = Inbox.Messages.WhereUnread();
68+
69+
//Console.WriteLine("Last unread message in inbox: " + allUnreadMessages[0].Content);
70+
Console.WriteLine("Unread Messages in inbox: " + allUnreadMessages.Count);
71+
72+
MagisterMessage msg = Inbox.Messages.First(m => m.Attachments.Count() != 0); //Take first message with at least 1 attachment. :)
73+
Console.WriteLine("First message in inbox with at least 1 attachment: " + msg.Body);
74+
Console.WriteLine("It's attachment count: " + msg.Attachments.Count());
75+
Console.WriteLine("");
76+
77+
#region Attachments
78+
foreach (Attachment attachment in msg.Attachments)
79+
{
80+
Console.WriteLine("Attachment's name: " + attachment.Name + ", MIME Type: " + attachment.MIME);
81+
attachment.Download(true); //Download the attachment and add the UserID infront of the file name.
82+
}
83+
#endregion
84+
85+
#region ForwardMessage
86+
var ForwardMSG = msg.CreateForwardMessage();
87+
ForwardMSG.Recipients = new List<MagisterPerson>() { mata.Person };
88+
ForwardMSG.Send();
89+
#endregion
90+
#endregion
91+
}
92+
#endregion
93+
Console.ReadLine();
94+
}
95+
}
96+
}
10 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
15.5 KB
Binary file not shown.
23.7 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
8+
</requestedPrivileges>
9+
</security>
10+
</trustInfo>
11+
</assembly>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.exe.config
2+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.exe
3+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataTest.pdb
4+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.dll
5+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\Newtonsoft.Json.dll
6+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.pdb
7+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\MataSharp.xml
8+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\bin\Debug\Newtonsoft.Json.xml
9+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.csprojResolveAssemblyReference.cache
10+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.exe
11+
C:\Users\Lieuwe\Documents\Visual Studio 2013\Projects\MataSharp\MataTest\obj\Debug\MataTest.pdb
Binary file not shown.

0 commit comments

Comments
 (0)