daily pastebin goal
42%
SHARE
TWEET

ShipMateLoot (C# Shell App Paste)

Gothicjawa Mar 24th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  3. using System;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Collections.Generic;
  7. using MySql.Data;
  8. using MySql.Data.MySqlClient;
  9. using Google.Protobuf;
  10.  
  11. namespace SML
  12. {
  13.     public class LootManager
  14.     {
  15.         public static MySqlConnection Conn;
  16.         public static string ConnString;
  17.        
  18.         public static void AddPart(string[] partData)
  19.         {
  20.             using(MySqlConnection conn = new MySqlConnection())
  21.             {
  22.                 Conn.ConnectionString = ConnString;
  23.                 Conn.Open();
  24.                
  25.                 using(MySqlCommand command = new MySqlCommand())
  26.                 {
  27.                     command.Connection = conn;
  28.                    
  29.                     string cmd = "INSERT INTO SMLoot(";
  30.                    
  31.                     for(int i = 0; i < 30; i++)
  32.                     {
  33.                         cmd += ((LootFilter.Filters)i).ToString() + ", ";
  34.                     }
  35.                    
  36.                     cmd += ") VALUES (";
  37.                    
  38.                     for(int i = 0; i < 30; i++)
  39.                     {
  40.                         cmd += "@" + ((LootFilter.Filters)i).ToString() + ", ";
  41.                     }
  42.                    
  43.                     cmd += ")";
  44.                    
  45.                     for(int i = 0; i < 30; i++)
  46.                     {
  47.                         command.Parameters.AddWithValue("@" + ((LootFilter.Filters)i).ToString() + ", ", partData[i]);
  48.                     }
  49.                    
  50.                     command.ExecuteNonQuery();
  51.                     conn.Close();
  52.                 }
  53.             }
  54.         }
  55.     }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top