Beispiel #1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void Init()
        {
            string   connectString = "Server = 10.20.86.11; DataBase = s3design_rtm; Uid = s3design; Password = davidbowie;"; // 默认连接字符串
            string   filename      = Path.Combine(Application.StartupPath, "GameDesingerTools_Public.ini");
            FileInfo fi            = new FileInfo(filename);

            if (fi.Exists)
            {
                string       content = FileFolderHelper.FileToString(filename);
                IniStructure m_inis  = new IniStructure();
                m_inis        = IniStructure.ReadIniWithContent(content);
                connectString = m_inis.GetValue("General", "ConnString");
            }
            else
            {
                filename = Path.Combine(Application.StartupPath, "GameDesingerTools_Public.ini");
                fi       = new FileInfo(filename);
                if (fi.Exists) // 读取AutoExport.ini文件
                {
                    string          content = FileFolderHelper.FileToString(filename);
                    SymmetricMethod sm      = new SymmetricMethod();
                    content = sm.Decrypto(content);

                    IniStructure m_inis = new IniStructure();
                    m_inis        = IniStructure.ReadIniWithContent(content);
                    connectString = m_inis.GetValue("General", "ConnString");
                }
            }

            conn = new SqlConnection(connectString);

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                string sqlString = "SELECT * FROM AI_Enum_Define";
                enumTable      = GetDataTable(sqlString);
                sqlString      = "SELECT * FROM AI_TemplateParamTable";
                parameterTable = GetDataTable(sqlString);
                sqlString      = "SELECT ID, FullPath FROM changan.s3diagram_rtm.dbo.diagram WHERE Class = 'AI图'";
                diagramTable   = GetDataTable(sqlString);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("在读取数据表信息时产生sql异常:" + ex.ToString());
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void Init()
        {
            string connectString = "Server = 10.20.86.11; DataBase = s3design_rtm; Uid = s3design; Password = davidbowie;"; // 默认连接字符串           
            string filename = Path.Combine(Application.StartupPath, "GameDesingerTools_Public.ini");
            FileInfo fi = new FileInfo(filename);

            if (fi.Exists)
            {
                string content = FileFolderHelper.FileToString(filename);
                IniStructure m_inis = new IniStructure();
                m_inis = IniStructure.ReadIniWithContent(content);
                connectString = m_inis.GetValue("General", "ConnString");
            }
            else
            {
                filename = Path.Combine(Application.StartupPath, "GameDesingerTools_Public.ini");
                fi = new FileInfo(filename);
                if (fi.Exists) // 读取AutoExport.ini文件
                {
                    string content = FileFolderHelper.FileToString(filename);
                    SymmetricMethod sm = new SymmetricMethod();
                    content = sm.Decrypto(content);

                    IniStructure m_inis = new IniStructure();
                    m_inis = IniStructure.ReadIniWithContent(content);
                    connectString = m_inis.GetValue("General", "ConnString"); 
                }
            }

            conn = new SqlConnection(connectString);

            try
            {
                if(conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                string sqlString = "SELECT * FROM AI_Enum_Define";
                enumTable = GetDataTable(sqlString);
                sqlString = "SELECT * FROM AI_TemplateParamTable";
                parameterTable = GetDataTable(sqlString);
                sqlString = "SELECT ID, FullPath FROM changan.s3diagram_rtm.dbo.diagram WHERE Class = 'AI图'";
                diagramTable = GetDataTable(sqlString);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("在读取数据表信息时产生sql异常:" + ex.ToString());
            }
            finally
            {
                if(conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }            
        }