Exemplo n.º 1
0
        public static bool UnixTryRunProgramInternal(EnsureInternal yes, string exe, string args, int timeout = Timeout.Infinite)
        {
            if (exe._IsEmpty())
            {
                throw new ArgumentNullException(nameof(exe));
            }
            args = args._NonNull();

            try
            {
                ProcessStartInfo info = new ProcessStartInfo()
                {
                    FileName               = exe,
                    Arguments              = args,
                    UseShellExecute        = false,
                    RedirectStandardOutput = false,
                    RedirectStandardError  = false,
                    RedirectStandardInput  = false,
                    CreateNoWindow         = true,
                    WorkingDirectory       = Env.AppRootDir,
                };

                using (Process p = Process.Start(info) !)
                {
                    return(p.WaitForExit(timeout));
                }
            }
            catch (Exception ex)
            {
                ex._Debug();
            }

            return(false);
        }
Exemplo n.º 2
0
        public static bool UnixTryRunSystemProgram(EnsureInternal yes, string commandName, string args, int timeout = Timeout.Infinite)
        {
            string[] dirs = { "/sbin/", "/bin/", "/usr/bin/", "/usr/local/bin/", "/usr/local/sbin/", "/usr/local/bin/" };

            foreach (string dir in dirs)
            {
                if (UnixTryRunProgramInternal(yes, Path.Combine(dir, commandName), args, timeout))
                {
                    return(true);
                }
            }

            return(false);
        }
 internal FileSystemBasedProvider(EnsureInternal yes, FileSystem underlayFileSystem, string rootDirectory, bool ignoreCase = true)
 {
     try
     {
         this.IgnoreCase  = ignoreCase;
         this.FileSystem  = new ChrootFileSystem(new ChrootFileSystemParam(underlayFileSystem, rootDirectory, FileSystemMode.ReadOnly));
         ProviderForWatch = this.FileSystem._CreateFileProviderForWatchInternal(EnsureInternal.Yes, "/");
     }
     catch
     {
         this._DisposeSafe();
         throw;
     }
 }
        internal FsBasedFileProviderFileInfoImpl(EnsureInternal yes, FileSystemBasedProvider provider, string fullPath, bool exists, bool isDirectroy, long length, string?physicalPath, string?name, DateTimeOffset lastModified)
        {
            this.Provider = provider;
            this.FullPath = fullPath;

            this.Exists = exists;

            if (this.Exists)
            {
                this.IsDirectory = isDirectroy;

                if (this.IsDirectory == false)
                {
                    this.Length = length;
                }

                this.PhysicalPath = physicalPath._NullCheck();
                this.Name         = name._NullCheck();
                this.LastModified = lastModified;
            }
        }
Exemplo n.º 5
0
 public void InternalSetMode(EnsureInternal yes, CoresMode mode)
 {
     this.Mode = mode;
 }
Exemplo n.º 6
0
 internal AcmeAccount(EnsureInternal yes, AcmeClient client, PrivKey privKey, string accountUrl)
 {
     this.Client     = client;
     this.PrivKey    = privKey;
     this.AccountUrl = accountUrl;
 }