public TesterWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif if (PlatformUtils.IsWindows()) { _environment = new WindowsEnvironment(new WindowsFileSystem()); } else { IFileSystem fs; if (PlatformUtils.IsMacOS()) { fs = new MacOSFileSystem(); } else { fs = new LinuxFileSystem(); } _environment = new PosixEnvironment(fs); } }
public static bool TryStatFileAndUpdateIndex(ITracer tracer, string path, MemoryMappedViewAccessor indexView, long offset) { try { LinuxNative.StatBuffer st = LinuxFileSystem.StatFile(path); Index.IndexEntry indexEntry = new Index.IndexEntry(indexView, offset); indexEntry.MtimeSeconds = (uint)st.MTimespec.Sec; indexEntry.MtimeNanosecondFraction = (uint)st.MTimespec.Nsec; indexEntry.CtimeSeconds = (uint)st.CTimespec.Sec; indexEntry.CtimeNanosecondFraction = (uint)st.CTimespec.Nsec; indexEntry.Size = (uint)st.Size; indexEntry.Dev = (uint)st.Dev; indexEntry.Ino = (uint)st.Ino; indexEntry.Uid = st.UID; indexEntry.Gid = st.GID; return(true); } catch (Win32Exception e) { EventMetadata metadata = new EventMetadata(); metadata.Add("path", path); metadata.Add("exception", e.ToString()); tracer.RelatedError(metadata, "Error stat-ing file."); return(false); } }
public CommandContext() { Streams = new StandardStreams(); Trace = new Trace(); if (PlatformUtils.IsWindows()) { FileSystem = new WindowsFileSystem(); SessionManager = new WindowsSessionManager(); SystemPrompts = new WindowsSystemPrompts(); Environment = new WindowsEnvironment(FileSystem); Terminal = new WindowsTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem); Git = new GitProcess( Trace, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new Settings(Environment, Git); CredentialStore = new WindowsCredentialManager(Settings.CredentialNamespace); } else if (PlatformUtils.IsMacOS()) { FileSystem = new MacOSFileSystem(); SessionManager = new MacOSSessionManager(); SystemPrompts = new MacOSSystemPrompts(); Environment = new PosixEnvironment(FileSystem); Terminal = new PosixTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem); Git = new GitProcess( Trace, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new Settings(Environment, Git); CredentialStore = new MacOSKeychain(Settings.CredentialNamespace); } else if (PlatformUtils.IsLinux()) { FileSystem = new LinuxFileSystem(); // TODO: support more than just 'Posix' or X11 SessionManager = new PosixSessionManager(); SystemPrompts = new LinuxSystemPrompts(); Environment = new PosixEnvironment(FileSystem); Terminal = new PosixTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem); Git = new GitProcess( Trace, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new Settings(Environment, Git); IGpg gpg = new Gpg( Environment.LocateExecutable("gpg"), SessionManager ); CredentialStore = new LinuxCredentialStore(FileSystem, Settings, SessionManager, gpg, Environment); } else { throw new PlatformNotSupportedException(); } HttpClientFactory = new HttpClientFactory(Trace, Settings, Streams); // Set the parent window handle/ID SystemPrompts.ParentWindowId = Settings.ParentWindowId; }
public CommandContext(string appPath) { EnsureArgument.NotNullOrWhiteSpace(appPath, nameof(appPath)); ApplicationPath = appPath; Streams = new StandardStreams(); Trace = new Trace(); if (PlatformUtils.IsWindows()) { FileSystem = new WindowsFileSystem(); SessionManager = new WindowsSessionManager(); SystemPrompts = new WindowsSystemPrompts(); Environment = new WindowsEnvironment(FileSystem); Terminal = new WindowsTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem, Trace); Git = new GitProcess( Trace, Environment, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new WindowsSettings(Environment, Git, Trace); } else if (PlatformUtils.IsMacOS()) { FileSystem = new MacOSFileSystem(); SessionManager = new MacOSSessionManager(); SystemPrompts = new MacOSSystemPrompts(); Environment = new PosixEnvironment(FileSystem); Terminal = new MacOSTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem, Trace); Git = new GitProcess( Trace, Environment, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new Settings(Environment, Git); } else if (PlatformUtils.IsLinux()) { FileSystem = new LinuxFileSystem(); // TODO: support more than just 'Posix' or X11 SessionManager = new PosixSessionManager(); SystemPrompts = new LinuxSystemPrompts(); Environment = new PosixEnvironment(FileSystem); Terminal = new LinuxTerminal(Trace); string gitPath = GetGitPath(Environment, FileSystem, Trace); Git = new GitProcess( Trace, Environment, gitPath, FileSystem.GetCurrentDirectory() ); Settings = new Settings(Environment, Git); } else { throw new PlatformNotSupportedException(); } HttpClientFactory = new HttpClientFactory(FileSystem, Trace, Settings, Streams); CredentialStore = new CredentialStore(this); // Set the parent window handle/ID SystemPrompts.ParentWindowId = Settings.ParentWindowId; }