Ejemplo n.º 1
0
        private static async Task <ArgumentHandleResult> ProcessSharedById(string id, bool justGo)
        {
            SharedEntry shared;

            using (var waiting = new WaitingDialog()) {
                waiting.Report(ControlsStrings.Common_Loading);
                shared = await SharingHelper.GetSharedAsync(id, waiting.CancellationToken);
            }
            return(await ProcessSharedEntry(shared, justGo));
        }
Ejemplo n.º 2
0
        private static async Task <ArgumentHandleResult> ProcessShared(string id)
        {
            SharedEntry shared;

            using (var waiting = new WaitingDialog()) {
                waiting.Report(ControlsStrings.Common_Loading);
                shared = await SharingHelper.GetSharedAsync(id, waiting.CancellationToken);
            }

            var data = shared?.Data;

            if (data == null)
            {
                return(ArgumentHandleResult.Failed);
            }

            switch (shared.EntryType)
            {
            case SharedEntryType.PpFilter:
                return(ProcessSharedPpFilter(shared, data));

            case SharedEntryType.CarSetup:
                return(ProcessSharedCarSetup(shared, data));

            case SharedEntryType.ControlsPreset:
                return(ProcessSharedControlsPreset(shared, data));

            case SharedEntryType.ForceFeedbackPreset:
                return(ProcessSharedForceFeedbackPreset(shared, data));

            case SharedEntryType.VideoSettingsPreset:
                return(ProcessSharedSettingsPreset(AcSettingsHolder.VideoPresets, shared, data));

            case SharedEntryType.AudioSettingsPreset:
                return(ProcessSharedSettingsPreset(AcSettingsHolder.AudioPresets, shared, data));

            case SharedEntryType.AssistsSetupPreset:
                return(ProcessSharedAssistsSetupPreset(shared, data));

            case SharedEntryType.TrackStatePreset:
                return(ProcessSharedTrackStatePreset(shared, data));

            case SharedEntryType.QuickDrivePreset:
                return(await ProcessSharedQuickDrivePreset(shared, data));

            case SharedEntryType.RaceGridPreset:
                return(ProcessSharedRaceGridPreset(shared, data));

            case SharedEntryType.RhmPreset:
                return(ProcessSharedRhmPreset(shared, data));

            case SharedEntryType.UserChampionship:
                return(OptionUserChampionshipExtMode ? ProcessSharedUserChampionshipExt(shared, data) :
                       ProcessSharedUserChampionship(shared, data));

            case SharedEntryType.Weather:
                return(ProcessSharedWeather(shared, data));

            case SharedEntryType.CustomShowroomPreset:
                return(ProcessSharedCustomShowroomPreset(shared, data));

            case SharedEntryType.CustomPreviewsPreset:
                return(ProcessSharedCustomPreviewsPreset(shared, data));

            case SharedEntryType.CspSettings:
                return(ProcessSharedCspSettings(shared, data));

            case SharedEntryType.Replay:
                throw new NotSupportedException();

            case SharedEntryType.Results:
                ModernDialog.ShowMessage(Encoding.UTF8.GetString(data));
                return(ArgumentHandleResult.Successful);

            default:
                throw new Exception(string.Format(AppStrings.Arguments_SharedUnsupported, shared.EntryType));
            }
        }