コード例 #1
0
ファイル: App.xaml.cs プロジェクト: airbilina/airbilina-win
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            //if app started on xbox then increase screen size on full screen.
            TransitionToFullScreen();

            if (e.PreviousExecutionState != ApplicationExecutionState.Suspended && e.PreviousExecutionState != ApplicationExecutionState.Running)
            {
                PopulateFirstStartReleases();
            }

            LaunchParameters.SetArguments(e.Arguments);

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                Window.Current.Content = rootFrame;
                await new JumpListService().RefreshPagesGroup();
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(HomeView), e.Arguments);
                }
                Window.Current.Activate();
            }
        }
コード例 #2
0
        private void InitializeGameLaunchParameters()
        {
            if (this.LaunchParameters.ContainsKey("StartupGame") && this.LaunchParameters["StartupGame"] != "TitleScreen")
            {
                string startupGame = this.LaunchParameters["StartupGame"];
                if (startupGame == "Contra")
                {
                    CurrentGame = GameType.Contra;
                }
                else if (startupGame == "ContraVania")
                {
                    CurrentGame = GameType.ContraVania;
                }
                else
                {
                    throw new System.Exception(string.Format("Unexpected StartupGame Launch Parameter: {0}", startupGame));
                }
                CurrentGameState = GameState.Initializing;
            }

            if (!LaunchParameters.ContainsKey("WindowedMode"))
            {
                //graphics.IsFullScreen = true;
            }

            if (LaunchParameters.ContainsKey("LifeCount"))
            {
                _startingLifeCount = int.Parse(LaunchParameters["LifeCount"]);
            }
        }
コード例 #3
0
        public HomeViewModel(IAnilibriaApiService anilibriaApiService)
        {
            m_AnilibriaApiService = anilibriaApiService ?? throw new ArgumentNullException(nameof(anilibriaApiService));

            var version = Package.Current.Id.Version;

            Version = $"{version.Major}.{version.Minor}.{version.Build}";

            m_MenuItems = new List <SplitViewItem> {
                new SplitViewItem {
                    Name          = "Каталог релизов",
                    Page          = ReleasesPage,
                    IconUri       = new Uri("ms-appx:///Assets/Icons/hambergermenu.svg"),
                    IsVisible     = StubMenuIsVisible,
                    IsReleasePage = true
                },
                new SplitViewItem {
                    Name           = "Видеоплеер",
                    Page           = PlayerPage,
                    IconUri        = new Uri("ms-appx:///Assets/Icons/videoplayer.svg"),
                    IsVisible      = StubMenuIsVisible,
                    IsOnlinePlayer = true
                },
                new SplitViewItem {
                    Name          = "Youtube",
                    Page          = YoutubePage,
                    IconUri       = new Uri("ms-appx:///Assets/Icons/youtube.svg"),
                    IsVisible     = StubMenuIsVisible,
                    IsYoutubePage = true
                },
                new SplitViewItem {
                    Name         = "Поддержать проект",
                    Page         = DonatePage,
                    IconUri      = new Uri("ms-appx:///Assets/Icons/donate.svg"),
                    IsVisible    = StubMenuIsVisible,
                    IsDonatePage = true
                },
                new SplitViewItem {
                    Name         = "Войти",
                    Page         = AuthorizePage,
                    IconUri      = new Uri("ms-appx:///Assets/Icons/user.svg"),
                    IsVisible    = AuthorizeOptionIsVisible,
                    IsSigninPage = true
                }

                /*,
                 * new SplitViewItem {
                 *      Name = "Менеджер загрузок",
                 *      Page = "Torrents",
                 *      Icon = "\xE896"
                 * }*/
            };
            RefreshOptions();

            CreateCommands();

            ObserverEvents.SubscribeOnEvent("showMessage", ShowMessage);

            LaunchParameters.AddSubscriber(ChangeLaunchParameter);
        }
コード例 #4
0
        public MainWindow(string[] args)
        {
            InitializeComponent();

            launchParameters = new LaunchParameters(args);

            // Настройки лаунчера
            launcherSettings = Registry.CurrentUser.OpenSubKey("RoELauncher", true);
            if (launcherSettings == null)
            {
                launcherSettings = Registry.CurrentUser.CreateSubKey("RoELauncher", RegistryKeyPermissionCheck.ReadWriteSubTree);

                launcherSettings.SetValue("Token", "", RegistryValueKind.String);
                launcherSettings.SetValue("Uid", "", RegistryValueKind.String);
                launcherSettings.SetValue("Language", "", RegistryValueKind.String);
                launcherSettings.SetValue("Server", "", RegistryValueKind.String);

                PlayButton.IsEnabled = false;
                PlayButton.Content   = Properties.Resources.SelectPath;

                SettingsGrid.Visibility  = Visibility.Visible;
                SettingsButton.IsEnabled = false;
            }
            else
            {
                PathToGame = launcherSettings.GetValue("PathToGame").ToString();

                if (launchParameters.IsEmpty())
                {
                    string token    = launcherSettings.GetValue("Token").ToString();
                    string uid      = launcherSettings.GetValue("Uid").ToString();
                    string language = launcherSettings.GetValue("Language").ToString();
                    string server   = launcherSettings.GetValue("Server").ToString();
                    launchParameters = new LaunchParameters(token, uid, language, server);

                    if (launchParameters.IsEmpty())
                    {
                        PlayButton.IsEnabled = false;
                        PlayButton.Content   = Properties.Resources.StartupGarena;
                    }
                }
                else
                {
                    if (launchParameters.Language == "th")
                    {
                        launchParameters.Language = "en";
                    }

                    launcherSettings.SetValue("Token", launchParameters.Token, RegistryValueKind.String);
                    launcherSettings.SetValue("Uid", launchParameters.Uid, RegistryValueKind.String);
                    launcherSettings.SetValue("Language", launchParameters.Language, RegistryValueKind.String);
                    launcherSettings.SetValue("Server", launchParameters.Server, RegistryValueKind.String);
                }
            }

            LanguageTexBox.Text = launchParameters.Language;

            // Пинг
            PingAsync("203.205.147.187", 1000, 500);
        }
コード例 #5
0
ファイル: MainGame.cs プロジェクト: szlatyka/Sharpex2D
        /// <summary>
        ///     Initializes the game.
        /// </summary>
        /// <param name="launchParameters">The LaunchParameters.</param>
        /// <returns>EngineConfiguration.</returns>
        public override EngineConfiguration OnInitialize(LaunchParameters launchParameters)
        {
            _resolution = "640x480";
            if (launchParameters.KeyAvailable("Resolution"))
            {
                _resolution = launchParameters["Resolution"];
            }

            var waveOutInitializer = new WaveOutInitializer();

            if (!waveOutInitializer.IsSupported)
            {
                MessageBox.Show("WaveOut wird nicht supported. Das Spiel wird ohne Ton gestartet.", "FlyingBird",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (launchParameters.KeyAvailable("Device"))
            {
                switch (launchParameters["Device"])
                {
                case "DirectX9":
                    _deviceHint = "DirectX9";
                    return(new EngineConfiguration(
                               new DirectXRenderDevice(),
                               waveOutInitializer.IsSupported ? waveOutInitializer : null));

                case "DirectX10":
                    _deviceHint = "DirectX10";
                    return(new EngineConfiguration(
                               new Sharpex2D.Rendering.DirectX10.DirectXRenderDevice(),
                               waveOutInitializer.IsSupported ? waveOutInitializer : null));

                case "DirectX11":
                    _deviceHint = "DirectX11";
                    return(new EngineConfiguration(
                               new Sharpex2D.Rendering.DirectX11.DirectXRenderDevice(),
                               waveOutInitializer.IsSupported ? waveOutInitializer : null));

                case "GDI+":
                    _deviceHint = "GDI+ :<(";
                    return(new EngineConfiguration(new GDIRenderDevice(),
                                                   waveOutInitializer.IsSupported ? waveOutInitializer : null));
                }
            }
            _deviceHint = "DirectX11";
            return(new EngineConfiguration(
                       new Sharpex2D.Rendering.DirectX11.DirectXRenderDevice(),
                       waveOutInitializer.IsSupported ? waveOutInitializer : null));
        }
コード例 #6
0
        public override void Setup(LaunchParameters launchParameters)
        {
            if (launchParameters.KeyAvailable("Debugger") && launchParameters["Debugger"] == "Enabled")
            {
                Debugger.Launch();
            }
            GraphicsManager = new GLGraphicsManager
            {
                PreferredBackBufferHeight = 768,
                PreferredBackBufferWidth  = 768
            };
            var window = Get <GameWindow>();

            window.Title                 = "ChainReact - Development Build";
            Content.RootPath             = "Content";
            SoundManager                 = new WaveOutSoundManager();
            ResourceManager.SoundManager = SoundManager;
        }
コード例 #7
0
ファイル: App.cs プロジェクト: Nuclearistt/TEKLauncher
 internal void Initialize()
 {
     Steam.Initialize();
     Game.Initialize();
     LaunchParameters.Initialize();
     QueueUserWorkItem(LoadList);
     QueueUserWorkItem(FetchSpacewarIDs);
     QueueUserWorkItem(LoadModsDetails);
     QueueUserWorkItem(LoadMods);
     QueueUserWorkItem(LoadServers);
     QueueUserWorkItem(LoadWorkshop);
     QueueUserWorkItem(RUSSIAData.LoadServers);
     CreateDirectory(DownloadsDirectory = $@"{Game.Path}\Downloads").Attributes = FileAttributes.Directory | FileAttributes.Hidden;
     CreateDirectory(ManifestsDirectory = $@"{Game.Path}\Manifests").Attributes = FileAttributes.Directory | FileAttributes.Hidden;
     (MWindow = new MainWindow()).Show();
     ShowChangelog();
     ShutdownMode = ShutdownMode.OnLastWindowClose;
 }
コード例 #8
0
 public SettingsPage()
 {
     InitializeComponent();
     if (LocCulture == "es" || LocCulture == "fr" || LocCulture == "pt")
     {
         foreach (Panel Stack in LPGrid.Children)
         {
             foreach (CheckBox Checkbox in Stack.Children)
             {
                 Checkbox.FontSize = 18D;
             }
         }
     }
     if (LocCulture == "fr" || LocCulture == "el")
     {
         foreach (Button Button in OptionsGrid.Children)
         {
             Button.FontSize = 16D;
         }
     }
     if (LocCulture == "ar")
     {
         StatusStack.FlowDirection = FlowDirection.RightToLeft;
         foreach (Panel Stack in ValidationBlock.Children)
         {
             Stack.FlowDirection = FlowDirection.RightToLeft;
         }
     }
     UseGlobalFonts.IsChecked = Settings.UseGlobalFonts;
     foreach (Panel Stack in LPGrid.Children)
     {
         foreach (CheckBox Checkbox in Stack.Children)
         {
             Checkbox.IsChecked  = LaunchParameters.ParameterExists((string)Checkbox.Tag);
             Checkbox.Checked   += CheckParameter;
             Checkbox.Unchecked += UncheckParameter;
         }
     }
     UpdateButton.Content         = LocString(Settings.DowngradeMode ? LocCode.Downgrade : LocCode.Update);
     ProgressBar.ProgressUpdated += ProgressUpdatedHandler;
     Downloader      = new Downloader(ProgressBar.Progress);
     SteamDownloader = new ContentDownloader(346111U, FinishHandler, SetStatus, ProgressBar);
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: szlatyka/Sharpex2D
        private void button1_Click(object sender, EventArgs e)
        {
            if (!File.Exists("FlyingBird.exe"))
            {
                MessageBox.Show("FlyingBird.exe konnte nicht gefunden werden.", "FlyingBird Launcher",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            LaunchParameters parameters =
                LaunchParameters.CreateParameters(new[]
                                                  { new LaunchParameter("Resolution", comboBox2.Text), new LaunchParameter("Device", comboBox1.Text) });

            var process = new Process();

            process.StartInfo.Arguments       = parameters.ToString();
            process.StartInfo.FileName        = "FlyingBird.exe";
            process.StartInfo.UseShellExecute = true;

            process.Start();
            Application.Exit();
        }
コード例 #10
0
        private static bool movePoles   = true;     // move poles from top to sides

        private static void Simulate(String testID, SimParams config, Random rnd)
        {
            // Prepare directory
            if (Directory.Exists(testID))
            {
                Directory.Delete(testID, true);
            }
            Directory.CreateDirectory(testID);
            Directory.SetCurrentDirectory(testID);

            // Cache some values that we are goting to use for configuration
            double R_Cell          = config[SimParameter.Double.R_Cell];
            double L_Poles         = config[SimParameter.Double.L_Poles];
            int    N_MT_Total      = config[SimParameter.Int.N_MT_Total];
            double Dt              = config[SimParameter.Double.Dt];
            double Save_Freq_Macro = config[SimParameter.Double.Save_Freq_Macro];
            double T_End           = config[SimParameter.Double.T_End];
            int    layerCount      = (int)(T_End / Save_Freq_Macro) + 1;

            // Ready to start
            int[]     res_mts    = new int[layerCount * 4 * cellsPerCase];
            double[]  res_angles = new double[layerCount * 2 * cellsPerCase];
            Stopwatch sw         = new Stopwatch();

            int batchSize = Math.Max(1, Environment.ProcessorCount);
            int simN      = 0;

            while (simN < cellsPerCase)
            {
                var parameters = new LaunchParameters();
                var cellCount  = Math.Min(batchSize, cellsPerCase - simN);
                sw.Reset();

                // Say greetings
                if (cellCount == 1)
                {
                    Console.WriteLine("Cell #" + (simN + 1).ToString());
                }
                else
                {
                    Console.WriteLine(String.Format("Cells #{0}...#{1}", simN + 1, simN + cellCount));
                }
                Console.Write("   Simulating ... ");

                // Update config in accordance with our flags
                sw.Start();
                parameters.Config = config;
                config[SimParameter.Double.D_Trans] = hasDiff ? SimParams.GetDefaultValue(SimParameter.Double.D_Trans, false) : 0.0;
                config[SimParameter.Double.D_Rot]   = hasDiff ? SimParams.GetDefaultValue(SimParameter.Double.D_Rot, false) : 0.0;

                // Set initial state
                parameters.InitialStates = new InitialStates();
                parameters.InitialStates.AddChromosomePair(0.0, 0.0, 1e-6, Math.PI / 2, 0.0, 0.0);
                for (int i = 0; i < N_MT_Total * 2; i++)
                {
                    double alpha = (rnd.NextDouble()) * Math.PI * 2;
                    double dx    = rnd.NextDouble() * (i < N_MT_Total ? 1 : -1);
                    double dy    = Math.Sqrt(1.0 - dx * dx) * Math.Cos(alpha);
                    double dz    = Math.Sqrt(1.0 - dx * dx) * Math.Sin(alpha);
                    parameters.InitialStates.AddMT(i < N_MT_Total ? PoleType.Left : PoleType.Right,
                                                   dx, dy, dz,
                                                   0.0,
                                                   MTState.Polymerization);
                }

                // Set poles
                if (movePoles)
                {
                    parameters.PoleCoords = new PoleCoordinates();

                    double t      = 180.0;
                    double pole_r = L_Poles / 2 * 1e-6;
                    for (int i = 0; i < t; i++)
                    {
                        double angle = i / (t - 1) * Math.PI / 2;
                        parameters.PoleCoords.AddRecord((double)i,
                                                        -pole_r * Math.Sin(angle), pole_r * Math.Cos(angle), 0.0,
                                                        pole_r * Math.Sin(angle), pole_r * Math.Cos(angle), 0.0);
                    }
                }

                // Simulate
                parameters.Args.Mode      = LaunchMode.New;
                parameters.Args.Solver    = new SimulatorConfig(SimulatorType.CPU);
                parameters.Args.CellCount = cellCount;
                parameters.Args.CellFile  = "results.cell";
                using (Launcher ml = new Launcher(".", "../Mitosis.exe", parameters))
                {
                    var res = ml.StartAndWait();
                    if (res.ExitCode != 0 || !String.IsNullOrEmpty(res.Error))
                    {
                        throw new ApplicationException(String.Format("Simulation failed, error #{0}: {1}, {2}",
                                                                     res.ExitCode, res.Error, res.Output));
                    }
                }
                sw.Stop();
                Console.WriteLine(String.Format("{0} seconds", (int)sw.ElapsedMilliseconds / 1000));

                // Analyze
                Console.Write("   Counting ... ");
                sw.Reset();
                sw.Start();
                for (int cellN = simN; cellN < simN + cellCount; cellN++)
                {
                    var ts = TimeStream.Open(cellCount == 1
                                    ? parameters.Args.CellFile
                                    : parameters.Args.CellFile.Replace("results.cell",
                                                                       String.Format("results_{0}.cell",
                                                                                     cellN - simN)));
                    if (ts.LayerCount != layerCount)
                    {
                        throw new ApplicationException("Unexpected count of time layers");
                    }
                    ts.Reset();
                    int layerN = 0;
                    while (ts.MoveNext())
                    {
                        var cell = ts.Current.Cell;
                        var chr0 = cell.Chromosomes.ElementAt(0);
                        var chr1 = cell.Chromosomes.ElementAt(1);

                        // Count MTs
                        int c0l = 0, c0r = 0, c1l = 0, c1r = 0;
                        var c0 = chr0.BoundMTs;
                        foreach (var mt in c0)
                        {
                            if (mt.Pole.Type == PoleType.Left)
                            {
                                c0l += 1;
                            }
                            else
                            {
                                c0r += 1;
                            }
                        }

                        var c1 = chr1.BoundMTs;
                        foreach (var mt in c1)
                        {
                            if (mt.Pole.Type == PoleType.Left)
                            {
                                c1l += 1;
                            }
                            else
                            {
                                c1r += 1;
                            }
                        }

                        int offset = layerCount * 4 * cellN + layerN * 4;
                        res_mts[offset + 0] = c0l;
                        res_mts[offset + 1] = c0r;
                        res_mts[offset + 2] = c1l;
                        res_mts[offset + 3] = c1r;

                        // Count angles
                        if (cell.AreSpringsBroken)
                        {
                            throw new ApplicationException("Wrong setup, springs were broken!");
                        }
                        Vector3 dp = new Vector3(cell.GetPole(PoleType.Left).Position.X - cell.GetPole(PoleType.Right).Position.X,
                                                 cell.GetPole(PoleType.Left).Position.Y - cell.GetPole(PoleType.Right).Position.Y,
                                                 cell.GetPole(PoleType.Left).Position.Z - cell.GetPole(PoleType.Right).Position.Z);
                        if (dp.Length() == 0.0f)
                        {
                            dp = new Vector3(-1.0f, 0.0f, 0.0f);
                        }
                        else
                        {
                            dp = dp / dp.Length();
                        }
                        if (Math.Abs(dp.Y) + Math.Abs(dp.Z) > 1e-9)
                        {
                            throw new ApplicationException("Poles must be located symmetrically");
                        }

                        Vector3 dc_x = new Vector3((float)-chr0.Orientation[0, 0],
                                                   (float)-chr0.Orientation[1, 0],
                                                   (float)-chr0.Orientation[2, 0]);
                        if (dc_x.Length() == 0.0f)
                        {
                            dc_x = new Vector3(-1.0f, 0.0f, 0.0f);
                        }
                        else
                        {
                            dc_x = dc_x / dc_x.Length();
                        }

                        Vector3 dc_y = new Vector3((float)-chr0.Orientation[0, 1],
                                                   (float)-chr0.Orientation[1, 1],
                                                   (float)-chr0.Orientation[2, 1]);
                        if (dc_y.Length() == 0.0f)
                        {
                            dc_y = new Vector3(0.0f, 1.0f, 0.0f);
                        }
                        else
                        {
                            dc_y = dc_y / dc_y.Length();
                        }

                        offset = (layerCount * cellN + layerN) * 2;
                        res_angles[offset + 0] = Math.Acos(Math.Min(1.0, Math.Max(-1.0, Vector3.Dot(dp, dc_x))));
                        res_angles[offset + 1] = Math.Acos(Math.Min(1.0, Math.Max(-1.0, Vector3.Dot(dp, dc_y))));

                        layerN += 1;
                    }
                    ts.Dispose();
                } // for cellN

                sw.Stop();
                Console.WriteLine(String.Format("{0} seconds", sw.ElapsedMilliseconds / 1000));
                simN += cellCount;
            } // while simN < cellsPerCase

            // Save results
            Console.WriteLine("Saving ...");

            // A-results
            using (var csv = File.CreateText("results_A.csv"))
            {
                csv.WriteLine("Connected MTs (pcs)");
                csv.Write("Time (seconds),Averaged,Min,Max");
                for (int i = 0; i < cellsPerCase; i++)
                {
                    csv.Write(",Cell #" + (i + 1).ToString());
                }
                csv.WriteLine();

                for (int layerN = 0; layerN < layerCount; layerN++)
                {
                    StringBuilder str = new StringBuilder();
                    int           min = Int32.MaxValue, max = Int32.MinValue, avg = 0;
                    for (int cellN = 0; cellN < cellsPerCase; cellN++)
                    {
                        int offset = layerN * 4 + layerCount * 4 * cellN;
                        int val    = res_mts[offset] + res_mts[offset + 1] + res_mts[offset + 2] + res_mts[offset + 3];
                        str.Append(",");
                        str.Append(val.ToString());
                        min  = Math.Min(min, val);
                        max  = Math.Max(max, val);
                        avg += val;
                    }
                    csv.WriteLine(String.Format("{0},{1},{2},{3}{4}",
                                                (Save_Freq_Macro * layerN).ToString(CultureInfo.InvariantCulture),
                                                ((double)avg / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                min, max, str.ToString()));
                }
            }

            // B-results
            using (var csv = File.CreateText("results_B.csv"))
            {
                csv.WriteLine("Kinetochore types (%)");
                csv.WriteLine("Time (seconds),No MTs,Monotelic,Syntelic,Bioriented,Merotelic");

                for (int layerN = 0; layerN < layerCount; layerN++)
                {
                    int noMTs = 0, monotelic = 0, syntelic = 0, bioriented = 0, merotelic = 0;
                    for (int cellN = 0; cellN < cellsPerCase; cellN++)
                    {
                        int offset = layerN * 4 + layerCount * 4 * cellN;

                        int c0l    = res_mts[offset + 0];
                        int c0r    = res_mts[offset + 1];
                        int c1l    = res_mts[offset + 2];
                        int c1r    = res_mts[offset + 3];
                        int c0m    = Math.Min(c0l, c0r);
                        int c0nm   = Math.Max(c0l, c0r);
                        int c1m    = Math.Min(c1l, c1r);
                        int c1nm   = Math.Max(c1l, c1r);
                        int c0_sum = c0m + c0nm;
                        int c1_sum = c1m + c1nm;
                        int sum    = c0_sum + c1_sum;

                        if (sum == 0)
                        {
                            noMTs += 1;
                        }
                        else if (c0m != 0 || c1m != 0)
                        {
                            merotelic += 1;
                        }
                        else if (c0_sum == 0 || c1_sum == 0)
                        {
                            monotelic += 1;
                        }
                        else if (Math.Min(c0l, c1l) != 0 || Math.Min(c0r, c1r) != 0)
                        {
                            syntelic += 1;
                        }
                        else if (c0m == 0 && c0nm != 0 && c1m == 0 && c1nm != 0)
                        {
                            bioriented += 1;
                        }
                        else
                        {
                            throw new ApplicationException("Internal error, unknown type of chromosome");
                        }
                    }
                    csv.WriteLine(String.Format("{0},{1},{2},{3},{4},{5}",
                                                (Save_Freq_Macro * layerN).ToString(CultureInfo.InvariantCulture),
                                                ((double)noMTs / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                ((double)monotelic / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                ((double)syntelic / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                ((double)bioriented / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                ((double)merotelic / cellsPerCase).ToString(CultureInfo.InvariantCulture)));
                }
            }

            // C-results
            using (var csv = File.CreateText("results_C.csv"))
            {
                csv.WriteLine("Merotelic MTs (pcs)");
                csv.Write("Time (seconds),Averaged,Min,Max");
                for (int i = 0; i < cellsPerCase; i++)
                {
                    csv.Write(",Cell #" + (i + 1).ToString());
                }
                csv.WriteLine();

                for (int layerN = 0; layerN < layerCount; layerN++)
                {
                    StringBuilder str = new StringBuilder();
                    int           min = Int32.MaxValue, max = Int32.MinValue, avg = 0;
                    for (int cellN = 0; cellN < cellsPerCase; cellN++)
                    {
                        int offset = layerN * 4 + layerCount * 4 * cellN;
                        int val    = Math.Min(res_mts[offset + 0], res_mts[offset + 1]) + Math.Min(res_mts[offset + 2], res_mts[offset + 3]);
                        str.Append(",");
                        str.Append(val.ToString());
                        min  = Math.Min(min, val);
                        max  = Math.Max(max, val);
                        avg += val;
                    }
                    csv.WriteLine(String.Format("{0},{1},{2},{3}{4}",
                                                (Save_Freq_Macro * layerN).ToString(CultureInfo.InvariantCulture),
                                                ((double)avg / cellsPerCase).ToString(CultureInfo.InvariantCulture),
                                                min, max, str.ToString()));
                }
            }

            // D-results
            using (var csv_x = File.CreateText("results_D_x.csv"))
                using (var csv_y = File.CreateText("results_D_y.csv"))
                {
                    var csvs = new StreamWriter[] { csv_x, csv_y };
                    for (int l = 0; l < csvs.Length; l++)
                    {
                        var csv = csvs[l];
                        csv.WriteLine("Angle, degrees");
                        csv.Write("Time (seconds),Averaged,Min,Max");
                        for (int i = 0; i < cellsPerCase; i++)
                        {
                            csv.Write(",Cell #" + (i + 1).ToString());
                        }
                        csv.WriteLine();

                        for (int layerN = 0; layerN < layerCount; layerN++)
                        {
                            StringBuilder str = new StringBuilder();
                            double        min = Double.MaxValue, max = Double.MinValue, avg = 0.0;
                            for (int cellN = 0; cellN < cellsPerCase; cellN++)
                            {
                                double angle = res_angles[l + (layerN + layerCount * cellN) * 2];
                                if (angle > Math.PI)
                                {
                                    angle = 2 * Math.PI - angle;
                                }
                                if (angle > Math.PI / 2)
                                {
                                    angle = Math.PI - angle;
                                }
                                angle *= 180.0 / Math.PI;
                                str.Append(",");
                                str.Append(String.Format(CultureInfo.InvariantCulture, "{0:F1}", angle));
                                min  = Math.Min(min, angle);
                                max  = Math.Max(max, angle);
                                avg += angle;
                            }

                            csv.WriteLine(String.Format(CultureInfo.InvariantCulture,
                                                        "{0:F1},{1:F1},{2:F1},{3:F1}{4}",
                                                        Save_Freq_Macro * layerN,
                                                        (double)avg / cellsPerCase,
                                                        min, max, str.ToString()));
                        }
                    }
                }

            Directory.SetCurrentDirectory("..");
        }
コード例 #11
0
 private void CheckParameter(object Sender, RoutedEventArgs Args) => LaunchParameters.Add((string)((FrameworkElement)Sender).Tag);
コード例 #12
0
ファイル: GameBase.cs プロジェクト: joewan/xenko
        /// <summary>
        /// Initializes a new instance of the <see cref="GameBase" /> class.
        /// </summary>
        protected GameBase()
        {
            // Internals
            Log = GlobalLogger.GetLogger(GetType().GetTypeInfo().Name);
            updateTime = new GameTime();
            drawTime = new GameTime();
            playTimer = new TimerTick();
            updateTimer = new TimerTick();
            totalUpdateTime = new TimeSpan();
            timer = new TimerTick();
            IsFixedTimeStep = false;
            maximumElapsedTime = TimeSpan.FromMilliseconds(500.0);
            TargetElapsedTime = TimeSpan.FromTicks(10000000 / 60); // target elapsed time is by default 60Hz
            lastUpdateCount = new int[4];
            nextLastUpdateCountIndex = 0;

            // Calculate the updateCountAverageSlowLimit (assuming moving average is >=3 )
            // Example for a moving average of 4:
            // updateCountAverageSlowLimit = (2 * 2 + (4 - 2)) / 4 = 1.5f
            const int BadUpdateCountTime = 2; // number of bad frame (a bad frame is a frame that has at least 2 updates)
            var maxLastCount = 2 * Math.Min(BadUpdateCountTime, lastUpdateCount.Length);
            updateCountAverageSlowLimit = (float)(maxLastCount + (lastUpdateCount.Length - maxLastCount)) / lastUpdateCount.Length;

            // Externals
            Services = new ServiceRegistry();

            // Asset manager
            Asset = new AssetManager(Services);

            LaunchParameters = new LaunchParameters();
            GameSystems = new GameSystemCollection();

            // Create Platform
            gamePlatform = GamePlatform.Create(this);
            gamePlatform.Activated += gamePlatform_Activated;
            gamePlatform.Deactivated += gamePlatform_Deactivated;
            gamePlatform.Exiting += gamePlatform_Exiting;
            gamePlatform.WindowCreated += GamePlatformOnWindowCreated;

            // Setup registry
            Services.AddService(typeof(IGame), this);
            Services.AddService(typeof(IGamePlatform), gamePlatform);

            IsActive = true;
        }
コード例 #13
0
ファイル: Game1.cs プロジェクト: szlatyka/Sharpex2D
 /// <summary>
 /// Initializes the game.
 /// </summary>
 /// <param name="launchParameters">The LaunchParameters.</param>
 /// <returns>EngineConfiguration.</returns>
 public override EngineConfiguration OnInitialize(LaunchParameters launchParameters)
 {
     return(new EngineConfiguration(new OpenGLGraphicsManager(), new WaveOutInitializer()));
 }
コード例 #14
0
ファイル: Game.cs プロジェクト: szlatyka/Sharpex2D
 /// <summary>
 /// Processes the Game initialization.
 /// </summary>
 /// <param name="launchParameters">The LaunchParameters.</param>
 public abstract EngineConfiguration OnInitialize(LaunchParameters launchParameters);
コード例 #15
0
ファイル: MainGame.cs プロジェクト: KaskadekingDE/ChainReact
 public override void Setup(LaunchParameters launchParameters)
 {
     if (launchParameters.KeyAvailable("Debugger") && launchParameters["Debugger"] == "Enabled")
     {
         Debugger.Launch();
     }
     GraphicsManager = new GLGraphicsManager
     {
         PreferredBackBufferHeight = 768,
         PreferredBackBufferWidth = 768
     };
     var window = Get<GameWindow>();
     window.Title = "ChainReact - Development Build";
     Content.RootPath = "Content";
     SoundManager = new WaveOutSoundManager();
     ResourceManager.SoundManager = SoundManager;
 }
コード例 #16
0
 public DebugLauncher(LaunchParameters parameters)
 {
     _parameters = parameters;
 }
コード例 #17
0
ファイル: Game.cs プロジェクト: szlatyka/Sharpex2D
 /// <summary>
 /// Restarts the Game with the specified LaunchParameters.
 /// </summary>
 /// <param name="launchParameters">The LaunchParameters.</param>
 public void Restart(LaunchParameters launchParameters)
 {
     SGL.Restart(launchParameters.ToString());
 }
コード例 #18
0
        static int Main(string[] args)
        {
            var errorsOccured    = false;
            var launchParameters = LaunchParameters.FromCommandLineArguments(args);

            if (launchParameters == null)
            {
                return(-1);
            }

            var baseDirectory = launchParameters.BaseDirectory;

            Console.WriteLine($"Working directory: {baseDirectory}");

            var analyzers = new List <IAnalyzer>
            {
                new FileContentAnalyzer()
            };

            if (!launchParameters.SkipProjectInclusionCheck)
            {
                analyzers.Add(new ProjectInclusionAnalyzer(baseDirectory));
            }

            analyzers.Add(new NamespaceUniquenessAnalyzer());

            Console.WriteLine("Searching for translation files...");

            var i18nFiles = LocateInternationalizationFiles(baseDirectory);

            foreach (var translationFilePath in i18nFiles)
            {
                var errorCollector = new ErrorCollector();

                var translationFile = TranslationFile.TryCreateFromFilePath(translationFilePath);
                if (translationFile == null)
                {
                    errorCollector.AddError("Could not retrieve locale and namespace from file path.");
                }
                else
                {
                    foreach (var analyzer in analyzers)
                    {
                        analyzer.Analyze(translationFile, errorCollector);
                    }
                }

                if (errorCollector.Errors.Any())
                {
                    errorsOccured = true;
                    LogError($"{Path.GetRelativePath(baseDirectory, translationFilePath)}:");
                    foreach (var error in errorCollector.Errors)
                    {
                        LogError(error);
                    }
                }
            }

            if (errorsOccured)
            {
                Console.WriteLine("Error: there are problems with some translation files.");
                Console.WriteLine("Inspect the log messages above.");
                return(-1);
            }

            Console.WriteLine("Success: no problems found with translation files.");
            return(0);
        }