Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed access modificators #418

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2213603
changed access modificators
Artooorcheck Apr 15, 2024
0558f80
Merge pull request #1 from Artooorcheck/master
fvoronin Apr 16, 2024
b1cd6fb
To Public
May 13, 2024
f0a9853
calendar order
artoorcheck Jul 23, 2024
b91c99d
bearer auth
artoorcheck Jul 23, 2024
af9165e
fix formatting
Artooorcheck Jul 24, 2024
41508ff
Merge pull request #2 from Artooorcheck/master
fvoronin Jul 25, 2024
152a1d3
phone parsing changed
Artooorcheck Jul 29, 2024
a67c7a8
receiving department updated
Artooorcheck Jul 29, 2024
6f58f55
fix cardav vk fields & oauth
Artooorcheck Aug 12, 2024
b55e2e9
Merge pull request #3 from Artooorcheck/master
tolix Aug 13, 2024
d7d6779
Apply Settings action & vCard data processing fixed
Artooorcheck Aug 19, 2024
236214b
float progressbar value
Artooorcheck Aug 20, 2024
d22df76
fix progress bar
Artooorcheck Aug 20, 2024
ec3d856
progress fixed
Artooorcheck Aug 20, 2024
378f1a1
Merge pull request #4 from Artooorcheck/master
fvoronin Aug 20, 2024
572591f
set default reminder for events without trigger
Artooorcheck Sep 2, 2024
e5d39bf
Disable notification for old events
Artooorcheck Sep 2, 2024
a7d7a24
changed datetime condition
Artooorcheck Sep 2, 2024
92b8753
Merge pull request #5 from Artooorcheck/master
fvoronin Sep 2, 2024
0b0e712
Add org Name, if CN is empty
Sep 11, 2024
52530fd
Merge pull request #6 from kuznecovsergey/master
fvoronin Sep 12, 2024
c60f5db
updated comparing of date to utc
artoorcheck Sep 18, 2024
6696335
Merge pull request #7 from Artooorcheck/master
fvoronin Sep 19, 2024
defdb82
custom time modified property added and attendee fixed (#8)
Artooorcheck Oct 24, 2024
34fbaec
catch custom modified time exception
Artooorcheck Oct 25, 2024
e1e4541
modified time exception comment added
Artooorcheck Oct 28, 2024
7be69c7
fix comment
Artooorcheck Oct 28, 2024
e19d9c2
catch custom modified time exception (#9)
Artooorcheck Oct 28, 2024
4557386
Merge branch 'croc-chelyabinsk:master' into master
Artooorcheck Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CalDavSynchronizer/CalDavSynchronizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
<Compile Include="ChangeWatching\IItemCollectionChangeWatcher.cs" />
<Compile Include="ChangeWatching\IFolderChangeWatcherFactory.cs" />
<Compile Include="ChangeWatching\ItemSavedEventArgs.cs" />
<Compile Include="DataAccess\IAuthService.cs" />
<Compile Include="DataAccess\RemoveInvalidXmlCharacterStreamReader.cs" />
<Compile Include="DDayICalWorkaround\CalDavSynchronizerSerializerFactory.cs" />
<Compile Include="DDayICalWorkaround\CustomAttendeeSerializer.cs" />
Expand Down
2 changes: 1 addition & 1 deletion CalDavSynchronizer/CalDavSynchronizerToolBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace CalDavSynchronizer
{
internal class CalDavSynchronizerToolBar
public class CalDavSynchronizerToolBar
{
private static readonly ILog s_logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Expand Down
125 changes: 67 additions & 58 deletions CalDavSynchronizer/ComponentContainer.cs
Original file line number Diff line number Diff line change
@@ -1,72 +1,65 @@
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Markup;
using CalDavSynchronizer.AutomaticUpdates;
using CalDavSynchronizer.ChangeWatching;
using CalDavSynchronizer.Contracts;
using CalDavSynchronizer.DataAccess;
using CalDavSynchronizer.Globalization;
using CalDavSynchronizer.Implementation;
using CalDavSynchronizer.Implementation.Common;
using CalDavSynchronizer.Implementation.ComWrappers;
using CalDavSynchronizer.Implementation.Events;
using CalDavSynchronizer.Implementation.TimeZones;
using CalDavSynchronizer.ProfileTypes;
using CalDavSynchronizer.Reports;
using CalDavSynchronizer.Scheduling;
using CalDavSynchronizer.Ui;
using CalDavSynchronizer.Ui.Options;
using CalDavSynchronizer.Ui.Options.Models;
using CalDavSynchronizer.Ui.Options.ViewModels;
using CalDavSynchronizer.Ui.Reports.ViewModels;
using CalDavSynchronizer.Ui.SystrayNotification;
using CalDavSynchronizer.Ui.SystrayNotification.ViewModels;
using CalDavSynchronizer.Utilities;
using GenSync;
using GenSync.EntityRelationManagement;
using GenSync.Logging;
using GenSync.ProgressReport;
using GenSync.Synchronization;
using log4net;
using log4net.Repository.Hierarchy;
using log4net.Core;
using log4net.Repository.Hierarchy;
using Microsoft.Office.Interop.Outlook;
using Application = Microsoft.Office.Interop.Outlook.Application;
using Exception = System.Exception;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Markup;
using System.Windows.Media;
using CalDavSynchronizer.Globalization;
using CalDavSynchronizer.Implementation;
using CalDavSynchronizer.Implementation.Common;
using CalDavSynchronizer.Implementation.Tasks;
using CalDavSynchronizer.Implementation.TimeZones;
using CalDavSynchronizer.ProfileTypes;
using CalDavSynchronizer.Scheduling.ComponentCollectors;
using CalDavSynchronizer.Ui.Options;
using CalDavSynchronizer.Ui.Options.BulkOptions.ViewModels;
using CalDavSynchronizer.Ui.Options.Models;
using CalDavSynchronizer.Ui.Options.ViewModels;
using CalDavSynchronizer.Ui.SystrayNotification;
using CalDavSynchronizer.Ui.SystrayNotification.ViewModels;
using GenSync.EntityRelationManagement;
using GenSync.Logging;
using GenSync.Synchronization;
using AppointmentId = CalDavSynchronizer.Implementation.Events.AppointmentId;
using Application = Microsoft.Office.Interop.Outlook.Application;
using Exception = System.Exception;
using MessageBox = System.Windows.Forms.MessageBox;

namespace CalDavSynchronizer
Expand Down Expand Up @@ -118,7 +111,17 @@ public event EventHandler<SchedulerStatusEventArgs> StatusChanged
remove { _synchronizationStatus.StatusChanged -= value; }
}

public ComponentContainer(Application application, IGeneralOptionsDataAccess generalOptionsDataAccess, IComWrapperFactory comWrapperFactory, IExceptionHandlingStrategy exceptionHandlingStrategy)
public IOptionsDataAccess OptionsData { get { return _optionsDataAccess; } }
public IGeneralOptionsDataAccess GeneralOptionsData { get { return _generalOptionsDataAccess; } }

public ComponentContainer(
Application application,
IGeneralOptionsDataAccess generalOptionsDataAccess,
IComWrapperFactory comWrapperFactory,
IExceptionHandlingStrategy exceptionHandlingStrategy,
IUiService uiService = null,
string applicationDataDirectoryBaseParam = null
)
{
if (application == null) throw new ArgumentNullException(nameof(application));
if (generalOptionsDataAccess == null) throw new ArgumentNullException(nameof(generalOptionsDataAccess));
Expand Down Expand Up @@ -158,7 +161,7 @@ public ComponentContainer(Application application, IGeneralOptionsDataAccess gen
_globalTimeZoneCache = new GlobalTimeZoneCache();


var applicationDataDirectoryBase = Path.Combine(
var applicationDataDirectoryBase = applicationDataDirectoryBaseParam ?? Path.Combine(
Environment.GetFolderPath(
generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData),
"CalDavSynchronizer");
Expand All @@ -169,7 +172,7 @@ public ComponentContainer(Application application, IGeneralOptionsDataAccess gen

_optionsDataAccess = new OptionsDataAccess(optionsFilePath);

_uiService = new UiService();
_uiService = uiService ?? new UiService();
var options = _optionsDataAccess.Load();

_permanentStatusesViewModel = new PermanentStatusesViewModel(_uiService, this, options);
Expand Down Expand Up @@ -208,7 +211,8 @@ public ComponentContainer(Application application, IGeneralOptionsDataAccess gen
EnsureSynchronizationContext,
new FolderChangeWatcherFactory(
_session),
_synchronizationStatus);
_synchronizationStatus,
uiService);

EnsureCacheCompatibility(options);

Expand Down Expand Up @@ -327,7 +331,7 @@ private void EnsureCacheCompatibility(Options[] options)
_session,
options,
o => EntityRelationDataAccess.GetRelationStoragePath(GetProfileDataDirectory(o.Id)),
o => DeleteCachesForProfiles(new[] {Tuple.Create(o.Id, o.Name)}));
o => DeleteCachesForProfiles(new[] { Tuple.Create(o.Id, o.Name) }));
_generalOptionsDataAccess.EntityCacheVersion = c_requiredEntityCacheVersion;
}
catch (Exception x)
Expand All @@ -346,7 +350,7 @@ private void EnsureCacheCompatibility(Options[] options)
_session,
options,
o => EntityRelationDataAccess.GetRelationStoragePath(GetProfileDataDirectory(o.Id)),
o => DeleteCachesForProfiles(new[] {Tuple.Create(o.Id, o.Name)}));
o => DeleteCachesForProfiles(new[] { Tuple.Create(o.Id, o.Name) }));
_generalOptionsDataAccess.EntityCacheVersion = c_requiredEntityCacheVersion;
}
catch (Exception x)
Expand All @@ -365,14 +369,14 @@ private void EnsureCacheCompatibility(Options[] options)
_session,
options,
o => EntityRelationDataAccess.GetRelationStoragePath(GetProfileDataDirectory(o.Id)),
o => DeleteCachesForProfiles(new[] {Tuple.Create(o.Id, o.Name)}));
o => DeleteCachesForProfiles(new[] { Tuple.Create(o.Id, o.Name) }));

s_logger.InfoFormat("Converting caches from 2 to 3");
EntityCacheVersionConversion.Version2To3.Convert(
_session,
options,
o => EntityRelationDataAccess.GetRelationStoragePath(GetProfileDataDirectory(o.Id)),
o => DeleteCachesForProfiles(new[] {Tuple.Create(o.Id, o.Name)}));
o => DeleteCachesForProfiles(new[] { Tuple.Create(o.Id, o.Name) }));
_generalOptionsDataAccess.EntityCacheVersion = c_requiredEntityCacheVersion;
}
catch (Exception x)
Expand Down Expand Up @@ -481,22 +485,27 @@ private void ConfigureLogLevel(bool debugLogLevel)
{
if (debugLogLevel)
{
((Hierarchy) LogManager.GetRepository()).Root.Level = Level.Debug;
((Hierarchy)LogManager.GetRepository()).Root.Level = Level.Debug;
}
else
{
((Hierarchy) LogManager.GetRepository()).Root.Level = Level.Info;
((Hierarchy)LogManager.GetRepository()).Root.Level = Level.Info;
}

((Hierarchy) LogManager.GetRepository()).RaiseConfigurationChanged(EventArgs.Empty);
((Hierarchy)LogManager.GetRepository()).RaiseConfigurationChanged(EventArgs.Empty);
}

public async void SynchronizeNowAsync()
{
await SynchronizeNow();
}

public async Task SynchronizeNow(IProgress<float> progressBar = null)
{
try
{
s_logger.Info("Synchronization manually triggered");
await _scheduler.RunNow();
await _scheduler.RunNow(progressBar);
}
catch (Exception x)
{
Expand Down Expand Up @@ -571,7 +580,7 @@ public Options[] ShowWpfOptions(Guid? initialSelectedProfileId, GeneralOptions g
}
}

private async Task ApplyNewOptions(Options[] oldOptions, Options[] newOptions, GeneralOptions generalOptions, IEnumerable<OneTimeChangeCategoryTask> oneTimeTasks)
public async Task ApplyNewOptions(Options[] oldOptions, Options[] newOptions, GeneralOptions generalOptions, IEnumerable<OneTimeChangeCategoryTask> oneTimeTasks)
{
_optionsDataAccess.Save(newOptions);
await _scheduler.SetOptions(newOptions, generalOptions);
Expand Down Expand Up @@ -626,12 +635,12 @@ public async Task ShowGeneralOptionsAsync()
await EditGeneralOptionsAsync(
o =>
{
var generalOptionsViewModel = new GeneralOptionsViewModel {Options = o.Clone()};
var generalOptionsViewModel = new GeneralOptionsViewModel { Options = o.Clone() };

if (_uiService.ShowGeneralOptions(generalOptionsViewModel))
return Tuple.Create(true, generalOptionsViewModel.Options);
else
return Tuple.Create(false, (GeneralOptions) null);
return Tuple.Create(false, (GeneralOptions)null);
});
}

Expand Down Expand Up @@ -701,7 +710,7 @@ private async void CheckForUpdatesNowAsync()
{
s_logger.Info("CheckForUpdates manually triggered");

var availableVersion = await Task.Run((Func<Version>) _availableVersionService.GetVersionOfDefaultDownload);
var availableVersion = await Task.Run((Func<Version>)_availableVersionService.GetVersionOfDefaultDownload);
if (availableVersion == null)
{
MessageBox.Show(Strings.Get($"Did not find any default version!"), MessageBoxTitle);
Expand Down Expand Up @@ -775,7 +784,7 @@ public static (string DataDirectoryPath, string ConfigFilePath) GetOrCreateDataD
ConfigFileName = "options.xml",
DataDirectoryName = profileGuid.ToString()
};
profiles = profiles.Union(new[] {profile}).ToArray();
profiles = profiles.Union(new[] { profile }).ToArray();
profileDataAccess.Save(profiles);
}

Expand Down Expand Up @@ -912,21 +921,21 @@ public async void DiplayBEntityAsync(Guid synchronizationProfileId, string entit

if (availableComponents.CalDavDataAccess != null)
{
var entityName = new WebResourceName {Id = entityId, OriginalAbsolutePath = entityId};
var entities = await availableComponents.CalDavDataAccess.GetEntities(new[] {entityName});
var entityName = new WebResourceName { Id = entityId, OriginalAbsolutePath = entityId };
var entities = await availableComponents.CalDavDataAccess.GetEntities(new[] { entityName });
DisplayFirstEntityIfAvailable(entities.FirstOrDefault());
}
else if (availableComponents.CardDavDataAccess != null || availableComponents.DistListDataAccess != null)
{
var entityName = new WebResourceName {Id = entityId, OriginalAbsolutePath = entityId};
var entityName = new WebResourceName { Id = entityId, OriginalAbsolutePath = entityId };

EntityWithId<WebResourceName, string> entity = null;

if (availableComponents.CardDavDataAccess != null)
entity = (await availableComponents.CardDavDataAccess.GetEntities(new[] {entityName})).FirstOrDefault();
entity = (await availableComponents.CardDavDataAccess.GetEntities(new[] { entityName })).FirstOrDefault();

if (entity == null && availableComponents.DistListDataAccess != null)
entity = (await availableComponents.DistListDataAccess.GetEntities(new[] {entityName})).FirstOrDefault();
entity = (await availableComponents.DistListDataAccess.GetEntities(new[] { entityName })).FirstOrDefault();

DisplayFirstEntityIfAvailable(entity);
}
Expand Down
4 changes: 3 additions & 1 deletion CalDavSynchronizer/Contracts/ServerAdapterType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public enum ServerAdapterType

GoogleTaskApi,

GoogleContactApi
GoogleContactApi,

WebDavHttpClientOAuth,
}
}
9 changes: 8 additions & 1 deletion CalDavSynchronizer/DataAccess/CalDavDataAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,13 @@ public async Task<CalDavResources> GetUserResources(Uri principalUri)
{
var displayName = string.IsNullOrEmpty(displayNameNode.InnerText) ? "Default Calendar" : displayNameNode.InnerText;
var resourceUri = new Uri(calendarDocument.DocumentUri, path);
calendars.Add(new CalendarData(resourceUri, displayName, calendarColor, await GetPrivileges(resourceUri), await GetCalendarOwnerPropertiesOrNull(resourceUri)));
var calendarOrderNode = responseElement.SelectSingleNode("D:propstat/D:prop/E:calendar-order", calendarDocument.XmlNamespaceManager);
int calendarOrder = int.MaxValue;
if (calendarOrderNode != null && int.TryParse(calendarOrderNode.InnerText, out int order))
{
calendarOrder = order;
}
calendars.Add(new CalendarData(resourceUri, displayName, calendarColor, await GetPrivileges(resourceUri), calendarOrder, await GetCalendarOwnerPropertiesOrNull(resourceUri)));
}

if (supportedComponentsNode.InnerXml.Contains("VTODO"))
Expand Down Expand Up @@ -483,6 +489,7 @@ private Task<XmlDocumentWithNamespaceManager> ListCalendars(Uri url)
<D:prop>
<D:resourcetype />
<D:displayname />
<E:calendar-order />
<E:calendar-color />
<C:supported-calendar-component-set />
</D:prop>
Expand Down
4 changes: 3 additions & 1 deletion CalDavSynchronizer/DataAccess/CalendarData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ public class CalendarData
public string Name { get; }
public ArgbColor? Color { get; }
public AccessPrivileges Privileges { get; }
public int Order { get; }
public CalendarOwnerProperties OwnerProperties { get; }

public CalendarData(Uri uri, string name, ArgbColor? color, AccessPrivileges privileges, CalendarOwnerProperties ownerProperties)
public CalendarData(Uri uri, string name, ArgbColor? color, AccessPrivileges privileges, int order, CalendarOwnerProperties ownerProperties)
{
Uri = uri;
Name = name;
Color = color;
Privileges = privileges;
Order = order;
OwnerProperties = ownerProperties;
}
}
Expand Down
13 changes: 13 additions & 0 deletions CalDavSynchronizer/DataAccess/IAuthService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CalDavSynchronizer.DataAccess
{
public interface IAuthService
{
string GetAccessToken();
}
}
Loading