Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Threading.Tasks;
- namespace Function_Library
- {
- class Functions
- {
- //Made by AlexDev. (ad_ofc#7068).
- // Modified by TERI (Tires#3415)
- string LoadUrl(string url) //Gets text from a raw website and returns. (Alex)
- {
- // Alex
- /*
- WebClient wc = new WebClient();
- string clipped = wc.DownloadString(url);
- return clipped;
- */
- // TERI
- // (TERI) 'Using' statement auto disposes, glad I learned that from Vortex/Baba Yaga lmfao like over 4 months ago or something I don't remember, oh god this sentence is starting to be long damn holy hell damn wow you're still reading and wasting your time over this sentence wow I took a year to write this sentence and yet you're wasting your time reading it, and you're still here fam just continue down no point of reading this, don't move the scrollbar right, there's totally nothing there totally not capping ;-; ur mom fat bc ur still here reading it
- using (var wc = new WebClient { Proxy = null }) // Proxy to null makes it a bit harder to grab the url and stuff Ig
- {
- return wc.DownloadString(url);
- }
- }
- // (TERI) Ok this function/method name is confusing af, it sounds like you're downloading a url as a file
- // (TERI) This should be named "DownloadFile" or something
- void DownloadUrl(string url, string name) //Downloads a file from the given url. (Alex)
- {
- // Alex
- /*
- WebClient wc = new WebClient();
- wc.DownloadFile(url, name);
- */
- // TERI
- using (var wc = new WebClient { Proxy = null })
- {
- wc.DownloadFile(new Uri(url).ToString(), name); // (TERI) ToString() makes it to like a correct url, so like if someone puts "google.com/favicon.ico" it's gonna turn to "http://google.com/favicon.ico"
- }
- }
- // (TERI) No need but alr Ig
- void MakeFolder(string filename) //Makes a folder in the base directory (Alex)
- {
- Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/" + filename);
- }
- string ReadFile(string filename) //Reads a .txt from the current directory (Alex)
- {
- // Alex
- /*
- string readfile_file = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + filename);
- return readfile_file;
- */
- // TERI
- return File.ReadAllText(Environment.CurrentDirectory + "\\" + filename);
- }
- void WriteFile(string iname, string text) //Writes a txt that exists in the directory (Alex)
- {
- File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + iname, text);
- }
- void MakeFile(string iname, string text) //Makes a new file and writes in it, if it exists, its writes it. (Alex)
- {
- File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + iname, text);
- }
- void StartProgram(string name)//Starts a program. (Alex)
- {
- Process.Start(AppDomain.CurrentDomain.BaseDirectory + name);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement