Guest User

Untitled

a guest
Mar 21st, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12.  
  13. namespace Renamer
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         string readpath;
  18.         string curruser = System.Environment.UserName;
  19.         string directoryfile;
  20.         public Form1()
  21.         {
  22.             InitializeComponent();
  23.            
  24.  
  25.         }
  26.  
  27.         private void Form1_Load(object sender, EventArgs e)
  28.         {
  29.             directoryfile = @"C:\Users\" + curruser + @"\Appdata\Local\fo4renamer\directory.txt";
  30.                       if (File.Exists(directoryfile))
  31.             {
  32.                 DisplayText.Visible = false;
  33.                 InsertText.Visible = false;
  34.                
  35.             readpath = File.ReadAllText(directoryfile);
  36.  
  37.  
  38.  
  39.             }
  40.         }
  41.        
  42.         private void InsertText_Click(object sender, EventArgs e)
  43.         {
  44.             string curruser = System.Environment.UserName;
  45.             string fo4directory = DisplayText.Text;
  46.           string path = Directory.GetCurrentDirectory();
  47.             string target = path + @"\data";
  48.             string directoryfile = @"C:\Users\" + curruser + @"\Appdata\Local\fo4renamer\directory.txt";
  49.             string appdata = @"C:\Users\" + curruser + @"\Appdata\Local\fo4renamer";
  50.            
  51.  
  52.  
  53.  
  54.  
  55.             //Checks if the renamer folder exists and creates folder
  56.             Directory.CreateDirectory(appdata);
  57.  
  58.                 label1.Text = curruser;
  59.  
  60.              
  61.                  //writes to file
  62.                   TextWriter tw = new StreamWriter(directoryfile);
  63.                     tw.WriteLine(fo4directory);
  64.                     tw.Close();
  65.          //set Label to the file output    
  66.             label1.Text = File.ReadAllText(directoryfile);
  67.             DisplayText.Visible = false;
  68.             InsertText.Visible = false;
  69.             string readpath = File.ReadAllText(directoryfile);
  70.         }
  71.  
  72.         private void ChangeDir_CheckedChanged(object sender, EventArgs e)
  73.         {
  74.             if (ChangeDir.Checked)
  75.             {
  76.                 DisplayText.Visible = true;
  77.                 InsertText.Visible = true;
  78.             }
  79.    else
  80.             {
  81.                 DisplayText.Visible = false;
  82.                 InsertText.Visible = false;
  83.             }
  84.  
  85.  
  86.         }
  87.  
  88.         private void French_CheckedChanged(object sender, EventArgs e)
  89.         {
  90.        
  91.                 if (French.Checked)
  92.                 {
  93.                     directoryfile = @"C:\Users\" + curruser + @"\Appdata\Local\fo4renamer\directory.txt";
  94.                 label1.Text = directoryfile;
  95.                 readpath = File.ReadAllText(directoryfile);
  96.                 string shouldwork = readpath + "data";
  97.                 string french = shouldwork + "\\french";
  98.                 string german = shouldwork + "\\german";
  99.                     string tmp = shouldwork + "tmp.txt";
  100.                     label1.Text = french;
  101.                     string path2 = @"C:\Users\duchacekda\Desktop\e\Renamer\Renamer\bin\Debug\tmp.txt";
  102.                     string filename = @"C:\Users\duchacekda\Desktop\e\Renamer\Renamer\bin\Debug\french.txt";
  103.               File.Move(french, german);
  104.                      }
Advertisement
Add Comment
Please, Sign In to add comment