unit images are processed into game characters

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

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{

private void Form1_Load(object sender, EventArgs e)
{

}


public Form1()
{
InitializeComponent();


// Get all file names in the current path
//String[] files = Directory.GetFiles("F:\\clo1");

int[] aescs = { 5, 4, 3, 2, 1, 8, 7, 6 };
List<string> files = new List<string>();

for(int j = 0; j < 8; ++j)
{
for (int i = 0; i < 4; ++i)
{
files.Add("F:/clo1/子图_1_"+ aescs[j] + "_png/" + i + ".png");
}
}

for (int j = 0; j < 8; ++j)
{
for (int i = 0; i < 6; ++i)
{
files.Add("F:/clo1/子图_2_" + aescs[j] + "_png/" + i + ".png");
}
}

for (int j = 0; j < 8; ++j)
{
for (int i = 0; i < 6; ++i)
{
files.Add("F:/clo1/子图_5_" + aescs[j] + "_png/" + i + ".png");
}
}
for (int j = 0; j < 8; ++j)
{
for (int i = 0; i < 6; ++i)
{
files.Add("F:/clo1/子图_6_" + aescs[j] + "_png/" + i + ".png");
}
}

 


int cur = 0;
foreach (String filename in files)
{
// last "\"
int lastpath = filename.LastIndexOf("/");
// last "."
int lastdot = filename.LastIndexOf(".") ;
// plain file name length
int length = lastdot - lastpath - 1;
// file directory string xx\xx\xx\
String beginpart = filename.Substring(0, lastpath + 1);
// plain file name
String namenoext = filename.Substring(lastpath + 1, length);
// extension
String ext = filename.Substring(lastdot);


// Fill in 3 digits to form a new file name
String namenew;
if (cur < 10)
namenew = "22900" + cur;
else if (cur < 100)
namenew = "2290" + cur;
else
namenew = "229 " + cur;
String fullnewname = "F:/clo2/" + namenew + ext;
// rename
File.Move(filename, fullnewname);
++cur;
}
}
}
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324412713&siteId=291194637