Exemple #1
0
        public void Start()
        {
            if (!Directory.Exists(Path.GetDirectoryName(LogFile)))
            {
                _ = Directory.CreateDirectory(Path.GetDirectoryName(LogFile));
            }

            if (!File.Exists(LogFile))
            {
                using (var stream = new FileStream(LogFile, FileMode.OpenOrCreate, FileAccess.Read)) { }
            }

            var bashfile = BashFile.Create();
            var command  = $@"bash.exe -c '{Cygwin.GetCygwinPath(bashfile)}'";

            Process = new ProcessRunner("bash.exe", $"-c '{Cygwin.GetCygwinPath(bashfile)}'");
            Process.StatusChanged += Process_StatusChanged;

            Tail.Run();

            File.WriteAllText(LogFile, $@"Command:
{command}

Rsync Command:
{File.ReadAllText(bashfile)}".Replace(System.Environment.NewLine, "\n")
                              );

            Process.Start();
        }
 public BashFile(string pFrom, string pTo, string pLogFile)
 {
     From    = Cygwin.GetCygwinPath(pFrom);
     To      = Cygwin.GetCygwinPath(pTo);
     LogFile = Cygwin.GetCygwinPath(pLogFile);
 }