@@ -405,13 +405,13 @@ public override string ToString()
405405
406406 public bool IsFolder => PrimaryItemAttribute is StorageItemTypes . Folder ;
407407 public bool IsRecycleBinItem => this is RecycleBinItem ;
408- public bool IsShortcut => this is ShortcutItem ;
408+ public bool IsShortcut => this is IShortcutItem ;
409409 public bool IsLibrary => this is LibraryItem ;
410- public bool IsLinkItem => IsShortcut && ( ( ShortcutItem ) this ) . IsUrl ;
410+ public bool IsLinkItem => IsShortcut && ( ( IShortcutItem ) this ) . IsUrl ;
411411 public bool IsFtpItem => this is FtpItem ;
412412 public bool IsArchive => this is ZipItem ;
413413 public bool IsAlternateStream => this is AlternateStreamItem ;
414- public bool IsGitItem => this is GitItem ;
414+ public bool IsGitItem => this is IGitItem ;
415415 public virtual bool IsExecutable => ! IsFolder && FileExtensionHelpers . IsExecutableFile ( ItemPath ) ;
416416 public virtual bool IsScriptFile => FileExtensionHelpers . IsScriptFile ( ItemPath ) ;
417417 public bool IsPinned => App . QuickAccessManager . Model . PinnedFolders . Contains ( itemPath ) ;
@@ -428,7 +428,7 @@ public BaseStorageFile ItemFile
428428 // This is a hack used because x:Bind casting did not work properly
429429 public RecycleBinItem AsRecycleBinItem => this as RecycleBinItem ;
430430
431- public GitItem AsGitItem => this as GitItem ;
431+ public IGitItem AsGitItem => this as IGitItem ;
432432
433433 public string Key { get ; set ; }
434434
@@ -507,7 +507,7 @@ public FtpItem(FtpListItem item, string folder) : base(null)
507507 } ;
508508 }
509509
510- public sealed class ShortcutItem : ListedItem
510+ public sealed class ShortcutItem : ListedItem , IShortcutItem
511511 {
512512 public ShortcutItem ( string folderRelativeId ) : base ( folderRelativeId )
513513 {
@@ -602,7 +602,7 @@ public override string Name
602602 }
603603 }
604604
605- public sealed class GitItem : ListedItem
605+ public sealed class GitItem : ListedItem , IGitItem
606606 {
607607 private volatile int statusPropertiesInitialized = 0 ;
608608 public bool StatusPropertiesInitialized
@@ -678,4 +678,129 @@ public string? GitLastCommitFullSha
678678 set => SetProperty ( ref _GitLastCommitFullSha , value ) ;
679679 }
680680 }
681+ public sealed class GitShortcutItem : ListedItem , IGitItem , IShortcutItem
682+ {
683+ private volatile int statusPropertiesInitialized = 0 ;
684+ public bool StatusPropertiesInitialized
685+ {
686+ get => statusPropertiesInitialized == 1 ;
687+ set => Interlocked . Exchange ( ref statusPropertiesInitialized , value ? 1 : 0 ) ;
688+ }
689+
690+ private volatile int commitPropertiesInitialized = 0 ;
691+ public bool CommitPropertiesInitialized
692+ {
693+ get => commitPropertiesInitialized == 1 ;
694+ set => Interlocked . Exchange ( ref commitPropertiesInitialized , value ? 1 : 0 ) ;
695+ }
696+
697+ private Style ? _UnmergedGitStatusIcon ;
698+ public Style ? UnmergedGitStatusIcon
699+ {
700+ get => _UnmergedGitStatusIcon ;
701+ set => SetProperty ( ref _UnmergedGitStatusIcon , value ) ;
702+ }
703+
704+ private string ? _UnmergedGitStatusName ;
705+ public string ? UnmergedGitStatusName
706+ {
707+ get => _UnmergedGitStatusName ;
708+ set => SetProperty ( ref _UnmergedGitStatusName , value ) ;
709+ }
710+
711+ private DateTimeOffset ? _GitLastCommitDate ;
712+ public DateTimeOffset ? GitLastCommitDate
713+ {
714+ get => _GitLastCommitDate ;
715+ set
716+ {
717+ SetProperty ( ref _GitLastCommitDate , value ) ;
718+ GitLastCommitDateHumanized = value is DateTimeOffset dto ? dateTimeFormatter . ToShortLabel ( dto ) : "" ;
719+ }
720+ }
721+
722+ private string ? _GitLastCommitDateHumanized ;
723+ public string ? GitLastCommitDateHumanized
724+ {
725+ get => _GitLastCommitDateHumanized ;
726+ set => SetProperty ( ref _GitLastCommitDateHumanized , value ) ;
727+ }
728+
729+ private string ? _GitLastCommitMessage ;
730+ public string ? GitLastCommitMessage
731+ {
732+ get => _GitLastCommitMessage ;
733+ set => SetProperty ( ref _GitLastCommitMessage , value ) ;
734+ }
735+
736+ private string ? _GitCommitAuthor ;
737+ public string ? GitLastCommitAuthor
738+ {
739+ get => _GitCommitAuthor ;
740+ set => SetProperty ( ref _GitCommitAuthor , value ) ;
741+ }
742+
743+ private string ? _GitLastCommitSha ;
744+ public string ? GitLastCommitSha
745+ {
746+ get => _GitLastCommitSha ;
747+ set => SetProperty ( ref _GitLastCommitSha , value ) ;
748+ }
749+
750+ private string ? _GitLastCommitFullSha ;
751+ public string ? GitLastCommitFullSha
752+ {
753+ get => _GitLastCommitFullSha ;
754+ set => SetProperty ( ref _GitLastCommitFullSha , value ) ;
755+ }
756+
757+ public string TargetPath { get ; set ; }
758+
759+ public override string Name
760+ => IsSymLink ? base . Name : Path . GetFileNameWithoutExtension ( ItemNameRaw ) ; // Always hide extension for shortcuts
761+
762+ public string Arguments { get ; set ; }
763+ public string WorkingDirectory { get ; set ; }
764+ public bool RunAsAdmin { get ; set ; }
765+ public bool IsUrl { get ; set ; }
766+ public bool IsSymLink { get ; set ; }
767+ public override bool IsExecutable => FileExtensionHelpers . IsExecutableFile ( TargetPath , true ) ;
768+ }
769+ public interface IGitItem
770+ {
771+ public bool StatusPropertiesInitialized { get ; set ; }
772+ public bool CommitPropertiesInitialized { get ; set ; }
773+
774+ public Style ? UnmergedGitStatusIcon { get ; set ; }
775+
776+ public string ? UnmergedGitStatusName { get ; set ; }
777+
778+ public DateTimeOffset ? GitLastCommitDate { get ; set ; }
779+
780+ public string ? GitLastCommitDateHumanized { get ; set ; }
781+
782+ public string ? GitLastCommitMessage { get ; set ; }
783+
784+ public string ? GitLastCommitAuthor { get ; set ; }
785+
786+ public string ? GitLastCommitSha { get ; set ; }
787+
788+ public string ? GitLastCommitFullSha { get ; set ; }
789+
790+ public string ItemPath
791+ {
792+ get ;
793+ set ;
794+ }
795+ }
796+ public interface IShortcutItem
797+ {
798+ public string TargetPath { get ; set ; }
799+ public string Arguments { get ; set ; }
800+ public string WorkingDirectory { get ; set ; }
801+ public bool RunAsAdmin { get ; set ; }
802+ public bool IsUrl { get ; set ; }
803+ public bool IsSymLink { get ; set ; }
804+
805+ }
681806}
0 commit comments