/*
         *
         * private void openToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  if (!printing)
         *  {
         *      if (openFileDialog.ShowDialog() == DialogResult.OK)
         *      {
         *          LoadAssembly(openFileDialog.FileName);
         *      }
         *  }
         * }
         *
         * private void reloadToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  if (!printing)
         *  {
         *      TreeNode node = treeView.SelectedNode;
         *      string path = (node == null ? null : node.FullPath);
         *
         *      Reflector current = Reflector.CurrentReflector;
         *      if (current != null)
         *      {
         *          LoadAssembly(current.AssemblyPath);
         *      }
         *
         *      if (path != null)
         *      {
         *          TrySelectNode(path);
         *      }
         *  }
         * }
         *
         * private void exitToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  Close();
         * }
         *
         * private Control GetActiveControl()
         * {
         *  Control cur = ActiveControl;
         *  do
         *  {
         *      ContainerControl container = cur as ContainerControl;
         *      if (container == null || container.ActiveControl == null)
         *      {
         *          return cur;
         *      }
         *
         *      cur = container.ActiveControl;
         *  }
         *  while (true);
         * }
         *
         * private void editToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
         * {
         *  Control cur = GetActiveControl();
         *
         *  bool copyEnabled = false;
         *  bool selectAllEnabled = false;
         *  if (cur != null)
         *  {
         *      TextBoxBase text_base = cur as TextBoxBase;
         *      if (text_base != null)
         *      {
         *          selectAllEnabled = true;
         *          copyEnabled = (text_base.SelectionLength > 0);
         *      }
         *      else
         *      {
         *          DataGridView grid_view = cur as DataGridView;
         *          if (grid_view != null)
         *          {
         *              copyEnabled = true;
         *              selectAllEnabled = true;
         *          }
         *      }
         *  }
         *
         *  copyToolStripMenuItem.Enabled = copyEnabled;
         *  selectAllToolStripMenuItem.Enabled = selectAllEnabled;
         * }
         *
         * // "Radio" menu item handlers:
         *
         * private void bit32TargetPlatformToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  bit32TargetPlatformToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  bit64TargetPlatformToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  Print();
         * }
         *
         * private void bit64TargetPlatformToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  bit32TargetPlatformToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  bit64TargetPlatformToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  Print();
         * }
         *
         * private void unicodeTargetPlatformToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  unicodeTargetPlatformToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  aNSITargetPlatformToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  Print();
         * }
         *
         * private void aNSITargetPlatformToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  unicodeTargetPlatformToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  aNSITargetPlatformToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  Print();
         * }
         *
         * private void windowsTypesToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  windowsTypesToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  plainCTypesToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  Print();
         * }
         *
         * private void plainCTypesToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  windowsTypesToolStripMenuItem.CheckState = CheckState.Unchecked;
         *  plainCTypesToolStripMenuItem.CheckState = CheckState.Indeterminate;
         *  Print();
         * }
         *
         * private void marshalDirectionAnnotationsToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  Print();
         * }
         *
         * private void contentsToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  Help.ShowHelp(this, System.IO.Path.Combine(
         *      System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
         *      "siggen.chm"));
         * }
         *
         * private void showAllToolStripMenuItem_CheckChanged(object sender, EventArgs e)
         * {
         *  symbolDisplay.ShowAll = showAllToolStripMenuItem.Checked;
         * }
         *
         * private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  new AboutForm().ShowDialog();
         * }
         *
         * private void optionsToolStripMenuItemImp_DropDownOpening(object sender, EventArgs e)
         * {
         *  showAllToolStripMenuItem.Enabled = (TabMode.PInvokeSearch == Mode);
         * }
         *
         * private void copyToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  // seems lame but is there a better way?
         *  SendKeys.Send("^c");
         * }
         *
         * private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *  // seems lame but is there a better way?
         *  SendKeys.Send("^a");
         * }
         *
         #endregion
         *
         #region Tree Building and Signature Display
         *
         * private void LoadAssembly(string assemblyPath)
         * {
         *  Cursor prev_cursor = Cursor.Current;
         *  Cursor.Current = Cursors.WaitCursor;
         *  try
         *  {
         *      Reflector new_reflector;
         *      try
         *      {
         *          new_reflector = new Reflector(assemblyPath);
         *      }
         *      catch (Exception e)
         *      {
         *          MessageBox.Show(String.Format("Could not load assembly '{0}'.\n\n{1}",
         *              assemblyPath, GetExceptionMessage(e)),
         *              "Error",
         *              MessageBoxButtons.OK,
         *              MessageBoxIcon.Error);
         *          return;
         *      }
         *
         *      if (RebuildTree(new_reflector))
         *      {
         *          Reflector.CurrentReflector = new_reflector;
         *          Print();
         *      }
         *      else
         *      {
         *          new_reflector.Dispose();
         *      }
         *  }
         *  finally
         *  {
         *      Cursor.Current = prev_cursor;
         *  }
         *
         *  reloadToolStripMenuItem.Enabled = true;
         * }
         *
         * private static TreeNode CreateTreeNode(string text, ImageIndex imageIndex)
         * {
         *  TreeNode node = new TreeNode(text, (int)imageIndex, (int)imageIndex);
         *  node.Name = text;
         *  return node;
         * }
         *
         * /// <summary>
         * /// Unwraps target invocation exceptions and concatenates all <see cref="LoaderException"/>s.
         * /// </summary>
         * private static string GetExceptionMessage(Exception e)
         * {
         *  while (e is TargetInvocationException)
         *  {
         *      e = e.InnerException;
         *  }
         *
         *  // extract LoaderExceptions from ReflectionTypeLoadException
         *  ReflectionTypeLoadException rtle = e as ReflectionTypeLoadException;
         *  if (rtle != null)
         *  {
         *      StringBuilder sb = new StringBuilder();
         *      for (int i = 0; i < rtle.LoaderExceptions.Length; i++)
         *      {
         *          if (sb.Length > 0) sb.Append('\n');
         *          sb.Append(rtle.LoaderExceptions[i].Message);
         *      }
         *
         *      return sb.ToString();
         *  }
         *
         *  // extract LoaderMessages from UnableToGetTypesException
         *  UnableToGetTypesException utgte = e as UnableToGetTypesException;
         *  if (utgte != null)
         *  {
         *      StringBuilder sb = new StringBuilder();
         *      for (int i = 0; i < utgte.LoaderMessages.Length; i++)
         *      {
         *          if (sb.Length > 0) sb.Append('\n');
         *          sb.Append(utgte.LoaderMessages[i]);
         *      }
         *
         *      return sb.ToString();
         *  }
         *
         *  return e.Message;
         * }
         *
         * private bool RebuildTree(Reflector reflector)
         * {
         *  List<TypeDescriptor> type_list;
         *  List<MethodDescriptor> method_list;
         *  try
         *  {
         *      reflector.GetInteropTypesAndMethods(out type_list, out method_list);
         *  }
         *  catch (Exception e)
         *  {
         *      MessageBox.Show(String.Format("Could not reflect assembly '{0}'.\n\n{1}",
         *          reflector.AssemblyPath, GetExceptionMessage(e)),
         *          "Error",
         *          MessageBoxButtons.OK,
         *          MessageBoxIcon.Error);
         *
         *      return false;
         *  }
         *
         *  if (type_list.Count == 0 && method_list.Count == 0)
         *  {
         *      MessageBox.Show(
         *          String.Format("Assembly '{0}' contains no delegates and no interop methods.", reflector.AssemblyPath),
         *          "Assembly not loaded",
         *          MessageBoxButtons.OK,
         *          MessageBoxIcon.Stop);
         *      return false;
         *  }
         *
         *  treeView.BeginUpdate();
         *  try
         *  {
         *      treeView.Nodes.Clear();
         *
         *      TreeNode root_node = CreateTreeNode(reflector.AssemblyPath, ImageIndex.Field);
         *
         *      treeView.Nodes.Add(root_node);
         *
         *      // convert the lists to a tree view hierarchy
         *      Dictionary<string, TreeNode> node_map = new Dictionary<string, TreeNode>();
         *
         *      foreach (TypeDescriptor descriptor in type_list)
         *      {
         *          // just pass it on to GetTypeNode
         *          GetTypeNode(node_map, root_node, descriptor);
         *      }
         *      foreach (MethodDescriptor descriptor in method_list)
         *      {
         *          TreeNode parent = GetTypeNode(node_map, root_node, descriptor.DeclaringType);
         *
         *          ImageIndex image_index =
         *              ((descriptor.MethodAttributes & MethodAttributes.Static) == MethodAttributes.Static) ?
         *              ImageIndex.StaticMethod :
         *              ImageIndex.InstanceMethod;
         *
         *          TreeNode method_node = CreateTreeNode(descriptor.MethodName + " : " + descriptor.MethodSigString, image_index);
         *          method_node.Tag = descriptor;
         *
         *          parent.Nodes.Add(method_node);
         *      }
         *
         *      treeView.Sort();
         *
         *      // expand
         *      while (true)
         *      {
         *          root_node.Expand();
         *          if (root_node.Nodes.Count == 1)
         *          {
         *              root_node = root_node.Nodes[0];
         *          }
         *          else break;
         *      }
         *  }
         *  finally
         *  {
         *      treeView.EndUpdate();
         *  }
         *
         *  return true;
         * }
         *
         * /// <summary>
         * /// Creates and returns or just returns the node representing the specified type.
         * /// </summary>
         * private TreeNode GetTypeNode(Dictionary<string, TreeNode> nodeMap, TreeNode rootNode, TypeDescriptor descriptor)
         * {
         *  TreeNode node;
         *  if (!nodeMap.TryGetValue(descriptor.TypeName, out node))
         *  {
         *      string type_name;
         *      int index;
         *
         *      // check for nested types
         *      if (descriptor.DeclaringType != null)
         *      {
         *          node = GetTypeNode(nodeMap, rootNode, descriptor.DeclaringType);
         *
         *          index = descriptor.TypeName.LastIndexOf('+');
         *          if (index > 0)
         *          {
         *              type_name = descriptor.TypeName.Substring(index + 1);
         *          }
         *          else if (descriptor.TypeName.StartsWith(descriptor.DeclaringType.TypeName))
         *          {
         *              type_name = descriptor.TypeName.Substring(descriptor.DeclaringType.TypeName.Length);
         *          }
         *          else
         *          {
         *              type_name = descriptor.TypeName;
         *          }
         *      }
         *      else
         *      {
         *          // find or create the namespace of the type
         *          index = descriptor.TypeName.LastIndexOf('.');
         *          if (index > 0)
         *          {
         *              type_name = descriptor.TypeName.Substring(index + 1);
         *              string ns_name = descriptor.TypeName.Substring(0, index);
         *
         *              if (!nodeMap.TryGetValue(ns_name, out node))
         *              {
         *                  // we do not have the namespace in the tree view
         *                  node = CreateTreeNode(ns_name, ImageIndex.Namespace);
         *                  rootNode.Nodes.Add(node);
         *
         *                  nodeMap.Add(ns_name, node);
         *              }
         *          }
         *          else
         *          {
         *              type_name = descriptor.TypeName;
         *              node = rootNode;
         *          }
         *      }
         *
         *      ImageIndex image_index;
         *
         *      if ((descriptor.TypeAttributes & TypeAttributes.Interface) == TypeAttributes.Interface)
         *          image_index = ImageIndex.Interface;
         *      else if (descriptor.IsValueType)
         *          image_index = ImageIndex.Structure;
         *      else
         *          image_index = ImageIndex.Class;
         *
         *      TreeNode type_node = CreateTreeNode(type_name, image_index);
         *      type_node.Tag = descriptor;
         *
         *      node.Nodes.Add(type_node);
         *
         *      nodeMap.Add(descriptor.TypeName, type_node);
         *      node = type_node;
         *  }
         *
         *  return node;
         * }
         *
         * /// <summary>
         * /// Called after reloading an assembly - we want to restore the treeview node selection.
         * /// </summary>
         * private void TrySelectNode(string fullPath)
         * {
         *  // try the select a node with the specified full path
         *  TreeNode node = null, final_node = null;
         *
         *  foreach (string component in
         *      fullPath.Split(new string[] { treeView.PathSeparator }, StringSplitOptions.None))
         *  {
         *      if (node == null)
         *      {
         *          node = treeView.Nodes[component];
         *      }
         *      else
         *      {
         *          node = node.Nodes[component];
         *      }
         *
         *      if (node != null)
         *      {
         *          final_node = node;
         *      }
         *      else break;
         *  }
         *
         *  if (final_node != null)
         *  {
         *      treeView.SelectedNode = final_node;
         *  }
         * }
         *
         * private void Print()
         * {
         *  Print(treeView.SelectedNode);
         * }
         *
         * private void Print(TreeNode node)
         * {
         *  // prevent reentrancy
         *  if (printing)
         *  {
         *      printPending = true;
         *      return;
         *  }
         *
         *  printing = true;
         *  try
         *  {
         *      richTextBoxCode.Clear();
         *      richTextBoxMessages.Clear();
         *
         *      if (node != null && node.Tag != null)
         *      {
         *          MethodDescriptor method_descr = node.Tag as MethodDescriptor;
         *
         *          if (method_descr != null)
         *          {
         *              buttonOK.Enabled = true;
         *
         *              // this is a node representing a method - prints its signature including definitions
         *              PrintMethod(method_descr, codePrinter, logPrinter, true, false);
         *          }
         *          else
         *          {
         *              TypeDescriptor type_descr = (TypeDescriptor)node.Tag;
         *              if (type_descr.IsDelegate)
         *              {
         *                  buttonOK.Enabled = true;
         *
         *                  // this is a node representing a delegate - prints its signature including definitions
         *                  PrintDelegate(type_descr, codePrinter, logPrinter, true, false);
         *              }
         *              else
         *              {
         *                  buttonOK.Enabled = false;
         *
         *                  // this is a node representing a non-delegate type - print preview of its methods
         *                  PrintMethodPreview(node, codePrinter, logPrinter, false, false);
         *              }
         *          }
         *      }
         *      else
         *      {
         *          buttonOK.Enabled = false;
         *      }
         *
         *      richTextBoxCode.Refresh();
         *      richTextBoxMessages.Refresh();
         *  }
         *  finally
         *  {
         *      printing = false;
         *
         *      if (printPending)
         *      {
         *          printPending = false;
         *          Print();
         *      }
         *  }
         * }
         *
         * /// <summary>
         * /// Prints a native signature to the provided printers according to the current settings.
         * /// </summary>
         * private void PrintSignature(SignatureGenerator.NativeSignature nativeSig, ICodePrinter printer, ILogPrinter logPrinter,
         *  bool printDefs, bool defsFirst)
         * {
         *  PrintFlags p_flags = PrintFlags.None;
         *
         *  if (plainCTypesToolStripMenuItem.Checked) p_flags |= PrintFlags.UsePlainC;
         *  if (marshalDirectionAnnotationsToolStripMenuItem.Checked) p_flags |= PrintFlags.PrintMarshalDirection;
         *
         *  if (!defsFirst)
         *      nativeSig.PrintTo(printer, logPrinter, p_flags);
         *
         *  if (printDefs)
         *  {
         *      foreach (NativeTypeDefinition def in nativeSig.GetDefinitions())
         *      {
         *          if (defsFirst)
         *              def.PrintTo(printer, logPrinter, p_flags);
         *
         *          printer.PrintLn();
         *          printer.PrintLn();
         *
         *          if (!defsFirst)
         *              def.PrintTo(printer, logPrinter, p_flags);
         *      }
         *  }
         *
         *  if (defsFirst)
         *      nativeSig.PrintTo(printer, logPrinter, p_flags);
         * }
         *
         * /// <summary>
         * /// Prints one method to the provided printers according to the current settings.
         * /// </summary>
         * private void PrintMethod(MethodDescriptor descriptor, ICodePrinter printer, ILogPrinter logPrinter, bool printDefs, bool defsFirst)
         * {
         *  // this is a node representing a method - get the signature (cached by the descriptor)
         *  SignatureGenerator.NativeSignature native_sig = descriptor.GetNativeSignature(
         *      aNSITargetPlatformToolStripMenuItem.Checked,
         *      bit64TargetPlatformToolStripMenuItem.Checked);
         *
         *  PrintSignature(native_sig, printer, logPrinter, printDefs, defsFirst);
         * }
         *
         * /// <summary>
         * /// Prints one delegate to the provided printers according to the current settings.
         * /// </summary>
         * private void PrintDelegate(TypeDescriptor descriptor, ICodePrinter printer, ILogPrinter logPrinter, bool printDefs, bool defsFirst)
         * {
         *  Debug.Assert(descriptor.IsDelegate);
         *
         *  // this is a node representing a delegate - get the signature (cached by the descriptor)
         *  SignatureGenerator.NativeSignature native_sig = descriptor.GetNativeSignature(
         *      aNSITargetPlatformToolStripMenuItem.Checked,
         *      bit64TargetPlatformToolStripMenuItem.Checked);
         *
         *  PrintSignature(native_sig, printer, logPrinter, printDefs, defsFirst);
         * }
         *
         * /// <summary>
         * /// Prints preview of all methods under the specified node to the provided printers according to the current settings.
         * /// </summary>
         * private void PrintMethodPreview(TreeNode node, ICodePrinter printer, ILogPrinter logPrinter, bool printDefs, bool defsFirst)
         * {
         *  // this can take some time - try to not appear hung
         *  int tick_count1 = Environment.TickCount;
         *  int tick_count2 = unchecked(tick_count1 + 1);
         *  Cursor original_cursor = Cursor.Current;
         *
         *  // this is a node representing a type - get signatures of all its methods
         *  ILogPrinter mem_log = new LogMemoryPrinter();
         *  bool first = true;
         *
         *  try
         *  {
         *      foreach (TreeNode child in node.Nodes)
         *      {
         *          MethodDescriptor method_descr = child.Tag as MethodDescriptor;
         *          if (method_descr != null)
         *          {
         *              if (!first)
         *              {
         *                  codePrinter.PrintLn();
         *                  codePrinter.PrintLn();
         *              }
         *              else first = false;
         *
         *              // print no messages and no definitions
         *              PrintMethod(method_descr, codePrinter, mem_log, printDefs, defsFirst);
         *
         *              int ticks = Environment.TickCount;
         *              if (ticks != tick_count1 && ticks != tick_count2)
         *              {
         *                  // it's taking too long
         *                  tick_count1 = Environment.TickCount;
         *                  tick_count2 = unchecked(tick_count1 + 1);
         *
         *                  Application.DoEvents();
         *
         *                  // re-set the selection on rich text box controls because DoEvents may have
         *                  // included some undesired user input
         *                  richTextBoxCode.Select(richTextBoxCode.TextLength, 0);
         *                  richTextBoxMessages.Select(richTextBoxMessages.TextLength, 0);
         *
         *                  Cursor.Current = Cursors.WaitCursor;
         *              }
         *          }
         *      }
         *  }
         *  finally
         *  {
         *      Cursor.Current = original_cursor;
         *  }
         *
         *  logPrinter.PrintEntry(
         *      Severity.Info, 0,
         *      "Please select an individual method in the tree to view additional information.");
         * }
         *
         */

        #endregion

        #region NativeStorageLoading

        private void LoadNativeStorage(object invokeUntyped)
        {
            try
            {
                _nativeStorage = new BasicSymbolStorage();
            }
            catch (Exception ex)
            {
                // Need to swallow this unfortunately because we are on a backrground thread
                Debug.Fail(ex.Message);
            }
            finally
            {
                if (_nativeStorage == null)
                {
                    _nativeStorage = new BasicSymbolStorage();
                }
            }

            // Ping the UI to let in know the Database is now loaded
            ISynchronizeInvoke invoke = (ISynchronizeInvoke)invokeUntyped;

            try
            {
                WaitCallback del = delegate(object notused) { this.OnTabPageChanged(this, EventArgs.Empty); };
                invoke.Invoke(del, new object[] { null });
            }
            catch (Exception)
            {
                // No need to assert.  We get this if the user closes the application before
                // the database finishes loading
            }
        }
        public SelectSymbolDialog(SearchKind kind, INativeSymbolStorage ns)
        {
            InitializeComponent();
            _storage         = ns;
            _searchGrid      = new SearchDataGrid();
            _searchGrid.Dock = DockStyle.Fill;
            TableLayoutPanel1.Controls.Add(_searchGrid, 1, 1);

            SearchKind = kind;
        }
        public TranslateSnippetControl()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            _storage = new BasicSymbolStorage();

            // Add any initialization after the InitializeComponent() call.
            _languageTypeComboBox.Items.AddRange(EnumUtil.GetAllValuesObject <LanguageType>());
            _languageTypeComboBox.SelectedItem = LanguageType.VisualBasic;
        }
Example #4
0
        public SymbolDisplayControl(INativeSymbolStorage storage)
        {
            _storage = storage;
            _conv    = new BasicConverter(LanguageType.VisualBasic, storage);

            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Populate the combo boxes
            m_languageCb.Items.AddRange(EnumUtil.GetAllValuesObject <LanguageType>());
            m_languageCb.SelectedItem = LanguageType.VisualBasic;
            m_searchKindCb.Items.AddRange(PInvoke.EnumUtil.GetAllValuesObjectExcept(SearchKind.None));
            m_searchKindCb.SelectedItem = SearchKind.All;

            // Initialize the values
            OnSearchKindChanged(null, EventArgs.Empty);
            OnLanguageChanged(null, EventArgs.Empty);
        }
Example #5
0
        public static IEnumerable <Macro> GetAllMacros(this INativeSymbolStorage storage)
        {
            var list = new List <Macro>();

            foreach (var name in storage.NativeNames.Where(x => x.Kind == NativeNameKind.Constant))
            {
                NativeConstant constant;
                if (!storage.TryGetGlobalSymbol(name, out constant))
                {
                    continue;
                }

                switch (constant.ConstantKind)
                {
                case ConstantKind.MacroMethod:
                {
                    var body = constant.Value.Expression;
                    if (body.Length > 1 && body[0] == '"' && body[body.Length - 1] == '"')
                    {
                        body = body.Substring(1, body.Length - 2);
                    }

                    MethodMacro method = null;
                    if (MethodMacro.TryCreateFromDeclaration(name.Name, body, out method))
                    {
                        list.Add(method);
                    }
                }
                break;

                case ConstantKind.Macro:
                    list.Add(new Macro(name.Name, constant.Value.Expression));
                    break;

                default:
                    Contract.ThrowInvalidEnumValue(constant.ConstantKind);
                    break;
                }
            }

            return(list);
        }
Example #6
0
        /// <summary>
        /// Save all of the information into a NativeStorage database that is completely resolved
        /// TODO: INativeSymbolStorage is wrong.  Should have a lower API like INativeSymbolLookupRaw.
        /// </summary>
        public void SaveToNativeStorage(INativeSymbolStorage nativeStorage)
        {
            foreach (NativeConstant nConst in this.FindResolvedConstants())
            {
                nativeStorage.AddConstant(nConst);
            }

            foreach (NativeDefinedType definedNt in this.FindResolvedDefinedTypes())
            {
                nativeStorage.AddDefinedType(definedNt);
            }

            foreach (NativeTypeDef typeDef in this.FindResolvedTypeDefs())
            {
                nativeStorage.AddTypeDef(typeDef);
            }

            foreach (NativeProcedure proc in this.FindResolvedProcedures())
            {
                nativeStorage.AddProcedure(proc);
            }
        }
Example #7
0
        public SearchDataGrid(INativeSymbolStorage storage)
        {
            _storage       = storage;
            Timer.Enabled  = false;
            Timer.Interval = 500;

            this.VirtualMode           = true;
            this.ReadOnly              = true;
            this.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
            this.AllowUserToAddRows    = false;
            this.AllowUserToDeleteRows = false;
            this.AllowUserToResizeRows = false;
            this.RowHeadersVisible     = false;

            DataGridViewTextBoxColumn nameColumn = new DataGridViewTextBoxColumn();

            nameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            nameColumn.HeaderText   = "Name";
            nameColumn.ReadOnly     = true;
            nameColumn.Width        = 180;
            _nameColumn             = nameColumn;

            DataGridViewTextBoxColumn valueColumn = new DataGridViewTextBoxColumn();

            valueColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            valueColumn.HeaderText   = "Value";
            valueColumn.ReadOnly     = true;
            valueColumn.MinimumWidth = 100;
            _valueColumn             = valueColumn;

            base.Columns.AddRange(new DataGridViewColumn[] {
                nameColumn,
                valueColumn
            });

            SearchKind = PInvoke.Controls.SearchKind.None;
        }
Example #8
0
 public ConstantsInfo(INativeSymbolStorage storage) : base(storage)
 {
 }
Example #9
0
 public static void AddProcedure(this INativeSymbolStorage storage, NativeProcedure procedure) => storage.Add(new NativeGlobalSymbol(procedure));
 public TranslateSnippetControl(INativeSymbolStorage storage)
 {
     _storage = storage;
 }
Example #11
0
 public ProcedureInfo(INativeSymbolStorage storage) : base(storage)
 {
 }
Example #12
0
 public AllInfo(INativeSymbolStorage storage) : base(storage)
 {
 }
Example #13
0
 public TypeInfo(INativeSymbolStorage storage) : base(storage)
 {
 }
Example #14
0
 public static void AddConstant(this INativeSymbolStorage storage, NativeConstant constant) => storage.Add(new NativeGlobalSymbol(constant));
Example #15
0
 protected SearchDataGridInfo(INativeSymbolStorage storage)
 {
     Storage = storage;
 }
Example #16
0
 public static NativeSymbolBag CreateFrom(Parser.NativeCodeAnalyzerResult result, INativeSymbolStorage storage)
 {
     return(CreateFrom(result, storage, new ErrorProvider()));
 }
Example #17
0
 public static void AddTypeDef(this INativeSymbolStorage storage, NativeTypeDef typeDef) => storage.Add(new NativeGlobalSymbol(typeDef));
Example #18
0
 public static void AddDefinedType(this INativeSymbolStorage storage, NativeDefinedType definedType) => storage.Add(new NativeGlobalSymbol(definedType));
Example #19
0
 public BasicConverter(LanguageType type, INativeSymbolStorage storage)
 {
     Storage      = storage;
     LanguageType = type;
 }
Example #20
0
 public static void AddEnumAndValues(this INativeSymbolStorage storage, NativeEnum enumeration)
 {
     // Enumerations are already special cased hence this behavior is automatic.
     // https://github.com/jaredpar/pinvoke/issues/16
     storage.Add(new NativeGlobalSymbol(enumeration));
 }