因此,基本上,没有任何Visual经验,我想改进我的动画工作流程。所以,我想用http://www.aseprite.org/cli/中找到的东西来做这件事。
因此,我编写了一个小程序,将所有.ase文件都放在一个文件夹中,并创建一个文本文件,其中包含批处理文件将上述.ase文件转换为.gif或png文件所需的行。我很笨,所以我手动将文本文件转换为.bat文件。
但是,从程序生成的.txt文件在转换为.bat时不起作用,但是如果我将行复制到我在windows中创建的另一个.txt文件,并将其转换为.bat,它就能工作。
所以问题是-我是否破坏了Visual中的.txt文件?如果代码有问题,我会分享它,但我不愿意,因为我不想有一个格式化错误噩梦。
哦,是的,我知道这不是个明智的方法。
编辑:啊,对,批处理文件的错误,顺便说一句,它闪现得非常快,关闭命令行提示符:“-批处理”不被识别为内部或外部命令、可操作的程序或批处理文件。
.bat中的代码类似于:
@set ASEPRITE="C:\Program Files\Aseprite\aseprite.exe"
%ASEPRITE% --batch animation.ase --scale 2 --save-as animation-x2.gif
%ASEPRITE% --batch animation.ase --scale 4 --save-as animation-x4.gif基本上,在VB中,我创建了txt文件和文本,如下所示:
' Dim fs As FileStream = File.Create(Label1.Text + "\Text.txt")
fs.Close()
For Each foundFile As String In My.Computer.FileSystem.GetFiles(Label1.Text)
Dim check As String = System.IO.Path.GetExtension(foundFile)
If check = ".ase" Then
ListBox1.Items.Add(Dir(foundFile))
str = Dir(foundFile)
str = str.Replace(".ase", fType)
My.Computer.FileSystem.WriteAllText(Label1.Text + "\Text.txt",
"%ASEPRITE% --batch " + Dir(foundFile) + " --scale " + fSize + " --save-as " + str + vbCrLf,
True)
End If
Next‘
发布于 2015-01-30 19:06:45
您可以尝试使用特定的编码来编写文件:
File.WriteAllText(path, text, Encoding.UTF8) ' or UTF or ASCII还可能是UTF8编码器使用了无法读取的:
File.WriteAllText(path, text, new UTF8Encoding(false))要寻找的另一件事是行字符的末尾。是\r\n还是\n?
您可以使用文件比较器来检查文件之间的差异,并且应该清楚区别是什么。
https://stackoverflow.com/questions/28242846
复制相似问题