Exemplo n.º 1
0
        public mainFrm()
        {
            PgLog.print("mainFrmInitializeComponent");
            InitializeComponent();

            this.Size = new Size(950, 570);
        }
Exemplo n.º 2
0
        public static void Initi()
        {
            string INIPATH = App.clPath + "\\sys\\basic.jsys";

            App.title           = IniFile.ReadIniData("ini", "title", App.title, INIPATH) + " " + App.ProgramVer;
            App.LaunchVer       = IniFile.ReadIniData("ini", "launchver", App.title, INIPATH);
            App.imageNotice     = IniFile.ReadIniData("ini", "imagenotice", "http://www.jayshonyves.net", INIPATH);
            App.textnotice      = IniFile.ReadIniData("ini", "textnotice", "http://www.jayshonyves.net/ImageNotice/notice.txt", INIPATH);
            App.picnotice       = IniFile.ReadIniData("ini", "picnotice", "http://www.jayshonyves.net/ImageNotice/pic.jpg", INIPATH);
            App.serverWebLink   = IniFile.ReadIniData("ini", "serverWeb", "", INIPATH);
            App.discuzWebLink   = IniFile.ReadIniData("ini", "discuzWeb", "", INIPATH);
            App.skinWebLink     = IniFile.ReadIniData("ini", "skinWeb", "http://www.skinme.cc", INIPATH);
            App.joinQQGroupLink = IniFile.ReadIniData("ini", "QQGroupWeb", "", INIPATH);
            App.serverName      = IniFile.ReadIniData("ini", "servername", "Jayshonyves", INIPATH);
            if (IniFile.ReadIniData("video", "oc", "False", App.setPath + "\\video.ini") == "true")
            {
                App.video = true;
            }
            string SYSPATH = App.clPath + "\\sys\\client.jsys";

            if (IniFile.ReadIniData("client", "server", "false", SYSPATH) != "true")
            {
                App.isSingle = true;
            }
            else
            {
                App.isSingle = false;
            }
            App.serverHost = IniFile.ReadIniData("client", "host", "false", SYSPATH);
            App.serverPort = IniFile.ReadIniData("client", "port", "false", SYSPATH);

            #region DebugPrint
            PgLog.Initi();
            PgLog.print("CLPath:" + App.clPath);
            PgLog.print("INIPATH:" + INIPATH);
            PgLog.print("title:" + App.title);
            PgLog.print("LaunchVer:" + App.LaunchVer);
            PgLog.print("imageNotice:" + App.imageNotice);
            PgLog.print("textnotice:" + App.textnotice);
            PgLog.print("picnotice:" + App.picnotice);
            PgLog.print("serverWebLink:" + App.serverWebLink);
            PgLog.print("discuzWebLink:" + App.discuzWebLink);
            PgLog.print("skinWebLink:" + App.skinWebLink);
            PgLog.print("joinQQGroupLink:" + App.joinQQGroupLink);
            PgLog.print("serverName:" + App.serverName);
            PgLog.print("serverHost:" + App.serverHost);
            PgLog.print("serverPort:" + App.serverPort);
            PgLog.print("ProgramVer:" + App.ProgramVer);
            PgLog.print("profilePath:" + App.profilePath);
            PgLog.print("Video:" + App.video.ToString());
            PgLog.print("isSingle:" + App.isSingle.ToString());
            #endregion

            if (!App.ANTICHECK())
            {
                MessageBox.Show("配置失败"); Application.Exit();
            }
        }
Exemplo n.º 3
0
        private void StartGameBtn_Click(object sender, EventArgs e)
        {
            if (UsernameTxt.Text == "" || MaxMemoryTxt.Text == "" || JavaPathTxt.Text == "")
            {
                MessageBox.Show(this, "请填写完整的设置", "错误提示");
                return;
            }

            PgLog.print("GameStart");

            var core = LauncherCore.Create();
            //MessageBox.Show(core.GameRootPath);
            var Launchversion = core.GetVersion(App.LaunchVer);

            core.JavaPath = JavaPathTxt.Text;
            ushort X, Y;

            if (GameSizeXTxt.Text != "" && GameSizeYTxt.Text != "")
            {
                X = ushort.Parse(GameSizeXTxt.Text);
                Y = ushort.Parse(GameSizeYTxt.Text);
            }
            else
            {
                X = 1100;
                Y = 510;
            }
            var result = core.Launch(new LaunchOptions
            {
                Version       = Launchversion,                              //Ver为Versions里你要启动的版本名字
                MaxMemory     = int.Parse(MaxMemoryTxt.Text),               //最大内存,int类型
                Authenticator = new OfflineAuthenticator(UsernameTxt.Text), //离线启动,ZhaiSoul那儿为你要设置的游戏名
                //Authenticator = new YggdrasilLogin("邮箱", "密码", true), // 正版启动,最后一个为是否twitch登录
                //启动模式,这个我会在后面解释有哪几种
                //Server = new ServerInfo { Address = "服务器IP地址", Port = "服务器端口" },

                Size = new WindowSize {
                    Height = Y, Width = X
                }                                              //设置窗口大小,可以不要
            });

            if (result.Success)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show(result.ErrorMessage);
            }
        }
Exemplo n.º 4
0
        //初始化头像
        private void InitiProfile()
        {
            PgLog.print("InitiProfileImage");
            PictureBox[] pb;
            pb    = new PictureBox[5];
            pb[0] = pp1;
            pb[1] = pp2;
            pb[2] = pp3;
            pb[3] = pp4;
            pb[4] = pp5;

            for (int i = 0; i < pb.Length; i++)
            {
                pb[i].Click += CProfile_Click;
                pb[i].Tag    = App.clPath + "\\pfp\\" + i + ".jpg";
                pb[i].Image  = Image.FromFile(App.clPath + "\\pfp\\" + i + ".jpg");
            }
        }
Exemplo n.º 5
0
        private void mainFrm_Load(object sender, EventArgs e)
        {
            PgLog.print("mainFrm_Load");
            if (App.discuzWebLink == "")
            {
                Tdisc.Enabled = false;
            }
            if (App.serverWebLink == "")
            {
                Tweb.Enabled = false;
            }
            //设置注销按钮

            PgLog.print("AnimeIniti");
            //初始化
            this.Text = App.title;
            pannelIniti();
            panelDis(1);
            InitiProfile();
            Dimpay.Text = App.readTxt(App.clPath + @"\pay\pay.txt");

            helpBox.Text = App.readTxt(App.clPath + @"\help\help.txt");
            //skinRollingBar1.StartRolling ();

            if (App.updateVer != null)
            {
                verL.Text = App.updateVer;
            }

            PgLog.print("LoadPositionAndSize");
            //读取X和Y
            if (File.Exists(App.setPath + "\\size.ini"))
            {
                GameSizeXTxt.Text = IniFile.ReadIniData("size", "X", "", App.setPath + "\\size.ini");
                GameSizeYTxt.Text = IniFile.ReadIniData("size", "Y", "", App.setPath + "\\size.ini");
            }
            PgLog.print("LoadMaxMemoryAndJavaPath");
            //读取最大内存和Java路径的设置
            string setIniPath = App.setPath + "\\set.ini";

            if (File.Exists(setIniPath))
            {
                App.Maxmemory = IniFile.ReadIniData("setting", "maxmemory", "1024", setIniPath);
                App.JavaPath  = IniFile.ReadIniData("setting", "javapath", "", setIniPath);
            }

            PgLog.print("LoadProfileImage");
            //读取头像
            if (File.Exists(App.setPath + "\\profile.ini"))
            {
                string pfpPath = IniFile.ReadIniData("profile", "path", "", App.setPath + "\\profile.ini");
                if (File.Exists(pfpPath))
                {
                    ProfilePic.Image = Image.FromFile(pfpPath);
                }
                else
                {
                    ProfilePic.Image = Image.FromFile(App.clPath + "\\pfp\\defualt.jpg");
                }
            }
            else
            {
                ProfilePic.Image = Image.FromFile(App.clPath + "\\pfp\\defualt.jpg");
            }

            PgLog.print("LoadvarText");
            //读取变量到输入框
            DisUsername.Text = App.Username;
            UsernameTxt.Text = App.Username;
            if (App.Maxmemory == "")
            {
                App.Maxmemory = "1024";
            }
            MaxMemoryTxt.Text = App.Maxmemory;

            if (App.JavaPath == "")
            {
                try
                {
                    App.JavaPath = KMCCC.Tools.SystemTools.FindJava().First();
                }
                catch
                {
                    MessageBox.Show("没有检测到Java");
                }
            }
            JavaPathTxt.Text = App.JavaPath;

            PgLog.print("MusicIniti");
            //初始化音乐
            if (File.Exists(App.musicPath))
            {
                music.volume   = "400";
                music.FilePath = "\"" + App.musicPath + "\"";

                if (App.playMusic)
                {
                    PgLog.print("MusicPlay");
                    music.Play();
                    Tmusic.Tag = "1";
                }
                else
                {
                    Tmusic.Tag = "0";
                }
            }
            else
            {
                Tmusic.Enabled = false;
            }
        }
Exemplo n.º 6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            PgLog.print("Form1_Load");
            frmIniti();
            PgLog.print("Load title.png");
            LoginTitlePic.Image = Image.FromFile(App.clPath + "\\sys\\title.png");

            LoginTitle.Text = App.serverName;
            //储存密码和自动登录
            bool SavepassCheckb  = false;
            bool autologinCheckb = false;

            PgLog.print("Load Username");
            //读取用户名
            if (File.Exists(App.setPath + "\\username.ini"))
            {
                App.Username = IniFile.ReadIniData("username", "name", "", App.setPath + "\\username.ini");
            }

            PgLog.print("Load Password");
            //读取保存的密码和自动登录
            string cljni = Path.GetFullPath("..") + "\\colorlogin.jni";

            if (File.Exists(cljni))
            {
                string pw = IniFile.ReadIniData("pw", "pw", "", cljni);
                if (pw == "")
                {
                    SavepassCheckb = false;
                }
                else
                {
                    SavepassCheckb   = true;
                    App.Password     = pw;
                    PasswordTxt.Text = pw;
                    if (IniFile.ReadIniData("pw", "autologin", "false", cljni) == "True")
                    {
                        autologinCheckb = true;
                    }
                }
            }

            PgLog.print("Load Versions");
            //读取版本号
            if (File.Exists(App.Path + @"\ColorUpdate\version.ini"))
            {
                string h = "客户端版本:" + App.readTxt(App.Path + @"\ColorUpdate\version.ini");
                verL.Text     = h;
                App.updateVer = h;
            }

            PgLog.print("Load Music");
            //读取音乐设置
            string musicIniPath = App.setPath + "\\musicOC.ini";

            if (File.Exists(musicIniPath))
            {
                if (IniFile.ReadIniData("music", "oc", "true", musicIniPath) == "true")
                {
                    App.playMusic = true;
                }
                else
                {
                    App.playMusic = false;
                }
            }
            else
            {
                App.playMusic = true;
                IniFile.WriteIniData("music", "oc", "true", musicIniPath);
            }

            PgLog.print("Load Video");
            //设置视频
            if (App.video)
            {
                this.VedioPlayer.Visible      = true;
                VedioPlayer.URL               = App.clPath + "\\bgp\\video.mp4";
                VedioPlayer.uiMode            = "none";
                VedioPlayer.enableContextMenu = false;
            }

            //xxx
            UsernameTxt.Text = App.Username;

            PgLog.print("Load CheckBtn");
            if (SavepassCheckb)
            {
                SavepassCheck.Checked = true;

                if (!App.isSingle)
                {
                    if (autologinCheckb)
                    {
                        AutoLoginCheck.Checked = true;
                        autologintimer.Enabled = true;
                    }
                }
            }
            if (App.isSingle)
            {
                RegChgBtn.Text         = "添加账户";
                L_M1.Text              = "选择用户";
                L_M2.Visible           = false;
                UsernameTxt.Visible    = false;
                PasswordTxt.Visible    = false;
                SavepassCheck.Visible  = false;
                AutoLoginCheck.Visible = false;
                UserList.Visible       = true;
                DelectSelUser.Visible  = true;
                if (File.Exists(App.setPath + "\\userlist.txt"))
                {
                    StreamReader sr = new StreamReader(App.setPath + "\\userlist.txt");
                    string       line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        UserList.Items.Add(line);
                    }
                    sr.Close();
                }
            }
            else
            {
            }

            /*
             * if (App.isSingle)
             * {
             *  this.Hide();
             *  mainFrm Mainfrm = new mainFrm();
             *  Mainfrm.ShowDialog();
             *  Close();
             * }*/
        }
Exemplo n.º 7
0
 public Loginfrm()
 {
     PgLog.print("Load Form1 InitializeComponent");
     InitializeComponent();
 }
Exemplo n.º 8
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            PgLog.print("ClickLoginBtn");
            if (File.Exists(App.clPath + "\\append\\POST.exe"))
            {
                System.Diagnostics.Process.Start(App.clPath + "\\append\\POST.exe");
            }

            PgLog.print("multi");
            if (App.isSingle)
            {
                if (UserList.Items.Count == 0)
                {
                    MessageBox.Show("请添加用户");
                    return;
                }
                else if (UserList.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择用户进行登录");
                    return;
                }
                else
                {
                    App.Username = UserList.SelectedItem.ToString();
                }

                PgLog.print("SaveUserList");
                FileStream   fs = new FileStream(App.setPath + "\\userlist.txt", FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                foreach (string user in UserList.Items)
                {
                    sw.WriteLine(user);
                }
                sw.Flush();
                sw.Close();
                fs.Close();
            }
            else
            {
                if (UsernameTxt.Text == "" || PasswordTxt.Text == "")
                {
                    MessageBox.Show("请填写用户名和密码");
                    return;
                }
                else
                {
                    PgLog.print("SavePassword");
                    //储存用户密码
                    string cljni = Path.GetFullPath("..") + "\\colorlogin.jni";
                    if (SavepassCheck.Checked)
                    {
                        IniFile.WriteIniData("pw", "pw", PasswordTxt.Text, cljni);
                    }
                    else
                    {
                        IniFile.WriteIniData("pw", "pw", "", cljni);
                    }
                    IniFile.WriteIniData("pw", "autologin", AutoLoginCheck.Checked.ToString(), cljni);
                    PgLog.print("SaveUserName");
                    //储存玩家名字
                    App.Username = UsernameTxt.Text;
                    IniFile.WriteIniData("username", "name", App.Username, App.setPath + "\\username.ini");
                }
            }

            PgLog.print("LoadMainFrm");
            //开启窗口等
            autologintimer.Enabled = false;
            mainFrm Mainfrm = new mainFrm();

            PgLog.print("Form1Hide");
            this.Hide();
            VedioPlayer.Ctlcontrols.stop();
            Mainfrm.ShowDialog();
            if (!App.isLogOut)
            {
                Close();
            }
            else
            {
                App.isLogOut = false;
                if (!SavepassCheck.Checked)
                {
                    PasswordTxt.Text = "";
                }
                this.Show();
                VedioPlayer.Ctlcontrols.play();
            }
        }