/* ----------------------------------------------- Functions */ #region Functions public void CleanUp() { Version = KindVersion.ERROR; NameDirectory = ""; NameFileBody = ""; NameFileExtension = ""; TableCommand = null; TableValue = null; TableListIndex = null; }
/* ----------------------------------------------- Functions */ #region Functions public void CleanUp() { Version = (KindVersion)(-1); // TableMaterial = null; TableParts = null; CatalogParts.CleanUp(); TableAnimation = null; TableAnimationPartsSetup = null; SignatureBootUpFunction = null; }
/* ----------------------------------------------- Functions */ #region Functions public void CleanUp() { Version = (KindVersion)(-1); DataCellMap = null; DataAnimation = null; DataEffect = null; DataSequence = null; PrefabAnimation = null; PrefabEffect = null; TableTexture = null; CacheMaterialAnimation = null; CacheMaterialEffect = null; }
/* ----------------------------------------------- Functions */ #region Functions public void CleanUp() { Version = (KindVersion)(-1); TableCellMap = null; }
/* ----------------------------------------------- Functions */ #region Functions public static Information Parse(ref LibraryEditor_SpriteStudio6.Import.Setting setting, string nameFile ) { const string messageLogPrefix = "Parse SignaleSetting"; Information informationSignalSetting = null; /* ".ssce" Load */ if (false == System.IO.File.Exists(nameFile)) { LogError(messageLogPrefix, "File Not Found", nameFile); goto Parse_ErrorEnd; } System.Xml.XmlDocument xmlSianalSetting = new System.Xml.XmlDocument(); xmlSianalSetting.Load(nameFile); /* Check Version */ System.Xml.XmlNode nodeRoot = xmlSianalSetting.FirstChild; nodeRoot = nodeRoot.NextSibling; KindVersion version = (KindVersion)(LibraryEditor_SpriteStudio6.Utility.XML.VersionGet(nodeRoot, "SpriteStudioSignal", (int)KindVersion.ERROR, true)); switch (version) { case KindVersion.ERROR: LogError(messageLogPrefix, "Version Invalid", nameFile); goto Parse_ErrorEnd; case KindVersion.CODE_000100: case KindVersion.CODE_010000: break; default: if (KindVersion.TARGET_EARLIEST > version) { version = KindVersion.TARGET_EARLIEST; if (true == setting.CheckVersion.FlagInvalidSSCE) { LogWarning(messageLogPrefix, "Version Too Early", nameFile); } } else { version = KindVersion.TARGET_LATEST; if (true == setting.CheckVersion.FlagInvalidSSCE) { LogWarning(messageLogPrefix, "Version Unknown", nameFile); } } break; } /* Create Information */ informationSignalSetting = new Information(); if (null == informationSignalSetting) { LogError(messageLogPrefix, "Not Enough Memory", nameFile); goto Parse_ErrorEnd; } informationSignalSetting.BootUp(); informationSignalSetting.Version = version; /* Get Base-Directories */ LibraryEditor_SpriteStudio6.Utility.File.PathSplit(out informationSignalSetting.NameDirectory, out informationSignalSetting.NameFileBody, out informationSignalSetting.NameFileExtension, nameFile); /* Decode Tags */ System.Xml.NameTable nodeNameSpace = new System.Xml.NameTable(); System.Xml.XmlNamespaceManager managerNameSpace = new System.Xml.XmlNamespaceManager(nodeNameSpace); string valueText = ""; /* Get Command Setting */ System.Xml.XmlNodeList listNode = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeRoot, "commands/value", managerNameSpace); if (null == listNode) { LogError(messageLogPrefix, "\"command/value\"-Node Not Found", nameFile); goto Parse_ErrorEnd; } Information.Command command = null; foreach (System.Xml.XmlNode nodeCommand in listNode) { command = new Information.Command(); if (null == command) { LogError(messageLogPrefix, "Not Enough Memory (Command WorkArea)", nameFile); goto Parse_ErrorEnd; } command.BootUp(); valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeCommand, "id", managerNameSpace); command.ID = valueText.Trim(); if (true == string.IsNullOrEmpty(command.ID)) { LogError(messageLogPrefix, "Command-ID Invelid (Empty)", nameFile); goto Parse_ErrorEnd; } /* MEMO: "Name" is not decoded because only needed on SS6. */ valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeCommand, "valueId", managerNameSpace); command.IDValue = valueText.Trim(); /* MEMO: "IDValue" allows the empty. (means "No values") */ /* Add Command */ informationSignalSetting.TableCommand.Add(command.ID, command); } /* Get Value Setting */ listNode = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeRoot, "values/value", managerNameSpace); if (null == listNode) { LogError(messageLogPrefix, "\"values/value\"-Node Not Found", nameFile); goto Parse_ErrorEnd; } Information.Value value = null; Information.Value.Parameter parameterValue = null; System.Xml.XmlNodeList listNodeParam = null; foreach (System.Xml.XmlNode nodeValue in listNode) { value = new Information.Value(); if (null == value) { LogError(messageLogPrefix, "Not Enough Memory (Value WorkArea)", nameFile); goto Parse_ErrorEnd; } value.BootUp(); valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeValue, "id", managerNameSpace); value.ID = valueText.Trim(); if (true == string.IsNullOrEmpty(value.ID)) { LogError(messageLogPrefix, "Value-ID Invelid (Empty)", nameFile); goto Parse_ErrorEnd; } listNodeParam = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeValue, "params/value", managerNameSpace); if (null == listNodeParam) { LogError(messageLogPrefix, "\"values/value/params/value\"-Node Not Found", nameFile); goto Parse_ErrorEnd; } foreach (System.Xml.XmlNode nodeParameterValue in listNodeParam) { parameterValue = new Information.Value.Parameter(); if (null == parameterValue) { LogError(messageLogPrefix, "Not Enough Memory (Value's parameter WorkArea)", nameFile); goto Parse_ErrorEnd; } parameterValue.CleanUp(); valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeParameterValue, "id", managerNameSpace); parameterValue.ID = valueText.Trim(); if (true == string.IsNullOrEmpty(parameterValue.ID)) { LogError(messageLogPrefix, "Value's Parameter-ID Invelid (Empty)", nameFile); goto Parse_ErrorEnd; } /* MEMO: "Name" is not decoded because only needed on SS6. */ valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeParameterValue, "type", managerNameSpace); valueText = valueText.Trim(); parameterValue.Type = TypeGetParameterValue(valueText); if (Library_SpriteStudio6.Data.Animation.Attribute.Signal.Command.Parameter.KindType.ERROR == parameterValue.Type) { LogError(messageLogPrefix, "Value's Param Type \"" + valueText + "\" Invelid (Enpty)", nameFile); goto Parse_ErrorEnd; } valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeParameterValue, "listId", managerNameSpace); parameterValue.IDList = valueText.Trim(); /* MEMO: "IDList" allows the empty. (means "No Index-List") */ /* Add Parameter */ value.TableParameter.Add(parameterValue.ID, parameterValue); } /* Add Value */ informationSignalSetting.TableValue.Add(value.ID, value); } /* Get List Setting */ listNode = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeRoot, "lists/value", managerNameSpace); if (null == listNode) { LogError(messageLogPrefix, "\"lists/value\"-Node Not Found", nameFile); goto Parse_ErrorEnd; } Information.ListIndex listIndex = null; Information.ListIndex.Item itemListIndex = null; System.Xml.XmlNodeList listNodeItemList = null; foreach (System.Xml.XmlNode nodeList in listNode) { listIndex = new Information.ListIndex(); if (null == listIndex) { LogError(messageLogPrefix, "Not Enough Memory (ListIndex WorkArea)", nameFile); goto Parse_ErrorEnd; } listIndex.BootUp(); valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeList, "id", managerNameSpace); listIndex.ID = valueText.Trim(); if (true == string.IsNullOrEmpty(listIndex.ID)) { LogError(messageLogPrefix, "ListIndex-ID Invelid (Empty)", nameFile); goto Parse_ErrorEnd; } listNodeItemList = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeList, "items/value", managerNameSpace); if (null == listNodeItemList) { LogError(messageLogPrefix, "\"values/value/params/value\"-Node Not Found", nameFile); goto Parse_ErrorEnd; } foreach (System.Xml.XmlNode nodeItemListIndex in listNodeItemList) { itemListIndex = new Information.ListIndex.Item(); if (null == itemListIndex) { LogError(messageLogPrefix, "Not Enough Memory (ListIndex's item WorkArea)", nameFile); goto Parse_ErrorEnd; } itemListIndex.CleanUp(); valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeItemListIndex, "id", managerNameSpace); itemListIndex.ID = valueText.Trim(); if (true == string.IsNullOrEmpty(itemListIndex.ID)) { LogError(messageLogPrefix, "ListIndex Item-ID Invelid (Empty)", nameFile); goto Parse_ErrorEnd; } /* MEMO: Decode the name in case of "ListIndex" (just in case). */ valueText = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeItemListIndex, "name", managerNameSpace); itemListIndex.Name = valueText.Trim(); /* MEMO: "Name" allows the empty, now. */ /* Add Parameter */ listIndex.TableItem.Add(itemListIndex.ID, itemListIndex); } /* Add List */ informationSignalSetting.TableListIndex.Add(listIndex.ID, listIndex); } /* Check Link(Relational)-ID */ { string idCheck; foreach (KeyValuePair <string, Information.Command> pair in informationSignalSetting.TableCommand) { idCheck = pair.Value.IDValue; if (false == string.IsNullOrEmpty(idCheck)) { if (false == informationSignalSetting.TableValue.ContainsKey(idCheck)) { LogError(messageLogPrefix, "Missing Link Value-ID(" + idCheck + ") in Command-ID(" + pair.Key + ")", nameFile ); goto Parse_ErrorEnd; } } } foreach (KeyValuePair <string, Information.Value> pair in informationSignalSetting.TableValue) { foreach (KeyValuePair <string, Information.Value.Parameter> pairParameter in informationSignalSetting.TableValue[pair.Key].TableParameter) { idCheck = pairParameter.Value.IDList; if (false == string.IsNullOrEmpty(idCheck)) { if (false == informationSignalSetting.TableListIndex.ContainsKey(idCheck)) { LogError(messageLogPrefix, "Missing Link List-ID(" + idCheck + ") in Value-ID(" + pair.Key + ", " + pairParameter.Key + ")", nameFile ); goto Parse_ErrorEnd; } } } } } return(informationSignalSetting); Parse_ErrorEnd: if (null != informationSignalSetting) { informationSignalSetting.CleanUp(); } return(null); }
public static Information Parse(ref LibraryEditor_SpriteStudio6.Import.Setting setting, string nameFile, LibraryEditor_SpriteStudio6.Import.SSPJ.Information informationSSPJ ) { const string messageLogPrefix = "Parse SSQE"; Information informationSSQE = null; /* ".ssee" Load */ if (false == System.IO.File.Exists(nameFile)) { LogError(messageLogPrefix, "File Not Found", nameFile, informationSSPJ); goto Parse_ErrorEnd; } System.Xml.XmlDocument xmlSSQE = new System.Xml.XmlDocument(); xmlSSQE.Load(nameFile); /* Check Version */ System.Xml.XmlNode nodeRoot = xmlSSQE.FirstChild; nodeRoot = nodeRoot.NextSibling; KindVersion version = (KindVersion)(LibraryEditor_SpriteStudio6.Utility.XML.VersionGet(nodeRoot, "SpriteStudioSequencePack", (int)KindVersion.ERROR, true)); /* MEMO: Loose version check */ /* If you check strictly, there are a lot of datas that can not be imported. */ switch (version) { case KindVersion.ERROR: LogError(messageLogPrefix, "Version Invalid", nameFile, informationSSPJ); goto Parse_ErrorEnd; case KindVersion.CODE_010000: /* MEMO: Read all as Ver.1.01.00. */ version = KindVersion.CODE_010000; break; default: if (KindVersion.TARGET_EARLIEST > version) { version = KindVersion.TARGET_EARLIEST; if (true == setting.CheckVersion.FlagInvalidSSQE) { LogWarning(messageLogPrefix, "Version Too Early", nameFile, informationSSPJ); } } else { version = KindVersion.TARGET_LATEST; if (true == setting.CheckVersion.FlagInvalidSSQE) { LogWarning(messageLogPrefix, "Version Unknown", nameFile, informationSSPJ); } } break; } /* Create Information */ informationSSQE = new Information(); if (null == informationSSQE) { LogError(messageLogPrefix, "Not Enough Memory", nameFile, informationSSPJ); goto Parse_ErrorEnd; } informationSSQE.CleanUp(); informationSSQE.Version = version; /* Get Base-Directories */ LibraryEditor_SpriteStudio6.Utility.File.PathSplit(out informationSSQE.NameDirectory, out informationSSQE.NameFileBody, out informationSSQE.NameFileExtension, nameFile); /* Decode Tags */ System.Xml.NameTable nodeNameSpace = new System.Xml.NameTable(); System.Xml.XmlNamespaceManager managerNameSpace = new System.Xml.XmlNamespaceManager(nodeNameSpace); //string valueText = ""; informationSSQE.Name = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeRoot, "name", managerNameSpace); informationSSQE.ExportPath = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeRoot, "exportPath", managerNameSpace); System.Xml.XmlNodeList nodeList = null; nodeList = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeRoot, "sequenceList/sequence", managerNameSpace); if (null == nodeList) { informationSSPJ.TableNameSSQE = new string[0]; } else { /* MEMO: Nothing to do, now. */ } List <Library_SpriteStudio6.Data.Sequence.Data> listSequence = new List <Library_SpriteStudio6.Data.Sequence.Data>(); listSequence.Clear(); foreach (System.Xml.XmlNode nodeSequence in nodeList) { Library_SpriteStudio6.Data.Sequence.Data sequence = new Library_SpriteStudio6.Data.Sequence.Data(); sequence.Name = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeSequence, "name", managerNameSpace); sequence.Index = ValueTextToInt(LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeSequence, "index", managerNameSpace)); sequence.Type = ValueTextToSequenceType(LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeSequence, "type", managerNameSpace)); System.Xml.XmlNodeList nodeListValueSequence = null; nodeListValueSequence = LibraryEditor_SpriteStudio6.Utility.XML.ListGetNode(nodeSequence, "list/value", managerNameSpace); List <Library_SpriteStudio6.Data.Sequence.Data.Step> listDetail = new List <Library_SpriteStudio6.Data.Sequence.Data.Step>(); listDetail.Clear(); foreach (System.Xml.XmlNode nodeValue in nodeListValueSequence) { Library_SpriteStudio6.Data.Sequence.Data.Step dataStep = new Library_SpriteStudio6.Data.Sequence.Data.Step(); dataStep.NamePackAnimation = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeValue, "refAnimePack", managerNameSpace); dataStep.NameAnimation = LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeValue, "refAnime", managerNameSpace); dataStep.PlayCount = ValueTextToInt(LibraryEditor_SpriteStudio6.Utility.XML.TextGetNode(nodeValue, "repeatCount", managerNameSpace)); listDetail.Add(dataStep); } sequence.TableStep = listDetail.ToArray(); listSequence.Add(sequence); } informationSSQE.SequenceList = listSequence.ToArray(); return(informationSSQE); Parse_ErrorEnd :; return(null); }
/* ----------------------------------------------- Functions */ #region Functions public void CleanUp() { Version = (KindVersion)(-1); }