示例#1
0
        private bool exists(string fullPath)
        {
            string  fileName = Path.GetFileName(fullPath);
            string  filePath = Path.GetDirectoryName(fullPath);
            Boolean test     = false;

            using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "SELECT id from Headers WHERE [fileName]=@fileName AND [filePath]=@filePath";
                    cmd.Parameters.AddWithValue("@fileName", fileName);
                    cmd.Parameters.AddWithValue("@filePath", filePath);
                    SqlDataReader results = cmd.ExecuteReader();

                    if (results.HasRows)
                    {
                        test = true;
                    }
                }
            }
            return(test);
        }
示例#2
0
 internal void stringTableSave(int id)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "INSERT into StringTables values('" + id + "','" + str + "')";
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#3
0
 internal void stringTableSave(int id, string name)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into StringTables ([header_id],[fileName],[string]) values(@headerID,@fileName,@str)";
             cmd.Parameters.AddWithValue("@headerID", id);
             cmd.Parameters.AddWithValue("@fileName", name);
             cmd.Parameters.AddWithValue("@str", str);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#4
0
 internal void archive2Save(int id, string fileName)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into Archives2 ([Header_id],[fileName],[u1],[dataSize]) values(@id,@fileName,@u1,@dataSize)";
             cmd.Parameters.AddWithValue("@id", id);
             cmd.Parameters.AddWithValue("@fileName", fileName);
             cmd.Parameters.AddWithValue("@u1", (int)u1);
             cmd.Parameters.AddWithValue("@dataSize", (int)dataSize);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#5
0
 internal void unknownSave(int id, string fileName)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into Unknowns ([Header_id],[fileName],[u1],[u2],[u3]) values(@id,@fileName,@u1,@u2,@u3)";
             cmd.Parameters.AddWithValue("@id", id);
             cmd.Parameters.AddWithValue("@fileName", fileName);
             cmd.Parameters.AddWithValue("@u1", (int)u1);
             cmd.Parameters.AddWithValue("@u2", (int)u2);
             cmd.Parameters.AddWithValue("@u3", (int)u3);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#6
0
 internal void setHeaderID()
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "SELECT id from Headers WHERE fileName='" + fileName + "' AND filePath='" + directory + "'";
             using (SqlDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     headerID = reader.GetInt32(0);
                 }
             }
         }
     }
 }
示例#7
0
 internal void fileSave(int id, string fileName)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into Files ([Header_id],[fileName],[name],[offset],[hash],[u1],[type]) values(@id,@fileName,@name,@offset,@hash,@u1,@type)";
             cmd.Parameters.AddWithValue("@id", id);
             cmd.Parameters.AddWithValue("@fileName", fileName);
             cmd.Parameters.AddWithValue("@name", name);
             cmd.Parameters.AddWithValue("@offset", (int)offset);
             cmd.Parameters.AddWithValue("@hash", (int)hash);
             cmd.Parameters.AddWithValue("@u1", (int)u1);
             cmd.Parameters.AddWithValue("@type", (int)type);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#8
0
        internal void save(string fullPath)
        {
            fileName  = Path.GetFileName(fullPath);
            directory = fullPath.Substring(0, fullPath.LastIndexOf('\\'));

            using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "INSERT into Headers (fileName,filePath,fileFormat,gameFlag,version,u1,u2,u3,stringTableSize,u4,otherCount,dirCount,typeCount,filecount,fileCount2," +
                                      "partCount,archiveCount,u5,u6,u7,u8,unknownCount,u9,u10,u11,archNamesLength,fileCount3,typeNamesLength,u12,u13,u14,u15,u16,u17,u18,u19,u20,u21,u22,u23,u24) " +
                                      "values('" + fileName + "','" + directory + "','" + fileFormatStr + "','" + gameFlag + "','" + version + "','" + unknown1 + "','" + unknown2 + "','" + unknown3 + "','" +
                                      stringTableSize + "','" + unknown4 + "','" + otherCount + "','" + dirCount + "','" + typeCount + "','" + fileCount + "','" + fileCount2 + "','" + partCount + "','" + archiveCount + "','" + unknown5 +
                                      "','" + unknown6 + "','" + unknown7 + "','" + unknown8 + "','" + unknownCount + "','" + unknown9 + "','" + unknown10 + "','" + unknown11 + "','" + archNamesLength + "','" + fileCount3 + "','" +
                                      typeNamesLength + "','" + unknown12 + "','" + unknown13 + "','" + unknown14 + "','" + unknown15 + "','" + unknown16 + "','" + unknown17 + "','" + unknown18 + "','" + unknown19 + "','" + unknown20 +
                                      "','" + unknown21 + "','" + unknown22 + "','" + unknown23 + "','" + unknown24 + "')";
                    cmd.ExecuteNonQuery();
                }
            }
        }
示例#9
0
 internal void dirSave(int id, string fileName)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into Directories ([Header_id],[fileName],[name],[offset],[u1],[hash],[u2],[prevDirFileCount],[fileCount]) values(@id,@fileName,@name,@offset," +
                               "@u1,@hash,@u2,@prevDirFileCount,@fileCount)";
             cmd.Parameters.AddWithValue("@id", id);
             cmd.Parameters.AddWithValue("@fileName", fileName);
             cmd.Parameters.AddWithValue("@name", name);
             cmd.Parameters.AddWithValue("@offset", (int)offset);
             cmd.Parameters.AddWithValue("@u1", (int)unknown1);
             cmd.Parameters.AddWithValue("@hash", (int)hash);
             cmd.Parameters.AddWithValue("@u2", (int)unknown2);
             cmd.Parameters.AddWithValue("@prevDirFileCount", (int)prevDirFileCount);
             cmd.Parameters.AddWithValue("@fileCount", (int)fileCount);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#10
0
 internal void archSave(int id, string fileName)
 {
     using (SqlConnection conn = new SqlConnection(ConnValue.connSt()))
     {
         conn.Open();
         using (SqlCommand cmd = conn.CreateCommand())
         {
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "insert into Archives ([Header_id],[fileName],[name],[offset],[u1],[u2],[u3],[u4a],[u4b],[zero1],[u5],[u6],[u7],[zero2],[u8],[compressedSize]," +
                               "[uncompressedSize],[zero3],[u9],[headerSize],[u10]) values(@id,@fileName,@name,@offset,@u1,@u2,@u3,@u4a,@u4b,@zero1,@u5,@u6,@u7,@zero2,@u8,@compressedSize," +
                               "@uncompressedSize,@zero3,@u9,@headerSize,@u10)";
             cmd.Parameters.AddWithValue("@id", id);
             cmd.Parameters.AddWithValue("@fileName", fileName);
             cmd.Parameters.AddWithValue("@name", name);
             cmd.Parameters.AddWithValue("@offset", (int)offset);
             cmd.Parameters.AddWithValue("@u1", (int)u1);
             cmd.Parameters.AddWithValue("@u2", (int)u2);
             cmd.Parameters.AddWithValue("@u3", (int)u3);
             cmd.Parameters.AddWithValue("@u4a", (int)u4a);
             cmd.Parameters.AddWithValue("@u4b", (int)u4b);
             cmd.Parameters.AddWithValue("@zero1", (int)zero1);
             cmd.Parameters.AddWithValue("@u5", (int)u5);
             cmd.Parameters.AddWithValue("@u6", (int)u6);
             cmd.Parameters.AddWithValue("@u7", (int)u7);
             cmd.Parameters.AddWithValue("@zero2", (int)zero2);
             cmd.Parameters.AddWithValue("@u8", (int)u8);
             cmd.Parameters.AddWithValue("@compressedSize", (int)compressedSize);
             cmd.Parameters.AddWithValue("@uncompressedSize", (int)uncompressedSize);
             cmd.Parameters.AddWithValue("@zero3", (int)zero3);
             cmd.Parameters.AddWithValue("@u9", (int)u9);
             cmd.Parameters.AddWithValue("@headerSize", (int)headerSize);
             cmd.Parameters.AddWithValue("@u10", (int)u10);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#11
0
        internal void save(string fullPath)
        {
            fileName  = Path.GetFileName(fullPath);
            directory = fullPath.Substring(0, fullPath.LastIndexOf('\\'));

            using (conn = new SqlConnection(ConnValue.connSt()))
            {
                conn.Open();
                using (cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "INSERT into Headers ([fileName],[filePath],[fileFormat],[gameFlag],[version],[u1],[u2],[u3],[stringTableSize],[u4],[otherCount],[dirCount]," +
                                      "[typeCount],[filecount],[fileCount2],[partCount],[archiveCount],[u5],[u6],[u7],[u8],[unknownCount],[u9],[u10],[u11],[archNamesLength],[fileCount3]," +
                                      "[typeNamesLength],[u12],[u13],[u14],[u15],[u16],[u17],[u18],[u19],[u20],[u21],[u22],[u23],[u24]) values(@fileName, @directory, @fileFormatStr, @gameFlag," +
                                      "@version, @unknown1, @unknown2, @unknown3, @stringTableSize, @unknown4, @otherCount1, @otherCount2, @dirCount, @fileCount, @fileCount2, @partCount, @archiveCount," +
                                      "@unknown5, @unknown6, @unknown7, @unknown8, @unknownCount, @unknown9, @unknown10, @unknown11, @archStringSize, @fileCount3, @dirNamesLength, @unknown12," +
                                      "@unknown13, @unknown14, @unknown15, @unknown16, @unknown17, @unknown18, @unknown19, @unknown20, @unknown21, @unknown22, @unknown23, @unknown24)";

                    cmd.Parameters.AddWithValue("@fileName", fileName);
                    cmd.Parameters.AddWithValue("@directory", directory);
                    cmd.Parameters.AddWithValue("@fileFormatStr", fileFormatStr);
                    cmd.Parameters.AddWithValue("@gameFlag", gameFlag);
                    cmd.Parameters.AddWithValue("@version", version);
                    cmd.Parameters.AddWithValue("@unknown1", (int)unknown1);
                    cmd.Parameters.AddWithValue("@unknown2", (int)unknown2);
                    cmd.Parameters.AddWithValue("@unknown3", (int)unknown3);
                    cmd.Parameters.AddWithValue("@stringTableSize", (int)stringTableSize);
                    cmd.Parameters.AddWithValue("@unknown4", (int)unknown4);
                    cmd.Parameters.AddWithValue("@otherCount1", (int)otherCount1);
                    cmd.Parameters.AddWithValue("@otherCount2", (int)otherCount2);
                    cmd.Parameters.AddWithValue("@dirCount", (int)dirCount);
                    cmd.Parameters.AddWithValue("@fileCount", (int)fileCount);
                    cmd.Parameters.AddWithValue("@fileCount2", (int)fileCount2);
                    cmd.Parameters.AddWithValue("@partCount", (int)partCount);
                    cmd.Parameters.AddWithValue("@archiveCount", (int)archiveCount);
                    cmd.Parameters.AddWithValue("@unknown5", (int)unknown5);
                    cmd.Parameters.AddWithValue("@unknown6", (int)unknown6);
                    cmd.Parameters.AddWithValue("@unknown7", (int)unknown7);
                    cmd.Parameters.AddWithValue("@unknown8", (int)unknown8);
                    cmd.Parameters.AddWithValue("@unknownCount", (int)unknownCount);
                    cmd.Parameters.AddWithValue("@unknown9", (int)unknown9);
                    cmd.Parameters.AddWithValue("@unknown10", (int)unknown10);
                    cmd.Parameters.AddWithValue("@unknown11", (int)unknown11);
                    cmd.Parameters.AddWithValue("@archStringSize", (int)archStringSize);
                    cmd.Parameters.AddWithValue("@fileCount3", (int)fileCount3);
                    cmd.Parameters.AddWithValue("@dirNamesLength", (int)dirNamesLength);
                    cmd.Parameters.AddWithValue("@unknown12", (int)unknown12);
                    cmd.Parameters.AddWithValue("@unknown13", (int)unknown13);
                    cmd.Parameters.AddWithValue("@unknown14", (int)unknown14);
                    cmd.Parameters.AddWithValue("@unknown15", (int)unknown15);
                    cmd.Parameters.AddWithValue("@unknown16", (int)unknown16);
                    cmd.Parameters.AddWithValue("@unknown17", (int)unknown17);
                    cmd.Parameters.AddWithValue("@unknown18", (int)unknown18);
                    cmd.Parameters.AddWithValue("@unknown19", (int)unknown19);
                    cmd.Parameters.AddWithValue("@unknown20", (int)unknown20);
                    cmd.Parameters.AddWithValue("@unknown21", (int)unknown21);
                    cmd.Parameters.AddWithValue("@unknown22", (int)unknown22);
                    cmd.Parameters.AddWithValue("@unknown23", (int)unknown23);
                    cmd.Parameters.AddWithValue("@unknown24", (int)unknown24);
                    cmd.ExecuteNonQuery();
                }

                setHeaderID();
            }
        }