Ejemplo 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");
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutMemeList([FromRoute] int id, [FromBody] MemeList memeList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != memeList.Id)
            {
                return(BadRequest());
            }

            _context.Entry(memeList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MemeListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
 private void _Bu_RemoveGiff_Click(object sender, EventArgs e)
 {
     if (_LB_GiffList.SelectedIndex == -1)
     {
         return;
     }
     MemeList.Remove((((string)(_LB_GiffList.SelectedItem)).Substring(0, ((string)(_LB_GiffList.SelectedItem)).IndexOf("-:-"))));
     _LB_GiffList.Items.RemoveAt(_LB_GiffList.SelectedIndex);
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> PostMemeList([FromBody] MemeList memeList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MemeLists.Add(memeList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMemeList", new { id = memeList.Id }, memeList));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> PostMemeListFromExcel([FromBody] string pathway)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            MemeList memeList = new MemeList(GetExcelFile(pathway), pathway);

            _context.MemeLists.Add(memeList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMemeList", new { id = memeList.Id }, memeList));
        }
Ejemplo n.º 6
0
        public async Task ListMemeSubreddits()
        {
            await MemeList.ReadFromJSON();

            EmbedBuilder builder = new EmbedBuilder();

            builder.Title = "Subreddits: " + MemeList.SubredditList.Count;
            int counter = 1;

            foreach (MemeSubreddit subreddit in MemeList.SubredditList)
            {
                builder.AddField(counter.ToString() + ".", $"r/{subreddit.subredditName}");
                counter++;
            }
            await ReplyAsync("", false, builder.Build());
        }
Ejemplo n.º 7
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);
            }
        }