示例#1
0
        public static AndroidDevice GetRandomAndroidDevice()
        {
TryLabel:
            var randomDeviceIndex = Rnd.Next(0, DevicesNames.Count);
            var device = AndroidAndroidDeviceSets.ElementAt(randomDeviceIndex).Value;

            device.PhoneGuid              = Guid.NewGuid();
            device.DeviceGuid             = Guid.NewGuid();
            device.DeviceId               = ApiRequestMessage.GenerateDeviceIdFromGuid(device.DeviceGuid);
            device.PigeonSessionId        = Guid.NewGuid();
            device.PushDeviceGuid         = Guid.NewGuid();
            device.FamilyDeviceGuid       = Guid.NewGuid();
            device.IGBandwidthSpeedKbps   = $"{Rnd.Next(1233, 1567)}.{Rnd.Next(100, 999)}";
            device.IGBandwidthTotalTimeMS = Rnd.Next(781, 999).ToString();
            try
            {
                device.IGBandwidthTotalBytesB = ((int)((double.Parse(device.IGBandwidthSpeedKbps) * double.Parse(device.IGBandwidthTotalTimeMS)) + Rnd.Next(100, 999))).ToString();
            }
            catch { }
            if (LastDevice != null)
            {
                if (device.DeviceId == LastDevice.DeviceId)
                {
                    goto TryLabel;
                }
            }
            LastDevice = device;
            return(device);
        }
示例#2
0
        public static ApiRequestMessage FromDevice(AndroidDevice device)
        {
            var requestMessage = new ApiRequestMessage
            {
                phone_id  = device.PhoneGuid.ToString(),
                guid      = device.DeviceGuid,
                device_id = device.DeviceId
            };

            return(requestMessage);
        }
示例#3
0
        public static AndroidDevice GetRandomAndroidDevice()
        {
TryLabel:
            var randomDeviceIndex = rnd.Next(0, DevicesNames.Count);
            var device = AndroidAndroidDeviceSets.ElementAt(randomDeviceIndex).Value;

            device.PhoneGuid  = Guid.NewGuid();
            device.DeviceGuid = Guid.NewGuid();
            device.DeviceId   = ApiRequestMessage.GenerateDeviceIdFromGuid(device.DeviceGuid);
            if (LastDevice != null)
            {
                if (device.DeviceId == LastDevice.DeviceId)
                {
                    goto TryLabel;
                }
            }
            LastDevice = device;
            return(device);
        }