Example #1
0
        private Server ReadServer(XElement server)
        {
            XElement images          = server.XPathSelectElement("style/images");
            XElement launcherProfile = server.XPathSelectElement("launcherProfile");
            XElement options         = server.XPathSelectElement("options");

            Server result = new Server
            {
                Name                = XElementExtender.ReadName(server),
                Version             = XElementExtender.ReadString(server, "version"),
                Ip                  = XElementExtender.ReadString(server, "server/url"),
                State               = XElementExtender.ReadString(server, "state"),
                StatusUri           = XElementExtender.ReadUri(server, "status"),
                PatchNotesUri       = XElementExtender.ReadUri(server, "patchnotesUrl"),
                PatchFilesUri       = XElementExtender.ReadUri(server, "patchUrl"),
                Image               = XElementExtender.ReadImage(images, "background") ?? Properties.Resources.filenotfound,
                LauncherProfileData = ReadLauncherProfileData(launcherProfile),
                Options             = ReadOptions(options)
            };

            result.GrayScaledImage = ImageManipulation.CreateGrayScaledImage(result.Image as Bitmap);

            OutputConsole.PrintVerbose(result, 1);
            return(result);
        }
Example #2
0
        private PatchFile ReadPatchFile(XElement item)
        {
            PatchFile result = new PatchFile
            {
                Filename       = XElementExtender.ReadName(item),
                DownloadUri    = XElementExtender.ReadUri(item),
                LocalDirectory = XElementExtender.ReadPath(item),
                Hash           = XElementExtender.ReadHash(item)
            };

            OutputConsole.PrintVerbose(result, 5);
            return(result);
        }
Example #3
0
        public FileInfos Read(XDocument document)
        {
            XElement launcherProfilesJson = document.XPathSelectElement("root/launcher/launcherProfilesJson");
            XElement optionsTxt           = document.XPathSelectElement("root/launcher/optionsTxt");
            XElement minecraftExecutable  = document.XPathSelectElement("root/launcher/minecraftExecutable");

            FileInfos result = new FileInfos()
            {
                DefaultLauncherProfilesFile  = XElementExtender.ReadUri(launcherProfilesJson),
                LauncherProfilesFilename     = XElementExtender.ReadPath(launcherProfilesJson),
                DefaultOptionsFile           = XElementExtender.ReadUri(optionsTxt),
                OptionsFilename              = XElementExtender.ReadRelativePath(optionsTxt),
                DefaultMinecraftLauncherFile = XElementExtender.ReadUri(minecraftExecutable),
                MinecraftLauncherFilename    = XElementExtender.ReadPath(minecraftExecutable),
                MinecraftLauncherHash        = XElementExtender.ReadHash(minecraftExecutable)
            };

            OutputConsole.PrintVerbose(result, 1);
            return(result);
        }