Ejemplo n.º 1
0
        //private Dictionary<string, RepoHeader> repos;

        public PackageManager(CoopConfigInfo config)
        {
            this.config = config;

            gameManager = GameManager.Instance;
            //Initialize();
        }
Ejemplo n.º 2
0
        public MainForm(string[] args)
        {
            InitializeComponent();

            this.Text = string.Format("Nucleus Coop v{0}", Globals.Version);

            controls = new Dictionary <UserGameInfo, GameControl>();

            configFile  = new CoopConfigInfo("config.json");
            gameManager = new GameManager(configFile);

            positionsControl = new PositionsControl();
            optionsControl   = new PlayerOptionsControl();
            jsControl        = new JSUserInputControl();

            positionsControl.OnCanPlayUpdated += StepCanPlay;
            optionsControl.OnCanPlayUpdated   += StepCanPlay;
            jsControl.OnCanPlayUpdated        += StepCanPlay;

            // selects the list of games, so the buttons look equal
            list_Games.Select();
            list_Games.AutoScroll       = false;
            list_Games.SelectedChanged += list_Games_SelectedChanged;
            //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0);

            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    string argument = args[i];
                    if (string.IsNullOrEmpty(argument))
                    {
                        continue;
                    }

                    string extension = Path.GetExtension(argument);
                    if (extension.ToLower().EndsWith("nc"))
                    {
                        // try installing
                        gameManager.RepoManager.InstallPackage(argument);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public MainForm(string[] args)
        {
            InitializeComponent();

            overlay         = new GameRunningOverlay();
            overlay.OnStop += Overlay_OnStop;

            this.Text = string.Format("Nucleus Coop v{0}", Globals.Version);

            controls = new Dictionary <UserGameInfo, GameControl>();

            configFile  = new CoopConfigInfo("config.json");
            gameManager = new GameManager(configFile);

            positionsControl = new PositionsControl();
            optionsControl   = new PlayerOptionsControl();
            jsControl        = new JSUserInputControl();

            positionsControl.OnCanPlayUpdated += StepCanPlay;
            optionsControl.OnCanPlayUpdated   += StepCanPlay;
            jsControl.OnCanPlayUpdated        += StepCanPlay;

            // selects the list of games, so the buttons look equal
            list_Games.Select();
            list_Games.AutoScroll       = false;
            list_Games.SelectedChanged += list_Games_SelectedChanged;
            //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0);


            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    string argument = args[i];
                    if (string.IsNullOrEmpty(argument))
                    {
                        continue;
                    }

                    string extension = Path.GetExtension(argument);
                    if (extension.ToLower().EndsWith("nc"))
                    {
                        // try installing if user allows it
                        if (MessageBox.Show("Would you like to install " + argument + "?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            gameManager.RepoManager.InstallPackage(argument);
                        }
                    }
                }
            }

            if (!gameManager.User.Options.RequestedToAssociateFormat)
            {
                gameManager.User.Options.RequestedToAssociateFormat = true;

                if (MessageBox.Show("Would you like to associate Nucleus Package Files (*.nc) to the application?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string startLocation = Process.GetCurrentProcess().MainModule.FileName;
                    if (!FileAssociations.SetAssociation(".nc", "NucleusCoop", "Nucleus Package Files", startLocation))
                    {
                        MessageBox.Show("Failed to set association");
                        gameManager.User.Options.RequestedToAssociateFormat = false;
                    }
                }

                gameManager.User.Save();
            }
        }