Jump to content

Turn Multiple Files to Null (useful for replace animations)


kepler007

Recommended Posts

I just developed a small tool to make multiple files to null and as I have tested this is useful for replace the Animations. let's say there are 5 animations and if you don't want to activate 3 animations? so using this tool can make files of aforesaid 3 animations null so only 2 would work in the game and the rest of 3 animations will remain in the mod but they don't take any space or work any more. also you can use this tool to make any text file null without removing the file.

 

http://www60.zippyshare.com/v/54085767/file.html

 

 

This Tool is completely opensource so feel free to add more features if you want

Source

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace AnimeReplacer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            pbarProgress.Minimum = 1;
        }

        List<string> selectedFiles = new List<string>();
        int progress = 1;
        bool firstRound = true;
        int selectedFileNumber = 0;
        
        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (firstRound == true)
            {
                firstRound = false;
                if (chkbackup.Checked == true)
                {
                    backupfiles(selectedFiles, @"\BACKUP");
                    pbarProgress.Value = 1;
                    progress = 1;
                }
            
                lblState.Text = "Files are being nulled";

                foreach (string fileName in selectedFiles)
                {
                    pbarProgress.Value = progress++;

                    using (StreamWriter writeStream = new StreamWriter(fileName, false))
                    {
                        writeStream.Write("");
                    }
                }
            }
        }

        private void btnSelectFiles_Click(object sender, EventArgs e)
        {
            ofdFiles.Filter = "HKX Files (*.hkx)|*.hkx|Text Files (*.txt)|*.txt";
            ofdFiles.Multiselect = true;
            
            if (ofdFiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                    foreach (string fileName in ofdFiles.FileNames)
                    {
                        selectedFiles.Add(fileName);
                        trvFileList.Nodes.Add(fileName);
                    }
            }
            
            selectedFileNumber += selectedFiles.Count;
            pbarProgress.Maximum = selectedFileNumber;
        }

        private void backupfiles(List<string> fileFullNames,string fileBackupfolderName)
        {
            foreach(string fileName in fileFullNames)
            {
                string strdirectoryName = new FileInfo(fileName).DirectoryName;
                string strdfileName = new FileInfo(fileName).Name;
                pbarProgress.Value = progress++;
                lblState.Text = "Files are being backed up........";

                if (!Directory.Exists(strdirectoryName + @"\" + fileBackupfolderName))
                {
                    Directory.CreateDirectory(strdirectoryName + @"\" + fileBackupfolderName);
                }
                File.Copy(fileName, strdirectoryName + @"\" + fileBackupfolderName + @"\" + strdfileName,true);
            }
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            clearAll();
        }

        private void clearAll()
        {
            Application.Restart();
        }
    }
}

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use