コード例 #1
0
ファイル: MainSettings.cs プロジェクト: zrolfs/pwiz
        public static AccumulationWindow Get(DateTime endWindow, int windowSize)
        {
            if (windowSize < 1)
            {
                throw new ArgumentException("Results time window size has be greater than 0.");
            }

            DateTime startDate;

            try
            {
                startDate = endWindow.AddDays(-(windowSize - 1));
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new ArgumentException("Results time window is too big.");
            }

            var window = new AccumulationWindow
            {
                EndDate   = endWindow,
                StartDate = startDate
            };

            return(window);
        }
コード例 #2
0
            public static AccumulationWindow Get(DateTime endWindow, int windowSize)
            {
                if (windowSize < 1)
                {
                    throw new ArgumentException("Window size has be greater than 0.");
                }
                var window = new AccumulationWindow
                {
                    EndDate   = endWindow,
                    StartDate = endWindow.AddDays(-(windowSize - 1))
                };

                return(window);
            }
コード例 #3
0
        public override string SkylineRunnerArgs(ImportContext importContext, bool toPrint = false)
        {
            // Get the current results time window
            var currentDate        = DateTime.Today;
            var accumulationWindow = AccumulationWindow.Get(currentDate, Settings.ResultsWindow);

            if (toPrint)
            {
                Log("Current results time window is {0} TO {1}",
                    accumulationWindow.StartDate.ToShortDateString(), accumulationWindow.EndDate.ToShortDateString());
            }


            var args = new StringBuilder();

            // Input Skyline file
            args.Append(string.Format(" --in=\"{0}\"", Settings.SkylineFilePath));

            string importOnOrAfter = "";

            if (importContext.ImportExisting)
            {
                // We are importing existing files in the folder.  The import-on-or-after is determined
                // by the last acquisition date on the files already imported in the Skyline document.
                // If the Skyline document does not have any results files, we will import all existing
                // files in the folder.
                if (Settings.LastAcquiredFileDate != DateTime.MinValue)
                {
                    importOnOrAfter = string.Format(" --import-on-or-after={0}", Settings.LastAcquiredFileDate);
                }
            }
            else
            {
                importOnOrAfter = string.Format(" --import-on-or-after={0}",
                                                accumulationWindow.StartDate.ToShortDateString());

                // Add arguments to remove files older than the start of the rolling window.
                args.Append(string.Format(" --remove-before={0}", accumulationWindow.StartDate.ToShortDateString()));
            }

            // Add arguments to import the results file
            args.Append(string.Format(" --import-file=\"{0}\"{1}", importContext.GetCurrentFile(), importOnOrAfter));

            // Save the Skyline file
            args.Append(" --save");

            return(args.ToString());
        }