Advertisement
Guest User

Untitled

a guest
Oct 17th, 2021
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Net;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9.  
  10. namespace FunctionLibrary
  11. {
  12.     /*Made by AlexDev. Modified By Immune*/
  13.  
  14.     public class Functions
  15.     {
  16.         public string DownloadString(string Url)
  17.         {
  18.             using (var Client = new WebClient())
  19.             {
  20.                 return Client.DownloadString(Url);
  21.             }
  22.             return null;
  23.         }
  24.  
  25.         public void DownloadFile(string Url, string Name)
  26.         {
  27.             using (var Client = new WebClient())
  28.             {
  29.                 Client.DownloadFile(Url, $"{Environment.CurrentDirectory}\\{Name}");
  30.             }
  31.         }
  32.  
  33.         public void MakeFolder(string FileName)
  34.             => File.Create($"{Environment.CurrentDirectory}\\{FileName}");
  35.  
  36.         public string ReadFile(string FileLocation)
  37.         {
  38.             return File.ReadAllText(FileLocation);
  39.         }
  40.  
  41.         public void WriteFile(string Name, string Text)
  42.             => File.WriteAllText(Name, Text); /* Might Be Backwards Since Pastebin Has No Syntax*/
  43.  
  44.         public void MakeFile(string Name, string Text)
  45.         {
  46.             using (var Writer = new StreamWriter(Name)
  47.             {
  48.                 Writer.WriteLine(Text);
  49.                 Writer.Close();
  50.             }
  51.         }
  52.  
  53.         void StartProgram(string FileLocation)
  54.             => Process.Start(FileLocation);
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement