Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
0425d42
* added interface project for XElement.DotNet.System.Environment.Use…
IanStorm Jun 13, 2016
955f871
* added implementation for XElement.DotNet.System.Environment.UserIn…
IanStorm Jun 13, 2016
8eaa4ca
* added MEF project for XElement.DotNet.System.Environment.UserInfor…
IanStorm Jun 13, 2016
61a0258
* moved OsRecognition project to Environment folder in VS solution
IanStorm Jun 13, 2016
875b1d3
* created project for sharing UI resources between modules and main …
IanStorm Jul 7, 2016
5268089
* initial commit of proxy application (used for admin privileges)
IanStorm Jul 12, 2016
7238ac2
* initial commit of UserProfileUC module
IanStorm Jul 13, 2016
66b4a38
* basic styling for UserProfileUC's toggle button
IanStorm Jul 16, 2016
1a9f378
* UserProfileUC project was missing in solution
IanStorm Jul 16, 2016
1511562
* fixed default namespace of UserInformation.Implementation project
IanStorm Jul 17, 2016
676d5d9
* implemented logic to determine the current user's role
IanStorm Jul 18, 2016
9901882
* removed unused and not working PrincipalContextRetriever
IanStorm Jul 19, 2016
83d2a63
* implemented MergeAllRetriever in MEF project to combine the result…
IanStorm Jul 19, 2016
efb5e12
* fixed documentation of MergeAllRetriever
IanStorm Jul 19, 2016
a2d8ef4
* better alignment of user profile icon in UserProfileUC
IanStorm Jul 19, 2016
6b81d4f
* UserProfileUC now shows the user's name and his/her role
IanStorm Jul 19, 2016
7b56b8b
* missing in last commit
IanStorm Jul 19, 2016
01daacb
* localized UserProfileUC
IanStorm Jul 19, 2016
aee3236
Merge branch '20160607_-_AdminPrivileges' of https://github.com/XElem…
IanStorm Jul 19, 2016
f1ce8cf
* removed dependency from UserProfileUC project to UserInformation.I…
IanStorm Jul 20, 2016
9b33fea
* if the user's name cannot be read out, his/her username will be di…
IanStorm Jul 20, 2016
f3055b7
* currently, properties Prename and Surname are not used in the UserP…
IanStorm Jul 20, 2016
f5a7338
* added UserProfileContainer which implements the usage of UserProfi…
IanStorm Jul 20, 2016
fb9e591
* actual usage of UserProfileUC on UI
IanStorm Jul 20, 2016
b42b5b2
* show busy spinner while loading user information
IanStorm Jul 21, 2016
810a063
* button for opening user profile is not moved down anymore when ope…
IanStorm Jul 23, 2016
fb00e3e
* refactoring
IanStorm Jul 23, 2016
48652b4
* the user information panel is now an adorner that overlays other c…
IanStorm Jul 24, 2016
da8e99f
* better license handling for referenced third party libraries
IanStorm Jul 24, 2016
8d7ba89
* basic client server communication possible in LinkCreatorProxy
IanStorm Aug 3, 2016
95de234
* updated assembly information of LinkCreatorProxy
IanStorm Aug 3, 2016
7631dbb
* cleanup
IanStorm Aug 3, 2016
384b4f9
* refactoring: adapted namespace
IanStorm Aug 4, 2016
8ed4646
* refactored constructor parameter
IanStorm Aug 4, 2016
7dfa310
* changed logic structure: moved MKLINK logic from Link class to new…
IanStorm Aug 8, 2016
e46c8a8
* initial commit of project that take cares of LinkCreator's serializ…
IanStorm Aug 9, 2016
124e767
* implemented LinkCreator's serialization
IanStorm Aug 9, 2016
ae0fdfa
* implemented adapter for LinkCreator service
IanStorm Aug 9, 2016
7f26665
* changes affecting LinkCreatorServiceAdapter project:
IanStorm Aug 9, 2016
5d51b3e
* added an implementation of IExecutor to the Logic project
IanStorm Aug 9, 2016
b8804fe
* implemented proper logic for LinkCreatorProxy
IanStorm Aug 10, 2016
fe0017a
* added empty Service project which will replace the LinkCreatorProxy…
IanStorm Aug 10, 2016
2702fc8
* fixed ArgsParser of LinkCreatorProxy
IanStorm Aug 10, 2016
9655146
* partial commit (currently client messages do not reach the server):
IanStorm Aug 10, 2016
2ea1e59
* fixed a NuGet package
IanStorm Aug 10, 2016
c782862
* refactoring
IanStorm Aug 10, 2016
d603509
* name of LinkCreator service is now dynamically determined
IanStorm Aug 10, 2016
27662f0
* LinkCreator client-server-communication implemented
IanStorm Aug 11, 2016
caa82c0
* now that the LinkCreator service is fully implemented, the main exe…
IanStorm Aug 11, 2016
1f0d826
* enabled Windows 10 support in manifest
IanStorm Aug 11, 2016
caecce1
* changed project type of LinkCreator/Service from console applicatio…
IanStorm Aug 11, 2016
35b0bff
* changed assembly name (i.e. name of the produced .exe file) of Link…
IanStorm Aug 11, 2016
1daf5d6
* changed and improved logging of LinkCreator:
IanStorm Aug 12, 2016
fe9a72a
* LinkCreator logging now additionally logs to Windows EventLog
IanStorm Aug 12, 2016
e86c759
* LinkCreator Logger is now singleton
IanStorm Aug 12, 2016
fc53b4c
* LinkCreator client is now waiting for a server response (telling se…
IanStorm Aug 12, 2016
715b355
added some TODOs
IanStorm Jun 23, 2018
90f4eac
added "not unit-tested" tag
IanStorm Jun 23, 2018
5a04c1a
fixed `System.Net.WebException`: "The request was aborted: Could not …
IanStorm Jun 25, 2018
5991de4
linting
IanStorm Jun 25, 2018
5e305a6
upgraded HtmlAgilityPack from v1.4.9 to v1.8.4
IanStorm Jun 25, 2018
07d7bb5
changes to how user information is being loaded
IanStorm Jun 25, 2018
5912fab
`WindowsPrincipalRetriever` can retrieve more information now
IanStorm Jun 25, 2018
c595624
added very basic unit test(s) for testing the user information retrie…
IanStorm Jun 25, 2018
b74d957
added retrieval interfaces for `IRoleInformation` and `IUserInformation`
IanStorm Jun 29, 2018
dad6918
resolved 1 TODO: Unit tested and implemented link creation check for …
IanStorm Jun 29, 2018
92d8cc9
unit-tested and fixed by that the "MkLink Executor"
IanStorm Jun 29, 2018
1a4d9b4
refactoring of local TestUtils
IanStorm Jun 29, 2018
65a1097
this TODO has been already resolved in 92d8cc9b15c894da21bb7019f189d1…
IanStorm Jun 29, 2018
60ec568
resolved 1 TODO related to window creation
IanStorm Jun 29, 2018
c169265
Merge remote-tracking branch 'origin/master' into 20160607_-_AdminPri…
IanStorm Jun 29, 2018
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
6 changes: 6 additions & 0 deletions DataTypes/IApplicationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ public interface IApplicationInfo

IDefinitionInfo DefinitionInfo { get; }

// TODO: Use guid as folder name
string FolderName { get; }

Guid Id { get; }

// TODO: Extend this: Use also "Herausgeber" field to identify installed application
/// <summary>
/// A regex that matches the name that is displayed in the installed applications list.
/// </summary>
string TechnicalNameMatcher { get; }

// TODO: Add publish year for better sorting

// TODO: Add series name (like "Battlefield") for better sorting (by grouping)
}
}
20 changes: 13 additions & 7 deletions Logic/Logic.Implementation/Execution/Link/FileLink.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
using System.IO;
using XElement.CloudSyncHelper.DataTypes;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
internal class FileLink : LinkBase, ILinkInt
{
public FileLink( IApplicationInfo appInfo,
IFileLinkInfo fileLinkInfo,
PathVariablesDTO pathVariablesDTO )
: base( appInfo, fileLinkInfo, pathVariablesDTO ) { }
public FileLink( LinkParametersDTO parametersDTO,
DependenciesDTO dependenciesDTO )
: base( parametersDTO, dependenciesDTO ) { }


protected override FileSystemInfo /*LinkBase.*/FileSystemInfo
{
get { return new FileInfo( this.LinkPath ); }
}


public override bool /*LinkBase.*/IsInCloud
{
get { return File.Exists( this.TargetPath ); }
}

protected override string /*LinkBase.*/MkLinkParams { get { return string.Empty; } }

protected override MkLink.Type /*LinkBase.*/MkLinkType
{
get { return MkLink.Type.FILE_LINK; }
}


protected override void /*LinkBase.*/MoveToCloud_CopyStuff()
{
File.Copy( this.LinkPath, this.TargetPath );
}


public override void /*LinkBase.*/Undo()
{
if ( File.Exists( this.LinkPath ) )
Expand Down
23 changes: 16 additions & 7 deletions Logic/Logic.Implementation/Execution/Link/FolderLink.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using System;
using System.IO;
using XElement.CloudSyncHelper.DataTypes;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
internal class FolderLink : LinkBase, ILinkInt
{
public FolderLink( IApplicationInfo appInfo,
IFolderLinkInfo folderLinkInfo,
PathVariablesDTO pathVariablesDTO )
: base( appInfo, folderLinkInfo, pathVariablesDTO ) { }
public FolderLink( LinkParametersDTO parametersDTO,
DependenciesDTO dependenciesDTO )
: base( parametersDTO, dependenciesDTO ) { }


private void AbstractSourceDestLinker( Func<string, string[]> sourcePathsGetter,
string source,
Expand All @@ -27,6 +26,7 @@ private void AbstractSourceDestLinker( Func<string, string[]> sourcePathsGetter,
}
}


// Copy all levels
private void CopyFilesRecursively( string source, string destination )
{
Expand All @@ -39,23 +39,31 @@ private void CopyFilesRecursively( string source, string destination )
( s, d ) => this.CopyFilesRecursively( s, d ) );
}


protected override FileSystemInfo /*LinkBase.*/FileSystemInfo
{
get { return new DirectoryInfo( this.LinkPath ); }
}


public override bool /*LinkBase.*/IsInCloud
{
get { return Directory.Exists( this.TargetPath ); }
}

protected override string /*LinkBase.*/MkLinkParams { get { return "/D"; } }

protected override MkLink.Type /*LinkBase.*/MkLinkType
{
get { return MkLink.Type.DIRECTORY_LINK; }
}


protected override void /*LinkBase.*/MoveToCloud_CopyStuff()
{
this.CopyFilesRecursively( this.LinkPath, this.TargetPath );
}


// Copy only one level
private void ShallowCopyFiles( string source, string destination )
{
Expand All @@ -65,6 +73,7 @@ private void ShallowCopyFiles( string source, string destination )
( s, d ) => File.Copy( s, d ) );
}


public override void /*LinkBase.*/Undo()
{
if ( Directory.Exists( this.LinkPath ) )
Expand Down
2 changes: 1 addition & 1 deletion Logic/Logic.Implementation/Execution/Link/GameLogic.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.IO;
using XElement.CloudSyncHelper.DataTypes;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
internal class GameLogic : IApplicationLogic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
internal interface IApplicationLogic
{
Expand Down
2 changes: 1 addition & 1 deletion Logic/Logic.Implementation/Execution/Link/ILinkInt.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using XElement.DesignPatterns.BehavioralPatterns.Command;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
internal interface ILinkInt : IDoUndoCommand, ILink
{
Expand Down
61 changes: 33 additions & 28 deletions Logic/Logic.Implementation/Execution/Link/LinkBase.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
using System;
using System.Diagnostics;
using System.IO;
using XElement.CloudSyncHelper.DataTypes;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
internal abstract class LinkBase : ILinkInt
{
public LinkBase( IApplicationInfo appInfo,
ILinkInfo linkInfo,
PathVariablesDTO pathVariablesDTO )
public LinkBase( LinkParametersDTO parametersDTO,
DependenciesDTO dependenciesDTO )
{
this._linkInfo = linkInfo;
this._pathVariablesDTO = pathVariablesDTO;
this._mkLinkExecutorFactory = dependenciesDTO.MkLinkExecutorFactory;

this._linkInfo = parametersDTO.LinkInfo;
this._pathVariablesDTO = parametersDTO.PathVariablesDTO;
this._symLinkHelper = new SymbolicLinkHelper();

Initialize( appInfo );
Initialize( parametersDTO.ApplicationInfo );
}


private void CreatePathToDestinationTarget()
{
Directory.CreateDirectory( this.PathToDestinationTarget );
}


public void /*ILink.*/Do()
{
this.CreatePathToDestinationTarget();
this.Undo();
this.ExecuteCmd();
}

private void ExecuteCmd()
{
var mkLink = this.GetCmdCommand();
var process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/c " + mkLink;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.Verb = "runas";
process.Start();

process.WaitForExit();
var mkLinkParams = new MkLink.ParametersDTO
{
Link = this.LinkPath,
Target = this.TargetPath,
Type = this.MkLinkType
};
this._mkLinkExecutorFactory.Get( mkLinkParams ).Execute();
}


private bool DoesSymbolicLinkPointToExpectedPath
{
get
Expand All @@ -54,13 +50,9 @@ private bool DoesSymbolicLinkPointToExpectedPath
}
}


protected abstract FileSystemInfo FileSystemInfo { get; }

private string GetCmdCommand()
{
return String.Format( "MKLINK {0} \"{1}\" \"{2}\"", this.MkLinkParams,
this.LinkPath, this.TargetPath );
}

private void Initialize( IApplicationInfo programInfo )
{
Expand All @@ -74,8 +66,10 @@ private void Initialize( IApplicationInfo programInfo )
}
}


public abstract bool /*ILink.*/IsInCloud { get; }


public bool /*ILink.*/IsLinked
{
get
Expand All @@ -85,6 +79,7 @@ public bool /*ILink.*/IsLinked
}
}


private bool IsSymbolicLink
{
get
Expand All @@ -94,6 +89,7 @@ private bool IsSymbolicLink
}
}


public string /*ILink.*/LinkPath
{
get
Expand All @@ -104,16 +100,20 @@ public string /*ILink.*/LinkPath
}
}

protected abstract string MkLinkParams { get; }

protected abstract MkLink.Type MkLinkType { get; }


public void /*ILink.*/MoveToCloud()
{
Directory.CreateDirectory( this.PathToCloudUserFolder );
this.MoveToCloud_CopyStuff();
}


protected abstract void MoveToCloud_CopyStuff();


private string PathToDestinationTarget
{
get
Expand All @@ -123,6 +123,7 @@ private string PathToDestinationTarget
}
}


private string PathToCloudUserFolder
{
get
Expand All @@ -135,6 +136,7 @@ private string PathToCloudUserFolder
}
}


public string /*ILink.*/TargetPath
{
get
Expand All @@ -144,9 +146,12 @@ public string /*ILink.*/TargetPath
}
}


public abstract void /*ILink.*/Undo(); // TODO: Delete folders if they are empty


private ILinkInfo _linkInfo;
private MkLink.IFactory _mkLinkExecutorFactory;
private PathVariablesDTO _pathVariablesDTO;
private IApplicationLogic _programLogic;
private SymbolicLinkHelper _symLinkHelper;
Expand Down
25 changes: 16 additions & 9 deletions Logic/Logic.Implementation/Execution/Link/LinkFactory.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using XElement.CloudSyncHelper.DataTypes;
using XElement.CloudSyncHelper.Logic.Execution;

namespace XElement.CloudSyncHelper.Logic
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
public class LinkFactory : ILinkFactory
{
public LinkFactory() { }
public LinkFactory( MkLink.IFactory mkLinkExecutorFactory )
{
this._mkLinkExecutorFactory = mkLinkExecutorFactory;
}


public ILink Get( IApplicationInfo appInfo,
ILinkInfo linkInfo,
Expand All @@ -20,25 +23,29 @@ public ILink Get( IApplicationInfo appInfo,
};
return this.Get( linkParamsDTO );
}

public ILink Get( LinkParametersDTO linkParametersDTO )
{
ILink link = null;

var dependenciesDTO = new Link.DependenciesDTO
{
MkLinkExecutorFactory = this._mkLinkExecutorFactory
};
if ( linkParametersDTO.LinkInfo is IFolderLinkInfo )
{
link = new FolderLink( linkParametersDTO.ApplicationInfo,
linkParametersDTO.LinkInfo as IFolderLinkInfo,
linkParametersDTO.PathVariablesDTO );
link = new FolderLink( linkParametersDTO, dependenciesDTO );
}
else
{
link = new FileLink( linkParametersDTO.ApplicationInfo,
linkParametersDTO.LinkInfo as IFileLinkInfo,
linkParametersDTO.PathVariablesDTO );
link = new FileLink( linkParametersDTO, dependenciesDTO );
}

return link;
}


protected MkLink.IFactory _mkLinkExecutorFactory;
}
#endregion
}
2 changes: 1 addition & 1 deletion Logic/Logic.Implementation/Execution/Link/ToolLogic.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.IO;
using XElement.CloudSyncHelper.DataTypes;

namespace XElement.CloudSyncHelper.Logic.Execution
namespace XElement.CloudSyncHelper.Logic.Execution.Link
{
#region not unit-tested
internal class ToolLogic : IApplicationLogic
Expand Down
Loading