Example #1
0
        public bool FixComputerId(out string error)
        {
            var computerId = CloudHelper.GetGuidId(CloudKey.ComputerId, this, out error);

            if (!computerId.HasValue)
            {
                return(false);
            }
            var profileId = CloudHelper.GetGuidId(CloudKey.ProfileId, this, out error);

            if (!profileId.HasValue)
            {
                return(false);
            }
            Fix(computerId.Value, profileId.Value, UserGames);
            Fix(computerId.Value, profileId.Value, UserDevices);
            Fix(computerId.Value, profileId.Value, UserInstances);
            Fix(computerId.Value, profileId.Value, UserSettings);
            return(true);
        }
Example #2
0
        public static void Select(CloudMessage command, CloudMessage results, List <string> messages, out string error)
        {
            var computerId = CloudHelper.GetGuidId(CloudKey.ComputerId, command, out error).Value;
            var profileId  = CloudHelper.GetGuidId(CloudKey.ProfileId, command, out error).Value;

            // Get all user games.
            if (command.UserGames != null)
            {
                UserGame[] userGames;
                error = Select(computerId, profileId, command.UserGames, out userGames);
                messages.Add(error);
                results.UserGames = FilterByChecksum(userGames, command.Checksums, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    messages.Add(error);
                }
            }
            // Get all user devices.
            if (command.UserDevices != null)
            {
                UserDevice[] userDevices;
                error = Select(computerId, profileId, command.UserDevices, out userDevices);
                messages.Add(error);
                results.UserDevices = FilterByChecksum(userDevices, command.Checksums, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    messages.Add(error);
                }
            }
            //// Get all user computers.
            //if (command.UserComputers != null)
            //{
            //    UserComputer[] userComputers;
            //    error = Select(computerId, profileId, command.UserComputers, out userComputers);
            //    messages.Add(error);
            //    results.UserComputers = FilterByChecksum(userComputers, command.Checksums, out error);
            //    if (!string.IsNullOrEmpty(error))
            //        messages.Add(error);
            //}
            // Get all user instances.
            if (command.UserInstances != null)
            {
                UserInstance[] userInstances;
                error = Select(computerId, profileId, command.UserInstances, out userInstances);
                messages.Add(error);
                results.UserInstances = FilterByChecksum(userInstances, command.Checksums, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    messages.Add(error);
                }
            }
            // Get all user instances.
            if (command.UserSettings != null)
            {
                UserSetting[] userSettings;
                error = Select(computerId, profileId, command.UserSettings, out userSettings);
                messages.Add(error);
                results.UserSettings = userSettings;
                //results.UserSettings = FilterByChecksum(userSettings, command.Checksums, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    messages.Add(error);
                }
            }
        }