Пример #1
0
        public string GetPrefixNamespaceAndClass()
        {
            var pieces          = FullyQualifiedName.Split('.').ToList();
            var namespacePieces = pieces.Take(pieces.Count - 1);

            return(String.Join(".", namespacePieces));
        }
Пример #2
0
        public virtual int CompareTo(IMethod value)
        {
            int cmp;

            cmp = base.CompareTo((IDecoration)value);

            if (cmp != 0)
            {
                return(cmp);
            }

            if (FullyQualifiedName != null)
            {
                cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
                if (cmp != 0)
                {
                    return(cmp);
                }
            }

            cmp = this.TypeParameters.Count - value.TypeParameters.Count;
            if (cmp != 0)
            {
                return(cmp);
            }

            return(DiffUtility.Compare(Parameters, value.Parameters));
        }
Пример #3
0
        private bool TryRecognizeSimpleLiteralExpression(
            FullyQualifiedName fullyQualifiedName,
            EbnfLexerRuleExpression ebnfLexerRule,
            out ILexerRule lexerRule)
        {
            lexerRule = null;

            if (ebnfLexerRule.NodeType != EbnfNodeType.EbnfLexerRuleExpression)
            {
                return(false);
            }

            var term = ebnfLexerRule.Term;

            if (term.NodeType != EbnfNodeType.EbnfLexerRuleTerm)
            {
                return(false);
            }

            var factor = term.Factor;

            if (factor.NodeType != EbnfNodeType.EbnfLexerRuleFactorLiteral)
            {
                return(false);
            }

            var literal = factor as EbnfLexerRuleFactorLiteral;

            lexerRule = new StringLiteralLexerRule(
                literal.Value,
                new TokenType(fullyQualifiedName.FullName));

            return(true);
        }
Пример #4
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 31 + FullyQualifiedName.GetHashCode();
            hash = hash * 31 + Source.GetHashCode();
            return(hash);
        }
Пример #5
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (FullyQualifiedName.Expression != null)
            {
                targetCommand.AddParameter("FullyQualifiedName", FullyQualifiedName.Get(context));
            }

            if (All.Expression != null)
            {
                targetCommand.AddParameter("All", All.Get(context));
            }

            if (ListAvailable.Expression != null)
            {
                targetCommand.AddParameter("ListAvailable", ListAvailable.Get(context));
            }

            if (Refresh.Expression != null)
            {
                targetCommand.AddParameter("Refresh", Refresh.Get(context));
            }

            if (PSSession.Expression != null)
            {
                targetCommand.AddParameter("PSSession", PSSession.Get(context));
            }

            if (CimSession.Expression != null)
            {
                targetCommand.AddParameter("CimSession", CimSession.Get(context));
            }

            if (CimResourceUri.Expression != null)
            {
                targetCommand.AddParameter("CimResourceUri", CimResourceUri.Get(context));
            }

            if (CimNamespace.Expression != null)
            {
                targetCommand.AddParameter("CimNamespace", CimNamespace.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Пример #6
0
 public InterfaceDefinition Initialize()
 {
     SourceUrl =
         "https://raw.githubusercontent.com/" +
         Project.Repository.Owner.GitHubAccountName + "/" +
         Project.ProjectName + "/master/" +
         FullyQualifiedName.Replace('.', '/') + ".cs";
     return(this);
 }
Пример #7
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = FullyQualifiedName?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ContainingAssemblyPath?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Пример #8
0
        public override bool Equals(object obj)
        {
            VisualStudioTestIdentifier test = obj as VisualStudioTestIdentifier;

            if (test != null)
            {
                return(FullyQualifiedName.Equals(test.FullyQualifiedName, StringComparison.Ordinal));
            }
            else
            {
                return(base.Equals(obj));
            }
        }
Пример #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (SearchResultType != global::Google.Cloud.DataCatalog.V1.SearchResultType.Unspecified)
            {
                hash ^= SearchResultType.GetHashCode();
            }
            if (SearchResultSubtype.Length != 0)
            {
                hash ^= SearchResultSubtype.GetHashCode();
            }
            if (RelativeResourceName.Length != 0)
            {
                hash ^= RelativeResourceName.GetHashCode();
            }
            if (LinkedResource.Length != 0)
            {
                hash ^= LinkedResource.GetHashCode();
            }
            if (modifyTime_ != null)
            {
                hash ^= ModifyTime.GetHashCode();
            }
            if (systemCase_ == SystemOneofCase.IntegratedSystem)
            {
                hash ^= IntegratedSystem.GetHashCode();
            }
            if (systemCase_ == SystemOneofCase.UserSpecifiedSystem)
            {
                hash ^= UserSpecifiedSystem.GetHashCode();
            }
            if (FullyQualifiedName.Length != 0)
            {
                hash ^= FullyQualifiedName.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            hash ^= (int)systemCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #10
0
        private ILexerRule LexerRuleExpression(
            FullyQualifiedName fullyQualifiedName,
            PdlLexerRuleExpression ebnfLexerRule)
        {
            if (TryRecognizeSimpleLiteralExpression(fullyQualifiedName, ebnfLexerRule, out ILexerRule lexerRule))
            {
                return(lexerRule);
            }

            var nfa = LexerRuleExpression(ebnfLexerRule);
            var dfa = _nfaToDfaAlgorithm.Transform(nfa);

            return(new DfaLexerRule(dfa, fullyQualifiedName.FullName));
        }
Пример #11
0
        public virtual int CompareTo(IProperty value)
        {
            int cmp;

            if (FullyQualifiedName != null)
            {
                cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
                if (cmp != 0)
                {
                    return(cmp);
                }
            }

            return(DiffUtility.Compare(Parameters, value.Parameters));
        }
Пример #12
0
        public virtual int CompareTo(IEvent value)
        {
            int cmp;

            if (0 != (cmp = base.CompareTo((IEntity)value)))
            {
                return(cmp);
            }

            if (FullyQualifiedName != null)
            {
                return(FullyQualifiedName.CompareTo(value.FullyQualifiedName));
            }

            return(0);
        }
Пример #13
0
        public virtual int CompareTo(IField field)
        {
            int cmp;

            cmp = base.CompareTo((IEntity)field);
            if (cmp != 0)
            {
                return(cmp);
            }

            if (FullyQualifiedName != null)
            {
                return(FullyQualifiedName.CompareTo(field.FullyQualifiedName));
            }
            return(0);
        }
Пример #14
0
        public virtual int CompareTo(IClass value)
        {
            int cmp;

            if (0 != (cmp = base.CompareTo((IDecoration)value)))
            {
                return(cmp);
            }

            if (FullyQualifiedName != null)
            {
                cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
                if (cmp != 0)
                {
                    return(cmp);
                }
                return(this.TypeParameters.Count - value.TypeParameters.Count);
            }
            return(-1);
        }
Пример #15
0
        /// <summary>
        /// Reports an error if no modules were removed...
        /// </summary>
        protected override void EndProcessing()
        {
            // Write an error record if specific modules were to be removed.
            // By specific, we mean either a name sting with no wildcards or
            // or a PSModuleInfo object. If the removal request only includes patterns
            // then we won't write the error.

            if (_numberRemoved == 0 && !MyInvocation.BoundParameters.ContainsKey("WhatIf"))
            {
                bool hasWildcards   = true;
                bool isEngineModule = true;
                foreach (string n in _name)
                {
                    if (!InitialSessionState.IsEngineModule(n))
                    {
                        isEngineModule = false;
                    }

                    if (!WildcardPattern.ContainsWildcardCharacters(n))
                    {
                        hasWildcards = false;
                    }
                }

                if (FullyQualifiedName != null && (FullyQualifiedName.Any(moduleSpec => !InitialSessionState.IsEngineModule(moduleSpec.Name))))
                {
                    isEngineModule = false;
                }

                if (!isEngineModule && (!hasWildcards || _moduleInfo.Length != 0 || (FullyQualifiedName != null && FullyQualifiedName.Length != 0)))
                {
                    string message = StringUtil.Format(Modules.NoModulesRemoved);
                    InvalidOperationException invalidOp = new InvalidOperationException(message);
                    ErrorRecord er = new ErrorRecord(invalidOp, "Modules_NoModulesRemoved",
                                                     ErrorCategory.ResourceUnavailable, null);
                    WriteError(er);
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Write out the specified modules...
        /// </summary>
        protected override void ProcessRecord()
        {
            // Name and FullyQualifiedName should not be specified at the same time.
            // Throw out terminating error if this is the case.
            if ((Name != null) && (FullyQualifiedName != null))
            {
                string      errMsg = StringUtil.Format(SessionStateStrings.GetContent_TailAndHeadCannotCoexist, "Name", "FullyQualifiedName");
                ErrorRecord error  = new ErrorRecord(new InvalidOperationException(errMsg), "NameAndFullyQualifiedNameCannotBeSpecifiedTogether", ErrorCategory.InvalidOperation, null);
                ThrowTerminatingError(error);
            }

            // -SkipEditionCheck only makes sense for -ListAvailable (otherwise the module is already loaded)
            if (SkipEditionCheck && !ListAvailable)
            {
                ErrorRecord error = new ErrorRecord(
                    new InvalidOperationException(Modules.SkipEditionCheckNotSupportedWithoutListAvailable),
                    nameof(Modules.SkipEditionCheckNotSupportedWithoutListAvailable),
                    ErrorCategory.InvalidOperation,
                    targetObject: null);

                ThrowTerminatingError(error);
            }

            var strNames = new List <string>();

            if (Name != null)
            {
                strNames.AddRange(Name);
            }

            var moduleSpecTable = new Dictionary <string, ModuleSpecification>(StringComparer.OrdinalIgnoreCase);

            if (FullyQualifiedName != null)
            {
                for (int modSpecIndex = 0; modSpecIndex < FullyQualifiedName.Length; modSpecIndex++)
                {
                    FullyQualifiedName[modSpecIndex] = FullyQualifiedName[modSpecIndex].WithNormalizedName(Context, SessionState.Path.CurrentLocation.Path);
                }

                moduleSpecTable = FullyQualifiedName.ToDictionary(moduleSpecification => moduleSpecification.Name, StringComparer.OrdinalIgnoreCase);
                strNames.AddRange(FullyQualifiedName.Select(spec => spec.Name));
            }

            string[] names = strNames.Count > 0 ? strNames.ToArray() : null;

            if (ParameterSetName.Equals(ParameterSet_Loaded, StringComparison.OrdinalIgnoreCase))
            {
                AssertNameDoesNotResolveToAPath(names,
                                                Modules.ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames,
                                                "ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames");
                GetLoadedModules(names, moduleSpecTable, this.All);
            }
            else if (ParameterSetName.Equals(ParameterSet_AvailableLocally, StringComparison.OrdinalIgnoreCase))
            {
                if (ListAvailable.IsPresent)
                {
                    GetAvailableLocallyModules(names, moduleSpecTable, this.All);
                }
                else
                {
                    AssertNameDoesNotResolveToAPath(names,
                                                    Modules.ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames,
                                                    "ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames");
                    GetLoadedModules(names, moduleSpecTable, this.All);
                }
            }
            else if (ParameterSetName.Equals(ParameterSet_AvailableInPsrpSession, StringComparison.OrdinalIgnoreCase))
            {
                AssertListAvailableMode();
                AssertNameDoesNotResolveToAPath(names,
                                                Modules.RemoteDiscoveryWorksOnlyForUnQualifiedNames,
                                                "RemoteDiscoveryWorksOnlyForUnQualifiedNames");

                GetAvailableViaPsrpSession(names, moduleSpecTable, this.PSSession);
            }
            else if (ParameterSetName.Equals(ParameterSet_AvailableInCimSession, StringComparison.OrdinalIgnoreCase))
            {
                AssertListAvailableMode();
                AssertNameDoesNotResolveToAPath(names,
                                                Modules.RemoteDiscoveryWorksOnlyForUnQualifiedNames,
                                                "RemoteDiscoveryWorksOnlyForUnQualifiedNames");

                GetAvailableViaCimSession(names, moduleSpecTable, this.CimSession,
                                          this.CimResourceUri, this.CimNamespace);
            }
            else
            {
                Dbg.Assert(false, "Unrecognized parameter set");
            }
        }
Пример #17
0
 public override int GetHashCode()
 {
     return(FullyQualifiedName.GetHashCode());
 }
Пример #18
0
 public StartProductionSettingModel(FullyQualifiedName fullyQualifiedName)
     : base(SettingKey, fullyQualifiedName.FullName)
 {
 }
Пример #19
0
 internal string GetTestsuiteName_CommandLineGenerator()
 {
     return(FullyQualifiedName.Split('.')[0]);
 }
Пример #20
0
 public TriviaSettingModel(FullyQualifiedName fullyQualifiedName)
     : base(SettingKey, fullyQualifiedName.FullName)
 {
 }
Пример #21
0
 public override string GetLocString()
 {
     return(string.Format(@"cs+class://{0}", string.Join("/", FullyQualifiedName.Split('.'))));
 }
Пример #22
0
 public NonTerminalModel(FullyQualifiedName fullyQualifiedName)
     : this(new NonTerminal(fullyQualifiedName.Namespace, fullyQualifiedName.Name))
 {
 }
Пример #23
0
 public NonTerminal(FullyQualifiedName fullyQualifiedName)
     : this(fullyQualifiedName.Namespace, fullyQualifiedName.Name)
 {
 }
Пример #24
0
 public IgnoreSettingModel(FullyQualifiedName fullyQualifiedName)
     : base(SettingKey, fullyQualifiedName.FullName)
 {
 }
Пример #25
0
 public ProductionExpression(FullyQualifiedName fullyQualifiedName)
 {
     ProductionModel = new ProductionModel(fullyQualifiedName);
 }
Пример #26
0
 public ProductionModel(FullyQualifiedName fullyQualifiedName)
     : this(new NonTerminalModel(fullyQualifiedName))
 {
 }