msos.CommandExecutionContext.WriteLink C# (CSharp) Method

WriteLink() public method

public WriteLink ( string text, string command ) : void
text string
command string
return void
        public void WriteLink(string text, string command)
        {
            if (HyperlinkOutput)
            {
                if (Printer.HasNativeHyperlinkSupport)
                {
                    Printer.WriteLink(text, command);
                }
                else
                {
                    // To work around the fact that we don't always have native
                    // hyperlink output (like HTML), we create a temporary alias
                    // for each link. The user can then execute the alias, which
                    // is like "clicking" the link.
                    string alias = AddTemporaryAlias(command);
                    Write(text + " ");
                    Printer.WriteLink(String.Format("[{0}]", alias), command);
                }
            }
            else
            {
                Write(text);
            }
        }

Usage Example

Esempio n. 1
0
        public void Execute(CommandExecutionContext context)
        {
            if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress))
                return;

            var type = context.Heap.GetObjectType(ObjectAddress);
            if (!type.IsArray)
            {
                context.WriteError("The object at the specified address is not an array.");
                return;
            }

            var size = type.GetSize(ObjectAddress);
            var length = type.GetArrayLength(ObjectAddress);
            context.WriteLine("Name:  {0}", type.Name);
            context.WriteLine("Size:  {0}(0x{1:x}) bytes", size, size);
            context.WriteLine("Array: Number of elements {0}, Type {1} {2}",
                length, type.ComponentType.Name,
                type.ComponentType.IsValueClass ? "(value type)" : "(reference type)");

            for (int i = 0; i < length; ++i)
            {
                context.Write("[{0}] ", i);

                object value;
                if (type.ComponentType.IsValueClass)
                {
                    value = type.GetArrayElementAddress(ObjectAddress, i);
                    if (value != null)
                    {
                        context.WriteLink(
                            String.Format("{0:x16}", value),
                            String.Format("!do {0:x16} --type {1}", value, type.ComponentType.Name)
                            );
                    }
                    else
                    {
                        context.Write("<null>");
                    }
                }
                else
                {
                    value = type.GetArrayElementValue(ObjectAddress, i);
                    ulong elementAddr = type.GetArrayElementAddress(ObjectAddress, i);
                    ulong elementRef;
                    if (context.Runtime.ReadPointer(elementAddr, out elementRef))
                    {
                        context.WriteLink(
                            String.Format("{0:x16}", value ?? "<null>"),
                            String.Format("!do {0:x16}", elementRef)
                            ); 
                    }
                    else
                    {
                        context.Write("{0:x16}", value ?? "<null>");
                    }
                }
                context.WriteLine();
            }
        }
All Usage Examples Of msos.CommandExecutionContext::WriteLink