Ejemplo n.º 1
0
        public static bool Connect()
        {
            if (ImageComparisonServer != null)
            {
                return(true);
            }

            try
            {
                ImageComparisonServer = new TcpClient();
                ImageComparisonServer.Connect(ParadoxImageServerHost, ParadoxImageServerPort);

                // Send initial parameters
                var networkStream = ImageComparisonServer.GetStream();
                var binaryWriter  = new BinaryWriter(networkStream);
                ImageTestResultConnection.Write(binaryWriter);

                return(true);
            }
            catch (Exception)
            {
                ImageComparisonServer = null;

                return(false);
            }
        }
Ejemplo n.º 2
0
        public static ImageTestResultConnection GetDefaultImageTestResultConnection()
        {
            var result = new ImageTestResultConnection();

            // TODO: Check build number in environment variables
            result.BuildNumber = -1;

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            result.Platform = "Windows";
            result.Serial   = Environment.MachineName;
#if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
            result.DeviceName = "Direct3D";
#elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
            result.DeviceName = "OpenGLES";
#elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
            result.DeviceName = "OpenGL";
#endif
#elif SILICONSTUDIO_PLATFORM_ANDROID
            result.Platform   = "Android";
            result.DeviceName = Android.OS.Build.Manufacturer + " " + Android.OS.Build.Model;
            result.Serial     = Android.OS.Build.Serial ?? "Unknown";
#elif SILICONSTUDIO_PLATFORM_IOS
            result.Platform   = "iOS";
            result.DeviceName = iOSDeviceType.Version.ToString();
            result.Serial     = UIKit.UIDevice.CurrentDevice.Name;
#elif SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
#if SILICONSTUDIO_PLATFORM_WINDOWS_PHONE
            result.Platform = "WindowsPhone";
#elif SILICONSTUDIO_PLATFORM_WINDOWS_STORE
            result.Platform = "WindowsStore";
#endif
            var deviceInfo = new EasClientDeviceInformation();
            result.DeviceName = deviceInfo.SystemManufacturer + " " + deviceInfo.SystemProductName;
            try
            {
                result.Serial = deviceInfo.Id.ToString();
            }
            catch (Exception)
            {
                var token      = HardwareIdentification.GetPackageSpecificToken(null);
                var hardwareId = token.Id;

                var hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
                var hashed = hasher.HashData(hardwareId);

                result.Serial = CryptographicBuffer.EncodeToHexString(hashed);
            }
#endif

            return(result);
        }
Ejemplo n.º 3
0
        public static ImageTestResultConnection GetDefaultImageTestResultConnection()
        {
            var result = new ImageTestResultConnection();

            // TODO: Check build number in environment variables
            result.BuildNumber = -1;

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            result.Platform = "Windows";
            result.Serial = Environment.MachineName;
#if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
            result.DeviceName = "Direct3D";
#elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
            result.DeviceName = "OpenGLES";
#elif SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
            result.DeviceName = "OpenGL";
#endif
#elif SILICONSTUDIO_PLATFORM_ANDROID
            result.Platform = "Android";
            result.DeviceName = Android.OS.Build.Manufacturer + " " + Android.OS.Build.Model;
            result.Serial = Android.OS.Build.Serial ?? "Unknown";
#elif SILICONSTUDIO_PLATFORM_IOS
            result.Platform = "iOS";
            result.DeviceName = iOSDeviceType.Version.ToString();
            result.Serial = UIKit.UIDevice.CurrentDevice.Name;
#elif SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
#if SILICONSTUDIO_PLATFORM_WINDOWS_PHONE
            result.Platform = "WindowsPhone";
#elif SILICONSTUDIO_PLATFORM_WINDOWS_STORE
            result.Platform = "WindowsStore";
#endif
            var deviceInfo = new EasClientDeviceInformation();
            result.DeviceName = deviceInfo.SystemManufacturer + " " + deviceInfo.SystemProductName;
            try
            {
                result.Serial = deviceInfo.Id.ToString();
            }
            catch (Exception)
            {
                var token = HardwareIdentification.GetPackageSpecificToken(null);
                var hardwareId = token.Id;

                var hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
                var hashed = hasher.HashData(hardwareId);

                result.Serial =  CryptographicBuffer.EncodeToHexString(hashed);
            }
#endif

            return result;
        }
Ejemplo n.º 4
0
        public static async Task <bool> ConnectAsync()
        {
            if (imageComparisonServer != null)
            {
                return(true);
            }

            try
            {
                imageComparisonServer = new StreamSocket();
                await imageComparisonServer.ConnectAsync(new HostName(ParadoxImageServerHost), ParadoxImageServerPort.ToString());

                // Send initial parameters
                using (var memoryStream = new MemoryStream())
                {
                    var binaryWriter = new BinaryWriter(memoryStream);
                    ImageTestResultConnection.Write(binaryWriter);

                    var dataWriter = new DataWriter(imageComparisonServer.OutputStream);
                    dataWriter.WriteBytes(memoryStream.ToArray());
                    await dataWriter.StoreAsync();

                    await dataWriter.FlushAsync();

                    dataWriter.DetachStream();
                }

                return(true);
            }
            catch (Exception)
            {
                imageComparisonServer = null;

                return(false);
            }
        }