Пример #1
0
        public bool Run()
        {
            if (State == Status.Running)
            {
                return(true);
            }

            var workingDirRel = WorkingDirectoryMask.Replace("%count%", RunCount.ToString());

            WorkingDirectory = System.IO.Path.Combine(BaseDirectory, workingDirRel);

            while (System.IO.Directory.Exists(WorkingDirectory))
            {
                RunCount++;
                workingDirRel    = WorkingDirectoryMask.Replace("%count%", RunCount.ToString());
                WorkingDirectory = System.IO.Path.Combine(BaseDirectory, workingDirRel);
            }

            try {
                if (!Nodes.All(n => n.PrepareProcessing()))
                {
                    return(false);
                }
            } catch (Exception e) {
                System.Diagnostics.Debug.WriteLine($"Graph.Run Exception: {e}");
                return(false);
            }

            OsClock.Start();
            Nodes.ForEach(n => n.StartProcessing());

            State = Status.Running;

            foreach (var dev in _devices)
            {
                if (HasActivePorts(dev) && !dev.StartSampling())
                {
                    Stop();
                    return(false);
                }
            }

            return(true);
        }