Ejemplo n.º 1
0
 public ModInfo(string filePath)
 {
     cIni ini = new cIni(filePath);
     ini.BufferLen = 1024 * 1024;
     Title = ini.ReadValue("ModInfo", "Title");
     Author = ini.ReadValue("ModInfo", "Author");
     Homepage = ini.ReadValue("ModInfo", "Homepage");
     Version = ini.ReadValue("ModInfo", "Version");
     RequiredFiles = ini.ReadValue("ModInfo", "RequiredFiles").Split(',');
     ModifiedFiles = ini.ReadValue("ModInfo", "ModifiedFiles").Split(',');
     Description = ini.ReadValue("ModInfo", "Description").Replace("\\r\\n","\r\n");
     DirName = Directory.GetParent(filePath).Name;
 }
        static void Main(string[] args)
        {
            string iniPath = currentDir + "/" + currentExeNameNoExt + ".ini";

            Console.WriteLine("SuperMeatBoy Multilanguage Loader 1.0");
            Console.WriteLine("Programmed by iAmGhost");
            Console.WriteLine("Project Page: https://github.com/iAmGhost/SuperMeatBoyMultilangLoader");
            Console.WriteLine("----------------");

            string language, smbpath;

            language = getArgData(args, "language");
            smbpath = getArgData(args, "smbpath");

            if (args.Length == 0 && File.Exists(iniPath))
            {
                cIni ini = new cIni(iniPath);

                language = ini.ReadValue("LoaderOptions", "Language", "");
                smbpath = ini.ReadValue("LoaderOptions", "SMBPath", "");

                if ((language == "" || smbpath == ""))
                {
                    Console.WriteLine("Ini file example:");
                    Console.WriteLine("[LoaderOptions]");
                    Console.WriteLine("Language=Korean");
                    Console.WriteLine("SMBPath=SuperMeatBoy.exe");
                    printLanguages();
                    Environment.Exit(1);
                }
            }
            else
            {
                if ((language == null || smbpath == null) && !File.Exists(iniPath))
                {
                    Console.WriteLine("Usage:");
                    Console.WriteLine(currentExeName + " --language=Korean --smbpath=\"SuperMeatBoy.exe\"");
                    Console.WriteLine("Or create " + currentExeNameNoExt + ".ini.");
                    printLanguages();
                    Environment.Exit(0);
                }
            }

            if (Path.Equals(Path.GetFullPath(currentDir + currentExeName), Path.GetFullPath(smbpath)))
            {
                Console.WriteLine("SMBPath is same as this loader.");
                Console.WriteLine("Halted for prevent infinite loop.");
                Environment.Exit(1);
            }

            if (!File.Exists(smbpath))
            {
                Console.WriteLine("Cannot find Super Meat Boy executable: {0}", smbpath);
                Environment.Exit(1);
            }

            Console.WriteLine("Starting Loader...");

            SuperMeatBoyLanguagePatcher patcher = new SuperMeatBoyLanguagePatcher();
            patcher.Language = language;
            patcher.SuperMeatBoyPath = smbpath;

            Console.WriteLine("Language: {0} (0x{1:X2})", language, patcher.LanguageCode);

            patcher.Launch();

            Environment.Exit(0);
        }