Ejemplo n.º 1
0
        private static void exportSetThread(object obj)
        {
            string[] args = (string[])obj;
            if (args == null || args.Length < 3)
            {
                System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
                return;
            }
            string mse_path = args[0];
            string setfile  = args[1];
            string path     = args[2];

            if (mse_path == null || mse_path.Length == 0 || setfile == null || setfile.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
                return;
            }
            else
            {
                string cmd = " --export " + setfile.Replace("\\\\", "\\").Replace("\\", "/") + " {card.gamecode}.png";
                System.Diagnostics.Process ie = new   System.Diagnostics.Process();
                ie.StartInfo.FileName         = mse_path;
                ie.StartInfo.Arguments        = cmd;
                ie.StartInfo.WorkingDirectory = path;
                MyPath.CreateDir(path);
                try{
                    ie.Start();
                    //等待结束,需要把当前方法放到线程里面
                    ie.WaitForExit();
                    ie.Close();
                    System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImages));
                }catch {
                }
            }
        }
Ejemplo n.º 2
0
        private static void exportSetThread(object obj)
        {
            string[] args = (string[])obj;
            if (args == null || args.Length < 3)
            {
                MessageBox.Show(LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
                return;
            }
            string mse_path = args[0];
            string setfile  = args[1];
            string path     = args[2];

            if (string.IsNullOrEmpty(mse_path) || string.IsNullOrEmpty(setfile))
            {
                MessageBox.Show(LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
                return;
            }
            else
            {
                string cmd = " --export " + setfile.Replace("\\\\", "\\").Replace("\\", "/") + " {card.gamecode}.png";
                _mseProcess = new System.Diagnostics.Process();
                _mseProcess.StartInfo.FileName         = mse_path;
                _mseProcess.StartInfo.Arguments        = cmd;
                _mseProcess.StartInfo.WorkingDirectory = path;
                _mseProcess.EnableRaisingEvents        = true;
                MyPath.CreateDir(path);
                try
                {
                    _mseProcess.Start();
                    //等待结束,需要把当前方法放到线程里面
                    _mseProcess.WaitForExit();
                    _mseProcess.Exited += new EventHandler(_exitHandler);
                    _mseProcess.Close();
                    _mseProcess = null;
                    MessageBox.Show(LanguageHelper.GetMsg(LMSG.exportMseImages));
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 3
0
        public void SetConfig(string config, string path)
        {
            if (!File.Exists(config))
            {
                return;
            }
            regx_monster  = "(\\s\\S*?)";
            regx_pendulum = "(\\s\\S*?)";
            //设置文件名
            configName = MyPath.getFullFileName(MSEConfig.TAG, config);

            replaces = new SortedList <string, string>();

            typeDic = new SortedList <long, string>();
            raceDic = new SortedList <long, string>();
            string[] lines = File.ReadAllLines(config, Encoding.UTF8);
            foreach (string line in lines)
            {
                if (string.IsNullOrEmpty(line) || line.StartsWith("#"))
                {
                    continue;
                }
                if (line.StartsWith(TAG_CN2TW))
                {
                    Iscn2tw = ConfHelper.getBooleanValue(line);
                }
                else if (line.StartsWith(TAG_SPELL))
                {
                    str_spell = ConfHelper.getValue(line);
                }
                else if (line.StartsWith(TAG_HEAD))
                {
                    head = ConfHelper.getMultLineValue(line);
                }
                else if (line.StartsWith(TAG_END))
                {
                    end = ConfHelper.getMultLineValue(line);
                }
                else if (line.StartsWith(TAG_TEXT))
                {
                    temp_text = ConfHelper.getMultLineValue(line);
                }
                else if (line.StartsWith(TAG_TRAP))
                {
                    str_trap = ConfHelper.getValue(line);
                }
                else if (line.StartsWith(TAG_REG_PENDULUM))
                {
                    regx_pendulum = ConfHelper.getValue(line);
                }
                else if (line.StartsWith(TAG_REG_MONSTER))
                {
                    regx_monster = ConfHelper.getValue(line);
                }
                else if (line.StartsWith(TAG_MAXCOUNT))
                {
                    maxcount = ConfHelper.getIntegerValue(line, 0);
                }
                else if (line.StartsWith(TAG_WIDTH))
                {
                    width = ConfHelper.getIntegerValue(line, 0);
                }
                else if (line.StartsWith(TAG_HEIGHT))
                {
                    height = ConfHelper.getIntegerValue(line, 0);
                }
                else if (line.StartsWith(TAG_PEND_WIDTH))
                {
                    pwidth = ConfHelper.getIntegerValue(line, 0);
                }
                else if (line.StartsWith(TAG_PEND_HEIGHT))
                {
                    pheight = ConfHelper.getIntegerValue(line, 0);
                }
                else if (line.StartsWith(TAG_NO_TEN))
                {
                    no10 = ConfHelper.getBooleanValue(line);
                }
                else if (line.StartsWith(TAG_NO_START_CARDS))
                {
                    string   val = ConfHelper.getValue(line);
                    string[] cs  = val.Split(',');
                    noStartCards = new long[cs.Length];
                    int i = 0;
                    foreach (string str in cs)
                    {
                        long l = 0;
                        long.TryParse(str, out l);
                        noStartCards[i++] = l;
                    }
                }
                else if (line.StartsWith(TAG_IMAGE))
                {
                    //如果路径不合法,则为后面的路径
                    imagepath = MyPath.CheckDir(ConfHelper.getValue(line), MyPath.Combine(path, PATH_IMAGE));
                    //图片缓存目录
                    imagecache = MyPath.Combine(imagepath, "cache");
                    MyPath.CreateDir(imagecache);
                }
                else if (line.StartsWith(TAG_REPALCE))
                {                //特数字替换
                    string word = ConfHelper.getValue(line);
                    string p    = ConfHelper.getRegex(ConfHelper.getValue1(word));
                    string r    = ConfHelper.getRegex(ConfHelper.getValue2(word));
                    if (!string.IsNullOrEmpty(p))
                    {
                        replaces.Add(p, r);
                    }
                }
                else if (line.StartsWith(TAG_RACE))
                {                //种族
                    ConfHelper.DicAdd(raceDic, line);
                }
                else if (line.StartsWith(TAG_TYPE))
                {                //类型
                    ConfHelper.DicAdd(typeDic, line);
                }
                else if (line.StartsWith(TAG_REIMAGE))
                {
                    reimage = ConfHelper.getBooleanValue(line);
                }
            }
        }