Beispiel #1
0
        public ModManager()
        {
            InitializeComponent();

            this.firstStart = true;

            this.Size = new Size(1300, 700);

            // Exit if Mod Manager already running
            if (System.Diagnostics.Process.GetProcessesByName("ModManager").Length > 1)
            {
                MessageBox.Show("Mod Manager is already running", "Mod Manager running", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(0);
            }

            this.updateStatus("");

            this.serverURL  = "https://mm.matux.fr";
            this.curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            this.utils = new Utils();

            // Create AppData if doesn't exist already
            this.appPath = System.AppDomain.CurrentDomain.BaseDirectory;
            Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ModManager");

            // Remove unused files directory
            this.utils.DirectoryDelete(this.appPath + "\\files");

            try
            {
                using (WebClient client = new WebClient())
                {
                    string version = client.DownloadString(this.serverURL + "/version.txt");
                    if (Version.Parse(version) > curVersion)
                    {
                        if (MessageBox.Show("There is a new version of Mod Manager available, would you like to download it ?", "Mod Manager Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            FileInfo installer = new FileInfo(this.appPath + "\\ModManagerInstaller.exe");
                            if (installer.Exists)
                            {
                                this.utils.FileDelete(this.appPath + "\\ModManagerInstaller.exe");
                            }
                            client.DownloadFile(this.serverURL + "/ModManagerInstaller.exe", this.appPath + "\\ModManagerInstaller.exe");
                            Process.Start(this.appPath + "\\ModManagerInstaller.exe");
                            Environment.Exit(0);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Can't reach Mod Manager server.\nPlease verify your internet connection and try again !", "Mod Manager server unavailable", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(0);
            }

            this.config = new Config();
            this.config.load();
            this.textureList = new TextureList(this.serverURL + "/textures", this.appPath + "\\textures.json", this);


            this.modlist            = new ModList(this.serverURL, this.appPath + "\\modlist.json", this);
            this.modlist.currentMod = this.modlist.mods.First();
            this.pagelist           = new PageList(this);
            this.modlist.show();
            //this.textureList.show();

            this.serverList = new ServerList(this);
            this.serverList.update();

            // Choose folder if needed
            if (this.config == null || this.config.amongUsPath == null)
            {
                this.pagelist.renderPage("PathSelection");
            }
            else
            {
                this.firstStart = false;
                this.pagelist.renderPage("ModSelection");
            }
        }
Beispiel #2
0
 public static string FilePath(ModList list)
 {
     return(FilePath(list.Name));
 }
Beispiel #3
0
 public Dialog_Rename_ModList(ModList list)
 {
     this.list               = list;
     this.curName            = list.Name;
     absorbInputAroundWindow = true;
 }
 public static void TryCreate(ModList list, Action failureCallback, Action successCallback)
 {
     list.Save(false, failureCallback, successCallback);
 }