示例#1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Resolver resolver;

            if (value is Guid && SymbolHelper.TryGetValue((Guid)value, out resolver))
            {
                return(resolver.ProviderName);
            }

            return(value);
        }
示例#2
0
        public IDebugSymbol GetContainer()
        {
            IDebugContainerField container = null;
            IDebugSymbol         pRetVal   = null;

            if ((HRESULT)HResult.S_OK == this.m_SymbolProvider.GetContainerField(this.m_Address, out container))
            {
                pRetVal = SymbolHelper.SymbolFromDebugField(this, container as IDebugField);
            }

            return(pRetVal);
        }
示例#3
0
        public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
        {
            if (InMethod && CurrentLock.Count > 0)
            {
                ISymbol symbol = null;
                if (node.Parent is AssignmentExpressionSyntax assignmentExpressionSyntax)
                {
                    symbol = SymbolHelper.GetSymbol(assignmentExpressionSyntax.Left, SemanticModel);
                }
                else if (node.Parent is ThrowStatementSyntax ||
                         node.Parent is YieldStatementSyntax ||
                         node.Parent is ArgumentSyntax ||
                         node.Parent is ReturnStatementSyntax)
                {
                    // do nothing
                }
                else if (node.Parent.Parent is VariableDeclaratorSyntax variableDeclaratorSyntax)
                {
                    symbol = SemanticModel.GetDeclaredSymbol(variableDeclaratorSyntax);
                }

                if (symbol != null)
                {
                    var blockSyntax = node.Parent.Ancestors().OfType <BlockSyntax>().First();

                    var analyzeBlockWalker = new AnalyzeBlockWalker(SemanticModel, symbol);
                    analyzeBlockWalker.Visit(blockSyntax);

                    var nonVolatileFieldsAndProperties = analyzeBlockWalker.NonVolatileFieldsAndProperties.ToList();

                    if (nonVolatileFieldsAndProperties.Any())
                    {
                        var locks = CurrentLock.ToList();
                        foreach (var nonVolatileFieldsAndProperty in nonVolatileFieldsAndProperties)
                        {
                            if (!NewObjectsAndLocks.ContainsKey(nonVolatileFieldsAndProperty))
                            {
                                if (GloablOptions.Verbose)
                                {
                                    Console.WriteLine($"For node {node}");
                                    Console.WriteLine($"With parent {node.Parent}");
                                    Console.WriteLine($"In lock(s) {String.Join(", ", locks)}");
                                    Console.WriteLine();
                                }
                                NewObjectsAndLocks.Add(nonVolatileFieldsAndProperty, locks);
                            }
                        }
                    }
                }
            }

            base.VisitObjectCreationExpression(node);
        }
 private static bool IsMethodSymbolExcluded(IMethodSymbol methodSymbol)
 {
     return
         (methodSymbol == null ||
          !methodSymbol.IsOverride ||
          methodSymbol.IsSealed ||
          methodSymbol.OverriddenMethod == null ||
          IgnoredMethodNames.Contains(methodSymbol.Name) ||
          methodSymbol.Parameters.Any(p => p.HasExplicitDefaultValue) ||
          methodSymbol.OverriddenMethod.Parameters.Any(p => p.HasExplicitDefaultValue) ||
          SymbolHelper.IsAnyAttributeInOverridingChain(methodSymbol));
 }
示例#5
0
        public byte[] ReadMapFromSRAMVarLength(SymbolHelper sh)
        {
            int varlength = 2;

            byte[] completedata = new byte[sh.Length];
            try
            {
                byte[] data;
                int    m_nrBytes     = varlength;
                int    m_nrOfReads   = 0;
                int    m_nrOfRetries = 0;
                m_nrOfReads = sh.Length / m_nrBytes;
                if (((sh.Length) % varlength) > 0)
                {
                    m_nrOfReads++;
                }
                int bytecount = 0;
                KWPHandler.getInstance().requestSequrityAccess(false); // no seq. access <GS-10022010>
                for (int readcount = 0; readcount < m_nrOfReads; readcount++)
                {
                    m_nrOfRetries = 0;
                    int addresstoread = (int)sh.Start_address + (readcount * m_nrBytes);
                    //LogHelper.Log("Reading 64 bytes from address: " + addresstoread.ToString("X6"));

                    while (!KWPHandler.getInstance().sendReadRequest(/*0xF04768*/ (uint)(addresstoread), (uint)varlength) && m_nrOfRetries < 20)
                    {
                        m_nrOfRetries++;
                    }
                    logger.Debug("Send command in " + m_nrOfRetries.ToString() + " retries");
                    m_nrOfRetries = 0;
                    while (!KWPHandler.getInstance().sendRequestDataByOffset(out data) && m_nrOfRetries < 20)
                    {
                        m_nrOfRetries++;
                    }
                    logger.Debug("Read data in " + m_nrOfRetries.ToString() + " retries");
                    logger.Debug("Read " + data.Length.ToString() + " bytes from CAN interface");
                    foreach (byte b in data)
                    {
                        //Console.Write(b.ToString("X2") + " ");
                        if (bytecount < completedata.Length)
                        {
                            completedata[bytecount++] = b;
                        }
                    }
                }
            }
            catch (Exception E)
            {
                logger.Debug("Failed to read memory: " + E.Message);
            }
            return(completedata);
        }
示例#6
0
        private void Initialize(int depth, InvocationExpressionSyntax invocationExpressionSyntax,
                                IMethodSymbol methodSymbol, SemanticModel semanticModel)
        {
            Depth            = depth;
            IsMethod         = true;
            InvocationString = invocationExpressionSyntax.ToString();
            var containingNode = invocationExpressionSyntax.Ancestors().OfType <StatementSyntax>().FirstOrDefault();

            OwnerStatementString = containingNode?.ToString();


            MemberName = methodSymbol.Name;
            ReturnType = new TypeDescriptor(methodSymbol.ReturnType);
            var containingTypeSymbol = methodSymbol.ContainingType;

            ContainingType = new TypeDescriptor(containingTypeSymbol);

            ParameterTypes = invocationExpressionSyntax.ArgumentList.Arguments
                             .Select(a => new TypeDescriptor(semanticModel.GetTypeInfo(a.Expression).Type))
                             .ToList();

            GenericTypesForMethod = methodSymbol.IsGenericMethod ? methodSymbol.TypeArguments
                                    .Select(t => new TypeDescriptor(t))
                                    .ToList() : null;

            GenericTypesForContainedType = containingTypeSymbol.IsGenericType ? containingTypeSymbol.TypeArguments
                                           .Select(t => new TypeDescriptor(t))
                                           .ToList() : null;

            MethodDeclarationSyntax = SymbolHelper.GetSyntaxReferences(invocationExpressionSyntax, semanticModel)
                                      .FirstOrDefault()
                                      ?.GetSyntax() as MethodDeclarationSyntax;

            if (invocationExpressionSyntax.Expression is MemberAccessExpressionSyntax memberAccessExpressionSyntax)
            {
                var memberAccessSymbolInfo = semanticModel.GetSymbolInfo(memberAccessExpressionSyntax);

                // info on the variable being accessed
                var objectAccessedSyntax     = memberAccessExpressionSyntax.Expression;
                var objectAccessedSymbol     = semanticModel.GetSymbolInfo(objectAccessedSyntax).Symbol;
                var objectAccessedTypeSymbol = semanticModel.GetTypeInfo(objectAccessedSyntax).Type;
                MemberOwnerType = new TypeDescriptor(objectAccessedTypeSymbol);
            }
            else
            {
                // a method that is part of the current class (containingType)
                MemberOwnerType = ContainingType;
            }
        }
示例#7
0
        // Implementation on IDebugValue
        public IDebugType RuntimeType()
        {
            IDebugType   pRetVal = null;
            IDebugBinder binder  = this.m_Context.Binder;

            if (null == this.m_RuntimeType)
            {
                binder.ResolveRuntimeType(this.m_Object, out this.m_RuntimeType);
            }
            if (null != this.m_RuntimeType)
            {
                pRetVal = SymbolHelper.DebugTypeFromField(this.m_RuntimeType, this.m_Context);
            }
            return(pRetVal);
        }
示例#8
0
        public SymbolHelper GetLeadingAxis(AxisCollection axis, int address)
        {
            SymbolHelper retval = new SymbolHelper();

            foreach (AxisHelper ah in axis)
            {
                int endaddress = ah.Addressinfile + ah.Length + 2;
                if (endaddress == address)
                {
                    retval.Y_axis_address = ah.Addressinfile;
                    retval.Y_axis_length  = ah.Length;
                }
            }
            return(retval);
        }
示例#9
0
        public float DetermineAverageMapValue(string filename, SymbolHelper sh)
        {
            float retval = 0;

            byte[] data = FileTools.Instance.readdatafromfile(filename, sh.Flash_start_address, sh.Length, sh.IsSixteenbits);
            if (data != null)
            {
                foreach (byte b in data)
                {
                    retval += (float)b;
                }
            }
            retval /= sh.Length;
            return(retval);
        }
示例#10
0
 private void gridControl1_DragDrop(object sender, DragEventArgs e)
 {
     // what symbol
     // kijken of het mag
     if (e.Data is System.Windows.Forms.DataObject)
     {
         object o = e.Data.GetData("T7.SymbolHelper");
         if (o is SymbolHelper)
         {
             SymbolHelper sh = (SymbolHelper)o;
             logger.Debug("Dropped: " + sh.Varname);
             AddSymbolToTuningPackage(sh);
         }
     }
 }
示例#11
0
 public new ISymbolReader GetSymbolReader(ModuleDefinition module, string fileName)
 {
     try
     {
         var pdbPath = SymbolHelper.GetPdbFileName(fileName);
         if (!File.Exists(pdbPath))
         {
             return(new NullReader());
         }
         return(base.GetSymbolReader(module, fileName));
     }
     catch (Exception)
     {
         return(new NullReader());
     }
 }
        private SyntaxNode GetDefaultExpression(ITypeSymbol type, MappingContext mappingContext, MappingPath mappingPath)
        {
            if (mappingPath.AddToMapped(type) == false)
            {
                return(syntaxGenerator.DefaultExpression(type)
                       .WithTrailingTrivia(SyntaxFactory.Comment(" /* Stop recursive mapping */")));
            }

            return(cache.GetOrAdd(type.ToDisplayString().TrimEnd('?'), _ =>
            {
                if (SymbolHelper.IsNullable(type, out var underlyingType))
                {
                    type = underlyingType;
                }


                if (type.TypeKind == TypeKind.Enum && type is INamedTypeSymbol namedTypeSymbol)
                {
                    var enumOption = namedTypeSymbol.MemberNames.Where(x => x != "value__" && x != ".ctor").OrderBy(x => x).FirstOrDefault();
                    if (enumOption != null)
                    {
                        return SyntaxFactoryExtensions.CreateMemberAccessExpression(SyntaxFactory.IdentifierName(namedTypeSymbol.Name), false, enumOption);
                    }
                    return syntaxGenerator.DefaultExpression(type);
                }

                if (type.SpecialType == SpecialType.None)
                {
                    ObjectCreationExpressionSyntax objectCreationExpression = null;

                    if (MappingHelper.IsCollection(type))
                    {
                        var isReadonlyCollection = ObjectHelper.IsReadonlyCollection(type);

                        if (type is IArrayTypeSymbol)
                        {
                            objectCreationExpression = CreateObject(type);
                        }
                        else if (type.TypeKind == TypeKind.Interface || isReadonlyCollection)
                        {
                            if (type is INamedTypeSymbol namedType && namedType.IsGenericType)
                            {
                                var typeArgumentListSyntax = SyntaxFactory.TypeArgumentList(SyntaxFactory.SeparatedList(namedType.TypeArguments.Select(x => syntaxGenerator.TypeExpression(x))));
                                var newType = SyntaxFactory.GenericName(SyntaxFactory.Identifier("List"), typeArgumentListSyntax);
                                objectCreationExpression = SyntaxFactory.ObjectCreationExpression(newType, SyntaxFactory.ArgumentList(), default(InitializerExpressionSyntax));
                            }
 public ISymbolReader GetSymbolReader(ModuleDefinition module, string fileName)
 {
     try
     {
         var pdbPath = SymbolHelper.GetPdbFileName(fileName);
         if (!File.Exists(pdbPath))
         {
             return(new NullReader());
         }
         // TODO: start reading header and check that the pdb matches the module
         return(_baseProvider.GetSymbolReader(module, fileName));
     }
     catch (Exception)
     {
         return(new NullReader());
     }
 }
示例#14
0
 public void AddSymbolToWatchlist(string symbolname, Int32 sramaddress, Int32 length, bool systemSymbol)
 {
     _stallReading = true;
     if (symbolname != "")
     {
         SymbolHelper sh = new SymbolHelper();
         sh.Varname        = symbolname;
         sh.Start_address  = sramaddress;
         sh.Length         = length;
         sh.IsSystemSymbol = systemSymbol;
         if (!CollectionContains(symbolname)) // maybe use systemSymbol as well <GS-11042011>
         {
             m_SymbolsToMonitor.Add(sh);
         }
     }
     _stallReading = false;
 }
示例#15
0
        public MappingElement MapExpression(MappingElement element, ITypeSymbol targetType, MappingPath mappingPath = null)
        {
            if (element == null)
            {
                return(null);
            }

            if (mappingPath == null)
            {
                mappingPath = new MappingPath();
            }

            var sourceType = element.ExpressionType;

            if (mappingPath.AddToMapped(sourceType) == false)
            {
                return(new MappingElement()
                {
                    ExpressionType = sourceType,
                    Expression = element.Expression.WithTrailingTrivia(SyntaxFactory.Comment(" /* Stop recursive mapping */"))
                });
            }

            if (ObjectHelper.IsSimpleType(targetType) && SymbolHelper.IsNullable(sourceType, out var underlyingType))
            {
                element = new MappingElement()
                {
                    Expression     = (ExpressionSyntax)syntaxGenerator.MemberAccessExpression(element.Expression, "Value"),
                    ExpressionType = underlyingType
                };
            }

            if (IsUnwrappingNeeded(targetType, element))
            {
                return(TryToUnwrap(targetType, element));
            }


            if (ShouldCreateConversionBetweenTypes(targetType, sourceType))
            {
                return(TryToCreateMappingExpression(element, targetType, mappingPath));
            }

            return(element);
        }
示例#16
0
        public void Symbol_IsPublicApi()
        {
            ISymbol symbol = this.testCode.GetMethodSymbol("Base.Method1");

            SymbolHelper.IsPubliclyAccessible(symbol).Should().BeTrue();

            symbol = this.testCode.GetMethodSymbol("Base.Method2");
            symbol.IsPubliclyAccessible().Should().BeTrue();

            symbol = this.testCode.GetPropertySymbol("Base.Property");
            symbol.IsPubliclyAccessible().Should().BeTrue();

            symbol = this.testCode.GetPropertySymbol("IInterface.Property2");
            symbol.IsPubliclyAccessible().Should().BeTrue();

            symbol = this.testCode.GetPropertySymbol("Derived1.Property");
            symbol.IsPubliclyAccessible().Should().BeFalse();
        }
示例#17
0
        public async Task RoslynWith_EFScenarioGood()
        {
            // Arrange
            var projectFilePath = @"..\..\..\EFScenario.Good\EFScenario.Good.csproj";

            var compilation = await LoadProjectAndGetCompilationAsync(projectFilePath);

            INamedTypeSymbol dbContextTypeSymbol;
            var entityTypeSymbols = SymbolHelper.GetAllEntityTypesFromDbContext(compilation, out dbContextTypeSymbol);

            // Act
            var efRoslynTheorem        = new EFRoslynTheorem();
            ObjectTheoremResult solved = efRoslynTheorem.Solve(entityTypeSymbols);

            // Assert
            Assert.IsNotNull(solved);
            Assert.AreEqual(Status.Satisfiable, solved.Status);
        }
示例#18
0
        public SymbolHelper GetYAxisSymbol(string m_currentfile, SymbolCollection symbols, AxisCollection axis, string symbolname, int address)
        {
            SymbolHelper retval = new SymbolHelper();

            foreach (AxisHelper ah in axis)
            {
                int endaddress = ah.Addressinfile + ah.Length + 2;
                if (endaddress == address)
                {
                    // this is an axis for this table...
                    // see if there is another one that leads
                    int[]  yaxis;
                    string y_descr = string.Empty;
                    retval = GetLeadingAxis(axis, ah.Addressinfile);
                }
            }
            return(retval);
        }
        public IStmt Translate(ObjectCreationExpressionSyntax node, SemanticModel semanticModel, CSharpSyntaxVisitor <IStmt> visitor)
        {
            var symbol = ModelExtensions.GetSymbolInfo(semanticModel, node).Symbol;

            if (symbol == null || !SymbolHelper.IsAssignableFrom(symbol, "IList"))
            {
                return(null);
            }
            return(new ObjectCreationExpr
            {
                TypeInformation = new TypeInformation
                {
                    TypeSymbol = symbol.ContainingType,
                    TypeName = "ArrayList"
                },
                Arguments = node.ArgumentList.Arguments.Select(visitor.Visit).ToArray()
            });
        }
        private void CreateParameterSymbol(SymbolResolverVisitor visitor, Function functionSymbol, ParameterNode parameter)
        {
            // If the parameter's type is present use it, if not use an anonymous type
            var paramTypeSymbol = parameter.SymbolInfo.Type == null
                        ? visitor.Inferrer.NewAnonymousType()
                        : SymbolHelper.GetTypeSymbol(visitor.SymbolTable, visitor.Inferrer, parameter.SymbolInfo.Type);

            // Check if the parameter has storage modifiers
            var storage = SymbolHelper.GetStorage(parameter.SymbolInfo.Mutability);

            // Create the parameter symbol in the function's scope
            var boundSymbol = functionSymbol.CreateParameter(parameter.Name.Value, paramTypeSymbol, storage);

            if (paramTypeSymbol is Anonymous asym)
            {
                visitor.Inferrer.TrackSymbol(asym, boundSymbol);
            }
        }
示例#21
0
        public static CodePropertyItem MapProperty(VisualBasicSyntax.PropertyBlockSyntax member,
                                                   ICodeViewUserControl control, SemanticModel semanticModel)
        {
            if (member == null)
            {
                return(null);
            }

            var item = BaseMapper.MapBase <CodePropertyItem>(member, member.PropertyStatement.Identifier,
                                                             member.PropertyStatement.Modifiers, control, semanticModel);

            var symbol = SymbolHelper.GetSymbol <IPropertySymbol>(semanticModel, member);

            item.Type = TypeMapper.Map(symbol?.Type);

            if (member.Accessors != null)
            {
                if (member.Accessors.Any(a => a.Kind() == VisualBasic.SyntaxKind.GetAccessorBlock))
                {
                    item.Parameters += "get";
                }

                if (member.Accessors.Any(a => a.Kind() == VisualBasic.SyntaxKind.SetAccessorBlock))
                {
                    item.Parameters += string.IsNullOrEmpty(item.Parameters) ? "set" : ",set";
                }

                if (!string.IsNullOrEmpty(item.Parameters))
                {
                    item.Parameters = $" {{{item.Parameters}}}";
                }
            }

            item.Tooltip = TooltipMapper.Map(item.Access, item.Type, item.Name, item.Parameters);
            item.Kind    = CodeItemKindEnum.Property;
            item.Moniker = IconMapper.MapMoniker(item.Kind, item.Access);

            if (TriviaSummaryMapper.HasSummary(member) && SettingsHelper.UseXMLComments)
            {
                item.Tooltip = TriviaSummaryMapper.Map(member);
            }

            return(item);
        }
示例#22
0
        public ISymbol Visit(SymbolResolverVisitor binder, ConstantNode constdec)
        {
            IType typeSymbol = null;

            // Get the constant's type or assume it if not present
            if (constdec.Type != null)
            {
                typeSymbol = SymbolHelper.GetTypeSymbol(binder.SymbolTable, binder.Inferrer, constdec.Type);
            }
            else
            {
                typeSymbol = binder.Inferrer.NewAnonymousType();
            }

            foreach (var definition in constdec.Definitions)
            {
                // Get the identifier name
                var constantName = definition.Left.Value;

                // Check if the symbol is already defined
                if (binder.SymbolTable.HasVariableSymbol(constantName))
                {
                    throw new SymbolException($"Symbol {constantName} is already defined.");
                }

                // If it is a variable definition, visit the right-hand side expression
                var rhsSymbol = definition.Right?.Visit(binder);

                if (rhsSymbol != null && !(rhsSymbol is IPrimitive))
                {
                    throw new SymbolException($"The expression to initialize '{constantName}' must be constant");
                }

                // Create the new symbol for the variable
                var boundSymbol = binder.SymbolTable.AddNewVariableSymbol(constantName, typeSymbol, Access.Public, Storage.Constant);

                if (typeSymbol is Anonymous asym)
                {
                    binder.Inferrer.TrackSymbol(asym, boundSymbol);
                }
            }

            return(null);
        }
示例#23
0
        public static CodeItem MapMethod(VisualBasicSyntax.MethodBlockSyntax member, ICodeViewUserControl control, SemanticModel semanticModel)
        {
            if (member == null)
            {
                return(null);
            }

            CodeItem item;

            var statementsCodeItems = StatementMapper.MapStatement(member.Statements, control, semanticModel);

            if (VisibilityHelper.ShouldBeVisible(CodeItemKindEnum.Switch) && statementsCodeItems.Any())
            {
                // Map method as item containing statements
                item = BaseMapper.MapBase <CodeClassItem>(member, member.SubOrFunctionStatement.Identifier,
                                                          member.SubOrFunctionStatement.Modifiers, control, semanticModel);
                ((CodeClassItem)item).Members.AddRange(statementsCodeItems);
                ((CodeClassItem)item).BorderColor = Colors.DarkGray;
            }
            else
            {
                // Map method as single item
                item = BaseMapper.MapBase <CodeFunctionItem>(member, member.SubOrFunctionStatement.Identifier,
                                                             member.SubOrFunctionStatement.Modifiers, control, semanticModel);

                var symbol = SymbolHelper.GetSymbol <IMethodSymbol>(semanticModel, member);
                ((CodeFunctionItem)item).Type       = TypeMapper.Map(symbol?.ReturnType);
                ((CodeFunctionItem)item).Parameters = ParameterMapper.MapParameters(member.SubOrFunctionStatement.ParameterList, semanticModel);
                item.Tooltip = TooltipMapper.Map(item.Access, ((CodeFunctionItem)item).Type, item.Name,
                                                 member.SubOrFunctionStatement.ParameterList, semanticModel);
            }

            item.Id      = IdMapper.MapId(item.FullName, member.SubOrFunctionStatement.ParameterList, semanticModel);
            item.Kind    = CodeItemKindEnum.Method;
            item.Moniker = IconMapper.MapMoniker(item.Kind, item.Access);

            if (TriviaSummaryMapper.HasSummary(member) && SettingsHelper.UseXMLComments)
            {
                item.Tooltip = TriviaSummaryMapper.Map(member);
            }

            return(item);
        }
示例#24
0
        public bool FirstColumnForTableAveragesLessThan(string filename, SymbolHelper sh, int value, int width)
        {
            bool retval = false;
            int  height = sh.Length / width;

            byte[] data    = readdatafromfile(filename, sh.Flash_start_address, sh.Length, sh.IsSixteenbits);
            int    average = 0;

            for (int i = 0; i < height; i++)
            {
                average += Convert.ToInt32(data[i * width]);
            }
            average /= height;
            if (average < value)
            {
                retval = true;
            }
            return(retval);
        }
示例#25
0
        public IDebugType GetType(string fullName)
        {
            IDebugField type = null;

            this.SymbolProvider.GetTypeByName(fullName, NAME_MATCH.nmCaseSensitive, out type);
            if (type != null)
            {
                return(SymbolHelper.DebugTypeFromField(type, this));
            }
            IEnumDebugFields namespaceList = null;

            this.SymbolProvider.GetNamespacesUsedAtAddress(this.Address, out namespaceList);
            if (namespaceList != null)
            {
                int        namespaceCount = 0;
                int        fetched        = 0;
                FIELD_INFO namespaceInfo  = new FIELD_INFO();
                namespaceList.GetCount(out namespaceCount);
                for (int i = 0; i < namespaceCount; i++)
                {
                    IDebugField[] namespc = new IDebugField[1];
                    namespaceList.Next(1, namespc, out fetched);
                    if (fetched > 0)
                    {
                        namespc[0].GetInfo(FIELD_INFO_FIELDS.FIF_FULLNAME, out namespaceInfo);
                        this.SymbolProvider.GetTypeByName(namespaceInfo.bstrFullName + "." + fullName, NAME_MATCH.nmCaseSensitive, out type);
                        if (type != null)
                        {
                            return(SymbolHelper.DebugTypeFromField(type, this));
                        }
                    }
                }
            }
            if (type == null)
            {
                this.SymbolProvider.GetTypeByName("StructuralTypes." + fullName, NAME_MATCH.nmCaseSensitive, out type);
            }
            if (type != null)
            {
                return(SymbolHelper.DebugTypeFromField(type, this));
            }
            return(null);
        }
示例#26
0
        public override void Initialize(IAppContext context)
        {
            _context       = context;
            _menuGenerator = context.Container.GetInstance <MenuGenerator>();
            ISecureContext secureContext = context as ISecureContext;

            _drawFence = true;
            _isDeign   = false;
            _isLayout  = false;
            if (secureContext.YutaiProject != null)
            {
                XmlPlugin xmlPlugin = secureContext.YutaiProject.FindPlugin("5e933989-b5a4-4a45-a5b7-2d9ded61df0f");
                if (xmlPlugin != null)
                {
                    string fileName = xmlPlugin.ConfigXML;
                    if (string.IsNullOrEmpty(fileName))
                    {
                        _printConfig.TemplateConnectionString = BuildDefaultConnectionString();
                    }
                    else
                    {
                        fileName = FileHelper.GetFullPath(fileName);
                        _printConfig.LoadFromXml(fileName);
                    }
                }
            }
            if (string.IsNullOrEmpty(_printConfig.TemplateConnectionString))
            {
                _printConfig.TemplateConnectionString = BuildDefaultConnectionString();
            }
            _templateGallery = new MapTemplateGallery();
            _templateGallery.SetWorkspace(_printConfig.TemplateConnectionString);

            ((IAppContextEvents)_context).OnActiveHookChanged += OnOnActiveHookChanged;
            _activeViewEvents            = ((IActiveViewEvents_Event)_context.FocusMap);
            _activeViewEvents.AfterDraw += ActiveViewEventsOnAfterDraw;

            if (_fillSymbol == null)
            {
                _fillSymbol = SymbolHelper.CreateTransparentFillSymbol(Color.Blue) as ISymbol;
                _lineSymbol = SymbolHelper.CreateSimpleLineSymbol(Color.Blue, 1.5) as ISymbol;
            }
        }
示例#27
0
 public void AddSymbolToWatchlist(SymbolHelper shuser, bool systemSymbol)
 {
     _stallReading = true;
     if (shuser.Varname != "")
     {
         SymbolHelper sh = new SymbolHelper();
         sh.Varname              = shuser.Varname;
         sh.Start_address        = shuser.Start_address;
         sh.Length               = shuser.Length;
         sh.UserCorrectionFactor = shuser.UserCorrectionFactor;
         sh.UserCorrectionOffset = shuser.UserCorrectionOffset;
         sh.UseUserCorrection    = shuser.UseUserCorrection;
         sh.IsSystemSymbol       = systemSymbol;
         if (!CollectionContains(shuser.Varname)) // maybe use systemSymbol as well <GS-11042011>
         {
             m_SymbolsToMonitor.Add(sh);
         }
     }
     _stallReading = false;
 }
示例#28
0
        private bool GetSelectedFromList(string varname)
        {
            foreach (object map in checkedListBoxControl1.CheckedItems)
            {
                if (map is SymbolHelper)
                {
                    SymbolHelper sh = (SymbolHelper)map;

                    /*if (sh.Selected)
                     * {
                     *  logger.Debug("Checking: " + sh.Varname + " " + sh.Selected.ToString());
                     * }*/
                    if (sh.Varname == varname)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#29
0
        private INamedTypeSymbol FindOriginatingSymbol(ISymbol accessedMember)
        {
            if (accessedMember == null)
            {
                return(null);
            }

            var originatingInterface = accessedMember.GetInterfaceMember()?.ContainingType;

            if (originatingInterface != null)
            {
                return(originatingInterface);
            }

            var overridenSymbol = SymbolHelper.GetOverriddenMember(accessedMember);

            return(overridenSymbol != null
                ? overridenSymbol.ContainingType
                : accessedMember.ContainingType);
        }
        public ISymbol Visit(SymbolResolverVisitor visitor, ObjectPropertyNode node)
        {
            var storage = SymbolHelper.GetStorage(node.Information.Mutability);

            // Visit the property's value node
            var rhsSymbol = visitor.Visit(node.Value);

            if (rhsSymbol != null)
            {
                visitor.SymbolTable.AddNewVariableSymbol(node.Name.Value, rhsSymbol.GetTypeSymbol(), Access.Public, storage);
                return(rhsSymbol);
            }

            var typeSymbol = SymbolHelper.GetTypeSymbol(visitor.SymbolTable, visitor.Inferrer, node.Information.Type);

            // Create the symbol for the object's property
            visitor.SymbolTable.AddNewVariableSymbol(node.Name.Value, typeSymbol, Access.Public, storage);

            return(typeSymbol);
        }