Exemplo n.º 1
0
 private void _Bu_AddGiff_Click(object sender, EventArgs e)
 {
     if (_TB_GiffKeys.Text != "" && _TB_GiffPath.Text != "")
     {
         if (!MemeList.ContainsKey(_TB_GiffKeys.Text) && !MemeList.ContainsValue(_TB_GiffPath.Text))
         {
             if (File.Exists(PathGetter.GetMemePath(_TB_GiffPath.Text)))
             {
                 MemeList.Add(_TB_GiffKeys.Text.ToLower(), _TB_GiffPath.Text);
                 _LB_GiffList.Items.Add(_TB_GiffKeys.Text.ToLower() + "-:-" + _TB_GiffPath.Text);
             }
             else
             {
                 MessageBox.Show("that file does not exist");
             }
         }
         else
         {
             MessageBox.Show("You have ether the file or the key already included");
         }
     }
     else
     {
         MessageBox.Show("You have a blank field");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Event for the loaded form to use
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            // we will try loading the list of games to pick from
            try
            {
                //the file is a simple text file so grab a stream reader as it has a nice line by line streamer and a file end bool
                using (StreamReader Reader = new StreamReader(new FileStream(Environment.CurrentDirectory + "\\GameToPlay.text", FileMode.OpenOrCreate)))
                {
                    //as long as we have lines load a line in as a new game item
                    while (!Reader.EndOfStream)
                    {
                        _LB_GamesToPlay.Items.Add(Reader.ReadLine());
                    }
                    Reader.Close(); // close the stream for the next app and clean up
                    Reader.Dispose();
                }
            }
            catch
            {
                // if we didnt find the thing or had a problem just make a primitve array of sample games to use
                string[] GamesToPayPrimitive = { null,              "Guns of Icarus Online",                                       "Half Life 3",                 "Valkyria Chronicles™",
                                                 "Gun Wings",       "Ghost in the Shell Stand Alone Complex First Assault Online", "Agarest: Generations of War", "ArcheAge",                        "Portal 2",
                                                 "Fallout 4",       "DARK SOULS™ II",                                              "ArcheAge",                    "Sid Meier's Civilization V",      "Age of Empires II: HD Edition", "Garry's Mod","Zombie Grinder",
                                                 "Team Fortress 2", "Life is Feudal: Your Own",                                    "Alien Swarm",                 "Counter-Strike: Global Offensive","STAR WARS™: Knights of the Old Republic™" };
                //microsoft wtf no to array of the items well do it the old fastioned way
                foreach (string s in GamesToPayPrimitive)
                {
                    _LB_GamesToPlay.Items.Add(s);
                }
            }

            try
            {
                //the file is a simple text file so grab a stream reader as it has a nice line by line streamer and a file end bool
                using (StreamReader Reader = new StreamReader(new FileStream(Environment.CurrentDirectory + "\\MemeList.text", FileMode.OpenOrCreate)))
                {
                    //as long as we have lines load a line in as a new game item
                    while (!Reader.EndOfStream)
                    {
                        KeyValuePair <string, string> Temp = new KeyValuePair <string, string>(Reader.ReadLine(), Reader.ReadLine());
                        MemeList.Add(Temp.Key, Temp.Value);
                        _LB_GiffList.Items.Add(Temp.Key + "-:-" + Temp.Value);
                    }
                    Reader.Close(); // close the stream for the next app and clean up
                    Reader.Dispose();
                }
            }
            catch
            {
                //do Nothing if it fails as this jut means we must rebind on exit
            }

            try
            {
                using (XmlReader XReader = XmlReader.Create(File.OpenRead(Environment.CurrentDirectory + "\\Setting.BotConfig")))
                {
                    while (XReader.Read())
                    {
                        switch (XReader.NodeType)
                        {
                        case XmlNodeType.Element:
                            switch (XReader.Name)
                            {
                            case "BotToken":
                                _TB_BotTokenSet.Text = XReader.ReadContentAsString();
                                break;
                            }
                            break;
                        }
                    }
                }
            }
            catch
            {
            }


            if (_Crashed)
            {
                _RTB_ConsoleOut.AppendText("This IS a FULL System crash RESTART! CHECK THE LOGS DING BAT -> " + Environment.CurrentDirectory + "\\KillLog.text");
            }

            if (_AutoConnect)
            {
                _Bu_Connect_Click(sender, e);
            }
        }