Esempio n. 1
0
        // Prepares and sends the usage info. Run this on a separate thread in case it is time-consuming.
        // Clients can turn on "Enable Just My Code" in the debugger options to avoid seeing handled
        //  exceptions in the .NET sockets code if the server can't be found.
        private static void _SendAtfUsageInfo(object unusedState)
        {
            // GetHostName() and GetHostEntry() can throw an exception. We don't want to cause any problems for clients.
            try
            {
                var recapUri = new Uri("http://sd-cdump-dev002.share.scea.com:8080");

                var logger = new ServerLogger();
                logger.ServerName      = recapUri;
                logger.ApplicationName = "ATF_" + logger.ApplicationName;

                string  atfVersionString;
                Version atfVersion = AtfVersion.GetVersion();
                atfVersionString = atfVersion != null?atfVersion.ToString() : "n/a";

                string      computerName     = Dns.GetHostName();
                IPHostEntry hostEntry        = Dns.GetHostEntry(computerName);
                string      fullComputerName = hostEntry.HostName;
                string      userName         = System.Environment.UserName;
                bool        appIs64Bit       = (IntPtr.Size == 8);
                string      osVersion        = GetOSFullName();
                string      clrVersion       = Environment.Version.ToString();
                int         physicalMb       = Kernel32.GetPhysicalMemoryMB();

                // Analyze all loaded assemblies
                var loadedAssemblies = new StringBuilder();
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    string name, version;
                    ParseAssemblyName(assembly.FullName, out name, out version);
                    if (loadedAssemblies.Length > 0)
                    {
                        loadedAssemblies.Append(", ");
                    }
                    loadedAssemblies.AppendFormat("{0} {1}", name, version);
                }

                string installedVisualStudioVersions = GetInstalledVisualStudioVersions();

                string phoneHomeMessage =
                    "ATF:" + atfVersionString + Environment.NewLine +
                    "Computer:" + fullComputerName + Environment.NewLine +
                    "User:"******"InstalledVS:" + installedVisualStudioVersions + Environment.NewLine +
                    "64-bit app:" + appIs64Bit + Environment.NewLine +
                    "RAM(MB):" + physicalMb + Environment.NewLine +
                    "O.S.:" + osVersion + Environment.NewLine +
                    "CLR:" + clrVersion + Environment.NewLine +
                    "assemblies:" + loadedAssemblies
                ;

                logger.SendLogData(phoneHomeMessage);
            }
            catch
            {
            }
        }
Esempio n. 2
0
        // Prepares and sends the usage info. Run this on a separate thread in case it is time-consuming.
        private static void _SendAtfUsageInfo(object unusedState)
        {
            // GetHostName() and GetHostEntry() can throw an exception. We don't want to cause any problems for clients.
            try
            {
                Uri recapUri = new Uri("http://sd-cdump-dev002.share.scea.com:8080");

                // If we didn't check this first, RecapConnect.post() could cause exceptions to
                //  be thrown within Dns.GetHostEntry(), etc. That's just the semantics of System.Net.Dns
                //  that it communicates normal results via exceptions being thrown which is annoying to
                //  clients if they don't have a working internet connection and they're using the
                //  debugger with the "break on exception thrown" setting turned on.
                if (!CanResolve(recapUri))
                {
                    return;
                }

                var logger = new ServerLogger();
                logger.ServerName      = recapUri;
                logger.ApplicationName = "ATF_" + logger.ApplicationName;

                string  atfVersionString;
                Version atfVersion = AtfVersion.GetVersion();
                atfVersionString = atfVersion != null?atfVersion.ToString() : "n/a";

                string      computerName     = Dns.GetHostName();
                IPHostEntry hostEntry        = Dns.GetHostEntry(computerName);
                string      fullComputerName = hostEntry.HostName;
                string      userName         = System.Environment.UserName;
                bool        appIs64Bit       = (IntPtr.Size == 8);
                string      osVersion        = GetOSFullName();
                string      clrVersion       = Environment.Version.ToString();
                int         physicalMb       = Kernel32.GetPhysicalMemoryMB();

                // Analyze all loaded assemblies
                StringBuilder loadedAssemblies = new StringBuilder();
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    string name, version;
                    ParseAssemblyName(assembly.FullName, out name, out version);
                    if (loadedAssemblies.Length > 0)
                    {
                        loadedAssemblies.Append(", ");
                    }
                    loadedAssemblies.AppendFormat("{0} {1}", name, version);
                }

                string installedVisualStudioVersions = GetInstalledVisualStudioVersions();

                string phoneHomeMessage =
                    "ATF:" + atfVersionString + Environment.NewLine +
                    "Computer:" + fullComputerName + Environment.NewLine +
                    "User:"******"InstalledVS:" + installedVisualStudioVersions + Environment.NewLine +
                    "64-bit app:" + appIs64Bit + Environment.NewLine +
                    "RAM(MB):" + physicalMb + Environment.NewLine +
                    "O.S.:" + osVersion + Environment.NewLine +
                    "CLR:" + clrVersion + Environment.NewLine +
                    "assemblies:" + loadedAssemblies
                ;

                logger.SendLogData(phoneHomeMessage);
            }
            catch
            {
            }
        }