private static void CacheSetupData()
        {
            if (Item_Setup.Count != 0)
            {
                return;
            }
            Assembly     _assembly;
            StreamReader _textStreamReader = null;

            try
            {
                _assembly         = Assembly.GetExecutingAssembly();
                _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("MSEAHackUtility." + Program.gateway + ".Ins.img.xml"));
            }
            catch (Exception e)
            {
                //              Debug.WriteLine(LogLevel.Error, "Error accessing Map.xml resourrce file {0}", e.StackTrace);
                return;
            }
            XmlDocument mapxml = new XmlDocument();

            mapxml.Load(_textStreamReader);
            foreach (XmlNode map in mapxml.DocumentElement.SelectNodes("/imgdir/imgdir"))
            {
                int     id       = int.Parse(map.Attributes["name"].InnerText);
                XmlNode node     = map.SelectSingleNode("string[@name='name']");
                XmlNode nodedesc = map.SelectSingleNode("string[@name='desc']");

                Item_Setup.Add(id, new KeyValuePair <string, String>(
                                   node == null ? "NULL" : node.Attributes["value"].InnerText.ToLower(),
                                   nodedesc == null ? "NULL" : nodedesc.Attributes["value"].InnerText));
            }
        }
示例#2
0
        public int Insert(Item_Setup item_Setup)
        {
            int isExecuted = 0;

            try
            {
                commandString          = @"INSERT INTO Item_Setup (Name) VALUES('" + item_Setup.Name + "')";
                sqlCommand             = new SqlCommand();
                sqlCommand.CommandText = commandString;
                sqlCommand.Connection  = sqlConnection;

                sqlConnection.Open();
                isExecuted = sqlCommand.ExecuteNonQuery();
                sqlConnection.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            return(isExecuted);
        }
 public int Insert(Item_Setup item_Setup)
 {
     return(itemSetUpRepository.Insert(item_Setup));
 }