public static LauncherProfile Load(string ProfileName)
        {
            LauncherProfile prof = new LauncherProfile(ProfileName);

            prof.Load();
            return(prof);
        }
        public static List <LauncherProfile> GetLauncherProfileList()
        {
            List <LauncherProfile> ProfileList = new List <LauncherProfile>();

            foreach (string profile in ProfilesRegistryLocation.GetSubKeyNames())
            {
                ProfileList.Add(LauncherProfile.Load(profile));
            }
            return(ProfileList);
        }
 public static string GetSpecificProfilePath(LauncherProfile Profil)
 {
     return(GetSpecificProfilePath(Profil.ProfileName));
 }
 public static string GetSpecificBinFolder(LauncherProfile Profil)
 {
     return(GetSpecificMinecraftFolder(Profil) + Path.DirectorySeparatorChar + "bin");
 }
        public Dictionary <string, string> AddModPack(ZipFile ModPack, WischisLauncherCore.LauncherProfile Profil)
        {
            Dictionary <string, string> ModListe = new Dictionary <string, string>();
            string ModName = Path.GetFileName(ModPack.Name);

            if (ModPack.EntryFileNames.Contains("modindex.txt"))
            {
                string   index      = new StreamReader(ModPack["modindex.txt"].OpenReader()).ReadToEnd();
                char[]   splitchars = { '\r', '\n' };
                string[] zeilen     = index.Split(splitchars);

                foreach (string zzz in zeilen)
                {
                    string zeile = zzz.Trim();
                    if (zeile == "" || zeile.Substring(0, 1) == "#" || zeile.Substring(0, 1) == ";")
                    {
                        continue;
                    }

                    string[] cmd = zeile.Split('\t');
                    if (cmd.Length <= 0)
                    {
                        continue;
                    }

                    switch (cmd[0])
                    {
                    case "copy":
                        //falls nicht genau 1 befehl und 2 argumente, brich ab.
                        if (cmd.Length != 3)
                        {
                            break;
                        }

                        foreach (ZipEntry ent in ModPack)
                        {
                            if (!Regex.IsMatch(ent.FileName, cmd[1]) || ent.FileName.Substring(ent.FileName.Length - 1, 1) == "/")
                            {
                                continue;
                            }
                            string location = Regex.Replace(ent.FileName, cmd[1], cmd[2], RegexOptions.None);

                            location = LauncherFolderStructure.GetSpecificMinecraftFolder(Profil) + Path.DirectorySeparatorChar + location;

                            if (File.Exists(location))
                            {
                                continue;
                            }
                            string dir = Path.GetDirectoryName(location);

                            string fname = dir + Path.DirectorySeparatorChar + Path.GetFileName(location);
                            ModListe.Add(("file|" + fname).ToLower(), ModName.ToLower());
                            if (Directory.Exists(dir))
                            {
                                Directory.CreateDirectory(dir);
                            }
                            FileStream fs = File.Open(location, FileMode.OpenOrCreate, FileAccess.Write);
                            ent.Extract(fs);
                            fs.Close();
                        }

                        break;

                    case "patch":
                        //falls nicht genau 1 befehl und 2 argumente, brich ab.
                        if (cmd.Length != 3)
                        {
                            break;
                        }

                        foreach (ZipEntry ent in ModPack)
                        {
                            if (!Regex.IsMatch(ent.FileName, cmd[1]) || ent.FileName.Substring(ent.FileName.Length - 1, 1) == "/")
                            {
                                continue;
                            }
                            string location = Regex.Replace(ent.FileName, cmd[1], cmd[2], RegexOptions.None);
                            ModListe.Add(("patch|" + ent.FileName).ToLower(), ModName.ToLower());
                            AddModFile(ent.OpenReader(), location);
                        }

                        break;

                    default:
                        //was ist das für ein befehl?
                        break;
                    }
                }
            }
            else
            {
                foreach (ZipEntry ent in ModPack)
                {
                    if (!ent.IsDirectory)
                    {
                        ModListe.Add(("patch|" + ent.FileName).ToLower(), ModName.ToLower());
                    }
                    AddModFile(ent);
                }
            }

            return(ModListe);
        }