Ejemplo n.º 1
0
        private static string CreateData(IniStructure IniData, string comment)
        {       //Iterates through all categories and keys and appends all data to Data
            int CategoryCount = IniData.GetCategories().Length;

            int[]  KeyCountPerCategory = new int[CategoryCount];
            string Data = comment;

            string[] temp = new string[2];          // will contain key-value pair

            for (int i = 0; i < CategoryCount; i++) // Gets keycount per category
            {
                string CategoryName = IniData.GetCategories()[i];
                KeyCountPerCategory[i] = IniData.GetKeys(CategoryName).Length;
            }

            for (int catcounter = 0; catcounter < CategoryCount; catcounter++)
            {
                Data += "\r\n[" + IniData.GetCategoryName(catcounter) + "]\r\n";
                // writes [Category] to Data
                for (int keycounter = 0; keycounter < KeyCountPerCategory[catcounter]; keycounter++)
                {
                    temp[0] = IniData.GetKeyName(catcounter, keycounter);
                    temp[1] = IniData.GetValue(catcounter, keycounter);
                    Data   += temp[0] + "=" + temp[1] + "\r\n";
                    // writes the key-value pair to Data
                }
            }
            return(Data);
        }
Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 3
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();
                }
            }            
        }
Ejemplo n.º 4
0
        private static string CreateData(IniStructure IniData, string comment)
        {	//Iterates through all categories and keys and appends all data to Data
            int CategoryCount = IniData.GetCategories().Length;
            int[] KeyCountPerCategory = new int[CategoryCount];
            string Data = comment;
            string[] temp = new string[2]; // will contain key-value pair

            for (int i = 0; i < CategoryCount; i++) // Gets keycount per category
            {
                string CategoryName = IniData.GetCategories()[i];
                KeyCountPerCategory[i] = IniData.GetKeys(CategoryName).Length;
            }

            for (int catcounter = 0; catcounter < CategoryCount; catcounter++)
            {
                Data += "\r\n[" + IniData.GetCategoryName(catcounter) + "]\r\n";
                // writes [Category] to Data
                for (int keycounter = 0; keycounter < KeyCountPerCategory[catcounter]; keycounter++)
                {
                    temp[0] = IniData.GetKeyName(catcounter, keycounter);
                    temp[1] = IniData.GetValue(catcounter, keycounter);
                    Data += temp[0] + "=" + temp[1] + "\r\n";
                    // writes the key-value pair to Data
                }
            }
            return Data;
        }