/// <summary/> /// <param name="name">Name of the dependency.</param> /// <param name="version">Version of the dependency.</param> /// <param name="path">Full path to the dependency.</param> /// <param name="targetFramework">TFM of the project to which this dependency belongs.</param> /// <param name="type">Type of the dependency. <see cref="DependencyType"/></param> /// <param name="resolved">Indicates whether this dependency is resolved on disk or not.</param> public DependencyDescription( string name, string version, string path, string targetFramework, DependencyType type, bool resolved) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrEmpty(targetFramework)) { throw new ArgumentNullException(nameof(targetFramework)); } Name = name; Version = version; TargetFramework = targetFramework; Resolved = resolved; Path = path; Type = type; _dependencies = new List <Dependency>(); }
public static string GetNpmInstallArguments(string packageName, string versionRange, DependencyType type, bool global = false, bool saveToPackageJson = true, string otherArguments = "") { string dependencyArguments = ""; if (global) { dependencyArguments = "-g"; } else if (saveToPackageJson) { switch(type) { case DependencyType.Standard: dependencyArguments = "--save"; break; case DependencyType.Development: dependencyArguments = "--save-dev"; break; case DependencyType.Optional: dependencyArguments = "--save-optional"; break; } } otherArguments = otherArguments.TrimStart(' ', '\t'); if (otherArguments.StartsWith("@", StringComparison.Ordinal)) { return string.Format(CultureInfo.InvariantCulture, "install {0}{1} {2}", packageName, otherArguments, dependencyArguments); } else if (!string.IsNullOrEmpty(versionRange)) { return string.Format(CultureInfo.InvariantCulture, "install {0}@\"{1}\" {2} {3}", packageName, versionRange, dependencyArguments, otherArguments); } return string.Format(CultureInfo.InvariantCulture, "install {0} {1} {2}", packageName, dependencyArguments, otherArguments); }
public PlugInDependency(string strName, string strResource, string strLink, DependencyType tType) { this.Name = strName; this.Resource = strResource; this.Link = strLink; this.Type = tType; }
public LocalModulesNode(NodejsProjectNode root, NodeModulesNode parent, string caption, string virtualName, DependencyType dependencyType) : base(root) { _parent = parent; _caption = caption; VirtualName = virtualName; PackagesDependencyType = dependencyType; }
public void Clone(ShaderPropertyDependency src) { isNor = src.isNor; dependencyType = src.dependencyType; dependencyShaderProperty.Clear(); dependencyShaderProperty.AddRange(src.dependencyShaderProperty); }
internal Dependency() { _fileName = string.Empty; _hintPath = string.Empty; _dependencyType = DependencyType.NoDependency; _key = null; }
/// <summary> /// <para>Initializes a new instance of the <see cref="ObjectDependency"/> class /// for deserialization.</para> /// </summary> internal ObjectDependency() { CustomDependency = null; Reference = null; LastUpdatedDate = new DateTime(); Type = new DependencyType(); }
/// <summary> /// Configures NCache to be used as a second level cache for entity framework. /// </summary> /// <param name="cacheId">Cache id that will be used to store result sets.</param> /// <param name="databaseType">Database type that will be used when creating database dependencies.</param> public static void Configure(string cacheId, DependencyType databaseType /*, DbContext context*/) { _cacheId = cacheId; _databaseType = databaseType; _isConfigured = true; }
private AnalysisDriver(string[] packages, string packagePath, bool installMissingPackages, bool installAll, DependencyType depType, bool cleanup, bool wait, Random random, TextWriter logger, TextWriter htmlLogger, int? dumpMembers, bool lowAnalysis, Dictionary<string, RunStats> baselineStats) { _packages = packages; _random = random; _packagePath = packagePath; _installMissingPackages = installMissingPackages; _installAll = installAll; _depType = depType; _cleanup = cleanup; _wait = wait; _logger = logger; _htmlLogger = htmlLogger; _dumpMembers = dumpMembers; _lowAnalysis = lowAnalysis; _baselineStats = baselineStats; WriteCsvHeader(); _jsonResults.Append("["); _npmController = NpmControllerFactory.Create(packagePath, string.Empty); _npmController.OutputLogged += NpmControllerOutputLogged; _npmController.ErrorLogged += NpmControllerErrorLogged; _npmController.Refresh(); if (_installAll) { foreach (var package in _packages) { if (!Directory.Exists(GetInstalledPackagePath(package.Split('@')[0]))) { InstallPackage(package); } } } }
internal NpmPackageInstallWindow(INpmController controller, NpmOutputViewModel executeVm, DependencyType dependencyType = DependencyType.Standard) { DataContext = _vm = new NpmPackageInstallViewModel(executeVm, Dispatcher); _vm.NpmController = controller; InitializeComponent(); DependencyComboBox.SelectedIndex = (int)dependencyType; }
public void Replace(Converter <IStatement, IStatement> converter) { List <IStatement> toRemove = new List <IStatement>(); Dictionary <IStatement, DependencyType> toAdd = new Dictionary <IStatement, DependencyType>(ReferenceEqualityComparer <IStatement> .Instance); Dictionary <IStatement, IOffsetInfo> toAddOffset = new Dictionary <IStatement, IOffsetInfo>(ReferenceEqualityComparer <IStatement> .Instance); foreach (KeyValuePair <IStatement, DependencyType> entry in dependencyTypeOf) { IStatement stmt = entry.Key; IStatement newStmt = Replace(stmt, converter); if (!ReferenceEquals(newStmt, stmt)) { toRemove.Add(stmt); if (newStmt != null) { DependencyType type = entry.Value; offsetIndexOf.TryGetValue(stmt, out IOffsetInfo offsetIndices); if (newStmt is AnyStatement anySt) { DependencyType anyTypes = DependencyType.Requirement | DependencyType.SkipIfUniform; DependencyType otherType = type & ~anyTypes; if (otherType > 0) { // must split Any for these types ForEachStatement(anySt, ist => { Add(toAdd, otherType, ist); if (offsetIndices != default(OffsetInfo)) { AddOffsetIndices(toAddOffset, offsetIndices, ist); } }); type &= anyTypes; } } if (type > 0) { Add(toAdd, type, newStmt); if (offsetIndices != default(OffsetInfo)) { AddOffsetIndices(toAddOffset, offsetIndices, newStmt); } } } } } foreach (IStatement ist in toRemove) { dependencyTypeOf.Remove(ist); offsetIndexOf.Remove(ist); } foreach (KeyValuePair <IStatement, DependencyType> entry in toAdd) { Add(entry.Value, entry.Key); } foreach (KeyValuePair <IStatement, IOffsetInfo> entry in toAddOffset) { AddOffsetIndices(entry.Value, entry.Key); } }
public QueuedNpmCommandInfo(string name, string version, DependencyType depType) { Name = name; Version = version; IsFreeformArgumentCommand = false; DependencyType = depType; }
public Dependency(string name, string version, DependencyType type, Location location) { Name = name; Version = version; Type = type; Location = location; }
public DependencyObject( Type type, DependencyType dependencyType, Func <Type, DependencyObject> resolveConstructorParameter) { Type = type; DependencyType = dependencyType; var constructors = type.GetConstructors(); if (constructors.Length != 1) { throw new ArgumentException("Cannot have multiple constructors in class: " + type.FullName); } _constructorInfo = constructors[0]; var parameters = _constructorInfo.GetParameters(); _constructorParameters = new DependencyObject[parameters.Length]; for (int i = 0; i < parameters.Length; ++i) { _constructorParameters[i] = resolveConstructorParameter(parameters[i].ParameterType); } }
public override async Task <int> ExecuteAsync() { DependencyType type = _options.Type.ToLower() == "toolset" ? DependencyType.Toolset : DependencyType.Product; Local local = new Local(LocalCommands.GetGitDir(Logger), Logger); DependencyDetail dependency = new DependencyDetail { Name = _options.Name, Version = _options.Version ?? string.Empty, RepoUri = _options.RepoUri ?? string.Empty, Commit = _options.Commit ?? string.Empty }; try { await local.AddDependenciesAsync(dependency, type); return(Constants.SuccessCode); } catch (Exception exc) { Logger.LogError(exc, $"Something failed while adding dependency '{dependency.Name}' {dependency.Version}."); return(Constants.ErrorCode); } }
public void AddDependency( DependencyType dependencyType, Project projectFrom, Project.Configuration configFrom, IEnumerable <KeyValuePair <Type, ITarget> > dependencies, IDictionary <KeyValuePair <Type, ITarget>, DependencySetting> dependenciesSetting ) { lock (this) { foreach (KeyValuePair <Type, ITarget> pair in dependencies) { TrackedConfiguration confFrom = FindConfiguration(projectFrom, configFrom); TrackedConfiguration confTo = FindConfiguration(pair.Key, pair.Value); DependencySetting dependencySetting; if (!dependenciesSetting.TryGetValue(pair, out dependencySetting)) { dependencySetting = DependencySetting.Default; } confFrom.AddDependency(confTo, dependencyType, dependencySetting); } } }
public void ManageModules(DependencyType dependencyType = DependencyType.Standard) { CheckNotDisposed(); // Probably overkill to check out before the user actually makes changes, but this is the easiest // and most reliable in the current codebase. if (!EnsurePackageJsonCheckedOut()) { ErrorHelper.ReportPackageJsonNotCheckedOut(Application.Current.MainWindow); return; } if (this.NpmController.RootPackage == null) { this.NpmController.Refresh(); if (this.NpmController.RootPackage == null) { MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.NodeModulesCouldNotParsePackageJsonErrorMessageText, NodejsConstants.PackageJsonFile)); return; } } using (var npmWorker = new NpmWorker(this.NpmController)) using (var manager = new NpmPackageInstallWindow(this.NpmController, npmWorker, dependencyType)) { manager.Owner = Application.Current.MainWindow; manager.ShowModal(); } ReloadHierarchy(); }
/// <summary> /// Add a new dependency to the repository /// </summary> /// <param name="dependency">Dependency to add.</param> /// <param name="dependencyType">Type of dependency.</param> /// <param name="repoUri">Repository URI to add the dependency to.</param> /// <param name="branch">Branch to add the dependency to.</param> /// <returns>Async task.</returns> public async Task AddDependencyAsync( DependencyDetail dependency, DependencyType dependencyType, string repoUri, string branch) { if ((await ParseVersionDetailsXmlAsync(repoUri, branch)).Any( existingDependency => existingDependency.Name.Equals(dependency.Name, StringComparison.OrdinalIgnoreCase))) { throw new DependencyException($"Dependency {dependency.Name} already exists in this repository"); } if (DependencyOperations.TryGetKnownUpdater(dependency.Name, out Delegate function)) { await(Task) function.DynamicInvoke(this, repoUri, branch, dependency); } else { await AddDependencyToVersionsPropsAsync( repoUri, branch, dependency); await AddDependencyToVersionDetailsAsync( repoUri, branch, dependency, dependencyType); } }
public override async Task <int> ExecuteAsync() { DependencyType type = _options.Type.ToLower() == "toolset" ? DependencyType.Toolset : DependencyType.Product; Local local = new Local(Logger); DependencyDetail dependency = new DependencyDetail { Name = _options.Name, Version = _options.Version ?? string.Empty, RepoUri = _options.RepoUri ?? string.Empty, Commit = _options.Commit ?? string.Empty, CoherentParentDependencyName = _options.CoherentParentDependencyName ?? string.Empty, Pinned = _options.Pinned, Type = type, }; try { await local.AddDependencyAsync(dependency); return(Constants.SuccessCode); } catch (FileNotFoundException exc) { Logger.LogError(exc, $"One of the version files is missing. Please make sure to add all files " + "included in https://github.com/dotnet/arcade/blob/main/Documentation/DependencyDescriptionFormat.md#dependency-description-details"); return(Constants.ErrorCode); } catch (Exception exc) { Logger.LogError(exc, $"Failed to add dependency '{dependency.Name}' to repository."); return(Constants.ErrorCode); } }
private static DependencyTestDataPoint CreateTestDataPointFromProperties(DependencyType DependencyType, String DependentModName, DependencyComparisonType DependencyComparisonType, ModVersion DependentModVersion) { var creationStringBuilder = new StringBuilder(); if (DependencyType.Id != DependencyTypeId.Required) { creationStringBuilder.Append($"{DependencyType} "); } creationStringBuilder.Append(DependentModName); if (DependencyComparisonType != null) { creationStringBuilder.Append($" {DependencyComparisonType} {DependentModVersion}"); } return(new DependencyTestDataPoint { CreationString = creationStringBuilder.ToString(), // TODO: will this ever be given a string where the ModVersion is in FactorioVersion format? ExpectedString = creationStringBuilder.ToString(), DependencyType = DependencyType, DependentModName = DependentModName, DependencyComparisonType = DependencyComparisonType, DependentModVersion = DependentModVersion, ObjectFromConstructor = new Dependency(DependencyType, DependentModName, DependencyComparisonType, DependentModVersion), ObjectFromFor = Dependency.For(creationStringBuilder.ToString()) }); }
public void AddRange(DependencyType type, IEnumerable <IStatement> stmts) { foreach (IStatement ist in stmts) { Add(type, ist); } }
public Dependency(DependencyType type, string modName, DependencyComparison comparison, AccurateVersion compareVersion) { Type = type; ModName = modName; Comparison = comparison; CompareVersion = compareVersion; }
/// <summary> /// Creates new instance from <see cref="Asmv1.dependency"/> /// </summary> /// <remarks> /// https://docs.microsoft.com/en-us/visualstudio/deployment/dependency-element-clickonce-application /// Older object with some more data: https://msdn.microsoft.com/en-us/library/k26e96zf.aspx /// </remarks> public Dependency(Asmv1.dependency dep, Manifest baseManifest = null) : this(baseManifest) { var depAsm = dep.dependentAssembly; DependencyType = (DependencyType)Enum.Parse(typeof(DependencyType), depAsm.dependencyType); AllowDelayedBinding = depAsm.allowDelayedBindingSpecified ? depAsm.allowDelayedBinding : (bool?)null; Codebase = depAsm.codebase; if (depAsm.sizeSpecified) { Size = depAsm.size; } var ident = depAsm.assemblyIdentity; Name = ident.name; Version = new Version(ident.version); PublicKeyToken = ident.publicKeyToken; Language = ident.language; Architecture = ident.processorArchitecture; ManifestType = ident.type; if (depAsm.hash != null) // Optional { ParseHash(depAsm.hash, ref HashAlgo, ref HashValue); } }
private int HandleNotKnownManOptPos(string firstTokenString, int dependencyType) { if (dependencyType != 0) { if (firstTokenString.Contains("NOT")) { dependencyType |= DependencyType.GetNot(); } if (firstTokenString.Contains("KNOWN")) { dependencyType |= DependencyType.GetKnown(); } if (firstTokenString.Contains("MANDATORY")) { dependencyType |= DependencyType.GetMandatory(); } if (firstTokenString.Contains("OPTIONALLY")) { dependencyType |= DependencyType.GetOptional(); } if (firstTokenString.Contains("POSSIBLY")) { dependencyType |= DependencyType.GetPossible(); } } return(dependencyType); }
public void QueueInstallPackage( string name, string version, DependencyType type) { QueueCommand(new QueuedNpmCommandInfo(name, version, type)); }
/// <summary> /// Create dependency from name and known bytes /// </summary> public Dependency(string name, byte[] data) { DependencyType = DependencyType.file; Codebase = name; Name = name; internalBytes = data; }
protected override object GetDependency(IAutowireContext context, Node node) { Ensure.Any.IsNotNull(context, nameof(context)); Ensure.Any.IsNotNull(node, nameof(node), opts => opts.WithMessage( "[Ancestor] attribute is only supported on members of a Node type class.")); Ensure.Bool.IsFalse(Enumerable, nameof(node), opts => opts.WithMessage( "[Ancestor] attribute can't be used on an IEnumerable<T> type field or property.")); var ancestor = node; while ((ancestor = ancestor.GetParent()) != null) { if (!DependencyType.IsInstanceOfType(ancestor)) { continue; } return(ancestor); } return(null); }
private static DependencyTestDataPoint GenerateValidRandomizedTestDataPoint() { var random = new Random(); DependencyType dependencyType = DependencyTypeTestData.GenerateValidRandomizedDependencyType(); String dependentModName = random.Next(10) == 0 ? "base" : ModTestData.GenerateValidRandomizedModName(); DependencyComparisonType dependencyComparisonType = null; ModVersion dependentModVersion = null; if (random.Next(6) == 0) { dependencyComparisonType = DependencyComparisonTypeTestData.GenerateValidRandomizedDependencyComparisonType(); if (dependentModName == "base" && random.Next(2) == 0) { dependentModVersion = ModVersion.For(FactorioVersionTestData.GenerateValidRandomizedFactorioVersionString() + ".0"); } else { dependentModVersion = ModVersionTestData.GenerateValidRandomizedModVersion(); } } return(CreateTestDataPointFromProperties( DependencyType: dependencyType, DependentModName: dependentModName, DependencyComparisonType: dependencyComparisonType, DependentModVersion: dependentModVersion )); }
private DependencyDefinition ReadDependency(XmlReader reader) { //Move to <Dependency> element MoveToElement(reader, DependencyElementName); //Prepare Dependency properties Guid uid = Guid.Empty; DependencyType dependencyType = DependencyType.Required; //Read Dependency attributes while (reader.MoveToNextAttribute()) { switch (reader.Name) { case UidAttributeName: uid = reader.ReadContentAsGuid(); break; case DependencyTypeAttributeName: dependencyType = reader.ReadContentAsEnum <DependencyType>(); break; } } //Move back to <Export> element reader.MoveToElement(); DependencyDefinition definition = new DependencyDefinition(uid, dependencyType); return(definition); }
private void fillConstructors(List <Assembly> assemblies) { Constructors = DependencyType .GetConstructors() .Select(x => new Constructor(x, assemblies)) .ToList(); }
/// <summary> /// <para>Deserialize the class data from a stream.</para> /// </summary> /// <param name="reader"> /// <para>The <see cref="IPrimitiveReader"/> that extracts used to extra data from a stream.</para> /// </param> /// <param name="version"> /// <para>The value of <see cref="CurrentVersion"/> that was written to the stream when it was originally serialized to a stream; the version of the <paramref name="reader"/> data.</para> /// </param> public void Deserialize(IPrimitiveReader reader, int version) { if (version == 1) { if (reader.ReadBoolean()) { var keySpace = DataBuffer.DeserializeValue(reader); var descr = LocalCache.Policy.GetDescription(keySpace); var dependencyVersion = reader.ReadInt32(); CustomDependency = (IObjectDependency)descr.Creator(); CustomDependency.Deserialize(reader, dependencyVersion); Type = new DependencyType(); Reference = null; LastUpdatedDate = new DateTime(); } else { CustomDependency = null; Type = (DependencyType)reader.ReadInt32(); Reference = reader.Read <ObjectReference>(false); LastUpdatedDate = reader.ReadDateTime(); } } else { reader.Response = SerializationResponse.Unhandled; } }
private void CancelMove(int moveRequestIndex) { MoveRequest request = Requests[moveRequestIndex]; request.Status = MoveStatus.Cancelled; // Update dependencies on this tank, based on its move being cancelled: for (int i = 0; i < Requests.Length; i++) { if (i != moveRequestIndex && Requests[i].Status == MoveStatus.Unresolved) { // Determine how tank i depends on this tank: DependencyType depType = DependencyMatrix[i, moveRequestIndex]; switch (depType) { case DependencyType.OnNewLeadingEdge: // Since the move is cancelled, the new leading edge will never occur, so is no longer a dependency: DependencyMatrix[i, moveRequestIndex] = DependencyType.None; break; case DependencyType.OnUnchangedBody: case DependencyType.OnOldTrailingEdge: // Since the tank move has been cancelled, its old trailing edge is now blocking tank i's move: CancelMove(i); break; } } } }
internal void ResolveDependencies(object instance, DependencyType dependencyType, object parent, ActinInstantiator parentInstantiator, Director director) { if (director is null) { throw new NullReferenceException("Director may not be null."); } var asActor = instance as Actor_SansType; if (asActor != null) { asActor.Instantiator = this; //Used for automatically disposing child dependencies. asActor.Util = new ActorUtil(asActor, director.Clock); } Func <AccessorInstantiatorPair, bool> notSet = (x) => x.Accessor.GetVal(instance) == null; //Set and Resolve Singletons: foreach (var dep in SingletonDependencies.Where(notSet)) { dep.Accessor.SetVal(instance, dep.Instantiator.GetSingletonInstance(director)); } //Set Child Instances: var unresolvedInstanceDependencies = new List <AccessorInstantiatorPairWithInstance>(); foreach (var dep in InstanceDependencies.Where(notSet)) { var childInstance = dep.Instantiator.CreateNew(); unresolvedInstanceDependencies.Add(new AccessorInstantiatorPairWithInstance { Pair = dep, Instance = childInstance, }); dep.Accessor.SetVal(instance, childInstance); } if (instance != null) //It should never be null, but it doesn't hurt to be safe. //Note that it's important that we called this before we resolved child dependencies. //The director assumes that the order it receives dependencies in is the order in //which they should be initialized. { director.RegisterInjectedDependency(instance); } //Resolve Child Instances: foreach (var dep in unresolvedInstanceDependencies) { dep.Pair.Instantiator.ResolveDependencies(dep.Instance, DependencyType.Instance, instance, this, director); } if (dependencyType == DependencyType.Instance && parent != null) { //Means we can have parents and siblings: foreach (var dep in ParentDependencies.Where(notSet)) { try { dep.Accessor.SetVal(instance, parent); } catch when(dep.Accessor.Markers.Contains(nameof(FlexibleParentAttribute))) { //Swallow the exception, as FlexibleParents may be different types. }
/// <summary> /// Initializes a new instance of the <see cref="DependencyModel"/> class. /// </summary> /// <param name="type">The type.</param> /// <param name="dependencyKey">The dependency key.</param> /// <param name="targetType">Type of the target.</param> /// <param name="isOptional">if set to <c>true</c> [is optional].</param> public DependencyModel(DependencyType type, String dependencyKey, Type targetType, bool isOptional) { dependencyType = type; this.dependencyKey = dependencyKey; this.targetType = targetType; this.isOptional = isOptional; }
public bool HasAnyDependencyOfType(DependencyType type) { foreach (IStatement ist in GetDependenciesOfType(type)) { return(true); } return(false); }
private void miAddDependency_Click(object sender, EventArgs e) { ResourceType c = (ResourceType) tvManifest.SelectedNode.Tag; DependencyType d = new DependencyType(); c.dependency.Add(d); Forms.PropertyEditor.Show(d); tvManifest.SelectedNode.Expand(); }
public DependencyModel(DependencyType dependencyType, string dependencyKey, Type targetType, bool isOptional, bool hasDefaultValue, object defaultValue) { this.targetType = targetType; DependencyType = dependencyType; DependencyKey = dependencyKey; IsOptional = isOptional; HasDefaultValue = hasDefaultValue; DefaultValue = defaultValue; }
/// <summary> /// 创建依赖任务 /// </summary> /// <param name="scheduleId">任务ID</param> /// <param name="dependencyScheduleId">依赖任务ID</param> /// <param name="type">依赖类型</param> /// <returns></returns> public static Dependency CreateDependency(int scheduleId, int dependencyScheduleId, DependencyType type) { var dependency = new Dependency { ScheduleId = scheduleId, }; dependency.SetDependencyType(type); dependency.SetDependency(dependencyScheduleId); return dependency; }
public static void ConfigureDependencies(DependencyType type) { switch (type) { case DependencyType.TEST: ObjectFactory.Initialize(x => x.AddRegistry<TestMode>()); break; case DependencyType.LIVE: ObjectFactory.Initialize(x => x.AddRegistry<LiveMode>()); break; } }
public NpmUninstallCommand( string fullPathToRootPackageDirectory, string packageName, DependencyType type, bool global = false, string pathToNpm = null, bool useFallbackIfNpmNotFound = true) : base(fullPathToRootPackageDirectory, pathToNpm) { Arguments = global ? string.Format("uninstall {0} --g", packageName) : string.Format( "uninstall {0} --{1}", packageName, (type == DependencyType.Standard ? "save" : (type == DependencyType.Development ? "save-dev" : "save-optional"))); }
public NpmInstallCommand( string fullPathToRootPackageDirectory, string packageName, string versionRange, DependencyType type, bool global = false, bool saveToPackageJson = true, string pathToNpm = null, bool useFallbackIfNpmNotFound = true) : base(fullPathToRootPackageDirectory, pathToNpm) { Arguments = NpmArgumentBuilder.GetNpmInstallArguments( packageName, versionRange, type, global, saveToPackageJson); }
public DependencyModel(DependencyType dependencyType, string dependencyKey, Type targetType, bool isOptional, bool hasDefaultValue, object defaultValue) { this.targetType = targetType; if (targetType != null && targetType.IsByRef) { targetItemType = targetType.GetElementType(); } else { targetItemType = targetType; } DependencyType = dependencyType; DependencyKey = dependencyKey; IsOptional = isOptional; HasDefaultValue = hasDefaultValue; DefaultValue = defaultValue; }
/// <summary> /// 设置依赖类型 /// </summary> /// <param name="dependency">依赖类型</param> public void SetDependencyType(DependencyType dependency) { switch (dependency) { case DependencyType.完成开始: DependencyType = DependencyType.完成开始; break; case DependencyType.开始开始: DependencyType = DependencyType.开始开始; break; case DependencyType.完成完成: DependencyType = DependencyType.完成完成; break; case DependencyType.开始完成: DependencyType = DependencyType.开始完成; break; default: throw new ArgumentOutOfRangeException("dependency"); } }
private async Task<bool> InstallPackageByVersionAsync( string packageName, string versionRange, DependencyType type, bool global, bool saveToPackageJson) { _command = new NpmInstallCommand( _npmController.FullPathToRootPackageDirectory, packageName, versionRange, type, global, saveToPackageJson, _npmController.PathToNpm); return await DoCommandExecute(true); }
public void ManageModules(DependencyType dependencyType = DependencyType.Standard) { CheckNotDisposed(); if (NpmController.RootPackage == null) { NpmController.Refresh(); if (NpmController.RootPackage == null) { MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.NodeModulesCouldNotParsePackageJsonErrorMessageText, NodejsConstants.PackageJsonFile)); return; } } using (var executeVm = new NpmOutputViewModel(NpmController)) using (var manager = new NpmPackageInstallWindow(NpmController, executeVm, dependencyType)) { manager.Owner = System.Windows.Application.Current.MainWindow; manager.ShowModal(); } ReloadHierarchy(); }
private ItemType CreateNewItem([NotNull]PageType pageType) { var title = ConfigHelper.GetDefaultItemTitle(pageType); var resIdn = IdGenerator.GenerateUniqueFileName(title, ".html", Course.FullPath); var resource = new ResourceType(resIdn, "webcontent", pageType, resIdn + ".html"); Course.Manifest.resources.Resources.Add(resource); if (pageType == PageType.Question) { string depId = "ExaminationDependency"; if (Course.Manifest.resources[depId] == null) { var depRes = new ResourceType(depId, "webcontent", PageType.Theory, null); depRes.file.Clear(); foreach (string href in HtmlPageBase.__NeededScripts) { depRes.file.Add(new FileType(href)); } foreach (string href in HtmlPageBase.__NeededFiles) { depRes.file.Add(new FileType(href)); } Course.Manifest.resources.Resources.Add(depRes); } DependencyType dep = new DependencyType(); dep.identifierref = depId; resource.dependency.Add(dep); } var node = (IItemContainer)tvItems.SelectedNode.Tag; var resultItem = ItemType.CreateNewItem(title, resIdn, resIdn, pageType); node.SubItems.Add(resultItem); return resultItem; }
/// <summary> /// Initializes a new instance of the <see cref="DependencyModel"/> class. /// </summary> /// <param name="dependencyType">The type.</param> /// <param name="dependencyKey">The dependency key.</param> /// <param name="targetType">Type of the target.</param> /// <param name="isOptional">if set to <c>true</c> [is optional].</param> public DependencyModel(DependencyType dependencyType, String dependencyKey, Type targetType, bool isOptional) : this(dependencyType, dependencyKey, targetType, isOptional, false, null) { }
public QueuedNpmCommandInfo( string name, string version, DependencyType depType) : this(name, version) { DependencyType = depType; IsGlobalInstall = false; }
public void ManageModules(DependencyType dependencyType = DependencyType.Standard, bool isGlobal = false) { CheckNotDisposed(); if (NpmController.RootPackage == null) { NpmController.Refresh(); if (NpmController.RootPackage == null) { MessageBox.Show(String.Format("Unable to parse {0} from your project. Please fix any errors and try again.", NodejsConstants.PackageJsonFile)); return; } } using (var executeVm = new NpmOutputViewModel(NpmController)) using (var manager = new NpmPackageInstallWindow(NpmController, executeVm, dependencyType, isGlobal)) { manager.Owner = System.Windows.Application.Current.MainWindow; manager.ShowModal(); } ReloadHierarchy(); }
public static void DownloadDependency(DependencyType dependencyType) { WaitHandle = new ManualResetEvent(false); // type of dependency to download string name; string filetype; string dependencyDir = null; Uri url; switch (dependencyType) { case DependencyType.ImageMagick: name = "ImageMagick"; filetype = "zip"; dependencyDir = Path.Combine(Cwd, "ImageMagick"); url = new Uri("https://www.nuget.org/api/v2/package/Magick.NET-Q16-x86/"); break; case DependencyType.GhostScript: name = "GhostScript"; filetype = "exe"; url = new Uri("http://downloads.ghostscript.com/public/gs907w32.exe"); break; default: throw new NotSupportedException("Unknown dependecy type"); } // delete previous archives string filename = Path.Combine(Cwd, string.Format("{0}.{1}", name, filetype)); if (File.Exists(filename)) { File.Delete(filename); } // download dependency Console.WriteLine("{0} not found. Please wait while downloading...", name); using (var wc = new WebClient()) { int p = 0; wc.DownloadProgressChanged += (sender, args) => { if (args.ProgressPercentage == p) return; Console.WriteLine("Downloaded {0} of 100%.", args.ProgressPercentage); p = args.ProgressPercentage; }; wc.DownloadFileCompleted += (sender, args) => { Console.WriteLine("Finished downloading {0}.", name); switch (dependencyType) { case DependencyType.ImageMagick: InstallImageMagick(filename, dependencyDir); break; case DependencyType.GhostScript: InstallGhostScript(filename); break; } }; Console.WriteLine("Starting to download..."); wc.DownloadFileAsync(url, filename); WaitHandle.WaitOne(Timeout.Infinite); } }
/// <summary> /// Get all packages which depend on the given package. /// </summary> /// <param name="package">The package for which to check as a dependency</param> /// <param name="type">Dependency types to search for. Defaults to all (including incompatibilities, might not be intended).</param> /// <returns>All packages which found to have a dependency to the given package.</returns> private IEnumerable<InstalledPackageInfo> GetDependingInstalledPackages(Package package, DependencyType type = DependencyType.Inclusion | DependencyType.Incompatibility | DependencyType.Prerequirement | DependencyType.Requirement | DependencyType.Suggestion) { // We expect to have only installed one version of a package at the same time, so we don't check the versions here. return ProfileInfo.InstalledPackages.Where( installedPackage => GetInstalledPackage(installedPackage).Metadata.Dependencies.Any(d => d.Name.Equals(package.Metadata.Id) && type.HasFlag(d.Type)) ); }
public static InitializeResult DependencyDelay(string dependency, DependencyType type) { return new InitializeResult(dependency, type); }
public IDependency AddDependency(IGanttTask fromTask, DependencyType type) { var dependency = new Dependency() { FromTask = fromTask, Type = type }; this.Dependencies.Add(dependency); return dependency; }
public Task<bool> InstallPackageByVersionAsync( string packageName, string versionRange, DependencyType type, bool saveToPackageJson) { return InstallPackageByVersionAsync(_npmController.FullPathToRootPackageDirectory, packageName, versionRange, type, false, saveToPackageJson); }
private Task<bool> InstallPackageByVersionAsync( string pathToRootDirectory, string packageName, string versionRange, DependencyType type, bool global, bool saveToPackageJson) { return DoCommandExecute(true, new NpmInstallCommand( pathToRootDirectory, packageName, versionRange, type, global, saveToPackageJson, _npmController.PathToNpm)); }
protected InitializeResult(string message, DependencyType? dependency) { this.message = message; this.dependency = dependency; }
public async Task<bool> InstallPackageByVersionAsync( string packageName, string versionRange, DependencyType type, bool saveToPackageJson) { return await InstallPackageByVersionAsync(packageName, versionRange, type, false, saveToPackageJson); }
public QueuedNpmCommandInfo(string name,string version, DependencyType depType) { Name = name; Version = version; IsFreeformArgumentCommand = false; DependencyType = depType; }
private static IEnumerable<string> GetComponentDependencies(string component, DependencyType dependencyType) { var allDependencies = new List<string>(); if (!string.IsNullOrEmpty(component) && ComponentsDependencyResolver.ComponentsDefinitionsDictionary.Value.ContainsKey(component)) { var componentDefinitionObject = ComponentsDependencyResolver.ComponentsDefinitionsDictionary.Value[component]; if (dependencyType == DependencyType.Scripts) { if (componentDefinitionObject.Scripts != null) { allDependencies.AddRange(componentDefinitionObject.Scripts); } } else { if (componentDefinitionObject.AngularModules != null) { allDependencies.AddRange(componentDefinitionObject.AngularModules); } } if (componentDefinitionObject.Components != null && dependencyType == DependencyType.Scripts) { foreach (var comp in componentDefinitionObject.Components) { allDependencies.AddRange(ComponentsDependencyResolver.GetComponentDependencies(comp, dependencyType)); } } } else { Log.Write(string.Format(System.Globalization.CultureInfo.InvariantCulture, "The component {0} could not be resolved", component)); } return allDependencies.Distinct(); }