Пример #1
0
        private void DownloadGame(MProfile profile, bool downloadResource = true)
        {
            MDownloader downloader = new MDownloader(profile);

            downloader.ChangeFile += Downloader_ChangeFile;
            downloader.DownloadAll(downloadResource);
        }
Пример #2
0
        private void StartGame()
        {
            var local = MProfileInfo.GetProfilesFromLocal();

            MProfileInfo[] versions = MProfileInfo.GetProfiles();
            MProfile       profile  = MProfile.GetProfile(versions, "1.12.2-forge1.12.2-14.23.5.2847");
            MLaunchOption  option   = new MLaunchOption()
            {
                StartProfile        = profile,
                JavaPath            = GADD_Application.Properties.Settings.Default.mclocation + "\\runtime\\bin\\javaw.exe",
                MaximumRamMb        = GADD_Application.Properties.Settings.Default.ram,
                LauncherName        = "GADD",
                Session             = session,
                CustomJavaParameter = Properties.Settings.Default.javargs
            };
            MLaunch launch = new MLaunch(option);
            var     proc   = launch.GetProcess();

            //proc.Start();
            //launch.GetProcess().Start();
            StartDebug(proc);
            //Console.ProcessLock(launch);
            Invoke((MethodInvoker) delegate
            {
                GaddPage.GP.ButtonStat(true);
            });
        }
        public string Save(bool createNew)
        {
            MProfile profile;

            try
            {
                HttpCookie aCookie = Request.Cookies["profile"];
                if (aCookie != null)
                {
                    string profile2 = HttpUtility.UrlDecode(aCookie.Value);
                    profile = Newtonsoft.Json.JsonConvert.DeserializeObject <MProfile>(profile2);
                }
                else
                {
                    profile = new MProfile();
                }

                string response = marriagesDB.SaveProfile(profile, createNew);

                if (createNew)
                {
                    //Mailer.SendMail("Created profile " + profile.ProfileID, "Created Successfully");
                    return("Saved pofile with ID " + response);
                }
                else
                {
                    //Mailer.SendMail("Updated profile " + profile.ProfileID, "Updated Successfully");
                    return("Updated profile " + profile.ProfileID);
                }
            }
            catch (Exception ex)
            {
                return("Error:" + ex.Message);
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            MLogin   login   = new MLogin();
            MSession session = MSession.GetOfflineSession(textBox1.Text);

            session = login.TryAutoLogin();
            Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\"));
            MProfileInfo[] infos   = MProfileInfo.GetProfiles();
            MProfile       profile = MProfile.FindProfile(infos, comboBox1.SelectedItem.ToString());

            DownloadGame(profile);

            var option = new MLaunchOption()
            {
                // must require
                StartProfile = profile,
                JavaPath     = "java.exe", //JAVA PAT
                MaximumRamMb = 4096,       // MB
                Session      = MSession.GetOfflineSession(textBox1.Text),

                // not require
                LauncherName        = "SkyLauncher",
                CustomJavaParameter = "" // java args
            };

            MLaunch launch = new MLaunch(option);

            launch.GetProcess().Start();
        }
Пример #5
0
        public ActionResult GetPerfil(int id)
        {
            List <PerfilViewModel> lstModel      = new List <PerfilViewModel>();
            List <MProfile>        lstResult     = null;
            UserIdentity           objUserIdenty = AutenticationManager.GetUser();


            MProfile entPerfiles = new MProfile();

            entPerfiles.UserId = Convert.ToInt32(AutenticationManager.GetUser().IdUsuario);

            lstResult = new WebApiProfile().GetProfilesByUser(entPerfiles);

            foreach (var item in lstResult)
            {
                lstModel.Add(new PerfilViewModel {
                    Perfil = item.Description, Id = item.ProfileId.ToString()
                });
            }
            ;


            if ((objUserIdenty.IdEmpresa != id || objUserIdenty.IdPerfil == 0) && lstModel.Count > 0)
            {
                objUserIdenty.IdPerfil = Convert.ToInt32(lstModel.FirstOrDefault().Id);
            }

            // Guardo la empresa
            objUserIdenty.IdEmpresa = id;

            AutenticationManager.SaveLogin(objUserIdenty);
            return(PartialView("_Perfil", lstModel));
        }
Пример #6
0
        public static int Insert(MProfile ent, ref int ProfileId)
        {
            using (SqlConnection con = new SqlConnection(ConnectionDB.GetConnectionString()))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("sp_Profile_ins", con);
                    cmd.CommandTimeout = 0;
                    cmd.Parameters.Add("@IDescription", SqlDbType.VarChar).Value = ent.Description;
                    cmd.Parameters.Add("@OProfileId", SqlDbType.Int).Direction   = ParameterDirection.Output;
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    ProfileId = Convert.ToInt32(cmd.Parameters["@OProfileId"].Value);
                    con.Close();

                    return(0);
                }

                catch (Exception ex)
                {
                    return(2);
                }
            }
        }
Пример #7
0
        private void Btn_Launch_Click(object sender, EventArgs e)
        {
            // Launch

            if (session == null)
            {
                MessageBox.Show("Login First");
                return;
            }

            if (Cb_Version.Text == "")
            {
                return;
            }
            groupBox1.Enabled = false;
            groupBox2.Enabled = false;

            string startVersion = Cb_Version.Text;
            string javaPath     = Txt_Java.Text;
            string xmx          = Txt_Ram.Text;
            string launcherName = Txt_LauncherName.Text;
            string serverIp     = Txt_ServerIp.Text;

            var th = new Thread(new ThreadStart(delegate
            {
                var profile = MProfile.FindProfile(versions, startVersion); // Find Profile

                DownloadGame(profile);                                      // Download game files

                MLaunchOption option = new MLaunchOption()                  // Set options
                {
                    StartProfile        = profile,
                    JavaPath            = javaPath,
                    LauncherName        = launcherName,
                    MaximumRamMb        = int.Parse(xmx),
                    ServerIp            = serverIp,
                    Session             = session,
                    CustomJavaParameter = Txt_JavaArgs.Text
                };

                if (Txt_ScWd.Text != "" && Txt_ScHt.Text != "")
                {
                    option.ScreenHeight = int.Parse(Txt_ScHt.Text);
                    option.ScreenWidth  = int.Parse(Txt_ScWd.Text);
                }

                MLaunch launch = new MLaunch(option); // Start Process
                var process    = launch.GetProcess();

                DebugProcess(process);

                this.Invoke((MethodInvoker) delegate
                {
                    groupBox1.Enabled = true;
                    groupBox2.Enabled = true;
                });
            }));

            th.Start();
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            MLogin   login   = new MLogin();
            MSession session = MSession.GetOfflineSession(textBox1.Text);

            session = login.TryAutoLogin();
            Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\"));
            MProfileInfo[] infos   = MProfileInfo.GetProfiles();
            MProfile       profile = MProfile.FindProfile(infos, "1.12.2");

            DownloadGame(profile);

            var option = new MLaunchOption()
            {
                // must require
                StartProfile = profile,
                JavaPath     = "java.exe", //SET YOUR JAVA PATH (if you want autoset, goto wiki)
                MaximumRamMb = 4096,       // MB
                Session      = MSession.GetOfflineSession(textBox1.Text),

                // not require
                LauncherName        = "McLauncher", // display launcher name at main window
                CustomJavaParameter = ""            // set your own java args
            };

            MLaunch launch = new MLaunch(option);

            launch.GetProcess().Start();
        }
Пример #9
0
        protected override int Execute()
        {
            Hashtable args    = GetArguments();
            string    prof    = args["profile"].ToString();
            string    outpath = args["outpath"].ToString();

            QRProfileBase prf = (QRProfileBase)BarcodeProfileFactory.CreateBarcodeProfileObject(prof);

            MProfile p = new MProfile();

            p.Message1       = prf.Message1;
            p.Message2       = prf.Message2;
            p.CompanyWebSite = prf.CompanyWebSite;
            string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            string fileName  = string.Format("{0}/{1}_{2}.png", outpath, prof, timeStamp);

            generator.TemplateFile = prf.TemplateFile;
            generator.Setup();
            generator.RenderToFile(p, fileName);
            generator.Cleanup();

            Console.WriteLine("Done generating barcode at [{0}].", fileName);

            return(0);
        }
Пример #10
0
        public MProfile GetProfile(MProfile MProfile)
        {
            MProfile        profile  = new MProfile();
            ProfileRequest  request  = new ProfileRequest();
            ProfileResponse response = new ProfileResponse();

            request.Profile          = MProfile;
            request.ApplicationToken = ConfigurationManager.AppSettings["ApplicationToken"].ToString();

            string bodyrequest  = JsonConvert.SerializeObject(request);
            string statuscode   = string.Empty;
            string bodyresponse = new Helper().InvokeApi("security/api/Profile", "GetProfile", bodyrequest, ref statuscode);

            if (statuscode.Equals("OK"))
            {
                response = JsonConvert.DeserializeObject <ProfileResponse>(bodyresponse);

                if (response.Code.Equals("0"))
                {
                    profile         = response.Profile;
                    profile.Options = response.Options;
                }
            }

            return(profile);
        }
Пример #11
0
        public static int Update(MProfile ent)
        {
            using (SqlConnection con = new SqlConnection(ConnectionDB.GetConnectionString()))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("sp_Profile_Upd", con);
                    cmd.CommandTimeout = 0;
                    cmd.Parameters.Add("@IDescription", SqlDbType.VarChar).Value = ent.Description;
                    cmd.Parameters.Add("@IProfileId", SqlDbType.Int).Value       = ent.ProfileId;
                    cmd.Parameters.Add("@IStatus", SqlDbType.Int).Value          = ent.Status;
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();

                    return(0);
                }

                catch (Exception ex)
                {
                    return(2);
                }
            }
        }
        public ActionResult Details(string profileID)
        {
            ViewBag.IsAdmin = isAdmin(Request);
            MProfile profile = marriagesDB.GetProfile(profileID);

            return(View(profile));
        }
        public ActionResult New()
        {
            MProfile profile = new MProfile();

            //profile.DateOfBirth = DateTime.Today.Date;
            return(View(profile));
        }
Пример #14
0
        public static int Delete(MProfile ent, ref int Val)
        {
            using (SqlConnection con = new SqlConnection(ConnectionDB.GetConnectionString()))
            {
                try
                {
                    Val = 1;

                    SqlCommand cmd = new SqlCommand("sp_Profile_Del", con);
                    cmd.CommandTimeout = 0;
                    cmd.Parameters.Add("@IProfileId", SqlDbType.Int).Value = ent.ProfileId;
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();

                    Val = 0;

                    return(ent.UserId);
                }

                catch (Exception ex)
                {
                    Val = 2;

                    return(0);
                }
            }
        }
Пример #15
0
        public string InsertProfile(MProfile MProfile)
        {
            ProfileRequest  request  = new ProfileRequest();
            ProfileResponse response = new ProfileResponse();

            string returnMsg = string.Empty;

            request.Profile          = MProfile;
            request.Options          = MProfile.Options;
            request.ApplicationToken = ConfigurationManager.AppSettings["ApplicationToken"].ToString();

            string bodyrequest  = JsonConvert.SerializeObject(request);
            string statuscode   = string.Empty;
            string bodyresponse = new Helper().InvokeApi("security/api/Profile", "InsertProfile", bodyrequest, ref statuscode);

            if (statuscode.Equals("OK"))
            {
                response  = JsonConvert.DeserializeObject <ProfileResponse>(bodyresponse);
                returnMsg = response.Code + "|" + response.Message;
            }
            else
            {
                returnMsg = "2" + "|" + "Error invoking User api";
            }

            return(returnMsg);
        }
Пример #16
0
        private void ThreadRunGame(string ramAmount)
        {
            runMinecraft runMinecraft       = new runMinecraft();
            MSession     sessionUtilisateur = formMain.SessionUtilisateur;
            MProfile     profileUtilisateur = formMain.ProfileUtilisateur;

            runMinecraft.Run(profileUtilisateur, sessionUtilisateur, ramAmount);
        }
Пример #17
0
        private void DownloadGame(MProfile profile) // download game files
        {
            MDownloader downloader = new MDownloader(profile);

            downloader.ChangeFile     += Downloader_ChangeFile;
            downloader.ChangeProgress += Downloader_ChangeProgress;
            downloader.DownloadAll();
        }
Пример #18
0
        private void DownloadGame(MProfile profile)
        {
            MDownloader downloader = new MDownloader(profile);

            downloader.ChangeFile     += formMain.Downloader_ChangeFile;
            downloader.ChangeProgress += formMain.Downloader_ChangeProgress;
            downloader.DownloadAll();
        }
        public MDownloader(MProfile _profile)
        {
            this.profile   = _profile;
            this.Minecraft = _profile.Minecraft;

            web = new WebDownload();
            web.DownloadProgressChangedEvent += Web_DownloadProgressChangedEvent;
        }
Пример #20
0
        public void CheckGameFiles(MProfile profile, bool downloadAsset = true)
        {
            var downloader = new MDownloader(profile);

            downloader.ChangeFile     += (e) => fire(e);
            downloader.ChangeProgress += (sender, e) => fire(e.ProgressPercentage);
            downloader.DownloadAll(downloadAsset);
        }
Пример #21
0
        private string ExtractNatives(MProfile profile)
        {
            var    ran    = new Random();
            int    random = ran.Next(10000, 99999);
            string path   = Path.Combine(profile.Minecraft.Versions, profile.Id, "natives-" + random.ToString());

            ExtractNatives(profile, path);
            return(path);
        }
Пример #22
0
 private void ClearProfileInfo()
 {
     _historyPlayListId    = null;
     _uploadPlayListId     = null;
     _watchLaterPlayListId = null;
     _likedPlayListId      = null;
     _favoritesPlaylistId  = null;
     _profileInfo          = null;
 }
Пример #23
0
        public MProfile GetProfile()
        {
            Minecraft.Initialize(Directory.GetCurrentDirectory() + @"\Minecraft\.minecraft");

            MProfileInfo[] versions = MProfileInfo.GetProfiles();
            MProfile       profile  = MProfile.FindProfile(versions, MINECRAFT_VERSION);

            return(profile);
        }
Пример #24
0
        public MProfile GetProfile(string versionname)
        {
            if (ProfileInfos == null || ProfileInfos.Length == 0)
            {
                UpdateProfileInfos();
            }

            return(MProfile.FindProfile(Minecraft, ProfileInfos, versionname));
        }
Пример #25
0
        public override MemoryStream RenderToStream(BaseModel data)
        {
            MProfile bc = (MProfile)data;

            string tmpFile = string.Format("{0}.png", RandomUtils.RandomStringNum(10));
            string qrFile  = CreateQR(tmpFile, bc.CompanyWebSite);
            var    ms      = ParseTemplate(htmlConverter, templateLines, bc, qrFile);

            return(ms);
        }
Пример #26
0
        private void Checkprofile()
        {
            LoginMojang loginMojang        = new LoginMojang();
            MProfile    profileUtilisateur = loginMojang.GetProfile();

            DownloadGame(profileUtilisateur);

            formMain.PannelLaunch(true);
            formMain.ProfileUtilisateur = profileUtilisateur;
        }
Пример #27
0
        public void Run(MProfile profile, MSession session, string ram)
        {
            int ramNumber = Checkram(ram);

            string javapath = Directory.GetCurrentDirectory() + @"\Minecraft\runtime\jre-x64\bin\javaw.exe";

            MLaunchOption option = LaunchOption(profile, session, ramNumber, javapath);

            MLaunch launch = new MLaunch(option);

            launch.GetProcess().Start();
        }
Пример #28
0
        public ProfileResponse InsertProfile([FromBody] ProfileRequest request)
        {
            ProfileResponse        response = new ProfileResponse();
            MProfile               profile  = new MProfile();
            List <MProfileOptions> options  = new List <MProfileOptions>();

            try
            {
                /*METODO QUE VALIDA EL TOKEN DE APLICACIÓN*/
                if (!BAplication.ValidateAplicationToken(request.ApplicationToken))
                {
                    response.Code    = "2";
                    response.Message = Messages.ApplicationTokenNoAutorize;
                    return(response);
                }
                /*************FIN DEL METODO*************/

                BaseRequest baseRequest = new BaseRequest();

                profile.Description = request.Profile.Description;

                foreach (MProfileOptions item in request.Options)
                {
                    options.Add(item);
                }

                int ProfileId = 0;
                int Val       = BProfile.Insert(profile, options, ref ProfileId);

                profile.ProfileId = ProfileId;

                if (Val.Equals(0))
                {
                    response.Code    = "0"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                    response.Message = Messages.Success;
                }
                else if (Val.Equals(2))
                {
                    response.Code    = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                    response.Message = String.Format(Messages.ErrorInsert, "Profile");
                }
            }
            catch (Exception ex)
            {
                response.Code    = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                response.Message = ex.Message;
            }

            response.Profile = profile;

            return(response);
        }
Пример #29
0
        public ProfilesResponse GetProfilesByUser([FromBody] ProfileRequest request)
        {
            ProfilesResponse response    = new ProfilesResponse();
            MProfile         profile     = new MProfile();
            List <MProfile>  profiles    = new List <MProfile>();
            BaseRequest      baseRequest = new BaseRequest();

            try
            {
                /*METODO QUE VALIDA EL TOKEN DE APLICACIÓN*/
                if (!BAplication.ValidateAplicationToken(request.ApplicationToken))
                {
                    response.Code    = "2";
                    response.Message = Messages.ApplicationTokenNoAutorize;
                    return(response);
                }
                /*************FIN DEL METODO*************/

                profile.UserId = request.Profile.UserId;

                int Val = 0;

                profiles = BProfile.LisByUser(profile, ref Val);

                if (Val.Equals(0))
                {
                    response.Code    = "0"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                    response.Message = Messages.Success;
                }
                else if (Val.Equals(2))
                {
                    response.Code    = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                    response.Message = String.Format(Messages.ErrorObtainingReults, "Profiles");
                }
                else
                {
                    response.Code    = "1"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                    response.Message = String.Format(Messages.NotReults, "Profiles");
                }
            }
            catch (Exception ex)
            {
                response.Code    = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción
                response.Message = ex.Message;
            }

            response.Profiles = profiles.ToArray();

            return(response);
        }
Пример #30
0
        public static int Insert(MProfile ent, List <MProfileOptions> entOpcs, ref int ProfileId)
        {
            int result = DAProfile.Insert(ent, ref ProfileId);

            if (result.Equals(0))
            {
                foreach (MProfileOptions opc in entOpcs)
                {
                    opc.ProfileId = ProfileId;
                    result        = DAProfile.InsertOptions(opc);
                }
            }

            return(result);
        }