Exemplo n.º 1
0
        private Dictionary <string, StoreFailure> LoadStoreFailures(string failureDirectory)
        {
            Dictionary <string, StoreFailure> failures = new Dictionary <string, StoreFailure>();
            IEnumerable <FileInfo>            files    = FileSearcher.GetFiles(new DirectoryInfo(failureDirectory), "store*.fail", SearchOption.TopDirectoryOnly);

            foreach (FileInfo file in files.OrderBy(f => f.CreationTime))
            {
                try
                {
                    StoreFailure failure = Utils.LoadFromXml <StoreFailure>(file.FullName);

                    if (!string.IsNullOrEmpty(failure.FileName))
                    {
                        failure.Dataset = new DicomDataSet();
                        failure.Dataset.Load(failure.FileName, DicomDataSetLoadFlags.None);
                    }

                    failures.Add(file.FullName, failure);
                }
                catch (Exception e)
                {
                    Messager.ShowError(_View as Form, e);
                }
            }
            return(failures);
        }
Exemplo n.º 2
0
        private void LoadRules()
        {
            if (_Options != null)
            {
                List <RuleItem> rules = new List <RuleItem>();
                List <string>   files = (from f in FileSearcher.GetFiles(new DirectoryInfo(_Options.RuleDirectory), "*.rule", SearchOption.AllDirectories)
                                         orderby f.CreationTime descending
                                         select f.FullName).ToList();

                foreach (string file in files)
                {
                    try
                    {
                        ServerRule rule = LoadRule <ServerRule>(file);

                        rule.Reset();
                        rules.Add(new RuleItem(rule, file));
                    }
                    catch (Exception e)
                    {
                        Logger.Global.SystemException(string.Empty, e);
                    }
                }
                _View.SetRules(rules);
            }
        }
Exemplo n.º 3
0
        private Dictionary <string, MoveServer> LoadMoveFailures(string failureDirectory)
        {
            Dictionary <string, MoveServer> failures = new Dictionary <string, MoveServer>();
            IEnumerable <FileInfo>          files    = FileSearcher.GetFiles(new DirectoryInfo(failureDirectory), "move*.fail", SearchOption.TopDirectoryOnly);

            foreach (FileInfo file in files.OrderBy(f => f.CreationTime))
            {
                try
                {
                    MoveServer server = Utils.LoadFromXml <MoveServer>(file.FullName);

                    server.FileName = file.FullName;
                    failures.Add(file.FullName, server);
                }
                catch (Exception e)
                {
                    Messager.ShowError(_View as Form, e);
                }
            }

            return(failures);
        }