Exemplo n.º 1
0
        static ConstStr()
        {
            EasyMapleConfig config = new EasyMapleConfig();

            if (config.CkTestWord)
            {
                GameName     = "MapleStoryT.exe";
                ngmArgument  = "-dll:platform.nexon.com/NGM/Bin/NGMDll.dll:1 -locale:KR -mode:launch -game:589826:0 -token:'{0}:3' -passarg:'WebStart' -timestamp:{1} -position:'GameWeb|https://maplestory.nexon.game.naver.com/Testworld/Main' -service:6 -architectureplatform:'none'";
                mapleRegPath = new string[] { "SOFTWARE", "Wizet", "MapleT" };
                mapleHome    = "https://maplestory.nexon.game.naver.com/Testworld/Main";
                mapleLogin   = "******";
            }
        }
Exemplo n.º 2
0
        public static async Task <string> StartGame(CookieContainer mapleCookie, EasyMapleConfig mapleConfig)
        {
            HttpHelper httph = new HttpHelper();
            HttpItem   item1 = new HttpItem()
            {
                URL             = ConstStr.mapleStart,
                Method          = "POST",
                Referer         = ConstStr.mapleHome,
                ContentType     = "application/x-www-form-urlencoded",
                CookieContainer = mapleCookie
            };
            var    result = httph.GetHtml(item1);
            string encPwd = Util.GetCookie("MSGENC", mapleCookie);
            var    ret    = await Task.FromResult(encPwd);

            //this.MapleEncPwd = encPwd;
            string protocolUrl = "ngm://launch/%20" + HttpUtility.UrlEncode(string.Format(ConstStr.ngmArgument, encPwd, Util.GetTimeStamp(DateTime.Now.AddHours(1)))).Replace("%27", "'").Replace("+", "%20");

            Util.ProcessStartByCmd($"start {mapleConfig.NgmPath} {protocolUrl} ");
            Util.LogTxt($"NgmPath:{mapleConfig.NgmPath}", mapleConfig.DeveloperMode);
            Util.LogTxt($"EncPwd:{encPwd.Length}", mapleConfig.DeveloperMode);
            return(ret);
        }
Exemplo n.º 3
0
 public MainForm(EasyMapleConfig config)
 {
     InitializeComponent();
     this.MapleConfig = config;
     this.MapleCookie = new CookieContainer();
 }
Exemplo n.º 4
0
 public SettingForm(EasyMapleConfig config)
 {
     InitializeComponent();
     MapleConfig = config;
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            try
            {
                EasyMapleConfig config = new EasyMapleConfig();

                var fileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName.ToLower();
                if (!fileName.Contains("maplestory.exe") && !fileName.Contains("maplestoryt.exe"))
                {
                    MessageBox.Show($"请修改文件名为{ConstStr.GameName}", "NGM限制");
                    return;
                }

                string executePath = System.Windows.Forms.Application.ExecutablePath;
                Application.EnableVisualStyles();

                Util.LogTxt(Util.IsAdminRun() ? "AdminStart" : "Normal", config.DeveloperMode);

                //判断当前登录用户是否为管理员
                if (!Util.IsAdminRun())
                {
                    Util.ProcessStart(executePath, args);
                    Environment.Exit(0);
                    return;
                }

                ResourceManager rm = new ResourceManager(ConstStr.SourcePath, Assembly.GetEntryAssembly());
                foreach (var leDll in ConstStr.LE)
                {
                    var loadPath = $"{Application.StartupPath}\\{leDll}.dll";
                    if (!File.Exists(loadPath))
                    {
                        File.WriteAllBytes(loadPath, (byte[])rm.GetObject($"{leDll}"));
                        FileInfo f = new FileInfo(loadPath);
                        f.Attributes = FileAttributes.Hidden;
                    }
                }

                if (args.Length > 0 && !string.IsNullOrEmpty(config.MaplePath))
                {
                    var arg = string.Empty;
                    arg = args == null
                              ? string.Empty
                              : args.Aggregate(arg, (current, s) => current + $" {s}");
                    Util.LogTxt(arg, config.DeveloperMode);

                    var applicationName = config.MaplePath + ConstStr.GameName;
                    var commandLine     = $"\"{applicationName}\" {arg}";
                    var location        = "ko-KR";
                    var registries      = RegistryEntriesLoader.GetRegistryEntries(false);

                    var currentDirectory = Path.GetDirectoryName(applicationName);
                    var ansiCodePage     = (uint)CultureInfo.GetCultureInfo(location).TextInfo.ANSICodePage;
                    var oemCodePage      = (uint)CultureInfo.GetCultureInfo(location).TextInfo.OEMCodePage;
                    var localeID         = (uint)CultureInfo.GetCultureInfo(location).TextInfo.LCID;
                    var defaultCharset   = (uint)
                                           GetCharsetFromANSICodepage(CultureInfo.GetCultureInfo(location)
                                                                      .TextInfo.ANSICodePage);

                    Util.LogTxt(commandLine, config.DeveloperMode);

                    var l = new LoaderWrapper
                    {
                        ApplicationName   = applicationName,
                        CommandLine       = commandLine,
                        CurrentDirectory  = currentDirectory,
                        AnsiCodePage      = ansiCodePage,
                        OemCodePage       = oemCodePage,
                        LocaleID          = localeID,
                        DefaultCharset    = defaultCharset,
                        HookUILanguageAPI = 0,
                        Timezone          = "Korea Standard Time",
                        NumberOfRegistryRedirectionEntries = registries?.Length ?? 0,
                        DebugMode = false
                    };

                    registries?.ToList()
                    .ForEach(
                        item =>
                        l.AddRegistryRedirectEntry(item.Root,
                                                   item.Key,
                                                   item.Name,
                                                   item.Type,
                                                   item.GetValue(CultureInfo.GetCultureInfo(location))));
                    try
                    {
                        uint ret = l.Start();
                        config.MapleStartStatus = ret == 0 ? 1 : -1;
                        config.Save();
                        Util.LogTxt($"ret:{ret}, not 0, please check the network .", config.DeveloperMode);
                    }
                    catch (Exception ex)
                    {
                        config.MapleStartStatus = 2;
                        config.Save();
                        Util.LogTxt(ex.Message, config.DeveloperMode);
                        Util.LogTxt(ex.StackTrace, config.DeveloperMode);
                    }
                }
                else
                {
                    if (fileName.Contains("maplestoryt.exe"))
                    {
                        config.CkTestWord = true;
                        config.Save();
                        //Process.Start("https://nid.naver.com/nidlogin.login?mode=number&url=https%3A%2F%2Fgame.naver.com%2Flogin.nhn%3FnxtUrl%3Dhttps%253A%252F%252Fmaplestory.nexon.game.naver.com%252FTestworld%252FMain");
                        //return;
                    }

                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new MainForm(config));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }