Skip to content

Commit

Permalink
Optimeet v1.0
Browse files Browse the repository at this point in the history
- .exe working
  • Loading branch information
Excustic committed Jul 31, 2023
1 parent c5b8842 commit 05541e2
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Optimeet/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public sealed class FileManager
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet", "meetings.xml");
readonly string path_settings = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet", "settings.csv");
public static readonly string path_keys = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet", "keys.json");
public Trie<Contact> Contacts;
public SortedSet<Meeting> Meetings;
public Dictionary<string, int[]> Settings;
Expand All @@ -26,7 +28,6 @@ public sealed class FileManager
public const string SETTING_2 = "Search radius (metres)";
public const string SETTING_3 = "Meeting duration (minutes)";
public const string SETTING_4 = "Define upcoming meetings deadline (weeks)";
public const string path_keys = "keys.json";
private FileManager()
{
LoadContacts();
Expand Down
15 changes: 10 additions & 5 deletions Optimeet/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -40,7 +41,10 @@ public partial class MainWindow : Window
//Google API variables
private CalendarService service;
private UserCredential credential;
private readonly string credPath = "token.json";
private readonly string secretsPath = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet", "client_secrets.json");
private readonly string credPath = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet", "token.json");
//Used for picking a meeting location
private Location FinalChoice;
private Location CreateContactLocation; //Used for saving a new contact
Expand Down Expand Up @@ -1326,9 +1330,10 @@ private async void SignInOutGoogleAccount(object sender, RoutedEventArgs e)
{
try
{
DirectoryInfo dir = new DirectoryInfo(Environment.CurrentDirectory);
DirectoryInfo dir = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.MyDoc‌​uments), "Optimeet"));
foreach (var subDir in dir.GetDirectories())
if (subDir.Name.Equals(credPath))
if (subDir.Name.Equals("t"+credPath.Split('t')[credPath.Split('t').Length-1]))
{
subDir.Attributes = FileAttributes.Normal;
subDir.Delete(true);
Expand All @@ -1352,7 +1357,7 @@ private async void SignInOutGoogleAccount(object sender, RoutedEventArgs e)
try
{
//Retrieve Google OAuth2.0 secret keys
using (var stream = new FileStream("../../client_secrets.json", FileMode.Open, FileAccess.Read))
using (var stream = new FileStream(secretsPath, FileMode.Open, FileAccess.Read))
{
var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
Expand Down Expand Up @@ -1382,7 +1387,7 @@ private async void SignInOutGoogleAccount(object sender, RoutedEventArgs e)
if (b == null)
return;
//User sign attempt --> Create new user --> log in to service
using (var stream = new FileStream("../../client_secrets.json", FileMode.Open, FileAccess.Read))
using (var stream = new FileStream(secretsPath, FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.FromStream(stream).Secrets,
Expand Down
4 changes: 2 additions & 2 deletions Optimeet/MapsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private static void Initialzie()
AutocompleteRequest += GKey;
}
}
catch (Exception)
catch (Exception e)
{
MessageBox.Show("Could not load all map services because some keys are missing", "Error");
MessageBox.Show("Could not load all map services because some keys are missing: "+e.Message+". "+FileManager.path_keys, "Error");
}
}
/// <summary>
Expand Down
50 changes: 50 additions & 0 deletions Optimeet/Optimeet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>D:\Optimeet\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -36,6 +52,21 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>8F3DF6FFD8455AD240D8EA93BC52F461C046202A</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Optimeet_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo-dark.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
Expand Down Expand Up @@ -171,6 +202,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Optimeet_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down Expand Up @@ -226,6 +258,21 @@
<ItemGroup>
<Resource Include="Assets\google.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="logo-dark.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MaterialDesignThemes.4.9.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.9.0\build\MaterialDesignThemes.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand All @@ -234,4 +281,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\MaterialDesignThemes.4.9.0\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MaterialDesignThemes.4.9.0\build\MaterialDesignThemes.targets'))" />
</Target>
<PropertyGroup>
<PreBuildEvent>del /S /Q $(TargetDir)publish</PreBuildEvent>
</PropertyGroup>
</Project>
1 change: 0 additions & 1 deletion Optimeet/client_secrets.json

This file was deleted.

Binary file added Optimeet/logo-dark.ico
Binary file not shown.

0 comments on commit 05541e2

Please sign in to comment.