Esempio n. 1
0
        /// <summary>
        /// Converts the relative output file to an absolute file path.
        /// </summary>
        public string GetAbsoluteOutputFile()
        {
            string folder = new FileInfo(FileName).DirectoryName;

            return(Path.Combine(folder, OutputFileName.Replace("/", "\\")));
        }
Esempio n. 2
0
        public override void StepRun(bool serialize, int i, string variety = null, string parameterName = null, double parameterValue = 0)
        {
            if (i == 0)
            {
                ///<Behnam>
                string miName, piName, riName, roiName, siiName, soiName, viName;
                miName  = RunItem.Normal.ManagementItem;
                piName  = RunItem.Normal.ParameterItem;
                riName  = RunItem.Name;
                roiName = RunItem.Normal.RunOptionItem;
                siiName = RunItem.Normal.SiteItem;
                soiName = RunItem.Normal.SoilItem;
                viName  = RunItem.Normal.VarietyItem;

                ManagementItem    mi  = null;
                CropParameterItem pi  = null;
                RunOptionItem     roi = null;
                SiteItem          sii = null;
                SoilItem          soi = null;
                CropParameterItem vi  = null;
                RunCore.GetItems(riName, miName, piName, roiName, siiName, soiName, viName, ref mi, ref pi, ref roi, ref sii, ref soi, ref vi);

                switch (roi.OutputPattern)
                {
                case "V13": ProjectFile.OutputVersion = OutputVersion.V13; break;

                case "V15": ProjectFile.OutputVersion = OutputVersion.V15; break;

                case "Cus": ProjectFile.OutputVersion = OutputVersion.Cus; break;

                case "Maize": ProjectFile.OutputVersion = OutputVersion.Maize; break;
                }
                ///</Behnam>

                ///<Behnam (2016.01.19)>
                ///<Comment>Adding the Summary file to the outputs of a Normal run</Comment>
                var SumOutputFileName = OutputFile.ExtractMultiRunHeader();
                SumOutputFileName.Title = OutputFileName.Replace(OutputExtention, SumOutputExtention);
                Book.Add(SumOutputFileName);

                Run.isFirstYear = true;
                var excelPage = RunCore.Run(RunItem.Name, true, true, ManagementItem, ParameterItem, RunOptionItem, SiteItem, SoilItem, VarietyItem);
                excelPage.Title = OutputFileName;
                Book.Add(excelPage);

                var WarningOutputFileName = OutputFile.ExtractWarningsNormalRun(RunCore.RunInstance);
                WarningOutputFileName.Title = "Warnings";
                Book.Add(WarningOutputFileName);


                if (serialize)
                {
                    RunCore.Save(excelPage, AbsoluteOutputPath, true);
                }

                if (ProjectFile.OutputVersion == OutputVersion.Cus)
                {
                    Run.SecondLine = false;
                    Book[0].Add(OutputFile.ExtractMultiRunLine(RunCore.RunInstance));
                }
                Book[0].Add(OutputFile.ExtractMultiRunLine(RunCore.RunInstance));
                ///</Behnam>
            }
            else
            {
                throw new RunException(RunItem.Name, "Normal run index != 0");
            }
        }