Exemplo n.º 1
0
        public AzureAccountManager(
            IAppSettings appSettings,
            ILauncher launcher)
        {
            this.appSettings = appSettings;
            this.launcher    = launcher;

            this.Environments = new List <CloudEnvironment>()
            {
                new CloudEnvironment(
                    AzureEnvironment.AzureChinaCloud.AuthenticationEndpoint,
                    AppResources.AzureEnvironment_China),

                new CloudEnvironment(
                    AzureEnvironment.AzureGermanCloud.AuthenticationEndpoint,
                    AppResources.AzureEnvironment_German),

                new CloudEnvironment(
                    AzureEnvironment.AzureGlobalCloud.AuthenticationEndpoint,
                    AppResources.AzureEnvironment_Global,
                    true),

                new CloudEnvironment(
                    AzureEnvironment.AzureUSGovernment.AuthenticationEndpoint,
                    AppResources.AzureEnvironment_USGovernment)
            };
        }
Exemplo n.º 2
0
        private static bool UpdateCustomization(CommandLineParams o, Session epiSession)
        {
            using (StreamReader sr = new StreamReader($@"{o.ProjectFolder}\Script.cs"))
            {
                var oTrans = new ILauncher(epiSession);
                Ice.Adapters.GenXDataAdapter ad = new Ice.Adapters.GenXDataAdapter(oTrans);
                ad.BOConnect();

                GenXDataImpl i      = (GenXDataImpl)ad.BusinessObject;
                string       script = (sr.ReadToEnd().Replace("public partial class Script", "public class Script").Replace("public static partial class Script", "public static class Script").EscapeXml());
                var          ds     = i.GetByID(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3);
                var          chunk  = ds.XXXDef[0];
                if (chunk.SysRevID != o.Version && o.Version > 0)
                {
                    if (MessageBox.Show("The customization appears to have been updated internally within Epicor, this means that if you continue you may be over-writing some changes made. Would you like to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        return(false);
                    }
                }
                string content = ad.GetDechunkedStringByIDWithCompany(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3);

                string newC = Regex.Replace(content, @"(?=\/\/ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)[\s\S]*?(?=<\/PropertyValue>)", script,
                                            RegexOptions.IgnoreCase);
                ad.ChunkNSaveUncompressedStringByID(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3, chunk.Description, chunk.Version, false, newC);
            }
            return(true);
        }
Exemplo n.º 3
0
 private static void OpenSelectedFolderAction(string folder)
 {
     using (ILauncher launcher = New <ILauncher>())
     {
         launcher.Launch(folder);
     }
 }
Exemplo n.º 4
0
        private void m_appTypeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            //this only happens when we detect admin required and revert the change
            if (m_appTypeCombo.SelectedIndex == m_launcherIndex)
            {
                return;
            }

            //not sure this CAN happen
            if (m_appTypeCombo.SelectedItem == null)
            {
                m_launcher = null;
                m_launchPropGrid.SelectedObject = null;
                return;
            }

            Type      launcherType = (m_appTypeCombo.SelectedItem as TypeEntry).Type;
            ILauncher launcher     = (ILauncher)Activator.CreateInstance(launcherType);

            //Don't allow the user to select a launcher that will just fail due to admin privileges required
            if (launcher.RequiresAdmin && !LauncherCommon.UserIsAdmin())
            {
                MessageBox.Show("You must run SlimTune as an administrator to profile the selected application type.");
                m_appTypeCombo.SelectedIndex = m_launcherIndex;
                return;
            }

            m_launcher = launcher;
            m_launchPropGrid.SelectedObject = m_launcher;
            m_launcherIndex = m_appTypeCombo.SelectedIndex;
        }
Exemplo n.º 5
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="coolTime">発射毎のクールタイム(秒)</param>
 /// <param name="launcher">実発射オブジェクト</param>
 /// <param name="timer">時間提供オブジェクト</param>
 public GunShooterHard(
     float coolTime,
     ILauncher launcher)
 {
     _coolTime = coolTime;
     _launcher = launcher;
 }
        public EpiForm()
        {
            // Change the sysconfig file name to the sysconfig file name you are using to connect to your app server from your client.
            // If you have web services licenses, use the Session.LicenseType.WebService else use Session.LicenseType.Default.
            using (var _session = new Ice.Core.Session("manager", "manager", Session.LicenseType.Default, @"config\ERP10.sysconfig"))
            {
                // 10.1.600.x For some forms a BASE currency must be added to the Session objects CurrencyInfo Hashtable. SalesOrder is
                // one of these forms.
                using (var svc = WCFServiceSupport.CreateImpl <Erp.Proxy.BO.CurrencyImpl>(_session, Erp.Proxy.BO.CurrencyImpl.UriPath))
                {
                    bool outbool;
                    var  defaultcurrency = svc.GetList("BaseCurr = 'TRUE'", 0, 0, out outbool);
                    if (defaultcurrency.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("No BASE currency code is set for Company " + _session.CompanyID, "No BASE Currency", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    var currencyrow = (Erp.BO.CurrencyListDataSet.CurrencyListRow)defaultcurrency.Tables[0].Rows[0];

                    Session.CurrencyInfo ci = new Session.CurrencyInfo("BASE", currencyrow.CurrSymbol,
                                                                       currencyrow.DecimalsGeneral, currencyrow.DecimalsPrice, currencyrow.DecimalsCost);
                    _session.CurrencyCodes.Add("BASE", ci);
                }

                var iLaunch = new ILauncher(_session);
                oTrans = new PartTransaction(iLaunch);


                // Run your methods here and always try to complete the execution of this using block.
                // If you terminate execution prior to that, you will leave an open session and continue to consume a license.
            }
        }
Exemplo n.º 7
0
 public virtual void UseWeapon(Weapons weapons, SkeletonAnimation animation, ILauncher launcher)
 {
     animation.state.SetAnimation(1, _weaponFireAnimation, false);
     launcher.AttackSpawn(_bulletPrefab, this);
     PlaySound(weapons, ShootSound);
     CurrentClip--;
 }
Exemplo n.º 8
0
        public static void DecryptAndOpenFile(IRuntimeFileInfo encryptedDocument, Passphrase passphrase, ProgressContext progress, Action <string, ProgressContext> failure = null)
        {
            string tempPath = Path.GetTempPath();
            string decryptedFileName;

            lastUsedKey = passphrase.DerivedPassphrase;

            if (!TryDecrypt(encryptedDocument, tempPath, lastUsedKey, progress, out decryptedFileName))
            {
                failure("Could not open file", progress);
                return;
            }

            string           fullPathToDecryptedFile = Path.Combine(tempPath, decryptedFileName);
            IRuntimeFileInfo decryptedFile           = OS.Current.FileInfo(fullPathToDecryptedFile);

            NSDictionary   userInfo     = new NSDictionary(Launcher.TargetFileUserInfoKey, decryptedFile.FullName);
            NSNotification notification = NSNotification.FromName(Launcher.FileDecryptedNotification, new NSObject(), userInfo);

            NSNotificationCenter.DefaultCenter.PostNotification(notification);

            ILauncher launcher = OS.Current.Launch(fullPathToDecryptedFile);

            launcher.Exited += (sender, e) => {
                fileSystemState.CheckActiveFiles(ChangedEventMode.RaiseOnlyOnModified, new ProgressContext());
            };

            fileSystemState.Add(new ActiveFile(encryptedDocument, decryptedFile, lastUsedKey, ActiveFileStatus.AssumedOpenAndDecrypted, launcher));
            //fileSystemState.Save ();
        }
Exemplo n.º 9
0
 public override void Start()
 {
     base.Start();
     name            = data.name;
     launcher        = GetComponent <ILauncher>();
     selectionCircle = GetComponent <UnitSelectionCircle>();
 }
Exemplo n.º 10
0
 public DeepLinkingService(IMainThread mainThread, IBrowser browser, IEmail email, IAppInfo appInfo, ILauncher launcher)
 {
     _appInfo    = appInfo;
     _email      = email;
     _browser    = browser;
     _mainThread = mainThread;
     _launcher   = launcher;
 }
Exemplo n.º 11
0
 public LaunchProgressWindow(IEnumerable <ILaunchTarget> accounts, ILauncher launcher)
 {
     Accounts         = new ObservableCollection <ILaunchTarget>(accounts);
     AccountsLaunched = new ObservableCollection <ILaunchTarget>();
     Launcher         = launcher;
     AutoClose        = true;
     InitializeComponent();
 }
Exemplo n.º 12
0
 private PlatformServices(ILauncher launcher)
 {
     Launcher           = launcher;
     SettingsManager    = new SettingsManager();
     SocketFactory      = new SocketFactory();
     BackgroundTransfer = new BackgroundTransferManager();
     _connectionStatus  = new NoConnectionStatus();
 }
Exemplo n.º 13
0
        public void Awake()
        {
            charFactory = GetComponent <PlayableCharacterFactory>();
            //Create the character.
            _myCharacter = charFactory.CreateCharacter(AvailableCharacters.Ruyo);
            //Assign freshly created character as child of this gameobject.
            _myCharacter.CharacterInstance.transform.parent = transform;
            //Make sure that the created character is positioned in the middle of the player gameobject.
            _myCharacter.CharacterInstance.transform.localPosition = Vector3.zero;
            //Get the launcher from the character and store its script ref...
            _launcher = _myCharacter.CharacterInstance.GetComponentInChildren <ILauncher>();
            //...same with the crosshair + setup the camera script.
            _crosshair = _myCharacter.CharacterInstance.GetComponentInChildren <Crosshair>();
            _crosshair.Begin(_cameraWorks);
            _controller2D = _myCharacter.CharacterInstance.GetComponentInChildren <IController2D>();
            //Get the healthbar script for the character, if it has any healthbar.
            _myCharacter.AddHealthBarReference(GetComponentInChildren <RuyoHealthbar>());

            _skillManager.AddObserver(_crosshair);
            //Create the skills factory. Then retrieve the factory script and proper skill factory.
            GameObject factorySelector = Instantiate(_factorySelectorPrefab);

            factorySelector.transform.parent = this.gameObject.transform;
            _skillFactorySelector            = factorySelector.GetComponent <ISkillFactorySelector>();
            ISkillFactory skillFactory = _skillFactorySelector.SelectFactory(AvailableCharacters.Ruyo);
            //Using the provided skill factory, generate the skills for the character.
            IGetTransform playerTransform      = this;
            IGetTransform shotSpawnerTransform = _launcher;
            //Create and assign the skills to the skills manager and save them temporarily for the
            //skillBarManager.
            IDictionary <SkillType, Sprite> skillsIcons = new Dictionary <SkillType, Sprite>();
            //Basic skill:
            ISkill newSkill = skillFactory.CreateSkill(SkillType.Basic, ref shotSpawnerTransform, ref playerTransform);

            newSkill.GameObject.transform.parent = this.gameObject.transform;
            _skillManager.AddSkill(SkillType.Basic, newSkill);
            //First active skill:
            newSkill = skillFactory.CreateSkill(SkillType.First, ref shotSpawnerTransform, ref playerTransform);
            newSkill.GameObject.transform.parent = this.gameObject.transform;
            _skillManager.AddSkill(SkillType.First, newSkill);
            skillsIcons.Add(SkillType.First, newSkill.icon);
            //Second active skill:
            newSkill = skillFactory.CreateSkill(SkillType.Second, ref shotSpawnerTransform, ref playerTransform);
            newSkill.GameObject.transform.parent = this.gameObject.transform;
            _skillManager.AddSkill(SkillType.Second, newSkill);
            skillsIcons.Add(SkillType.Second, newSkill.icon);
            //Third active skill:
            newSkill = skillFactory.CreateSkill(SkillType.Third, ref shotSpawnerTransform, ref playerTransform);
            newSkill.GameObject.transform.parent = this.gameObject.transform;
            _skillManager.AddSkill(SkillType.Third, newSkill);
            skillsIcons.Add(SkillType.Third, newSkill.icon);

            //Initialize the skillBarManager skill icons.
            SkillsBarManager skillBarManager = _myCharacter.CharacterInstance.GetComponentInChildren <SkillsBarManager>();

            skillBarManager.InitializeSkillsIcons(skillsIcons);
            _skillManager.AddObserver(skillBarManager);
        }
Exemplo n.º 14
0
 public ActiveFile(ActiveFile activeFile, ActiveFileStatus status, ILauncher process)
 {
     if (activeFile == null)
     {
         throw new ArgumentNullException("activeFile");
     }
     Initialize(activeFile);
     Status = status;
     Process = process;
 }
Exemplo n.º 15
0
 public ActiveFile(ActiveFile activeFile, ActiveFileStatus status, ILauncher process)
 {
     if (activeFile == null)
     {
         throw new ArgumentNullException("activeFile");
     }
     Initialize(activeFile);
     Status  = status;
     Process = process;
 }
Exemplo n.º 16
0
        public DatabasePageViewModel(
            INavigator navigator,
            IDatabaseCache unlocker,
            IClipboard <string> clipboard,
            ICredentialProvider credentialProvider,
            INameProvider nameProvider,
            ILauncher launcher,
            IMessageDialogFactory dialogs,
            ILogger log)
        {
            _clipboard          = clipboard;
            _unlocker           = unlocker;
            _navigator          = navigator;
            _credentialProvider = credentialProvider;
            _nameProvider       = nameProvider;
            _launcher           = launcher;
            _dialogs            = dialogs;
            _log = log;

            ItemClickCommand = new DelegateCommand <IKeePassId>(item => GroupClicked(item as IKeePassGroup), item => (item as IKeePassGroup) != null);

            GoToParentCommand = new DelegateCommand <IKeePassGroup>(group =>
            {
                if (_database != null)
                {
                    _navigator.GoToDatabaseView(_database, group);
                }
            });

            CopyCommand = new DelegateCommand <string>(text => _clipboard.Copy(text));

            OpenUrlCommand = new DelegateCommand <IKeePassEntry>(async entry =>
            {
                if (Uri.TryCreate(entry.Url, UriKind.Absolute, out Uri uri))
                {
                    await _launcher.LaunchUriAsync(uri);
                }
            });

            AddEntryCommand = new DelegateCommand(async() =>
            {
                var name = await _nameProvider.GetNameAsync();

                if (!string.IsNullOrEmpty(name))
                {
                    Items.Add(_group.CreateEntry(name));
                }

                NotifyAllCommands();

#if FEATURE_SAVE
                // This is disabled currently due to twsouthwick/KeePassWin 15
            }, () => !_saving);
#else
            }, () => !_activeSearch);
Exemplo n.º 17
0
 private void Initialize(IRuntimeFileInfo encryptedFileInfo, IRuntimeFileInfo decryptedFileInfo, DateTime lastWriteTimeUtc, AesKey key, AesKeyThumbprint thumbprint, ActiveFileStatus status, ILauncher process)
 {
     EncryptedFileInfo = OS.Current.FileInfo(encryptedFileInfo.FullName);
     DecryptedFileInfo = OS.Current.FileInfo(decryptedFileInfo.FullName);
     Key                        = key;
     Thumbprint                 = thumbprint;
     Status                     = status;
     LastActivityTimeUtc        = OS.Current.UtcNow;
     Process                    = process;
     LastEncryptionWriteTimeUtc = lastWriteTimeUtc;
 }
Exemplo n.º 18
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="coolTime">発射毎のクールタイム(秒)</param>
 /// <param name="blocker">発射遮断オブジェクト</param>
 /// <param name="launcher">実発射オブジェクト</param>
 /// <param name="timer">時間提供オブジェクト</param>
 public GunShooter(
     float coolTime,
     IBlocker blocker,
     ILauncher launcher,
     ITimer timer)
 {
     _coolTime = coolTime;
     _blocker  = blocker;
     _launcher = launcher;
     _timer    = timer;
 }
Exemplo n.º 19
0
        public ServiceDetailViewModel(
            IKubernetesService kubernetesService,
            IPopupService popupService,
            INavigationService navigationService,
            ILauncher launcher)
            : base(kubernetesService, popupService, navigationService)
        {
            this.launcher = launcher;

            this.LaunchExternalEndpointCommand = new Command(this.LaunchExternalEndpointCommandExecute);
        }
Exemplo n.º 20
0
 private void OnEnable()
 {
     _agent                       = GetComponent <Agent>();
     _animation                   = GetComponent <SkeletonAnimation>();
     _launcher                    = GetComponent <ILauncher>();
     _meleeCollider               = GetComponentInChildren <MeleeCollider>().GetComponent <BoxCollider2D>();
     _agent.Body.OnAttack        += Attack;
     _agent.Body.OnSwitchWeapons += SwitchWeapons;
     _agent.Body.OnMeleeAttack   += MeleeAttack;
     _agent.Body.OnDrawMelee     += DrawMelee;
     InitialiseCurrentWeapon();
 }
Exemplo n.º 21
0
        public QLViewModel()
        {
            Launcher = new Launcher();

            string makePath(string path) => Path.Combine(Environment.CurrentDirectory, @"ApplicationData\", path);

            Launchables.Add("SlideShow", new LaunchableFile(makePath(@"Demo\FileSlideShow.exe"), "", ""));
            Launchables.Add("PowerShell-Project", new LaunchableDirectory(makePath(@"Demo\"), "", true));
            Launchables.Add("Py Batch Save", new LaunchableFile(makePath(@"Demo\BatchSave.py"), "", "", false, false, "/C python"));
            Launchables.Add("Py Dupe Check", new LaunchableFile(makePath(@"Demo\DupeCheck.py"), "", "Collection", false, false, "/C python"));

            InitCommands();
        }
Exemplo n.º 22
0
    void Start()
    {
        launcher = GetComponent <ILauncher>();

        if (launcherSettings.UsedByAi)
        {
            GetComponentInParent <FiringAI>().OnFire += Fire;
        }
        else
        {
            gm            = GameManager.instance;
            gm.gunHeat    = heat;
            gm.maxGunHeat = heatMax;
            gm.player.GetComponent <Player_Input>().OnFire += Fire;
        }
    }
Exemplo n.º 23
0
        private void Awake()
        {
            _TargetBehaviour = GetComponent <Targetter>();
            _Launcher        = GetComponent <ILauncher>();

            if (_TargetBehaviour == null)
            {
                Debug.LogError($"Missing component {nameof(Targetter)}");
            }
            if (_Launcher == null)
            {
                Debug.LogError($"Missing component {nameof(ILauncher)}");
            }

            ResetFireTimer();
        }
Exemplo n.º 24
0
        public static void TestInvalidArguments()
        {
            IRuntimeFileInfo nullFileInfo      = null;
            ILauncher        nullProcess       = null;
            IRuntimeFileInfo decryptedFileInfo = OS.Current.FileInfo(_testTextPath);
            IRuntimeFileInfo encryptedFileInfo = OS.Current.FileInfo(_helloWorldAxxPath);
            AesKey           key            = new AesKey();
            AesKey           nullKey        = null;
            ILauncher        process        = new FakeLauncher(String.Empty);
            ActiveFile       nullActiveFile = null;

            ActiveFile originalActiveFile = new ActiveFile(decryptedFileInfo, decryptedFileInfo, key, ActiveFileStatus.None, process);

            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(nullActiveFile, key) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(originalActiveFile, nullKey) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(nullActiveFile, ActiveFileStatus.None, nullProcess) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(nullActiveFile, ActiveFileStatus.None) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(nullActiveFile, DateTime.MinValue, ActiveFileStatus.None) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(nullFileInfo, decryptedFileInfo, new AesKey(), ActiveFileStatus.None, nullProcess) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(encryptedFileInfo, nullFileInfo, new AesKey(), ActiveFileStatus.None, nullProcess) == null)
                                                          {
                                                          }
                                                  });
            Assert.Throws <ArgumentNullException>(() => { if (new ActiveFile(encryptedFileInfo, decryptedFileInfo, nullKey, ActiveFileStatus.None, nullProcess) == null)
                                                          {
                                                          }
                                                  });
        }
Exemplo n.º 25
0
        public static void Main(string[] args)
        {
            Assembly binaries = GetAssembly();

            if (binaries == null)
            {
                MessageBox.Show(
                    "First-time download of binaries failed.\n\n" +
                    "This could either be because the server is down or your\n" +
                    "internet connection is being silly.",
                    "FAIL");
            }
            else
            {
                ILauncher launcher = binaries.CreateInstance(LauncherClassName) as ILauncher;
                launcher.Launch();
            }
        }
Exemplo n.º 26
0
        public async Task TestMainWithLauncherFailure()
        {
            Mock <ILauncher> mock = new Mock <ILauncher>(MockBehavior.Strict);

            mock.SetupGet(l => l.IsRunning).Returns(true);
            mock.Setup(m => m.RunAsync()).Returns(() => throw new Exception("Unit Test: Forced Launcher Failure"));
            ILauncher launcher = mock.Object;

            Program.SetLauncher(launcher);
            IMessageHandler messageHandler = new Mock <IMessageHandler>(MockBehavior.Strict).Object;
            IUserInput      userInput      = new Mock <IUserInput>(MockBehavior.Strict).Object;

            Program.SetUserInput(userInput);
            Program.SetMessageHandler(messageHandler);
            await Program.Main().ConfigureAwait(false);

            mock.Verify(l => l.RunAsync(), Times.Once);
            launcher.IsRunning.Should().BeTrue();
        }
Exemplo n.º 27
0
        public static async Task <int> RunBuild(ILauncher launcher, Func <Task <IRecorder> > createRecorder, string outputDir, string workDir)
        {
            await using var recorder = await createRecorder();

            Directory.CreateDirectory(outputDir);
            var artifact = new FSArtifactSaver(outputDir);

            var schema = await recorder.LoadSchema();

            var sdks = await recorder.ListAvailableSdks().ToListAsync();

            var sdkInstallManager = recorder.CreateSdkInstaller();

            var conf = await recorder.LoadRepoConfig();

            var currentPlatform = PlatformInfo.Current;

            await using var launchPropsCleanup = GetDockerLaunchProps(
                            platform: currentPlatform,
                            sdks: sdks,
                            workDir: workDir,
                            currentDir: recorder.CurrentDir,
                            sourcesDir: recorder.SourcesDir,
                            conf,
                            sdkInstallManager,
                            schema
                            );

            var launchProps = await launchPropsCleanup.Value();

            await using var proxyServer = await ProxyServer.Create(
                            Path.Combine(launchProps.SocketDir, "helium.sock"),
                            recorder,
                            conf,
                            artifact
                            );

            var exitCode = await launcher.Run(currentPlatform, launchProps);

            await recorder.RecordMetadata();

            return(exitCode);
        }
Exemplo n.º 28
0
        public void Add(ILauncher launcher, ActiveFile activeFile)
        {
            if (activeFile == null)
            {
                throw new ArgumentNullException("activeFile");
            }

            PurgeInactive();
            lock (_lock)
            {
                List <ILauncher> processes = ActiveProcesses(activeFile);
                if (processes == null)
                {
                    processes = new List <ILauncher>();
                    _processState[activeFile.EncryptedFileInfo.FullName] = processes;
                }
                processes.Add(launcher);
            }
        }
        public void SetControls()
        {
            if (selectedDevice == null)
            {
                launcher = null;
                mediaPlayer = null;
                mediaControl = null;
                tvControl = null;
                volumeControl = null;
                toastControl = null;
                textInputControl = null;
                mouseControl = null;
                externalInputControl = null;
                powerControl = null;
                keyControl = null;
                playListControl = null;
                webAppLauncher = null;
            }
            else
            {
                launcher = selectedDevice.GetCapability<ILauncher>();
                mediaPlayer = selectedDevice.GetCapability<IMediaPlayer>();
                mediaControl = selectedDevice.GetCapability<IMediaControl>();
                tvControl = selectedDevice.GetCapability<ITvControl>();
                volumeControl = selectedDevice.GetCapability<IVolumeControl>();
                toastControl = selectedDevice.GetCapability<IToastControl>();
                textInputControl = selectedDevice.GetCapability<ITextInputControl>();
                mouseControl = selectedDevice.GetCapability<IMouseControl>();
                externalInputControl = selectedDevice.GetCapability<IExternalInputControl>();
                powerControl = selectedDevice.GetCapability<IPowerControl>();
                keyControl = selectedDevice.GetCapability<IKeyControl>();
                playListControl = selectedDevice.GetCapability<IPlayListControl>();
                webAppLauncher = selectedDevice.GetCapability<IWebAppLauncher>();
            }

            SetControlsMedia();
            SetWebAppControls();
            SetControlControls();
            SetControlApps();
            SetControlKeys();
            SetControlSystem();
        }
        public void SetControls()
        {
            if (selectedDevice == null)
            {
                launcher             = null;
                mediaPlayer          = null;
                mediaControl         = null;
                tvControl            = null;
                volumeControl        = null;
                toastControl         = null;
                textInputControl     = null;
                mouseControl         = null;
                externalInputControl = null;
                powerControl         = null;
                keyControl           = null;
                playListControl      = null;
                webAppLauncher       = null;
            }
            else
            {
                launcher             = selectedDevice.GetCapability <ILauncher>();
                mediaPlayer          = selectedDevice.GetCapability <IMediaPlayer>();
                mediaControl         = selectedDevice.GetCapability <IMediaControl>();
                tvControl            = selectedDevice.GetCapability <ITvControl>();
                volumeControl        = selectedDevice.GetCapability <IVolumeControl>();
                toastControl         = selectedDevice.GetCapability <IToastControl>();
                textInputControl     = selectedDevice.GetCapability <ITextInputControl>();
                mouseControl         = selectedDevice.GetCapability <IMouseControl>();
                externalInputControl = selectedDevice.GetCapability <IExternalInputControl>();
                powerControl         = selectedDevice.GetCapability <IPowerControl>();
                keyControl           = selectedDevice.GetCapability <IKeyControl>();
                playListControl      = selectedDevice.GetCapability <IPlayListControl>();
                webAppLauncher       = selectedDevice.GetCapability <IWebAppLauncher>();
            }

            SetControlsMedia();
            SetWebAppControls();
            SetControlControls();
            SetControlApps();
            SetControlKeys();
            SetControlSystem();
        }
Exemplo n.º 31
0
        public void TestMain()
        {
            Mock <ILauncher> mock = new Mock <ILauncher>(MockBehavior.Strict);

            mock.SetupGet(l => l.IsRunning).Returns(true);
            mock.Setup(m => m.RunAsync()).Returns(Task.CompletedTask);
            ILauncher launcher = mock.Object;

            Program.SetLauncher(launcher);
            IMessageHandler messageHandler = new Mock <IMessageHandler>(MockBehavior.Strict).Object;
            IUserInput      userInput      = new Mock <IUserInput>(MockBehavior.Strict).Object;

            Assert.Throws <ArgumentNullException>(() => Program.SetUserInput(null));
            Assert.Throws <ArgumentNullException>(() => Program.SetMessageHandler(null));
            Program.SetUserInput(userInput);
            Program.SetMessageHandler(messageHandler);
            Program.Main();
            mock.Verify(l => l.RunAsync(), Times.Once);
            Assert.True(launcher.IsRunning);
        }
Exemplo n.º 32
0
        /// <summary>
        /// Updates Epicor Customization
        /// Deprecated will be replaced shortly.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="epiSession"></param>
        /// <returns></returns>
        private static bool UpdateCustomization(CommandLineParams o, Session epiSession)
        {
            var r = o;

            Log.Information($"Updating Customization. Company: {r.Company}, CGCCode: {r.CSGCode}, Key1: {r.Key1}, Key3:{r.Key2}, Key3: {r.Key3}, LayerType: {r.LayerType}, ProductType: {r.ProductType}");
            using (StreamReader sr = new StreamReader($@"{o.ProjectFolder}\Script.cs"))
            {
                try
                {
                    var oTrans = new ILauncher(epiSession);
                    Ice.Adapters.GenXDataAdapter ad = new Ice.Adapters.GenXDataAdapter(oTrans);
                    ad.BOConnect();

                    GenXDataImpl i      = (GenXDataImpl)ad.BusinessObject;
                    string       script = (sr.ReadToEnd().Replace("public partial class Script", "public class Script").Replace("public static partial class Script", "public static class Script"));
                    var          ds     = i.GetByID(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3);
                    var          chunk  = ds.XXXDef[0];
                    if (chunk.SysRevID != o.Version && o.Version > 0)
                    {
                        if (MessageBox.Show("The customization appears to have been updated internally within Epicor, this means that if you continue you may be over-writing some changes made. Would you like to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return(false);
                        }
                    }
                    string     content = ad.GetDechunkedStringByIDWithCompany(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3);
                    XDocument  doc     = XDocument.Load(new StringReader(content));
                    XNamespace ns      = "http://tempuri.org/XMLSchema.xsd";
                    var        elList  = doc.Descendants(ns + "PropertyName").ToList().Where(xm => xm.Value == "Script").FirstOrDefault();
                    (elList.NextNode as XElement).Value = script;
                    //string newC = Regex.Replace(content, @"(?=\/\/ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)[\s\S]*?(?=<\/PropertyValue>)", script,
                    //RegexOptions.IgnoreCase);
                    ad.ChunkNSaveUncompressedStringByID(o.Company, o.ProductType, o.LayerType, o.CSGCode, o.Key1, o.Key2, o.Key3, chunk.Description, chunk.Version, false, doc.ToString());
                    Log.Information("Customization Updated");
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Failed to Update Customization");
                }
            }
            return(true);
        }
Exemplo n.º 33
0
		private void LoadLauncherConfig()
		{
			try
			{
				//try and load a launcher configuration from isolated storage
				using(var isoStore = IsolatedStorageFile.GetUserStoreForAssembly())
				{
					var configFile = new IsolatedStorageFileStream(ConfigFile, FileMode.Open, FileAccess.Read, isoStore);
					using(var sr = new StreamReader(configFile))
					{
						//read the concrete type to deserialize
						var launcherTypeName = sr.ReadLine();
						var launcherType = Type.GetType(launcherTypeName, true);

						//read the actual object
						XmlSerializer serializer = new XmlSerializer(launcherType);
						m_launcher = (ILauncher) serializer.Deserialize(sr);

						//select the correct item in the combo box
						foreach(TypeEntry item in m_appTypeCombo.Items)
						{
							if(item.Type == launcherType)
							{
								m_appTypeCombo.SelectedItem = item;
								break;
							}
						}
					}
					isoStore.Close();
				}
			}
			catch
			{
				//couldn't load the launcher, for whatever reason
			}
		}
Exemplo n.º 34
0
 /// <summary>
 /// class constructor
 /// </summary>
 private TurretManager(){
     //instantiate a turret to control
     ActiveTurret = Turret.GetInstance();
     //reset turret so its ready
     this.ResetToOrigin();
 }
Exemplo n.º 35
0
        public bool InitializeWindow( string gameName, Image coverImage,
			ILauncher [] launchers, IGameLooper [] gameLoopers, Node [] mainNodes )
        {
            window = new Form ();

            window.Text = gameName;
            window.BackColor = Color.White;
            window.ClientSize = new Size ( 400, 260 );
            window.FormBorderStyle = FormBorderStyle.FixedDialog;
            window.StartPosition = FormStartPosition.CenterScreen;
            window.MaximizeBox = false;
            window.MinimizeBox = true;
            window.ShowInTaskbar = false;

            PictureBox cover = new PictureBox ();
            cover.Image = coverImage ?? Image.FromStream (
                Assembly.GetExecutingAssembly ().GetManifestResourceStream ( "Daramkun.Misty.Resources.DefaultCover.png" )
            );
            cover.Bounds = new Rectangle ( 0, 0, 400, 100 );
            window.Controls.Add ( cover );

            Label pafLabel = new Label () { Text = "&PAF:", Bounds = new Rectangle ( 10, 120, 60, 24 ) };
            window.Controls.Add ( pafLabel );

            ComboBox pafComboBox = new ComboBox () { DropDownStyle = ComboBoxStyle.DropDownList, Bounds = new Rectangle ( 70, 116, 310, 24 ) };
            foreach ( ILauncher launcher in launchers )
                pafComboBox.Items.Add ( launcher.ToString () );
            if ( pafComboBox.Items.Count >= 1 )
                pafComboBox.SelectedIndex = 0;
            if ( pafComboBox.Items.Count <= 1 )
                pafComboBox.Enabled = false;
            window.Controls.Add ( pafComboBox );

            Label glLabel = new Label () { Text = "&Looper:", Bounds = new Rectangle ( 10, 160, 60, 24 ) };
            window.Controls.Add ( glLabel );

            ComboBox glComboBox = new ComboBox () { DropDownStyle = ComboBoxStyle.DropDownList, Bounds = new Rectangle ( 70, 156, 310, 24 ) };
            foreach ( IGameLooper gl in gameLoopers )
                glComboBox.Items.Add ( gl.ToString () );
            if ( glComboBox.Items.Count >= 1 )
                glComboBox.SelectedIndex = 0;
            if ( glComboBox.Items.Count <= 1 )
                glComboBox.Enabled = false;
            window.Controls.Add ( glComboBox );

            Label nodeLabel = new Label () { Text = "&Game:", Bounds = new Rectangle ( 10, 200, 60, 24 ) };
            window.Controls.Add ( nodeLabel );

            ComboBox nodeComboBox = new ComboBox () { DropDownStyle = ComboBoxStyle.DropDownList, Bounds = new Rectangle ( 70, 196, 310, 24 ) };
            foreach ( Node node in mainNodes )
                nodeComboBox.Items.Add ( node.ToString () );
            if ( nodeComboBox.Items.Count >= 1 )
                nodeComboBox.SelectedIndex = 0;
            if ( nodeComboBox.Items.Count <= 1 )
                nodeComboBox.Enabled = false;
            window.Controls.Add ( nodeComboBox );

            Button acceptButton = new Button () { Text = "&Run", Bounds = new Rectangle ( 120, 226, 80, 24 ) };
            acceptButton.Click += ( object sender, EventArgs e ) =>
            {
                if ( pafComboBox.SelectedIndex < 0 )
                {
                    MessageBox.Show ( "Please select a Platform Abstraction Framework." );
                    return;
                }
                if ( nodeComboBox.SelectedIndex < 0 )
                {
                    MessageBox.Show ( "Please select a Game." );
                    return;
                }

                IsClickedOK = true;
                SelectedPAF = pafComboBox.SelectedIndex;
                SelectedGameLooper = glComboBox.SelectedIndex;
                SelectedMainNode = nodeComboBox.SelectedIndex;
                window.Close ();
            };
            window.Controls.Add ( acceptButton );

            Button cancelButton = new Button () { Text = "E&xit", Bounds = new Rectangle ( 210, 226, 80, 24 ) };
            cancelButton.Click += ( object sender, EventArgs e ) =>
            {
                IsClickedOK = false;
                window.Close ();
            };
            window.Controls.Add ( cancelButton );

            window.AcceptButton = acceptButton;
            window.CancelButton = cancelButton;

            return true;
        }
Exemplo n.º 36
0
		private void m_appTypeCombo_SelectedIndexChanged(object sender, EventArgs e)
		{
			//this only happens when we detect admin required and revert the change
			if(m_appTypeCombo.SelectedIndex == m_launcherIndex)
				return;

			//not sure this CAN happen
			if(m_appTypeCombo.SelectedItem == null)
			{
				m_launcher = null;
				m_launchPropGrid.SelectedObject = null;
				return;
			}

			Type launcherType = (m_appTypeCombo.SelectedItem as TypeEntry).Type;
			ILauncher launcher = (ILauncher) Activator.CreateInstance(launcherType);
			//Don't allow the user to select a launcher that will just fail due to admin privileges required
			if(launcher.RequiresAdmin && !LauncherCommon.UserIsAdmin())
			{
				MessageBox.Show("You must run SlimTune as an administrator to profile the selected application type.");
				m_appTypeCombo.SelectedIndex = m_launcherIndex;
				return;
			}

			m_launcher = launcher;
			m_launchPropGrid.SelectedObject = m_launcher;
			m_launcherIndex = m_appTypeCombo.SelectedIndex;
		}
Exemplo n.º 37
0
 public ActiveFile(IRuntimeFileInfo encryptedFileInfo, IRuntimeFileInfo decryptedFileInfo, AesKey key, ActiveFileStatus status, ILauncher process)
 {
     if (encryptedFileInfo == null)
     {
         throw new ArgumentNullException("encryptedFileInfo");
     }
     if (decryptedFileInfo == null)
     {
         throw new ArgumentNullException("decryptedFileInfo");
     }
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     Initialize(encryptedFileInfo, decryptedFileInfo, decryptedFileInfo.LastWriteTimeUtc, key, null, status, process);
 }
Exemplo n.º 38
0
 private void Initialize(IRuntimeFileInfo encryptedFileInfo, IRuntimeFileInfo decryptedFileInfo, DateTime lastWriteTimeUtc, AesKey key, AesKeyThumbprint thumbprint, ActiveFileStatus status, ILauncher process)
 {
     EncryptedFileInfo = OS.Current.FileInfo(encryptedFileInfo.FullName);
     DecryptedFileInfo = OS.Current.FileInfo(decryptedFileInfo.FullName);
     Key = key;
     Thumbprint = thumbprint;
     Status = status;
     LastActivityTimeUtc = OS.Current.UtcNow;
     Process = process;
     LastEncryptionWriteTimeUtc = lastWriteTimeUtc;
 }
Exemplo n.º 39
0
        public static void Run( ILauncher launcher, Node mainNode, Action initializeEvent = null, params object [] args )
        {
            IWindow window = null; IGraphicsDevice graphicsDevice = null; IAudioDevice audioDevice = null;

            Launcher = launcher;

            try
            {
                launcher.LauncherInitialize ( out window, out graphicsDevice, out audioDevice );
            }
            catch ( Exception e ) { if ( !SkipInitializeException ) throw new Exception ( "Initialization Exception", e ); }
            Window = window;
            GraphicsDevice = graphicsDevice;
            AudioDevice = audioDevice;

            if ( initializeEvent != null )
                initializeEvent ();

            MainNode = mainNode;

            TimeSpan elapsedUpdateTimeStep = new TimeSpan (),
                elapsedDrawTimeStep = new TimeSpan ();
            TimeSpan lastUpdateTimeStep = TimeSpan.FromMilliseconds ( Environment.TickCount ),
                lastDrawTimeStep = TimeSpan.FromMilliseconds ( Environment.TickCount );

            GameTime updateGameTime = new GameTime (), drawGameTime = new GameTime ();

            launcher.LauncherRun ( new LauncherArgument ()
            {
                Initialize = () =>
                {
                    if ( mainNode != null )
                        mainNode.Intro ( args );
                },
                UpdateLogic = () =>
                {
                    if ( elapsedUpdateTimeStep >= FixedUpdateTimeStep || FixedUpdateTimeStep.TotalMilliseconds == 0 )
                    {
                        updateGameTime.Update ();
                        if ( mainNode != null )
                            mainNode.Update ( updateGameTime );
                        elapsedUpdateTimeStep -= FixedUpdateTimeStep;
                    }
                    else
                    {
                        TimeSpan temp = TimeSpan.FromMilliseconds ( Environment.TickCount );
                        elapsedUpdateTimeStep += ( temp - lastUpdateTimeStep );
                        lastUpdateTimeStep = temp;
                    }
                },
                DrawLogic = () =>
                {
                    if ( LiqueurSystem.AudioDevice != null )
                        LiqueurSystem.AudioDevice.Update ();

                    if ( elapsedDrawTimeStep >= FixedDrawTimeStep || FixedDrawTimeStep.TotalMilliseconds == 0 )
                    {
                        drawGameTime.Update ();
                        if ( mainNode != null )
                            mainNode.Draw ( drawGameTime );
                        LiqueurSystem.GraphicsDevice.SwapBuffer ();
                        elapsedDrawTimeStep -= FixedDrawTimeStep;
                    }
                    else
                    {
                        TimeSpan temp = TimeSpan.FromMilliseconds ( Environment.TickCount );
                        elapsedDrawTimeStep += ( temp - lastDrawTimeStep );
                        lastDrawTimeStep = temp;
                    }
                },
                Resize = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowResize ();
                },
                Activated = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowActivated ();
                },
                Deactivated = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowDeactivated ();
                }
            } );
        }
Exemplo n.º 40
0
        public static void Run( ILauncher launcher, Node mainNode, IGameLooper gameLooper = null, Type gameTimeType = null )
        {
            Launcher = launcher;
            MainNode = mainNode;

            if ( gameLooper == null )
                GameLooper = new PlainGameLooper ();
            else
                GameLooper = gameLooper;

            int elapsedUpdateTimeStep = 0, elapsedDrawTimeStep = 0;
            int lastUpdateTimeStep = Environment.TickCount, lastDrawTimeStep = Environment.TickCount;

            GameTime updateGameTime, drawGameTime;
            if ( gameTimeType == null ) { updateGameTime = new GameTime (); drawGameTime = new GameTime (); }
            else { updateGameTime = Activator.CreateInstance ( gameTimeType ) as GameTime; drawGameTime = Activator.CreateInstance ( gameTimeType ) as GameTime; }

            thisThread = Thread.CurrentThread;

            launcher.Initialize ();
            Window.Show ();
            mainNode.Intro ();
            isRunningMode = true;
            GameLooper.Run (
                () =>
                {
                    if ( AudioDevice != null )
                        AudioDevice.Update ();

                    if ( elapsedUpdateTimeStep >= fixedUpdateTimeStep )
                    {
                        updateGameTime.Update ();
                        mainNode.Update ( updateGameTime );
                        elapsedUpdateTimeStep -= fixedUpdateTimeStep;
                    }
                    else
                    {
                        int temp = Environment.TickCount;
                        elapsedUpdateTimeStep += ( temp - lastUpdateTimeStep );
                        lastUpdateTimeStep = temp;
                    }
                },
                () =>
                {
                    if ( invokedMethod.Count > 0 )
                    {
                        foreach ( Action action in invokedMethod.ToArray () )
                        {
                            action ();
                            invokeSpinLock.Enter ();
                            invokedMethod.Remove ( action );
                            invokeSpinLock.Exit ();
                        }
                    }

                    if ( elapsedDrawTimeStep >= fixedDrawTimeStep )
                    {
                        drawGameTime.Update ();
                        mainNode.Draw ( drawGameTime );
                        elapsedDrawTimeStep -= fixedDrawTimeStep;
                    }
                    else
                    {
                        int temp = Environment.TickCount;
                        elapsedDrawTimeStep += ( temp - lastDrawTimeStep );
                        lastDrawTimeStep = temp;
                    }
                    Window.DoEvents ();
                },
                ref isRunningMode
            );

            mainNode.Outro ();
            launcher.Dispose ();
        }
Exemplo n.º 41
0
        public bool InitializeWindow( string gameName, Image coverImage,
			ILauncher [] launchers, IGameLooper [] gameLoopers, Node [] mainNodes )
        {
            throw new NotImplementedException ();
        }