操作步骤:
1. 用RC扫描自己有的romset,生成Mamemiss.txt列表
2. 用下面的程序,以Mamemiss.txt为输入,生成多份FlashFXP fqf文件 - 1.fqf、2.fqf....
3. 多打开几个FlashFXP,一个个Ctrl+L Load Queue....逐一选上1.fqf、2.fqf...,All Ctrl+Z!
4. 去睡觉....一觉醒来以后,就fullset了....
提示:请自行修改程序中Main里面的配置参数! 为了程序简洁起见,错误处理一概无视....
感想:哪天要是能够做个机器人帮偶补rom就圆满了......CM+QueueGen Batch Processing....
using System;
using System.IO;
using System.Text;
namespace QueueGen
{
class MainApp
{
[STAThread]
static void Main(string[] args)
{
//FlashFXP站点管理器中的站点名称
const String SOURCE_HOST="Emuz";
//FTP源目录名
const String SOURCE_DIR="/pub/Roms/MAME ROMs/";
//本机目的子目录名
const String TARGET_DIR="C:\\Documents and Settings\\LUY\\Desktop\\roms\\";
//RC生成的MissGame文件
const String DATA_FILE="../../MAMEmissM.txt";
//输出的队列文件存放的目录
const String QUEUE_FILE_DIR="../../";
//输出分为几份队列文件?(用于多FlashFXP Session下载)
const int QUEUE_FILE_COUNT=3;
QueueGen qg=new QueueGen(QUEUE_FILE_COUNT,
SOURCE_HOST,SOURCE_DIR,
TARGET_DIR,
DATA_FILE,QUEUE_FILE_DIR);
qg.GenQueueFile();
}
}
class QueueGen
{
private int Count;
private String FileType="0";
private String Direction="5";
private String TargetHost="-";
private String FileSize="1";
private String SourceFilename;
private String TargetFilename;
private String SourceHost;
private String SourceDir;
private String TargetDir;
private String DataFile;
private String QueueFileDir;
private StreamReader sr;
private FileStream[] fs;
private BinaryWriter[] w;
public QueueGen(int CT,String SH,String SD,String TD,String DF,String QD)
{
Count=CT;
SourceHost=SH;
SourceDir=SD;
TargetDir=TD;
DataFile=DF;
QueueFileDir=QD;
}
public void GenQueueFile()
{
OpenAllFiles();
int idx=0;
int fileidx=0;
byte[] buf=new byte[1024*10];
while ((SourceFilename=sr.ReadLine())!=null)
{
Console.WriteLine(SourceFilename);
SourceFilename=SourceFilename+".zip";
TargetFilename=SourceFilename;
idx=0;
AppendBuf(FileType,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(Direction,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(2,buf,ref idx);
AppendBuf(SourceHost,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(2,buf,ref idx);
AppendBuf(TargetHost,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(SourceDir,buf,ref idx);
AppendBuf(SourceFilename,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(TargetDir,buf,ref idx);
AppendBuf(TargetFilename,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(FileSize,buf,ref idx);
AppendBuf(0x0d,buf,ref idx);
AppendBuf(0x0a,buf,ref idx);
w[fileidx].Write(buf,0,idx);
fileidx=(fileidx+1)%Count;
}
CloseAllFiles();
}
private void OpenAllFiles()
{
sr = new StreamReader(DataFile);
fs = new FileStream[Count];
w = new BinaryWriter[Count];
for (int i=1;i<=Count;i++)
{
String fn=QueueFileDir+i.ToString()+".fqf";
fs[i-1]=new FileStream(fn, FileMode.Create);
w[i-1] = new BinaryWriter(fs[i-1]);
}
}
private void CloseAllFiles()
{
for (int i=0;i<Count;i++)
{
w[i].Close();
fs[i].Close();
}
sr.Close();
}
private void AppendBuf(String s,byte[] buf,ref int idx)
{
ASCIIEncoding ascii = new ASCIIEncoding();
ascii.GetBytes(s,0,s.Length,buf,idx);
idx+=s.Length;
}
private void AppendBuf(byte b,byte[] buf,ref int idx)
{
buf[idx]=b;
idx++;
}
}
}
using System.IO;
using System.Text;
namespace QueueGen
{
class MainApp
{
[STAThread]
static void Main(string[] args)
{
//FlashFXP站点管理器中的站点名称
const String SOURCE_HOST="Emuz";
//FTP源目录名
const String SOURCE_DIR="/pub/Roms/MAME ROMs/";
//本机目的子目录名
const String TARGET_DIR="C:\\Documents and Settings\\LUY\\Desktop\\roms\\";
//RC生成的MissGame文件
const String DATA_FILE="../../MAMEmissM.txt";
//输出的队列文件存放的目录
const String QUEUE_FILE_DIR="../../";
//输出分为几份队列文件?(用于多FlashFXP Session下载)
const int QUEUE_FILE_COUNT=3;
QueueGen qg=new QueueGen(QUEUE_FILE_COUNT,
SOURCE_HOST,SOURCE_DIR,
TARGET_DIR,
DATA_FILE,QUEUE_FILE_DIR);
qg.GenQueueFile();
}
}
class QueueGen
{
private int Count;
private String FileType="0";
private String Direction="5";
private String TargetHost="-";
private String FileSize="1";
private String SourceFilename;
private String TargetFilename;
private String SourceHost;
private String SourceDir;
private String TargetDir;
private String DataFile;
private String QueueFileDir;
private StreamReader sr;
private FileStream[] fs;
private BinaryWriter[] w;
public QueueGen(int CT,String SH,String SD,String TD,String DF,String QD)
{
Count=CT;
SourceHost=SH;
SourceDir=SD;
TargetDir=TD;
DataFile=DF;
QueueFileDir=QD;
}
public void GenQueueFile()
{
OpenAllFiles();
int idx=0;
int fileidx=0;
byte[] buf=new byte[1024*10];
while ((SourceFilename=sr.ReadLine())!=null)
{
Console.WriteLine(SourceFilename);
SourceFilename=SourceFilename+".zip";
TargetFilename=SourceFilename;
idx=0;
AppendBuf(FileType,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(Direction,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(2,buf,ref idx);
AppendBuf(SourceHost,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(2,buf,ref idx);
AppendBuf(TargetHost,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(SourceDir,buf,ref idx);
AppendBuf(SourceFilename,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(TargetDir,buf,ref idx);
AppendBuf(TargetFilename,buf,ref idx);
AppendBuf(1,buf,ref idx);
AppendBuf(FileSize,buf,ref idx);
AppendBuf(0x0d,buf,ref idx);
AppendBuf(0x0a,buf,ref idx);
w[fileidx].Write(buf,0,idx);
fileidx=(fileidx+1)%Count;
}
CloseAllFiles();
}
private void OpenAllFiles()
{
sr = new StreamReader(DataFile);
fs = new FileStream[Count];
w = new BinaryWriter[Count];
for (int i=1;i<=Count;i++)
{
String fn=QueueFileDir+i.ToString()+".fqf";
fs[i-1]=new FileStream(fn, FileMode.Create);
w[i-1] = new BinaryWriter(fs[i-1]);
}
}
private void CloseAllFiles()
{
for (int i=0;i<Count;i++)
{
w[i].Close();
fs[i].Close();
}
sr.Close();
}
private void AppendBuf(String s,byte[] buf,ref int idx)
{
ASCIIEncoding ascii = new ASCIIEncoding();
ascii.GetBytes(s,0,s.Length,buf,idx);
idx+=s.Length;
}
private void AppendBuf(byte b,byte[] buf,ref int idx)
{
buf[idx]=b;
idx++;
}
}
}