Exemplo n.º 1
0
        public override string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IReadOnlyDictionary <string, IControllerMapping> controllerMappings, IGameInfo gameInfo)
        {
            if (gamepadAbstraction.ProfileType == ControllerProfileType.NULL_PROFILE)
            {
                return(string.Empty);
            }
            var template = new StringBuilder(inputTemplate.StringTemplate);

            foreach (IControllerInput input in controllerDefinition.ControllerInputs.Values)
            {
                string templateKey   = controllerMappings["default"].InputMappings[input.InputName];
                string inputSetting  = gamepadAbstraction[input.GamepadAbstraction];
                string emulatorValue = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
                                       inputTemplate.KeyboardMappings.First().Value[inputSetting] : inputTemplate.GamepadMappings.First().Value[inputSetting];
                template.Replace($"{{{templateKey}}}", emulatorValue);
            }

            if (platformInfo.PlatformID == StonePlatforms.NINTENDO_WII && controllerDefinition.ControllerID == "GCN_CONTROLLER")
            {
                template.Replace("{N}", (playerIndex - 4).ToString()); //Account for GCPad being in controller positions 5-8.
            }
            else
            {
                template.Replace("{N}", playerIndex.ToString()); //Player Index
            }

            foreach (string key in inputTemplate.TemplateKeys)
            {
                template.Replace($"{{{key}}}",
                                 controllerMappings["default"].KeyMappings.ContainsKey(key)
                        ? controllerMappings["default"].KeyMappings[key]
                        : inputTemplate.NoBind);
            }
            return(template.ToString());
        }
Exemplo n.º 2
0
 public SystemModule(IAppFolderInfo appFolderInfo,
                     IRuntimeInfo runtimeInfo,
                     IPlatformInfo platformInfo,
                     IOsInfo osInfo,
                     IRouteCacheProvider routeCacheProvider,
                     IConfigFileProvider configFileProvider,
                     IMainDatabase database,
                     ILifecycleService lifecycleService,
                     IDeploymentInfoProvider deploymentInfoProvider)
     : base("system")
 {
     _appFolderInfo          = appFolderInfo;
     _runtimeInfo            = runtimeInfo;
     _platformInfo           = platformInfo;
     _osInfo                 = osInfo;
     _routeCacheProvider     = routeCacheProvider;
     _configFileProvider     = configFileProvider;
     _database               = database;
     _lifecycleService       = lifecycleService;
     _deploymentInfoProvider = deploymentInfoProvider;
     Get("/status", x => GetStatus());
     Get("/routes", x => GetRoutes());
     Post("/shutdown", x => Shutdown());
     Post("/restart", x => Restart());
 }
Exemplo n.º 3
0
        public static void InitSDK(Grid layoutRoot, string appId, string appKey)
        {
            advertisingIdHelper = DependencyService.Get <IAdvertisingIdHelper>();
            platformInfo        = DependencyService.Get <IPlatformInfo>();
            hybridWebView       = new HybridWebView();
            fileHelper          = new FileHelper();

            advertisingIdHelper.GetAdvertisingId(AdManager.SetAdvertisingId);
            duid        = WebUtility.UrlEncode(platformInfo.GetDeviceId());
            mconnection = WebUtility.UrlEncode(platformInfo.GetMobileConnectionType());
            mop         = WebUtility.UrlEncode(platformInfo.GetMobileOperatorName());

            aid    = appId;
            appkey = appKey;

            if (!layoutRoot.Children.Contains(hybridWebView))
            {
                hybridWebView.Uri               = "useragent.html";
                hybridWebView.MethodToInvoke    = "getUserAgent";
                hybridWebView.WidthRequest      = 1;
                hybridWebView.HeightRequest     = 1;
                hybridWebView.VerticalOptions   = LayoutOptions.Start;
                hybridWebView.HorizontalOptions = LayoutOptions.Start;
                hybridWebView.BackgroundColor   = Color.Transparent;
                hybridWebView.Opacity           = 1;
                layoutRoot.Children.Add(hybridWebView);
            }

            hybridWebView.RegisterAction(AdManager.SetUserAgent);
        }
 public void AddPlatform(IPlatformInfo platformInfo)
 {
     SQLiteConnection dbConnection = this.GetConnection();
     dbConnection.Open();
     using (var sqlCommand = new SQLiteCommand(@"INSERT OR IGNORE INTO ports VALUES(
                                                         @platform_id,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         null
                                                         )", dbConnection))
     {
         sqlCommand.Parameters.AddWithValue("@platform_id", platformInfo.PlatformID);
         sqlCommand.ExecuteNonQuery();
         dbConnection.Close();
     }/*
     if (Environment.OSVersion.Platform == PlatformID.Win32NT)
     {
         this.SetDefaults_Win32(platformInfo); //Set windows defaults if runs on windows.
     }
     else
     {
         this.SetDefaults_KeyboardOnly(platformInfo); //Only set keyboard defaults
     }*/
 }
Exemplo n.º 5
0
        public SendFeedbackInteractor(
            IFeedbackApi feedbackApi,
            ISingletonDataSource <IThreadSafeUser> userDataSource,
            IDataSource <IThreadSafeWorkspace, IDatabaseWorkspace> workspacesDataSource,
            IDataSource <IThreadSafeTimeEntry, IDatabaseTimeEntry> timeEntriesDataSource,
            IPlatformInfo platformInfo,
            IUserPreferences userPreferences,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            string message)
        {
            Ensure.Argument.IsNotNull(message, nameof(message));
            Ensure.Argument.IsNotNull(feedbackApi, nameof(feedbackApi));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(userDataSource, nameof(userDataSource));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(workspacesDataSource, nameof(workspacesDataSource));
            Ensure.Argument.IsNotNull(timeEntriesDataSource, nameof(timeEntriesDataSource));

            this.message               = message;
            this.feedbackApi           = feedbackApi;
            this.timeService           = timeService;
            this.platformInfo          = platformInfo;
            this.userDataSource        = userDataSource;
            this.userPreferences       = userPreferences;
            this.workspacesDataSource  = workspacesDataSource;
            this.timeEntriesDataSource = timeEntriesDataSource;
            this.lastTimeUsageStorage  = lastTimeUsageStorage;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Just provide the ElementInfo Object and would generate supported Action for the same according to the current selected Platform
        /// </summary>
        /// <param name="elementInfo"></param>
        /// <param name="mContext"></param>
        /// <returns></returns>
        static Act GeneratePOMElementRelatedAction(ElementInfo elementInfo, Context mContext)
        {
            Act           instance;
            IPlatformInfo mPlatform  = PlatformInfoBase.GetPlatformImpl(mContext.Platform);
            string        elementVal = string.Empty;

            if (elementInfo.OptionalValuesObjectsList.Count > 0)
            {
                elementVal = Convert.ToString(elementInfo.OptionalValuesObjectsList.Where(v => v.IsDefault).FirstOrDefault().Value);
            }

            ElementActionCongifuration actionConfigurations = new ElementActionCongifuration
            {
                LocateBy           = eLocateBy.POMElement,
                LocateValue        = elementInfo.ParentGuid.ToString() + "_" + elementInfo.Guid.ToString(),
                ElementValue       = elementVal,
                AddPOMToAction     = true,
                POMGuid            = elementInfo.ParentGuid.ToString(),
                ElementGuid        = elementInfo.Guid.ToString(),
                LearnedElementInfo = elementInfo,
            };

            instance = mPlatform.GetPlatformAction(elementInfo, actionConfigurations);
            return(instance);
        }
Exemplo n.º 7
0
 public UpdatePackageProvider(IHttpClient httpClient, IReadarrCloudRequestBuilder requestBuilder, IAnalyticsService analyticsService, IPlatformInfo platformInfo)
 {
     _platformInfo     = platformInfo;
     _analyticsService = analyticsService;
     _requestBuilder   = requestBuilder.Services;
     _httpClient       = httpClient;
 }
Exemplo n.º 8
0
        public App()
        {
            if (config == null)
            {
                config = new Configuration();
                IPlatformInfo platformInfo = DependencyService.Get <IPlatformInfo>();
                CrossLogger.Current.Info("Kala", "Model: " + platformInfo.GetModel());
                CrossLogger.Current.Info("Kala", "Version: " + platformInfo.GetVersion());

                CrossLogger.Current.Debug("Kala", @"URL Settings: '" + Settings.Protocol + "://" + Settings.Server + ":" + Settings.Port.ToString() + "'");
                CrossLogger.Current.Debug("Kala", @"Auth Settings: '" + Settings.Username + " / " + Settings.Password + "'");
                CrossLogger.Current.Debug("Kala", @"Sitemap Settings: '" + Settings.Sitemap + "'");
            }
            ;

            //Initialize FFImageLoading with Authentication
            FFImageLoading.AuthenticatedHttpImageClientHandler.Initialize();

            //TabbedPage setup
            if (tp.Children.Count == 0)
            {
                tp.BackgroundColor    = App.config.BackGroundColor;
                tp.BarBackgroundColor = App.config.BackGroundColor;
                tp.BarTextColor       = App.config.TextColor;

                tp.CurrentPageChanged += (sender, e) =>
                {
                    //Reset screensaver timer
                    App.config.LastActivity = DateTime.Now;
                    CrossLogger.Current.Debug("Kala", "Reset Screensaver timer");
                };

                /**/ //Show a busy signal here as we can't display anything until we have downloaded the sitemap with its items. No async. Pointless..
                sitemaps = Sitemap.GetActiveSitemap(Settings.Sitemap);

                //Selected sitemap was not found, display settings page to make change
                if (sitemaps == null)
                {
                    //Add settings tab
                    MainPage = new Views.Page1();
                }
                else
                {
                    Sitemap sitemap = new Sitemap();
                    sitemap.GetUpdates();
                    sitemap.CreateSitemap(sitemaps);
                    CrossLogger.Current.Debug("Kala", "Got Sitemaps");

                    //Add settings tab last
                    App.tp.Children.Add(new Views.Page1());
                    MainPage = App.tp;
                }
            }
            else
            {
                MainPage = App.tp;
            }
            App.config.Initialized = true;
        }
 public ModifyPortInputDeviceEventArgs(ICoreService eventCoreInstance, int portNumber, IPlatformInfo platformInfo, string previousPortInputDevice, string modifiedPortInputDevice)
     : base(eventCoreInstance)
 {
     this.portNumber = portNumber;
     this.Platform = platformInfo;
     this.PreviousPortInputDevice = previousPortInputDevice;
     this.ModifiedPortInputDevice = modifiedPortInputDevice;
 }
Exemplo n.º 10
0
        public Test3Page()
        {
            InitializeComponent();
            IPlatformInfo platformInfo = DependencyService.Get <IPlatformInfo>();

            modelLabel.Text   = platformInfo.GetModel();
            versionLabel.Text = platformInfo.GetVersion();
        }
 public ModifyPlatformPreferenceEventArgs(ICoreService eventCoreInstance, string previousPreference, string modifiedPreference, IPlatformInfo platform, PreferenceType preferenceType)
     : base(eventCoreInstance)
 {
     this.Platform = platform;
     this.PreferenceType = preferenceType;
     this.PreviousPreference = previousPreference;
     this.ModifiedPreference = modifiedPreference;
 }
Exemplo n.º 12
0
 public ReconfigureSentry(IConfigFileProvider configFileProvider,
                          IPlatformInfo platformInfo,
                          IMainDatabase database)
 {
     _configFileProvider = configFileProvider;
     _platformInfo       = platformInfo;
     _database           = database;
 }
Exemplo n.º 13
0
 public UpdatePackageProvider(IHttpClient httpClient, IProwlarrCloudRequestBuilder requestBuilder, IAnalyticsService analyticsService, IPlatformInfo platformInfo, IMainDatabase mainDatabase)
 {
     _platformInfo     = platformInfo;
     _analyticsService = analyticsService;
     _requestBuilder   = requestBuilder.Services;
     _httpClient       = httpClient;
     _mainDatabase     = mainDatabase;
 }
Exemplo n.º 14
0
 public FallbackHttpDispatcher(ManagedHttpDispatcher managedDispatcher, CurlHttpDispatcher curlDispatcher, ICacheManager cacheManager, IPlatformInfo platformInfo, Logger logger)
 {
     _managedDispatcher    = managedDispatcher;
     _curlDispatcher       = curlDispatcher;
     _platformInfo         = platformInfo;
     _curlTLSFallbackCache = cacheManager.GetCache <bool>(GetType(), "curlTLSFallback");
     _logger = logger;
 }
Exemplo n.º 15
0
 public ManagedHttpDispatcher(IHttpProxySettingsProvider proxySettingsProvider, ICreateManagedWebProxy createManagedWebProxy, IUserAgentBuilder userAgentBuilder, IPlatformInfo platformInfo, Logger logger)
 {
     _proxySettingsProvider = proxySettingsProvider;
     _createManagedWebProxy = createManagedWebProxy;
     _userAgentBuilder      = userAgentBuilder;
     _platformInfo          = platformInfo;
     _logger = logger;
 }
        public InteractorFactory(
            IIdProvider idProvider,
            ITimeService timeService,
            ITogglDataSource dataSource,
            ITogglApi api,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            INotificationService notificationService,
            IIntentDonationService intentDonationService,
            IApplicationShortcutCreator shortcutCreator,
            ILastTimeUsageStorage lastTimeUsageStorage,
            IPlatformInfo platformInfo,
            UserAgent userAgent,
            ICalendarService calendarService,
            ISyncManager syncManager,
            IStopwatchProvider stopwatchProvider,
            ITogglDatabase database,
            IPrivateSharedStorageService privateSharedStorageService,
            IUserAccessManager userAccessManager)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(idProvider, nameof(idProvider));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(userAgent, nameof(userAgent));
            Ensure.Argument.IsNotNull(calendarService, nameof(calendarService));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));

            this.dataSource                  = dataSource;
            this.api                         = api;
            this.idProvider                  = idProvider;
            this.timeService                 = timeService;
            this.userPreferences             = userPreferences;
            this.shortcutCreator             = shortcutCreator;
            this.analyticsService            = analyticsService;
            this.notificationService         = notificationService;
            this.intentDonationService       = intentDonationService;
            this.lastTimeUsageStorage        = lastTimeUsageStorage;
            this.platformInfo                = platformInfo;
            this.userAgent                   = userAgent;
            this.calendarService             = calendarService;
            this.syncManager                 = syncManager;
            this.stopwatchProvider           = stopwatchProvider;
            this.database                    = database;
            this.privateSharedStorageService = privateSharedStorageService;
            this.userAccessManager           = userAccessManager;
        }
Exemplo n.º 17
0
        public MainPage()
        {
            InitializeComponent();

            IPlatformInfo platformInfo = DependencyService.Get <IPlatformInfo>();

            lDeviceModel.Text = platformInfo.GetModel();
            lVersion.Text     = platformInfo.GetVersion();
        }
Exemplo n.º 18
0
 public Logger(IUserSettings userSettings, IGameSettings gameSettings, ILoggerCore loggerCore, IPlatformInfo platformInfo)
 {
     this.userSettings      = userSettings;
     this.gameSettings      = gameSettings;
     this.loggerCore        = loggerCore;
     this.platformInfo      = platformInfo;
     Filename               = LogFileName;
     WillDeleteLogOnDispose = true;
 }
Exemplo n.º 19
0
        public BookStorage(IPlatformInfo platform, ICouchBaseLite couchbase, ISettingsService settingsService)
        {
            // Connect to the database
            couchbase.Initialize(platform.BaseDirectory);
            var options = couchbase.CreateDatabaseOptions();

            options.Create    = true;
            m_DataBase        = couchbase.CreateConnection("bookscouchdb", options);
            m_SettingsService = settingsService;
        }
Exemplo n.º 20
0
        public OutdatedAppViewModel(IPlatformInfo platformInfo, IRxActionFactory rxActionFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            storeUrl = platformInfo.StoreUrl;

            UpdateApp   = rxActionFactory.FromAsync(updateApp);
            OpenWebsite = rxActionFactory.FromAsync(openWebsite);
        }
        /* Win32 End */
        public override string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IControllerProfile controllerProfile, IInputTemplate inputTemplate)
        {
            var controllerMappings = controllerProfile.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
                                     controllerTemplate.KeyboardControllerMappings : controllerTemplate.GamepadControllerMappings;
            string deviceName            = this.CoreInstance.ControllerPortsDatabase.GetDeviceInPort(platformInfo, playerIndex);
            IList <IInputDevice> devices = new InputManager().GetGamepads();

            if (!devices.Select(device => device.DI_ProductName).Contains(deviceName) || !(devices.Where(device => device.XI_IsXInput).Count() == 0))
            { //todo fix this
                if (deviceName == InputDeviceNames.XInputDevice1)
                {
                    var xinputDevice = devices.Where(device => device.XI_IsXInput).Where(device => device.XI_GamepadIndex == 1).FirstOrDefault();
                    if (!xinputDevice.Equals(null))
                    {
                        controllerMappings["default"].KeyMappings["JOYPAD_INDEX"] = xinputDevice.DeviceIndex.ToString();
                    }
                }
                if (deviceName == InputDeviceNames.XInputDevice2)
                {
                    var xinputDevice = devices.Where(device => device.XI_IsXInput).Where(device => device.XI_GamepadIndex == 1).FirstOrDefault();
                    if (!xinputDevice.Equals(null))
                    {
                        controllerMappings["default"].KeyMappings["JOYPAD_INDEX"] = xinputDevice.DeviceIndex.ToString();
                    }
                }
                if (deviceName == InputDeviceNames.XInputDevice3)
                {
                    var xinputDevice = devices.Where(device => device.XI_IsXInput).Where(device => device.XI_GamepadIndex == 1).FirstOrDefault();
                    if (!xinputDevice.Equals(null))
                    {
                        controllerMappings["default"].KeyMappings["JOYPAD_INDEX"] = xinputDevice.DeviceIndex.ToString();
                    }
                }
                if (deviceName == InputDeviceNames.XInputDevice4)
                {
                    var xinputDevice = devices.Where(device => device.XI_IsXInput).Where(device => device.XI_GamepadIndex == 1).FirstOrDefault();
                    if (!xinputDevice.Equals(null))
                    {
                        controllerMappings["default"].KeyMappings["JOYPAD_INDEX"] = xinputDevice.DeviceIndex.ToString();
                    }
                }
                if (devices.Select(device => device.DI_ProductName).Contains(deviceName))
                {
                    controllerMappings["default"].KeyMappings["JOYPAD_INDEX"] = devices.Where(device => device.DI_ProductName == deviceName).First().DeviceIndex.ToString();
                }
            }
            else
            {
                controllerProfile  = controllerDefinition.ProfileStore[InputDeviceNames.KeyboardDevice];
                controllerMappings = controllerTemplate.KeyboardControllerMappings;
                playerIndex        = 1; //Force Keyboard player 1 if no controllers detected
            }
            return(base.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate, controllerProfile, inputTemplate, controllerMappings));
        }
Exemplo n.º 22
0
        protected override void OnStart()
        {
            //Logger.WriteLine("OnStart: Pt-1");

            IPlatformInfo platformInfo = DependencyService.Get <IPlatformInfo>();

            Resources["AppVersion"] = platformInfo.GetAppVersion();

            // -------------------
            SetFirstColors();
        }
Exemplo n.º 23
0
        public RepositoryModel(Repository source, IPlatformInfo platform)
        {
            Repository  = source;
            Version     = Repository.Version;
            Path        = Repository.Path;
            _dispatcher = Dispatcher.CurrentDispatcher;
            var platformProvider = ServiceLocator.Current.GetInstance <IPlatformProvider>();

            _platform = platform;
            UpdateDownloadState();
        }
        public void TestInitialize()
        {
            Context      = new Context();
            mDriver      = new TestDriver();
            PlatformInfo = new TestPlatform();
            mBF          = new BusinessFlow()
            {
                Name = "TestRecordingBF", Active = true
            };
            Activity activity = new Activity();

            mBF.AddActivity(activity);
            Context.BusinessFlow = mBF;
        }
Exemplo n.º 25
0
        public ImageResizer(IDiskProvider diskProvider, IPlatformInfo platformInfo)
        {
            _diskProvider = diskProvider;

            _enabled = true;

            // More conservative memory allocation
            SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = new SimpleGcMemoryAllocator();

            // Thumbnails don't need super high quality
            SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.SetEncoder(JpegFormat.Instance, new JpegEncoder
            {
                Quality = 92
            });
        }
Exemplo n.º 26
0
        public RecordingManager(ObservableList <ApplicationPOMModel> lstApplicationPOM, BusinessFlow bFlow, Context context, IRecord platformDriver, IPlatformInfo pInfo)
        {
            try
            {
                PlatformInfo        = pInfo;
                PlatformDriver      = platformDriver;
                mApplicationPOMList = lstApplicationPOM;
                BusinessFlow        = bFlow;
                Context             = context;

                //if lstApplicationPOM == null then dont create POM or if applicationPOM.Name has some value then use the existing POM
                //or else create new POM
                if (mApplicationPOMList == null)
                {
                    LearnAdditionalDetails = false;
                    CreatePOM  = false;
                    CurrentPOM = null;
                }
                else
                {
                    LearnAdditionalDetails = true;
                    CreatePOM = true;
                    if (mApplicationPOMList.Count > 0)
                    {
                        CurrentPOM = mApplicationPOMList[0];
                    }
                    else
                    {
                        CurrentPOM = AddNewEmptyPOM("NewEmptyPOM");
                    }
                    ListPOMObjectHelper = new List <POMObjectRecordingHelper>();
                    foreach (var cPom in mApplicationPOMList)
                    {
                        ListPOMObjectHelper.Add(new POMObjectRecordingHelper()
                        {
                            PageTitle = cPom.Name, PageURL = cPom.PageURL, ApplicationPOM = cPom
                        });
                    }
                }

                PlatformDriver.ResetRecordingEventHandler();
                PlatformDriver.RecordingEvent += PlatformDriver_RecordingEvent;
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error in Recording Manager while instantiating", ex);
            }
        }
Exemplo n.º 27
0
 static void InitializeAdditionalLinks(IPlatformInfo platform, string workPath, string repositoryPath)
 {
     foreach (var link in platform.Links)
     {
         var sourcePath = link.sourcePath.Replace("_VisualTests_WorkBinPath_", workPath);
         if (!Directory.Exists(sourcePath))
         {
             continue;
         }
         var targetPath = System.IO.Path.Combine(repositoryPath, link.targetPath);
         if (PrepareToLinkCreationAndCheck(targetPath))
         {
             CreateDirectoryLink(sourcePath, targetPath);
         }
     }
 }
        public void TestInitialize()
        {
            Context      = new Context();
            mDriver      = new TestDriver();
            PlatformInfo = new TestPlatform();
            mBF          = new BusinessFlow()
            {
                Name = "TestRecordingBF", Active = true
            };
            Activity activity = new Activity();

            mBF.AddActivity(activity);
            Context.BusinessFlow = mBF;

            Context.Target = new Amdocs.Ginger.Common.Repository.TargetBase();
        }
Exemplo n.º 29
0
        private void StartRecording()
        {
            IRecord       record       = (IRecord)mDriver;
            IPlatformInfo platformInfo = PlatformInfoBase.GetPlatformImpl(mContext.Platform);

            if (xIntegratePOM.IsChecked == true)
            {
                mRecordingMngr = new RecordingManager(mPomModels, mContext.BusinessFlow, mContext, record, platformInfo);
            }
            else
            {
                mRecordingMngr = new RecordingManager(null, mContext.BusinessFlow, mContext, record, platformInfo);
            }

            mRecordingMngr.StartRecording();
        }
Exemplo n.º 30
0
 public void SetDeviceInPort(IPlatformInfo platformInfo, int portNumber, string deviceName)
 {
     SQLiteConnection dbConnection = this.GetConnection();
     if (portNumber > 8 || portNumber < 1)
     {
         throw new IndexOutOfRangeException("Snowflake only supports consoles up to 8 controller ports");
     }
     dbConnection.Open();
     using (var sqlCommand = new SQLiteCommand($"UPDATE `ports` SET `port{portNumber}` = @controllerId WHERE `platform_id` == @platformId", dbConnection))
     {
         sqlCommand.Parameters.AddWithValue("@controllerId", deviceName);
         sqlCommand.Parameters.AddWithValue("@platformId", platformInfo.PlatformID);
         sqlCommand.ExecuteNonQuery();
     }
     dbConnection.Close();
 }
Exemplo n.º 31
0
        private bool StartRecording()
        {
            IRecord       record       = (IRecord)mDriver;
            IPlatformInfo platformInfo = PlatformInfoBase.GetPlatformImpl(mContext.Platform);

            if (xIntegratePOM.IsChecked == true)
            {
                mRecordingMngr = new RecordingManager(mPomModels, mContext.BusinessFlow, mContext, record, platformInfo);
            }
            else
            {
                mRecordingMngr = new RecordingManager(null, mContext.BusinessFlow, mContext, record, platformInfo);
            }

            mRecordingMngr.RecordingNotificationEvent += RecordingMngr_RecordingNotificationEvent;
            return(mRecordingMngr.StartRecording());
        }
Exemplo n.º 32
0
        private static IPlatformInfo GetPlatformInfoObject()
        {
            if (platformInfo != null)
            {
                return(platformInfo);
            }

#if UNITY_IPHONE
            platformInfo = new iOSPlatformInfoBinding();
#elif UNITY_ANDROID
            platformInfo = new AndroidPlatformInfoBinding();
#elif UNITY_STANDALONE
            platformInfo = new StandalonePlatformInfoBinding();
#elif UNITY_WEBPLAYER
            platformInfo = new WebplayerPlatformInfoBinding();
#endif
            return(platformInfo);
        }
 public void AddPlatform(IPlatformInfo platformInfo)
 {
     SQLiteConnection dbConnection = this.GetConnection();
     dbConnection.Open();
     using (var sqlCommand = new SQLiteCommand(@"INSERT OR IGNORE INTO platformprefs VALUES(
                                   @platform_id,
                                   @emulator,
                                   @scraper)", dbConnection))
     {
         sqlCommand.Parameters.AddWithValue("@platform_id", platformInfo.PlatformID);
         KeyValuePair<string, IEmulatorBridge> emulator = this.pluginManager.Plugins<IEmulatorBridge>().FirstOrDefault(x => x.Value.SupportedPlatforms.Contains(platformInfo.PlatformID));
         KeyValuePair<string, IScraper> scraper = this.pluginManager.Plugins<IScraper>().FirstOrDefault(x => x.Value.SupportedPlatforms.Contains(platformInfo.PlatformID));
         string emulatorId = emulator.Equals(default(KeyValuePair<string, IEmulatorBridge>)) ?  "null" : emulator.Key;
         string scraperId = scraper.Equals(default(KeyValuePair<string, IScraper>)) ? "null" : scraper.Key;
         sqlCommand.Parameters.AddWithValue("@emulator", emulatorId);
         sqlCommand.Parameters.AddWithValue("@scraper", scraperId);
         sqlCommand.ExecuteNonQuery();
     }
     dbConnection.Close();
 }
Exemplo n.º 34
0
 public string GetDeviceInPort(IPlatformInfo platformInfo, int portNumber)
 {
     if (portNumber > 8 || portNumber < 1){
         return string.Empty;
     }
     SQLiteConnection dbConnection = this.GetConnection();
     dbConnection.Open();
     using (var sqlCommand = new SQLiteCommand($"SELECT `port{portNumber}` FROM `ports` WHERE `platform_id` == @platformId", dbConnection))
     {
         sqlCommand.Parameters.AddWithValue("@platformId", platformInfo.PlatformID);
         using (var reader = sqlCommand.ExecuteReader())
         {
             var result = new DataTable();
             result.Load(reader);
             DataRow row = result.Rows[0];
             dbConnection.Close();
             return row.Field<string>($"port{portNumber}");
         }
     }
 }
Exemplo n.º 35
0
        public ImageResizer(IDiskProvider diskProvider, IPlatformInfo platformInfo)
        {
            _diskProvider = diskProvider;

            // Random segfaults on mono 5.0 and 5.4
            if (PlatformInfo.IsMono && platformInfo.Version < new System.Version(5, 8))
            {
                return;
            }

            _enabled = true;

            // More conservative memory allocation
            SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = new SimpleGcMemoryAllocator();

            // Thumbnails don't need super high quality
            SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.SetEncoder(JpegFormat.Instance, new JpegEncoder
            {
                Quality = 92
            });
        }
Exemplo n.º 36
0
        public static void InitializeLinks(IPlatformInfo platform, string repositoryPath, string version)
        {
            var workPaths = new[] {
                System.IO.Path.Combine(repositoryPath, "..", version, "Bin"),
                System.IO.Path.Combine(repositoryPath, "..", $"20{version}", "Bin"),
                System.IO.Path.Combine("c:\\Work", version, "Bin"),
                System.IO.Path.Combine("c:\\Work", $"20{version}", "Bin"),
                System.IO.Path.Combine("d:\\Work", version, "Bin"),
                System.IO.Path.Combine("d:\\Work", $"20{version}", "Bin")
            };

            var workPath = workPaths.Where(Directory.Exists).FirstOrDefault();

            if (workPath == null)
            {
                return;
            }

            InitializeBinIfNeed(workPath, repositoryPath);
            InitializeAdditionalLinks(platform, workPath, repositoryPath);
        }
 public IPlatformDefaults GetPreferences(IPlatformInfo platformInfo)
 {
     SQLiteConnection dbConnection = this.GetConnection();
     dbConnection.Open();
     using (var sqlCommand = new SQLiteCommand(@"SELECT * FROM `platformprefs` WHERE `platform_id` == @platform_id"
         , dbConnection))
     {
         sqlCommand.Parameters.AddWithValue("@platform_id", platformInfo.PlatformID);
         using (var reader = sqlCommand.ExecuteReader())
         {
             var result = new DataTable();
             result.Load(reader);
             var row = result.Rows[0];
             string scraper = result.Rows[0].Field<string>("scraper");
             string emulator = result.Rows[0].Field<string>("emulator");
             IPlatformDefaults platformDefaults =
                 new PlatformDefaults(scraper,  emulator);
             dbConnection.Close();
             return platformDefaults;
         }
     }
 }
Exemplo n.º 38
0
 public virtual string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IGameInfo gameInfo)
 {
     if (gamepadAbstraction.ProfileType == ControllerProfileType.NULL_PROFILE) return string.Empty;
     var controllerMappings = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
         controllerTemplate.KeyboardControllerMappings : controllerTemplate.GamepadControllerMappings;
     return this.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate, gamepadAbstraction, inputTemplate, controllerMappings, gameInfo);
 }
Exemplo n.º 39
0
        public virtual string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IReadOnlyDictionary<string, IControllerMapping> controllerMappings, IGameInfo gameInfo)
        {
            if (gamepadAbstraction.ProfileType == ControllerProfileType.NULL_PROFILE) return string.Empty;
            var template = new StringBuilder(inputTemplate.StringTemplate);
            foreach (IControllerInput input in controllerDefinition.ControllerInputs.Values)
            {
                string templateKey = controllerMappings["default"].InputMappings[input.InputName];
                string inputSetting = gamepadAbstraction[input.GamepadAbstraction];
                string emulatorValue = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
                    inputTemplate.KeyboardMappings.First().Value[inputSetting] : inputTemplate.GamepadMappings.First().Value[inputSetting];
                template.Replace($"{{{templateKey}}}", emulatorValue);
            }

            foreach (var key in inputTemplate.TemplateKeys)
            {
                template.Replace("{N}", playerIndex.ToString()); //Player Index
                if (controllerMappings["default"].KeyMappings.ContainsKey(key))
                {
                    template.Replace($"{{{key}}}", controllerMappings["default"].KeyMappings[key]); //Non-input keys
                }
                else
                {
                    template.Replace($"{{{key}}}", inputTemplate.NoBind); //Non-input keys
                }
            }
            return template.ToString();
        }
Exemplo n.º 40
0
 public ScrapeService(IPlatformInfo scrapePlatform, string scraperName, ICoreService coreInstance)
 {
     this.ScrapePlatform = scrapePlatform;
     this.CoreInstance = coreInstance;
     this.ScraperPlugin = this.CoreInstance.Get<IPluginManager>().Plugins<IScraper>()[scraperName];
 }
Exemplo n.º 41
0
 private void SetDefaults_Win32(IPlatformInfo platformInfo)
 {
     this.SetDeviceInPort(platformInfo, 1, InputDeviceNames.KeyboardDevice);
     this.SetDeviceInPort(platformInfo, 2, InputDeviceNames.XInputDevice1);
     this.SetDeviceInPort(platformInfo, 3, InputDeviceNames.XInputDevice2);
     this.SetDeviceInPort(platformInfo, 4, InputDeviceNames.XInputDevice3);
     this.SetDeviceInPort(platformInfo, 5, InputDeviceNames.XInputDevice4);
 }
        private void SetColumn(IPlatformInfo platformInfo, string column, string value)
        {
            SQLiteConnection dbConnection = this.GetConnection();
            dbConnection.Open();
            using (var sqlCommand = new SQLiteCommand("UPDATE `platformprefs` SET `%colName` = @value WHERE `platform_id` == @platform_id", dbConnection))
            {
                sqlCommand.CommandText = sqlCommand.CommandText.Replace("%colName", column);

                sqlCommand.Parameters.AddWithValue("@value", value);
                sqlCommand.Parameters.AddWithValue("@platform_id", platformInfo.PlatformID);
                sqlCommand.ExecuteNonQuery();
            }
            dbConnection.Close();
        }
 public void SetScraper(IPlatformInfo platformInfo, string value)
 {
     this.SetColumn(platformInfo, "scraper", value);
 }
 public void SetEmulator(IPlatformInfo platformInfo, string value)
 {
     this.SetColumn(platformInfo, "emulator", value);
 }
Exemplo n.º 45
0
 private void SetDefaults_KeyboardOnly(IPlatformInfo platformInfo)
 {
     this.SetDeviceInPort(platformInfo, 1, InputDeviceNames.KeyboardDevice);
 }
Exemplo n.º 46
0
 public ScrapeService(IPlatformInfo scrapePlatform, ICoreService coreInstance)
     : this(scrapePlatform, coreInstance.Get<IPlatformPreferenceDatabase>().GetPreferences(scrapePlatform).Scraper, coreInstance)
 {
 }
Exemplo n.º 47
0
 public virtual string CompileController(int playerIndex, IPlatformInfo platformInfo, IInputTemplate inputTemplate, IGameInfo gameInfo)
 {
     string deviceName = this.CoreInstance.Get<IControllerPortsDatabase>().GetDeviceInPort(platformInfo, playerIndex);
     string controllerId = platformInfo.ControllerPorts[playerIndex];
     IControllerDefinition controllerDefinition = this.CoreInstance.Controllers[controllerId];
     IGamepadAbstraction gamepadAbstraction = this.CoreInstance.Get<IGamepadAbstractionDatabase>()[deviceName];
     return this.CompileController(playerIndex,
         platformInfo,
         controllerDefinition,
         this.ControllerTemplates[controllerId],
         gamepadAbstraction,
         inputTemplate,
         gameInfo);
 }
        public override string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IReadOnlyDictionary<string, IControllerMapping> controllerMappings, IGameInfo gameInfo)
        {
            if (gamepadAbstraction.ProfileType == ControllerProfileType.NULL_PROFILE) return string.Empty;
            var template = new StringBuilder(inputTemplate.StringTemplate);
            foreach (IControllerInput input in controllerDefinition.ControllerInputs.Values)
            {
                string templateKey = controllerMappings["default"].InputMappings[input.InputName];
                string inputSetting = gamepadAbstraction[input.GamepadAbstraction];
                string emulatorValue = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
                    inputTemplate.KeyboardMappings.First().Value[inputSetting] : inputTemplate.GamepadMappings.First().Value[inputSetting];
                template.Replace($"{{{templateKey}}}", emulatorValue);
            }

            if (platformInfo.PlatformID == StonePlatforms.NINTENDO_WII && controllerDefinition.ControllerID == "GCN_CONTROLLER")
            {
                template.Replace("{N}", (playerIndex - 4).ToString()); //Account for GCPad being in controller positions 5-8.
            }
            else
            {
                template.Replace("{N}", playerIndex.ToString()); //Player Index
            }

            foreach (string key in inputTemplate.TemplateKeys)
            {
                template.Replace($"{{{key}}}",
                    controllerMappings["default"].KeyMappings.ContainsKey(key)
                        ? controllerMappings["default"].KeyMappings[key]
                        : inputTemplate.NoBind);
            }
            return template.ToString();
        }
        public override string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IGameInfo gameInfo)
        {
            var controllerMappings = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
               controllerTemplate.KeyboardControllerMappings : controllerTemplate.GamepadControllerMappings;

            string deviceName = gamepadAbstraction.DeviceName;
            IList<IInputDevice> devices = new InputManager().GetGamepads();
            if (deviceName == null) deviceName = String.Empty;

            int realWiimoteAmount = devices.Count(device => device.DI_ProductName.Contains("RVL-CNT"));

            if(controllerDefinition.ControllerID == "WII_COMBINED_CONTROLLER")
            {
                //All wiimotes have the same attachment
                int wiimote_extension = this.ConfigurationFlagStore.GetValue(gameInfo, "wiimote_extension", ConfigurationFlagTypes.SELECT_FLAG);
                controllerMappings["default"].KeyMappings["EXTENSION"] = this.ConfigurationFlags["wiimote_extension"].SelectValues[wiimote_extension].Value;

                if (playerIndex <= realWiimoteAmount)
                {
                    controllerMappings["default"].KeyMappings["SOURCE"] = "2"; //Real Wiimotes take precedence
                }
                else
                {
                    controllerMappings["default"].KeyMappings["SOURCE"] = "1"; //Emulated Wiimote
                }
            }

            if (deviceName.Equals(InputDeviceNames.KeyboardDevice, StringComparison.InvariantCultureIgnoreCase))
            {
                controllerMappings["default"].KeyMappings["DEVICE"] = "DInput/0/Keyboard Mouse";
                return this.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate,
                    gamepadAbstraction, inputTemplate, controllerMappings, gameInfo);
            }
            string xinputDevice = "XInput/{0}/Gamepad";
            string dintpuDevice = "DInput/{0}/{1}";
            if (deviceName.Equals(InputDeviceNames.XInputDevice1, StringComparison.InvariantCultureIgnoreCase))
            {
                controllerMappings["default"].KeyMappings["DEVICE"] =
                    String.Format(xinputDevice, 0);
            }
            else if (deviceName.Equals(InputDeviceNames.XInputDevice2, StringComparison.InvariantCultureIgnoreCase))
            {
                controllerMappings["default"].KeyMappings["DEVICE"] =
                    String.Format(xinputDevice, 1);
            }
            else if (deviceName.Equals(InputDeviceNames.XInputDevice3, StringComparison.InvariantCultureIgnoreCase))
            {
                controllerMappings["default"].KeyMappings["DEVICE"] =
                    String.Format(xinputDevice, 2);
            }
            else if (deviceName.Equals(InputDeviceNames.XInputDevice4, StringComparison.InvariantCultureIgnoreCase))
            {
                controllerMappings["default"].KeyMappings["DEVICE"] =
                    String.Format(xinputDevice, 3);
            }
            else if (devices.Select(device => device.DI_ProductName).Contains(deviceName))
            {
                var device = devices.First(d => d.DI_ProductName == deviceName);
                controllerMappings["default"].KeyMappings["DEVICE"] =
                    String.Format(dintpuDevice, device.DI_ProductName, device.DeviceIndex);
            }
            return this.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate, gamepadAbstraction, inputTemplate, controllerMappings, gameInfo);
        }