Example #1
0
        private void InitializeFileWatcher(IEnumerable <string> args)
        {
            if (args.Count() == 0)
            {
                return;
            }
            var file = new FileInfo(args.ElementAt(0));

            if (!file.Exists)
            {
                throw Fault
                      .Missing("File to watch", file.FullName);
            }

            var wtchr = new FileSystemWatcher(file.DirectoryName, file.Name);

            wtchr.Deleted += (s, e) =>
                             _ui.Send(_ =>
            {
                throw new FileNotFoundException($"Watched file deleted.{L.f}{file.FullName}");
            },
                                      null);

            wtchr.EnableRaisingEvents = true;
        }
Example #2
0
        private static string FindMyIniFile(string uniserverBaseDir)
        {
            var iniPath = Path.Combine(uniserverBaseDir, MY_INI_URI);

            if (!File.Exists(iniPath))
            {
                throw Fault.Missing("MariaDB ini file", iniPath);
            }

            return(iniPath);
        }
Example #3
0
        private string GetSampleFile(string filename)
        {
            const string DIR  = @"SDK.WPF45.Tests\Compression";
            var          topD = AppDomain.CurrentDomain.BaseDirectory;
            var          path = Path.Combine(topD, DIR, filename);

            if (!File.Exists(path))
            {
                throw Fault.Missing(filename, path);
            }
            return(path);
        }
Example #4
0
        private bool ValidateTargetFile()
        {
            if (TargetPath.IsBlank())
            {
                SetStatus(Fault.BlankText("Target File Path").Message);
                return(false);
            }

            if (!_file.Found(TargetPath))
            {
                SetStatus(Fault.Missing("Target Local Package File", TargetPath).Message);
                return(false);
            }

            return(true);
        }