Ejemplo n.º 1
0
        public string GetVersionString()
        {
            StringBuilder sb           = new StringBuilder(CLRMetaHost.MaxVersionStringLength);
            int           verStrLength = sb.Capacity;

            m_runtimeInfo.GetVersionString(sb, ref verStrLength);
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public static DebugContext ForRuntime(ICLRRuntimeInfo runtime)
        {
            var versionBuilder = new StringBuilder();
            var versionBuilderCapacity = versionBuilder.Capacity;

            runtime.GetVersionString(versionBuilder, ref versionBuilderCapacity);

            var version = versionBuilder.ToString();

            DebugContext debugContext;

            if (!DebugContexts.TryGetValue(version, out debugContext))
            {
                DebugContexts.Add(version, debugContext = new DebugContext(runtime));
            }

            return debugContext;
        }
Ejemplo n.º 3
0
        public static ICLRRuntimeInfo GetRuntime(IEnumUnknown runtimes, String version)
        {
            Object[]        temparr = new Object[3];
            uint            fetchedNum;
            String          highestVersion = null;
            ICLRRuntimeInfo result         = null;

            do
            {
                runtimes.Next(Convert.ToUInt32(temparr.Length), temparr, out fetchedNum);

                for (int i = 0; i < fetchedNum; i++)
                {
                    ICLRRuntimeInfo t = (ICLRRuntimeInfo)temparr[i];

                    // initialize buffer for the runtime version string
                    StringBuilder sb  = new StringBuilder(16);
                    UInt32        len = Convert.ToUInt32(sb.Capacity);
                    t.GetVersionString(sb, ref len);

                    // version not specified we return the first one
                    if (!String.IsNullOrEmpty(version))
                    {
                        if (sb.ToString().StartsWith(version, StringComparison.Ordinal))
                        {
                            return(t);
                        }
                    }
                    else
                    {
                        if (highestVersion == null || String.CompareOrdinal(version, highestVersion) > 0)
                        {
                            highestVersion = version;
                            result         = t;
                        }
                    }
                }
            } while (fetchedNum == temparr.Length);

            return(result);
        }