//**************************************************//
        //					 FUNCTIONS                      //
        //**************************************************//
        public void LoadProfiles()
        {
            if (Directory.Exists(Globals.profilesFolder) == false) //if "profiles folder doesn't exist ?"
            {
                MessageBox.Show("unable to find profiles, make sure the launcher is in SPT-AKI SERVER folder");
            }
            else
            {
                var profilesFiles = Directory.GetFiles(Globals.profilesFolder);

                if (profilesFiles.Length == 0) //file count = 0
                {
                    //MessageBox.Show("There is no profiles actually ...? ");
                    CreateProfileForm C = new CreateProfileForm(this.Location);
                    C.Show();
                }
                else
                {
                    foreach (string filePath in profilesFiles) //for each file in the directory
                    {
                        using (StreamReader r = new StreamReader(filePath))
                        {
                            dynamic profileDATA = JObject.Parse(r.ReadToEnd());
                            //create a new profile Object from the json file
                            profiles.Add(new Profile()
                            {
                                id       = (string)profileDATA["info"]["id"],
                                username = (string)profileDATA["info"]["username"],
                                password = (string)profileDATA["info"]["password"],
                                wipe     = (bool)profileDATA["info"]["wipe"],
                                edition  = (string)profileDATA["info"]["edition"]
                            });
                            //don't forget to add them into the profile selection
                            profilesListBox.Items.Add((string)profileDATA["info"]["username"]);
                        }
                    }
                }
            }
        }
예제 #2
0
 public CreateProfilePresenter(MenuPresenter prevPresenter)
 {
     _prevPresenter = prevPresenter;
     _form          = new CreateProfileForm(this);
     _form.Show();
 }