예제 #1
0
파일: MegaTools.cs 프로젝트: poulad/MegaGui
        public MegaTools()
        {
            _proc = new Process();
            _proc.StartInfo.CreateNoWindow         = true;
            _proc.StartInfo.UseShellExecute        = false;
            _proc.StartInfo.RedirectStandardInput  = true;
            _proc.StartInfo.RedirectStandardOutput = true;
            _proc.StartInfo.RedirectStandardError  = true;
            _proc.EnableRaisingEvents = true;

            _proc.Exited += _proc_Exited;

            _currentOperation = MegaOperation.NOTHING;

            _whitespaceRegex = new Regex("\\s+");
            _megalsRegex     = new Regex
                                   (@"\w+\s+\w+\s+(?<type>\d)\s+(?<size>\d+|-)\s+(?<date>\d{4}-\d{2}-\d{2})\s+(?<time>\d{2}\:\d{2}\:\d{2})\s+(?<name>.*)",
                                   RegexOptions.IgnoreCase);
        }
예제 #2
0
파일: MegaTools.cs 프로젝트: poulad/MegaGui
        public bool MegaLS()
        {
            if (_currentOperation != MegaOperation.NOTHING)
            {
                return(false);
            }
            else
            {
                _currentOperation = MegaOperation.LIST;
            }

            _proc.StartInfo.FileName  = "megals";
            _proc.StartInfo.Arguments = _megalsArgs;

            _proc.OutputDataReceived += MegaLS_OutputDataReceived;
            _proc.ErrorDataReceived  += MegaLS_ErrorDataReceived;

            bool hasStarted = _proc.Start();

            _proc.BeginOutputReadLine();
            _proc.BeginErrorReadLine();

            return(hasStarted);
        }
예제 #3
0
파일: MegaTools.cs 프로젝트: poulad/MegaGui
 void _proc_Exited(object sender, EventArgs e)
 {
     _currentOperation = MegaOperation.NOTHING;
 }