All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daxie.xops.xcs.XCSWriter Maven / Gradle / Ivy

Go to download

XOPSManipulator is a Java library that offers several functions to manipulate matters relating to X operations.

The newest version!
package com.daxie.xops.xcs;

import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import com.daxie.log.LogFile;
import com.daxie.tool.ByteFunctions;
import com.daxie.tool.ExceptionFunctions;
import com.daxie.xops.XOPSConstants;
import com.daxie.xops.character.CharacterAILevel;
import com.daxie.xops.character.CharacterBinSpecifierAndEnumConverter;
import com.daxie.xops.character.CharacterData;
import com.daxie.xops.character.CharacterModelType;
import com.daxie.xops.character.CharacterTextureType;
import com.daxie.xops.character.CharacterType;

/**
 * Writes data to a XCS file.
 * @author Daba
 *
 */
class XCSWriter {
	private CharacterData[] character_data_array=null;
	
	public XCSWriter(CharacterData[] character_data_array) {
		this.character_data_array=character_data_array;
	}
	
	public void Write(String xcs_filename) throws FileNotFoundException{
		if(character_data_array==null) {
			LogFile.WriteWarn("[XCSWriter-Write] Data is null.",true);
			return;
		}
		if(character_data_array.length!=XOPSConstants.CHARACTER_NUM) {
			LogFile.WriteWarn("[XCSWriter-Write] Invalid number of data. data_num:"+character_data_array.length,true);
			return;
		}
		
		DataOutputStream dos;
		dos=new DataOutputStream(
				new BufferedOutputStream(
						new FileOutputStream(xcs_filename)));
		
		try {
			dos.write(0x58);//X
			dos.write(0x43);//C
			dos.write(0x53);//S
			
			dos.write(0x00);
			dos.write(0x01);
			dos.write(0x00);
			dos.write(0x0C);
			dos.write(0x00);
			dos.write(0x2B);
			dos.write(0x00);
			dos.write(0x07);
			dos.write(0x00);
			
			for(int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy