public void AddTo(ComponentsList componentsList) { foreach (var fakeTestComponent in _componentSources) { fakeTestComponent.AddTo(componentsList); } }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { // BIG TODO: reengineer command parsing var componentNamePattern = args.LastOrDefault(); if (componentNamePattern == null || componentNamePattern.StartsWith("-") || componentNamePattern.EndsWith("\"")) { logger.Error("No component pattern specified"); return true; } string tags = args.ParseStringParameter("tags"); string licenseUrl = args.ParseStringParameter("licenseUrl"); string projectUrl = args.ParseStringParameter("projectUrl"); string iconUrl = args.ParseStringParameter("iconUrl"); string copyright = args.ParseStringParameter("copyright"); bool requireLicenseAcceptance = args.Contains("-r"); if (licenseUrl == null && requireLicenseAcceptance) { logger.Error("Requiring license acceptance demands a license url"); return true; } var specificComponent = components.FindComponent<IProject>(componentNamePattern, c => c.CanBecomeNugget); if (specificComponent == null) return true; if (specificComponent.PromoteToNuget(logger, packagesOutputDirectory, tags, licenseUrl, projectUrl, iconUrl, copyright, requireLicenseAcceptance) != null) ScanCommand.Rescan(logger, metaProject, components); return true; }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { var destination = args.ParseStringParameter("to", metaProject.LastPublishedTo); if (string.IsNullOrWhiteSpace(destination)) return true; if (!Directory.Exists(destination)) { logger.Error("Could not find destination folder: '{0}'", destination); return true; } metaProject.LastPublishedTo = destination; var componentNamePattern = args.FirstOrDefault(s => !s.StartsWith("-")) ?? ".*"; var list = components.FilterBy(componentNamePattern, nugets: true); var listIsOk = true; foreach (var component in list) if (component is INugetSpec) if (!BuildHelper.PackageExists(component as INugetSpec, packagesOutputDirectory)) { listIsOk = false; logger.ErrorDetail("There is no built package for nuget '{0}'", component.Name); } if (listIsOk) foreach (var component in list) if (component is INugetSpec) BuildHelper.CopyIfNew(logger, component as INugetSpec, packagesOutputDirectory, destination); return true; }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { var nugetNamePattern = args.FirstOrDefault(); if (nugetNamePattern == null || nugetNamePattern.StartsWith("-") || nugetNamePattern.EndsWith("\"")) { logger.Error("No nuget pattern specified"); return true; } var nugetComponent = components.FindComponent<INugetSpec>(nugetNamePattern); if (nugetComponent == null) return true; logger.Info("== Nuget to add: {0}", nugetComponent); var componentNamePattern = args.LastOrDefault(); if (componentNamePattern == null || componentNamePattern.StartsWith("-") || componentNamePattern.EndsWith("\"")) { logger.Error("No component pattern specified"); return true; } var specificComponent = components.FindComponent<IProject>(componentNamePattern); if (specificComponent == null) return true; logger.Info("== Component to reference nuget: {0}", specificComponent); if (specificComponent == nugetComponent) { logger.Error("Nuget can't be added to itself"); return true; } specificComponent.AddNuget(logger, nugetComponent, components, packagesOutputDirectory); return true; }
private void UpdateComponentsList() { ComponentsList.Clear(); foreach (var pair in Components) { if (pair.Value > 0) { if (StackButton.Checked) { int stacks = pair.Value / 64; int mod = pair.Value % 64; if (stacks > 0 && mod > 0) { ComponentsList.Text += stacks.ToString() + " * 64 + " + mod.ToString() + " " + pair.Key + '\n'; } else if (stacks == 0) { ComponentsList.Text += mod.ToString() + " " + pair.Key + '\n'; } else { ComponentsList.Text += stacks.ToString() + " * 64 " + pair.Key + '\n'; } } else { ComponentsList.Text += pair.Value.ToString() + "x " + pair.Key + '\n'; } } } }
private static void AddAllInstanceFactories( IEnumerable <TestComponentSourceRoot> factoryRepositories, ComponentsList componentsViewModel) { foreach (var testComponentInstanceFactoryRepository in factoryRepositories) { testComponentInstanceFactoryRepository.AddTo(componentsViewModel); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { _components = animator.GetComponent<ComponentsList> (); _head = animator.GetBoneTransform (HumanBodyBones.Head); _leftHand = animator.GetBoneTransform (HumanBodyBones.LeftHand); _rightHand = animator.GetBoneTransform (HumanBodyBones.RightHand); _chest = animator.GetBoneTransform (HumanBodyBones.Chest); _spine = animator.GetBoneTransform (HumanBodyBones.Spine); _slot = _components.inventory._currentSlot; UpdateStatePower (animator,stateInfo,layerIndex); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { _components = animator.GetComponent <ComponentsList> (); _head = animator.GetBoneTransform(HumanBodyBones.Head); _leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand); _rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand); _chest = animator.GetBoneTransform(HumanBodyBones.Chest); _spine = animator.GetBoneTransform(HumanBodyBones.Spine); _slot = _components.inventory._currentSlot; UpdateStatePower(animator, stateInfo, layerIndex); }
public void AddComponent(Component c) { c.Location = new System.Drawing.Point(0, 0); c.Name = "ABC"; c.Size = new System.Drawing.Size(100, 100); c.TabIndex = 10; c.SetD(this); ComponentsList.Add(c); this.Controls.Add(c); GC.Collect(); }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { logger.Info("Directories that will be scanned:"); using (logger.Block) foreach (var dir in metaProject.ListOfDirectories) logger.Info(dir); logger.Info("Directories that won't be scanned:"); using (logger.Block) foreach (var dir in metaProject.ListOfExcludedDirectories) logger.Info(dir); Rescan(logger, metaProject, components); return true; }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { var pattern = args.FirstOrDefault(s => !s.StartsWith("-")); bool full = args.Contains("-full") || args.Contains("-f"); bool nugets = args.Contains("-nugets") || args.Contains("-n"); bool orphans = args.Contains("-orphans"); bool solutions = args.Contains("-solutions") || args.Contains("-s"); bool orderByTreeDepth = args.Contains("-orderbytree") || args.Contains("-o"); bool groupByType = (args.Contains("-groupbytype") || args.Contains("-g")) && !nugets; var i = 0; if (solutions) { logger.Info("=========== [Solutions]"); foreach (var solution in components.Solutions) { logger.Info("[{0:0000}] {1}", ++i, solution.ToString()); if (full) using (logger.Block) { int j = 0; foreach (var project in solution.Projects.OrderBy(p => p.Name)) { var component = components.FindMatchingComponent(project); if (component == null) logger.Info("[{0:0000}] Missing project '{1}'", ++j, project.Name); else logger.Info("[{0:0000}] {1}", ++j, component.ToString()); } } } } else { if (string.IsNullOrWhiteSpace(pattern)) { logger.Info("Listing all {0}...", nugets ? "nugets" : "components"); } else { logger.Info("Listing {1} filtered by '{0}' ...", pattern, nugets ? "nugets" : "components"); pattern = pattern.ToLowerInvariant(); } if (orphans) logger.Info("-- only orphan projects"); if (orderByTreeDepth) logger.Info("-- ordered by dependents components tree depth (most referenced first)"); if (groupByType) logger.Info("-- grouped by type"); var lastGroup = ""; foreach (var component in components.FilterBy(pattern, nugets, orderByTreeDepth, groupByType, orphans)) { if (groupByType && component.Type != lastGroup) { lastGroup = component.Type; logger.Info("=========== [{0}]", lastGroup); } logger.Info("[{0:0000}] {1}", ++i, (full ? component.ToLongString() : component.ToString())); } } return true; }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { UpdatePackagesCommand.UpdateDependencies(logger, components, packagesOutputDirectory); var componentNamePattern = args.FirstOrDefault(s => !s.StartsWith("-")); if (!string.IsNullOrWhiteSpace(componentNamePattern)) { var rootComponent = components.FindComponent<IVersionable>(componentNamePattern); if (rootComponent == null) return true; BuildHelper.BuildChain(logger, rootComponent, packagesOutputDirectory, rootComponent.DependentProjects); } else { foreach (var rootComponent in GetPendingForPublishingComponents(logger, components, packagesOutputDirectory)) BuildHelper.BuildChain(logger, rootComponent, packagesOutputDirectory, rootComponent.DependentProjects); } return true; }
private IEnumerable<IVersionable> GetPendingForPublishingComponents(ILogger logger, ComponentsList components, string packagesOutputDirectory) { var list = new List<IVersionable>(); foreach (var component in components.FilterBy(".*", nugets: true)) if (component is INugetSpec && component is IVersionable) if (!BuildHelper.PackageExists(component as INugetSpec, packagesOutputDirectory)) list.Add((IVersionable)component); foreach (var versionable in list) { var isRoot = true; foreach (var other in list) if (versionable.Dependencies.Contains(other)) isRoot = false; if (isRoot) yield return versionable; } }
static void Main(string[] args) { Console.WriteLine("NugetCracker {0}\nSee https://github.com/monoman/NugetCracker\n", Version.ToString(3)); using (_metaProjectPersistence = new MetaProjectPersistence(args.GetMetaProjectFilePath())) { Console.WriteLine("Using {0}", _metaProjectPersistence.FilePath); _components = new ComponentsList(); if (!args.TakeWhile(s => s.ToLowerInvariant() != "-c").Any(s => s.ToLowerInvariant() == "-noscan")) ProcessCommand(new string[] { "scan" }); var inlineCommand = args.SkipWhile(s => s.ToLowerInvariant() != "-c").Skip(1); if (inlineCommand.Count() > 0) { ProcessCommand(inlineCommand); Console.WriteLine("Done!"); } else InteractiveLoop(); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ComponentsList != null) { hashCode = hashCode * 59 + ComponentsList.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } return(hashCode); } }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { bool foundOne = false; var partToBump = ParsePartToBump(logger, args); bool noBuild = args.Where(s => s.StartsWith("-n")).Count() > 0; foreach (var componentNamePattern in args.Where(s => !s.StartsWith("-"))) { foundOne = true; var specificComponent = components.FindComponent<IVersionable>(componentNamePattern); if (specificComponent == null) return true; BumpVersion(logger, specificComponent, partToBump, packagesOutputDirectory, noBuild); } if (!foundOne) { logger.Error("No component pattern specified"); return true; } return true; }
private void OnOpenComponents(object sender, ExecutedRoutedEventArgs e) { try { var view = e.Parameter as ViewPoint; if (view == null) { MessageBox.Show("The selected ViewPoint is null", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } var dialog = new ComponentsList(view.VisInfo.Components); dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; dialog.Show(); } catch (System.Exception ex1) { MessageBox.Show("exception: " + ex1); } }
/// <summary> /// подразумевается, что Components и Exceptions будут созданы с помощью new ComponentsList<>() /// в противном случае, могут возникнуть ошибки /// </summary> /// <param name="Components">компоненты, которые обязаны быть в группе</param> /// <param name="Exceptions">компоненты, которых обязано не быть в группе</param> /// <returns>возвращает ссылку на созданную/существующую группу</returns> public static Group Create(ComponentsList Components, ComponentsList Exceptions, Action <int> OnAdd = null) { if (Components == null) { Debug.LogError("Components == null"); } if (Components.types.GroupBy(g => g).Where(w => w.Count() > 1).Count() != 0) { Debug.LogError("повторяющиеся компоненты при создании группы. Группа будет создана"); } if (Exceptions != null && Exceptions.types.GroupBy(g => g).Where(w => w.Count() > 1).Count() != 0) { Debug.LogError("повторяющиеся исключения при создании группы. Группа будет создана"); } if (Exceptions == null) { Exceptions = new ComponentsList(); } Group group = new Group(Components.types, Exceptions.types); Group exist_group = GetExistGroup(group); if (exist_group != null) { exist_group.group_per_instance++; return(exist_group); } group.OnAddEntity += OnAdd; group.InitDictionary(); group.InitEvents(); groups.Add(group); return(group); }
/// <summary> /// Returns true if OrgApacheFelixSystemreadyImplComponentsCheckProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheFelixSystemreadyImplComponentsCheckProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheFelixSystemreadyImplComponentsCheckProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ComponentsList == other.ComponentsList || ComponentsList != null && ComponentsList.Equals(other.ComponentsList) ) && ( Type == other.Type || Type != null && Type.Equals(other.Type) )); }
public bool Process(ILogger logger, IEnumerable<string> args, MetaProjectPersistence metaProject, ComponentsList components, string packagesOutputDirectory) { var relativePath = string.Join(" ", args.Where(s => !s.StartsWith("-"))); if (string.IsNullOrWhiteSpace(relativePath)) { logger.Error("No relativePath provided"); return true; } bool force = args.Any(s => s.Length > 1 && "-force".StartsWith(s.ToLowerInvariant())); var path = metaProject.ToAbsolutePath(relativePath); if (!Directory.Exists(path)) { logger.Error("The path '{0}' doesn't exist", path); return true; } if (!force) { Console.Write("Exclude directory '{0}' and all subfolders from scanning? [y/N]", path); var answer = Console.ReadLine().Trim().ToLowerInvariant(); if (answer != "y") return true; } metaProject.AddExcludedDirectory(path); components.Prune(path); logger.Info("Directory '{0}' excluded from scanning", relativePath); return true; }
public static void Rescan(ILogger logger, MetaProjectPersistence metaProject, ComponentsList components) { components.Clear(); int scannedDirsCount = 0; foreach (string dir in metaProject.ListOfDirectories) { string path = metaProject.ToAbsolutePath(dir); logger.Info("Scanning '{0}' > '{1}'", dir, path); components.Scan(metaProject, path, _factories, s => { logger.Debug(s); scannedDirsCount++; }); } logger.Info("Scanned {0} directories", scannedDirsCount); logger.Info("Found {0} component{1}", components.Count, components.Count > 1 ? "s" : ""); logger.Info("Found {0} solution{1}", components.Solutions.Count, components.Solutions.Count > 1 ? "s" : ""); logger.Info("Sorting..."); components.SortByName(); logger.Info("Finding dependents..."); components.FindDependents(); logger.Info("Matching solutions to projects..."); components.MatchSolutionsToProjects(); return; }
public static Group Create(ComponentsList Components, Action <int> OnAdd = null) { return(Create(Components, null, OnAdd)); }
public ComponentsPage() { InitializeComponent(); BindingContext = new ComponentsList(); }
UnsubscribeToComponent(ComponentsList[index]);
public FB_Entity() { _Components = new ComponentsList <ComponentX>(); _Components.CollectionChanged += this.OnCollectionChanged; }
public void AddTo(ComponentsList components) { components.Add(_name, _description, _factory); }
private List <StiToken> PostProcessTokensList(List <StiToken> tokensList) { List <StiToken> newList = new List <StiToken>(); tokenPos = 0; while (tokenPos < tokensList.Count) { StiToken token = tokensList[tokenPos]; tokenPos++; if (token.Type == StiTokenType.Identifier) { StiDataSource ds = report.Dictionary.DataSources[token.Value]; StiBusinessObject bos = report.Dictionary.BusinessObjects[token.Value]; #region check for DataSource field if (ds != null) { StringBuilder fieldPath = new StringBuilder(StiNameValidator.CorrectName(token.Value)); while (tokenPos + 1 < tokensList.Count && tokensList[tokenPos].Type == StiTokenType.Dot) { token = tokensList[tokenPos + 1]; string nextName = StiNameValidator.CorrectName(token.Value); StiDataRelation dr = GetDataRelationByName(nextName, ds); if (dr != null) { ds = dr.ParentSource; tokenPos += 2; fieldPath.Append("."); fieldPath.Append(dr.NameInSource); continue; } if (ds.Columns.Contains(nextName)) { tokenPos += 2; fieldPath.Append("."); fieldPath.Append(nextName); break; } foreach (StiDataColumn column in ds.Columns) { if (StiNameValidator.CorrectName(column.Name) == nextName) { tokenPos += 2; fieldPath.Append("."); fieldPath.Append(column.NameInSource); break; } } CheckDataSourceField(ds.Name, nextName); tokenPos += 2; fieldPath.Append("."); fieldPath.Append(nextName); //token = tokensList[tokenPos - 1]; break; } token.Type = StiTokenType.DataSourceField; //надо оптимизировать и сохранять сразу массив строк !!!!! token.Value = fieldPath.ToString(); } #endregion #region check for BusinessObject field else if (bos != null) { StringBuilder fieldPath = new StringBuilder(token.Value); while (tokenPos + 1 < tokensList.Count && tokensList[tokenPos].Type == StiTokenType.Dot) //while (inputExpression[pos2] == '.') { token = tokensList[tokenPos + 1]; string nextName = token.Value; if (bos.Columns.Contains(nextName)) { tokenPos += 2; fieldPath.Append("."); fieldPath.Append(nextName); break; } bos = bos.BusinessObjects[nextName]; if (bos != null) { tokenPos += 2; fieldPath.Append("."); fieldPath.Append(bos.Name); continue; } break; } token.Type = StiTokenType.BusinessObjectField; //надо оптимизировать и сохранять сразу массив строк !!!!! token.Value = fieldPath.ToString(); } #endregion else if ((newList.Count > 0) && (newList[newList.Count - 1].Type == StiTokenType.Dot)) { if (MethodsList.Contains(token.Value)) { token.Type = StiTokenType.Method; } else if (PropertiesList.Contains(token.Value)) { token.Type = StiTokenType.Property; } else { ThrowError(ParserErrorCode.FieldMethodOrPropertyNotFound, token, token.Value); } } else if (TypesList.Contains(token.Value)) { token.Type = StiTokenType.Cast; if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Dot)) { string tempName = token.Value + "." + tokensList[tokenPos + 1].Value; if (FunctionsList.Contains(tempName)) { token.Type = StiTokenType.Function; token.Value = tempName; tokenPos += 2; } if (SystemVariablesList.Contains(tempName)) { token.Type = StiTokenType.SystemVariable; token.Value = tempName; tokenPos += 2; } } } else if (ComponentsList.Contains(token.Value)) { token.Type = StiTokenType.Component; if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Colon) && ComponentsList.Contains(tokensList[tokenPos + 1].Value)) { StiComponent comp = (StiComponent)ComponentsList[tokensList[tokenPos + 1].Value]; if (comp != null && comp is StiDataBand) { token.Value = (comp as StiDataBand).DataSourceName; token.Type = StiTokenType.DataSourceField; tokenPos += 2; } } } else if (FunctionsList.Contains(token.Value)) { while ((StiFunctionType)FunctionsList[token.Value] == StiFunctionType.NameSpace) { if (tokenPos + 1 >= tokensList.Count) { ThrowError(ParserErrorCode.UnexpectedEndOfExpression); } token.Value += "." + tokensList[tokenPos + 1].Value; tokenPos += 2; if (!FunctionsList.Contains(token.Value)) { ThrowError(ParserErrorCode.FunctionNotFound, token, token.Value); } } token.Type = StiTokenType.Function; } else if (SystemVariablesList.Contains(token.Value) && (token.Value != "value" || component is Stimulsoft.Report.CrossTab.StiCrossCell)) { token.Type = StiTokenType.SystemVariable; } //else if (token.Value.ToLowerInvariant() == "true" || token.Value.ToLowerInvariant() == "false") //{ // if (token.Value.ToLowerInvariant() == "true") // token.ValueObject = true; // else // token.ValueObject = false; // token.Type = StiTokenType.Number; //} //else if (token.Value.ToLowerInvariant() == "null") //{ // token.ValueObject = null; // token.Type = StiTokenType.Number; //} else if (ConstantsList.Contains(token.Value)) { while (ConstantsList[token.Value] == namespaceObj) { if (tokenPos + 1 >= tokensList.Count) { ThrowError(ParserErrorCode.UnexpectedEndOfExpression); } string oldTokenValue = token.Value; token.Value += "." + tokensList[tokenPos + 1].Value; tokenPos += 2; if (!ConstantsList.Contains(token.Value)) { ThrowError(ParserErrorCode.ItemDoesNotContainDefinition, token, oldTokenValue, tokensList[tokenPos + 1].Value); } } token.ValueObject = ConstantsList[token.Value]; token.Type = StiTokenType.Number; } else if (report.Dictionary.Variables.Contains(token.Value)) { token.Type = StiTokenType.Variable; } else if (token.Value == "or" || token.Value == "and" || token.Value == "not") { if (token.Value == "or") { token.Type = StiTokenType.DoubleOr; } if (token.Value == "and") { token.Type = StiTokenType.DoubleAnd; } if (token.Value == "not") { token.Type = StiTokenType.Not; } } else { if ((tokenPos < tokensList.Count) && (tokensList[tokenPos].Type != StiTokenType.Dot) || (tokenPos == tokensList.Count)) { CheckDataSourceField(defaultDataSourceName, token.Value); token.Type = StiTokenType.DataSourceField; token.Value = defaultDataSourceName + "." + token.Value; } else { if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Dot)) { CheckDataSourceField(token.Value, tokensList[tokenPos + 1].Value); token.Type = StiTokenType.DataSourceField; token.Value = token.Value + "." + tokensList[tokenPos + 1].Value; tokenPos += 2; } else { ThrowError(ParserErrorCode.NameDoesNotExistInCurrentContext, token, token.Value); } } } } newList.Add(token); } return(newList); }
public void AddTo(ComponentsList components) { components.Add("Filesystem", "Performs various filesystem operations", this); }