Exemple #1
0
 void SendPlanDefUpdated(PlanDef pd)
 {
     foreach (var cl in _server.Clients)
     {
         if (cl.IsGui)
         {
             var m = new Net.PlanDefsMessage(new PlanDef[1] {
                 pd
             }, incremental: true);
             _server.SendToSingle(m, cl.Name);
         }
     }
 }
Exemple #2
0
        public bool Equals(PlanDef other)
        {
            if (other == null)
            {
                return(false);
            }

            if (this.Name == other.Name
                &&
                this.AppDefs.SequenceEqual(other.AppDefs)
                )
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        // Checks within a single plan only
        // Does not find cross-plan circular dependencies...
        void CheckDependenciesCircular(PlanDef planDef, AppDef ad, Dictionary <AppIdTuple, bool> depsUsed)
        {
            if (ad.Dependencies is not null)
            {
                foreach (var depName in ad.Dependencies)
                {
                    var depId = new AppIdTuple(depName);
                    if (depsUsed.ContainsKey(depId))
                    {
                        throw new CircularDependencyException($"{planDef.Name}: {ad.Id}: Circular dependency {depName} found.");
                    }
                    // remember this dep
                    depsUsed[depId] = true;

                    // check it recursively
                    var depAppDef = planDef.AppDefs.FirstOrDefault(x => x.Id == depId);
                    if (depAppDef is not null)
                    {
                        CheckDependenciesCircular(planDef, depAppDef, depsUsed);
                    }
                }
            }
        }