/// <summary> /// Checks the package dependencies. /// (adding / deleting) /// </summary> /// <param name="repository">The repository.</param> /// <param name="package">The package.</param> public static void CheckPackageDependencies(Repository repository, Package package) { chkPackage = package; pRepository = repository; //ProgressInfo.Info = Resources.stateCheckStType; Manipulation.AddorGetStereotype(pRepository, appSettings.Stereotype, appSettings.Type); DependingPackageList neededDependency = NeededDependencies(chkPackage); DependingPackageList currentDependency = CurrentDependencies(chkPackage); ProgressInfo.Info = Resources.stateUpdCurDep; IEnumerator enumCurrent = currentDependency.GetEnumerator(); enumCurrent.Reset(); ProgressInfo.Maximum = currentDependency.Count; while (enumCurrent.MoveNext()) { ProgressInfo.Next(); DependingPackages dp = (DependingPackages)enumCurrent.Current; if (dp != null) { if (!neededDependency.IsInList(dp.Element1.ElementID, dp.Element2.ElementID)) { DelPackageDependency(dp.Element1, dp.Element2); } DependingPackages needDp = neededDependency.GetItemByElements(dp.Element1.ElementID, dp.Element2.ElementID); if (needDp != null) { if (dp.Connector != null) { dp.Connector.Direction = needDp.Direction; dp.Connector.Update(); } } } } ProgressInfo.Reset(); ProgressInfo.Info = Resources.stateAddNewDep; IEnumerator enumNedded = neededDependency.GetEnumerator(); enumNedded.Reset(); ProgressInfo.Maximum = currentDependency.Count; while (enumNedded.MoveNext()) { ProgressInfo.Next(); DependingPackages dp = (DependingPackages)enumNedded.Current; if (dp != null && !currentDependency.IsInList(dp.Element1.ElementID, dp.Element2.ElementID)) { #pragma warning disable 618 Manipulation.AddConnector(dp.Element1, dp.Element2, string.Empty, dp.Direction, appSettings.Type, appSettings.Stereotype); #pragma warning restore 618 } } ProgressInfo.Info = Resources.stateUpdRep; UpdateDiagrams(); ProgressInfo.Reset(); ProgressInfo.Info = Resources.stateFinished; }