Esempio n. 1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void Init()
        {
            tree = treePh;
            this.m_lua["this"] = this;
            tabStrip1.MdiForm = this;            

            // 读取策划工具的配置信息
            Helper.ClientPath = IniIO.IniReadValue("General", "RootDir", "./GameDesingerTools.ini");
            string filename = Application.StartupPath + "/GameDesingerTools_Public.ini";
            string content = FileFolderHelper.FileToString(filename);
            SymmetricMethod sm = new SymmetricMethod();
            content = sm.Decrypto(content);
            IniStructure m_inis = new IniStructure();
            m_inis = IniStructure.ReadIniWithContent(content);
            Helper.ConnectionString = m_inis.GetValue("General", "ConnString");

            string configFileName = Path.Combine(Application.StartupPath, "LuaEditor.ini");

            // 读取本机配置信息
            if (File.Exists(configFileName))
            {
                string serverPath = IniIO.IniReadValue("General", "ServerFolder", configFileName);

                if (!string.IsNullOrEmpty(serverPath))
                {
                    Helper.ServerPath = serverPath;
                }

                /* 调试相关的参数暂时不允许自定义
                string receiveMessageDelay = IniIO.IniReadValue("General", "ReceiveMessageDelay", configFileName);
                
                if (!string.IsNullOrEmpty(receiveMessageDelay))
                {
                    Helper.ReceiveMessageDelay = int.Parse(receiveMessageDelay);
                }

                string receiveMessageRetryTime = IniIO.IniReadValue("General", "ReceiveMessageRetryTime", configFileName);

                if (!string.IsNullOrEmpty(receiveMessageRetryTime))
                {
                    Helper.ReceiveMessageRetryTime = int.Parse(receiveMessageRetryTime);
                }

                string breakPointWaitCircle = IniIO.IniReadValue("General", "BreakPointWaitCircle", configFileName);

                if (!string.IsNullOrEmpty(breakPointWaitCircle))
                {
                    Helper.BreakPointWaitCircle = int.Parse(breakPointWaitCircle);
                }
                */ 

                string serverIP = IniIO.IniReadValue("General", "ServerIP", configFileName);

                if (!string.IsNullOrEmpty(serverIP))
                {
                    Helper.ServerIP = serverIP;
                }

                string fontName = IniIO.IniReadValue("General", "ScriptFontName", configFileName);
                string fontSize = IniIO.IniReadValue("General", "ScriptFontSize", configFileName);

                if (!string.IsNullOrEmpty(fontName) && !string.IsNullOrEmpty(fontSize))
                {
                    Helper.ScriptFont = new Font(fontName, float.Parse(fontSize), FontStyle.Regular);
                }

                string fontColor = IniIO.IniReadValue("General", "ScriptForeColor", configFileName);

                if (!string.IsNullOrEmpty(fontColor))
                {
                    Helper.ScriptForeColor = Color.FromName(fontColor);
                }                
            }

            // 读取_setting.cfg
            string strCfgFile = System.IO.Directory.GetCurrentDirectory().TrimEnd(new char[] { '\\' });
            strCfgFile += @"\Plugins\LuaCheck\_setting.cfg";
            Helper.GameLuaEditorSetting = Helper.FileToString(strCfgFile);

            // 如果setting读不到,就取默认setting
            if (Helper.GameLuaEditorSetting == "")
            {
                string strFolder = System.IO.Directory.GetCurrentDirectory().TrimEnd(new char[] { '\\' });
                string strCfg = Helper.FileToString(strFolder + @"\Plugins\LuaCheck\setting.cfg");
                // strCfg = "哈哈,int,123,|是否允许开启,list,false;true,|";
                string[] as_item = strCfg.Split(new string[] { ",", "|" }, StringSplitOptions.None);
                string strUserCfg = "";
                for (int i = 0; i < as_item.Length - 1; i += 4)
                {
                    strUserCfg += as_item[i + 2].Split(new char[] { ';' })[0] + ",";
                }
                Helper.GameLuaEditorSetting = strUserCfg.TrimEnd(new char[]{','});
            }

            // 注册debug相关的按钮
            debugButtonList.Add(bStepInto);
            debugButtonList.Add(bContinueDebug);
            debugButtonList.Add(bRefreshVar);
            debugButtonList.Add(bStepOver);

            // 清理锁
            DataBaseManager dbm = DataBaseManager.GetDataBaseManager();
            dbm.Init(Helper.ConnectionString);
            dbm.ClearRecordLocks();
            Conn = dbm.conn;

            bar4.Items[1].Text = dbm.GetDataBaseName();
            bar4.Items[2].Text = dbm.GetHostName();

            // 生成数据库脚本树
            LoadDataBaseScriptTree();

            // 生成本地脚本树
            LoadLocalScriptTree();

            this.m_lua.RegisterFunction("GetDataTableRow", this, typeof(MainForm).GetMethod("GetDataTableRow"));
            CurrentMainForm = this;

            // 初始化调试计时器
            debugWaitTimer.Tick += new EventHandler(OnTimerExpired);
        }
Esempio n. 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="mainForm">主窗体</param>
 public StringReplaceForm(MainForm mainForm)
 {
     InitializeComponent();
     this.m_parent = mainForm;
 }