/// <summary> /// Initializes a new instance of <see cref="ModuleInfo"/>. /// </summary> /// <param name="name">The module's name.</param> /// <param name="type">The module <see cref="Type"/>'s AssemblyQualifiedName.</param> /// <param name="dependsOn">The modules this instance depends on.</param> /// <exception cref="ArgumentNullException">An <see cref="ArgumentNullException"/> is thrown if <paramref name="dependsOn"/> is <see langword="null"/>.</exception> public ModuleInfo(string name, string type, params string[] dependsOn) { if (Type.GetType(type) == null) { throw new ArgumentNullException(nameof(type)); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } if (dependsOn == null) { throw new ArgumentNullException(nameof(dependsOn)); } ModuleName = name; ModuleType = type; foreach (string dependency in dependsOn) { if (!DependsOn.Contains(dependency)) { DependsOn.Add(dependency); } } }
public void AddDependsOn(Project p) { if (!DependsOn.Contains(p)) { DependsOn.Add(p); } if (!p.IsDependencyFor.Contains(this)) { p.IsDependencyFor.Add(this); } }
public virtual ManifestModuleInfo LoadFromExternalManifest(ExternalModuleManifest manifest, ExternalModuleManifestVersion version) { if (manifest == null) { throw new ArgumentNullException(nameof(manifest)); } ModuleName = manifest.Id; if (version.Dependencies != null) { foreach (var dependency in version.Dependencies) { DependsOn.Add(dependency.Id); } } Id = manifest.Id; Version = version.SemanticVersion; VersionTag = version.VersionTag; PlatformVersion = version.PlatformSemanticVersion; ReleaseNotes = version.ReleaseNotes; Ref = version.PackageUrl; if (version.Dependencies != null) { Dependencies.AddRange(version.Dependencies.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } if (version.Incompatibilities != null) { Incompatibilities.AddRange(version.Incompatibilities.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } Title = manifest.Title; Description = manifest.Description; Authors = manifest.Authors; Owners = manifest.Owners; LicenseUrl = manifest.LicenseUrl; ProjectUrl = manifest.ProjectUrl; IconUrl = manifest.IconUrl; RequireLicenseAcceptance = manifest.RequireLicenseAcceptance; Copyright = manifest.Copyright; Tags = manifest.Tags; Identity = new ModuleIdentity(Id, Version); if (manifest.Groups != null) { Groups.AddRange(manifest.Groups); } return(this); }
void test(Finder finder, string it) { if (it[0] == ' ') { it = it.Remove(0, 1); } if (it == "..") { return; } var sp = it.Split('/'); var currentPath = Directory.Replace(Name, string.Empty); for (int j = 0; j < sp.Length; j++) { if (sp[j] == ".") { } else if (sp[j] == "..") { var vv = currentPath.Split(Path.DirectorySeparatorChar); currentPath = currentPath.Replace(Path.DirectorySeparatorChar + vv[vv.Length - 2], string.Empty); } else { currentPath += sp[j]; if (j != sp.Length - 1) { currentPath += Path.DirectorySeparatorChar; } } } Item found = finder.Items.Where(e => e.Directory.Contains(currentPath)).FirstOrDefault(); if (found != null) { if (found != this) { found.Dependencies.Add(this); DependsOn.Add(found); } } }
protected override void FindDependentVariables(IEnumerable <MetaVariable <H, I> > allVariables) { DependsOn.Add(allVariables.Single(d => d.MetaProperty == this.BasedOnMetaProperty)); }
public void Add(object item) { if (IgnoreDecl) { return; } else if (item is P_Root.MachineSends) { MachineSends.Add(item as P_Root.MachineSends); } else if (item is P_Root.MachineReceives) { MachineReceives.Add(item as P_Root.MachineReceives); } else if (item is P_Root.MachineProtoDecl) { MachineProtoDecls.Add(item as P_Root.MachineProtoDecl); } else if (item is P_Root.FunProtoDecl) { FunProtoDecls.Add(item as P_Root.FunProtoDecl); } else if (item is P_Root.MachineExports) { MachineExports.Add(item as P_Root.MachineExports); } else if (item is P_Root.EventSetContains) { EventSetContains.Add(item as P_Root.EventSetContains); } else if (item is P_Root.EventSetDecl) { EventSetDecl.Add(item as P_Root.EventSetDecl); } else if (item is P_Root.InterfaceTypeDef) { InterfaceTypeDef.Add(item as P_Root.InterfaceTypeDef); } else if (item is P_Root.ObservesDecl) { Observes.Add(item as P_Root.ObservesDecl); } else if (item is P_Root.Annotation) { Annotations.Add(item as P_Root.Annotation); } else if (item is P_Root.DoDecl) { Dos.Add(item as P_Root.DoDecl); } else if (item is P_Root.AnonFunDecl) { AnonFunctions.Add(item as P_Root.AnonFunDecl); } else if (item is P_Root.FunDecl) { Functions.Add(item as P_Root.FunDecl); } else if (item is P_Root.TransDecl) { Transitions.Add(item as P_Root.TransDecl); } else if (item is P_Root.VarDecl) { Variables.Add(item as P_Root.VarDecl); } else if (item is P_Root.StateDecl) { States.Add(item as P_Root.StateDecl); } else if (item is P_Root.MachineDecl) { Machines.Add(item as P_Root.MachineDecl); } else if (item is P_Root.EventDecl) { Events.Add(item as P_Root.EventDecl); } else if (item is P_Root.ModelType) { ModelTypes.Add(item as P_Root.ModelType); } else if (item is P_Root.EnumTypeDef) { EnumTypeDefs.Add(item as P_Root.EnumTypeDef); } else if (item is P_Root.TypeDef) { TypeDefs.Add(item as P_Root.TypeDef); } else if (item is P_Root.DependsOn) { DependsOn.Add(item as P_Root.DependsOn); } else if (item is P_Root.FunProtoCreatesDecl) { FunProtoCreates.Add(item as P_Root.FunProtoCreatesDecl); } else { throw new Exception("Cannot add into the Program : " + item.ToString()); } }
public void Add(object item) { if (item is P_Root.AnyTypeDecl) { AnyTypeDecl.Add(item as P_Root.AnyTypeDecl); } else if (item is P_Root.MachineSends) { MachineSends.Add(item as P_Root.MachineSends); } else if (item is P_Root.MachineReceives) { MachineReceives.Add(item as P_Root.MachineReceives); } else if (item is P_Root.EventSetContains) { EventSetContains.Add(item as P_Root.EventSetContains); } else if (item is P_Root.EventSetDecl) { EventSetDecl.Add(item as P_Root.EventSetDecl); } else if (item is P_Root.InterfaceDef) { InterfaceDef.Add(item as P_Root.InterfaceDef); } else if (item is P_Root.ObservesDecl) { Observes.Add(item as P_Root.ObservesDecl); } else if (item is P_Root.Annotation) { Annotations.Add(item as P_Root.Annotation); } else if (item is P_Root.DoDecl) { Dos.Add(item as P_Root.DoDecl); } else if (item is P_Root.AnonFunDecl) { AnonFunctions.Add(item as P_Root.AnonFunDecl); } else if (item is P_Root.FunDecl) { Functions.Add(item as P_Root.FunDecl); } else if (item is P_Root.TransDecl) { Transitions.Add(item as P_Root.TransDecl); } else if (item is P_Root.VarDecl) { Variables.Add(item as P_Root.VarDecl); } else if (item is P_Root.StateDecl) { States.Add(item as P_Root.StateDecl); } else if (item is P_Root.MachineDecl) { Machines.Add(item as P_Root.MachineDecl); } else if (item is P_Root.MachineCard) { MachineCards.Add(item as P_Root.MachineCard); } else if (item is P_Root.MachineKind) { MachineKinds.Add(item as P_Root.MachineKind); } else if (item is P_Root.MachineStart) { MachineStarts.Add(item as P_Root.MachineStart); } else if (item is P_Root.EventDecl) { Events.Add(item as P_Root.EventDecl); } else if (item is P_Root.EnumTypeDef) { EnumTypeDefs.Add(item as P_Root.EnumTypeDef); } else if (item is P_Root.TypeDef) { TypeDefs.Add(item as P_Root.TypeDef); } else if (item is P_Root.DependsOn) { DependsOn.Add(item as P_Root.DependsOn); } else { throw new Exception("Cannot add into the Program : " + item); } }