/// <summary> /// Calculates funcion points /// </summary> public void EstimateFunctionPoints() { ClearVariables(); int numberDets = Dets.Count; if (SendMessage) { numberDets++; } if (GenerateAction) { numberDets++; } ActionFunctionPoints = HelperEstimation.CalculateActionFunctionPoints(Type, numberDets, Files.Count); foreach (UMLFile file in Files) { FilesFunctionPoints += (double)file.FunctionPointsDistribute; } TotalFunctionPoints = Math.Round(ActionFunctionPoints + FilesFunctionPoints, 2); //this.Save(); }
public void EstimateFunctionPoints() { FunctionPointsDistribute = HelperEstimation.CalculateFileFunctionPoints(Type, Dets, Rets); if (this.Collaborations != null && this.Collaborations.Count > 0) { FunctionPointsDistribute = Math.Round(FunctionPointsDistribute / this.Collaborations.Count, 2); } //this.Save(); }
/// <summary> /// Saves the factors list in the profile file /// </summary> /// <typeparam name="ListType">List type</typeparam> /// <param name="appPath">Application path</param> /// <param name="item">Factors List</param> public static void WriteFactorsInProfile <ListType>(ListType item) { string appPath = TUPUX.Entity.Constants.AppPath.Path; HelperEstimation.XMLSerialize <ListType>(appPath + PATH_FACTORS, item); string line = String.Empty; try { // Read Profile using (StreamReader sr = new StreamReader(appPath + PATH_PROFILE)) { line = sr.ReadToEnd(); } } catch (Exception ex) { log.Error("", ex); } if (!String.IsNullOrEmpty(line)) { int beginSection = line.IndexOf(BEGINSECTIONFACTOR); int endSection = line.IndexOf(ENDSECTIONFACTOR); string section = line.Substring(beginSection + BEGINSECTIONFACTOR.Length, endSection - (beginSection + BEGINSECTIONFACTOR.Length)); XslCompiledTransform xslTransformer = new XslCompiledTransform(); using (Stream xsltFile = new FileStream(appPath + PATH_XSL, FileMode.Open)) { using (XmlReader styleSheetReader = XmlReader.Create(xsltFile)) { xslTransformer.Load(styleSheetReader); xslTransformer.Transform(appPath + PATH_FACTORS, appPath + PATH_OUTTEMP); } } using (StreamReader read = new StreamReader(appPath + PATH_OUTTEMP)) { read.ReadLine(); line = line.Replace(section, "\n" + read.ReadToEnd() + "\n"); } using (StreamWriter sw = new StreamWriter(appPath + PATH_PROFILE)) { sw.Write(line); } Helper.IncludeProfile(UMLProfile.ESTIMATION); } }
/// <summary> /// Gets factors list using a file /// </summary> /// <param name="fileName">File Name</param> /// <returns></returns> public static UMLFactorCollection GetFactors(bool defaultFactor) { string fileName = ""; if (defaultFactor) { fileName = pahtFactorsDefault; } else { fileName = pahtFactors; } UMLFactorCollection factors = HelperEstimation.XMLDeserialize <UMLFactorCollection>(fileName); foreach (UMLFactor factor in factors) { factor.MarkLoaded(); } return(factors); }