public void Analyze() { Logger.LogAllLine("Analyze Scripts================>"); MissionScripts.Clear(); HeroScripts.Clear(); MonsterScripts.Clear(); SkillScripts.Clear(); BufferScripts.Clear(); { var files = SystemTool.GetDirectoryFiles(PathManager.InputMissionScriptPath); foreach (var scriptFile in files) { MissionScripts.Add(scriptFile.Name, false); } } { var files = SystemTool.GetDirectoryFiles(PathManager.InputHeroScriptPath); foreach (var scriptFile in files) { HeroScripts.Add(scriptFile.Name, false); } } { var files = SystemTool.GetDirectoryFiles(PathManager.InputMonsterScriptPath); foreach (var scriptFile in files) { MonsterScripts.Add(scriptFile.Name, false); } } { var files = SystemTool.GetDirectoryFiles(PathManager.InputSkillScriptPath); foreach (var scriptFile in files) { SkillScripts.Add(scriptFile.Name, false); } } { var files = SystemTool.GetDirectoryFiles(PathManager.InputBufferScriptPath); foreach (var scriptFile in files) { BufferScripts.Add(scriptFile.Name, false); } } //copy all scripts { var files = SystemTool.GetDirectoryFiles(PathManager.InputScriptPath); foreach (var scriptFile in files) { var resourceFile = new FileListFile(scriptFile, true, true); FileSystemGenerator.CopyFileToOutput(resourceFile); } } }
public void FilterImage(FileInfo info) { string dirName = info.Directory.Name; uint id = FileListFile.GetResourceOrder(info.Name); var resourceName = FileListFile.GetResourceName(info.Name); resourceName = resourceName.Replace(".png", string.Empty); if (info.FullName.Contains("Icon") && info.Directory.FullName.Contains("Art\\Images\\Other")) { if (dirName == resourceName) { var icons = GetIconDict(dirName); if (icons != null) { if (!icons.ContainsKey(id)) { icons.Add(id, false); } } } } else if (info.Directory.FullName.Contains("Art\\Images\\UI")) { if (!UIImages.ContainsKey(info.Name)) { UIImages.Add(info.Name, info); } } }
private void GetFileList(string path, string prefix) { var files = Directory.GetFiles(path); foreach (string file in files) { var fileInfo = new FileInfo(file); var resourceFile = new FileListFile(fileInfo); FileSystemGenerator.AddFileAndTag(resourceFile); Logger.LogInfoLine("{0}File: {1}", prefix, fileInfo.FullName); CopyAudio(resourceFile); } var dirs = Directory.GetDirectories(path); foreach (string dir in dirs) { var directoryInfo = new DirectoryInfo(dir); Logger.LogInfoLine("{0}Dir:\t{1}", prefix, directoryInfo.Name); GetFileList(dir, prefix + "\t"); } }
public static void AddLayerFile(FileListFile file) { if (!LayerFileDict.ContainsKey(file.FileInfo.Name)) { LayerFileDict[file.FileInfo.Name] = file; } }
private void CopyAudio(FileListFile audioFile) { var packageInfo = PublishInfo.GetPublishInfo(audioFile.FileInfo.FullName); if (packageInfo.IsPublish(PublishTarget.Current)) { string tempFilePath = PathManager.OutputPath + Path.AltDirectorySeparatorChar.ToString() + PathManager.AudioDirectoryName + Path.AltDirectorySeparatorChar.ToString() + audioFile.FileInfo.Name; audioFile.FileInfo.CopyTo(tempFilePath); } }
public static FileId ParseFrom(string fullName) { var data = new Medusa.CoreProto.FileId { Name = FileListFile.GetResourceName(fullName), Order = FileListFile.GetResourceOrder(fullName), Tag = PublishInfo.GetPublishInfo(fullName).Tag }; return(new FileId(data)); }
public void Analyze() { Logger.LogAllLine("Analyze config================>"); FileListFile fileListFile = new FileListFile(PathManager.InputConfigPaperConfigPath, true, true); FileSystemGenerator.CopyFileToOutput(fileListFile); fileListFile = new FileListFile(PathManager.InputConfigServerGameConfigPath, true, true); FileSystemGenerator.CopyFileToOutput(fileListFile); }
public void Analyze() { Logger.LogAllLine("Analyze Other================>"); var files = SystemTool.GetDirectoryFiles(PathManager.InputOtherPath); foreach (var animationFile in files) { var resourceFile = new FileListFile(animationFile); FileSystemGenerator.CopyFileToOutput(resourceFile); } }
public void Analyze() { Logger.LogAllLine("Analyze Audio================>"); var files = SystemTool.GetDirectoryFiles(PathManager.InputAudioPath); foreach (var file in files) { if (file.Extension == ".wav" || file.Extension == ".mp3") { var resourceFile = new FileListFile(file); FileSystemGenerator.CopyFileToOutput(resourceFile); } } }
public static void TryUpdate(FileCacheItem item) { if (mFileSystem == null) { return; } var resourceName = FileListFile.GetResourceName(item.path); var resourceOrder = FileListFile.GetResourceOrder(item.path); FileSystemOrderItem orderItem = null; foreach (var tagItems in mFileSystem.TagItems) { foreach (var fileSystemNameItem in tagItems.NameItems) { if (fileSystemNameItem.Name == resourceName) { foreach (var fileSystemOrderItem in fileSystemNameItem.OrderItems) { if (fileSystemOrderItem.Order == resourceOrder) { if (orderItem == null) { orderItem = fileSystemOrderItem; } else { return; } } } } } } if (orderItem != null) { item.TextureRect = orderItem.TextureRect; item.Offset = orderItem.Offset; Logger.LogInfoLine("FileCache FileSystem Hit:{0}", item.path); } }
public void Analyze() { StringTables.Clear(); mNameGroups.Clear(); Logger.LogAllLine("Analyze StringTable================>"); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Jet\4.0\Engines\Excel", true); reg.SetValue("TypeGuessRows", 0); var validNames = Enum.GetNames(typeof(PublishLanguages)); var tabelNames = ExcelHelper.GetExcelTableNames(PathManager.InputConfigStringTablePath.FullName); foreach (string tableName in tabelNames) { string pureTableName = tableName.Replace("$", String.Empty).Replace("'", String.Empty).Replace(TableName, String.Empty); bool isValidTable = validNames.Any(pureTableName.Contains); if (!isValidTable || !tableName.Contains(TableName)) { continue; } var table = ExcelHelper.LoadDataFromExcel(PathManager.InputConfigStringTablePath.FullName, tableName); string resourceName = tableName.Replace("$", String.Empty); var packageInfo = PublishInfo.GetPublishInfo(resourceName); var stringTable = GetOrCreateStringTable(packageInfo); foreach (DataRow row in table.Rows) { bool isValid = true; bool isAllNull = true; for (int i = 0; i < row.ItemArray.Length; i++) { if (row.IsNull(i)) { isValid = false; } else { isAllNull = false; } } if (isValid) { try { string name = Convert.ToString(row["name"]); uint order = Convert.ToUInt32(row["order"]); string str = Convert.ToString(row["value"]); string resultStr = ExcelHelper.ConvertToUTF8(str); Add(stringTable, name, order, resultStr); } catch (Exception ex) { Logger.LogErrorLine(ex.Message); ExcelHelper.PrintRow(row); } } else if (!isAllNull) { Logger.LogErrorLine("Invalid string table line:"); ExcelHelper.PrintRow(row); } } //print var stringTableResult = Parse(stringTable); if ((PublishTarget.Current.PublishInfo.Language & packageInfo.Language) == packageInfo.Language) { string tempPath = PathManager.OutputConfigPath + "/" + TableName + pureTableName + ".bin"; using (var file = File.Open(tempPath, FileMode.Create, FileAccess.ReadWrite)) { Serializer.Serialize(file, stringTableResult); Logger.LogAllLine("Generate:{0}", tempPath); } var resourceFile = new FileListFile(new FileInfo(tempPath), true, true); FileSystemGenerator.AddFileAndTag(resourceFile); } else { Logger.LogAllLine("Ignore:\t{0}", pureTableName); } } }
public void Analyze() { mUsedItemIds.Clear(); Logger.LogAllLine("Analyze ServerList================>"); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Jet\4.0\Engines\Excel", true); reg.SetValue("TypeGuessRows", 0); ServerList config = new ServerList(); var table = ExcelHelper.LoadDataFromExcel(PathManager.InputConfigServerConfigPath.FullName, PathManager.ServerListTableName); foreach (DataRow row in table.Rows) { bool isValid = true; bool isAllNull = true; for (int i = 0; i < row.ItemArray.Length; i++) { if (row.IsNull(i)) { isValid = false; } else { isAllNull = false; } } if (isValid) { try { var configItem = new ServerListItem(); configItem.Id = Convert.ToUInt32(row["Id"]); var serverUsages = ParseServerUsages(Convert.ToString(row["ServerUsages"])); configItem.ServerUsages.AddRange(serverUsages); foreach (var serverUsageItem in serverUsages) { if (!mUsedItemIds.ContainsKey(serverUsageItem.ServerId)) { mUsedItemIds.Add(serverUsageItem.ServerId, false); } } config.Items.Add(configItem); } catch (Exception ex) { Logger.LogErrorLine(ex.Message); ExcelHelper.PrintRow(row); } } else if (!isAllNull) { Logger.LogErrorLine("Invalid Server Config line:"); ExcelHelper.PrintRow(row); } } using (var file = PathManager.OutputConfigServerListPath.OpenWrite()) { Serializer.Serialize(file, config); } var resourceFile = new FileListFile(PathManager.OutputConfigServerListPath, true, true); FileSystemGenerator.AddFileAndTag(resourceFile); Logger.LogAllLine("Generate:\t{0}", PathManager.OutputConfigServerListPath); }
public void Analyze() { Logger.LogAllLine("Analyze FuckyString================>"); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Jet\4.0\Engines\Excel", true); reg.SetValue("TypeGuessRows", 0); var validNames = Enum.GetNames(typeof(PublishLanguages)); var tabelNames = ExcelHelper.GetExcelTableNames(PathManager.InputConfigStringTablePath.FullName); foreach (string tableName in tabelNames) { string pureTableName = tableName.Replace("$", String.Empty).Replace("'", String.Empty).Replace(TableName, String.Empty); bool isValidTable = validNames.Any(pureTableName.Contains); if (!isValidTable || !tableName.Contains(TableName)) { continue; } var table = ExcelHelper.LoadDataFromExcel(PathManager.InputConfigStringTablePath.FullName, tableName); string resourceName = tableName.Replace("$", String.Empty); var packageInfo = PublishInfo.GetPublishInfo(resourceName); SortedDictionary <char, MyFuckyStringNode> rootNodes = new SortedDictionary <char, MyFuckyStringNode>(); foreach (DataRow row in table.Rows) { bool isValid = true; bool isAllNull = true; for (int i = 0; i < row.ItemArray.Length; i++) { if (row.IsNull(i)) { isValid = false; } else { isAllNull = false; } } if (isValid) { try { string str = Convert.ToString(row["Value"]).Trim(); string resultStr = ExcelHelper.ConvertToUTF8(str); SortedDictionary <char, MyFuckyStringNode> nodes = rootNodes; var chars = resultStr.ToCharArray(); for (int i = 0; i < chars.Length; ++i) { MyFuckyStringNode node; if (!nodes.TryGetValue(chars[i], out node)) { node = new MyFuckyStringNode { Char = chars[i], IsFucky = i == chars.Length - 1 }; nodes.Add(chars[i], node); } nodes = node.Childs; if (!node.IsFucky) { node.IsFucky = i == chars.Length - 1; } } } catch (Exception ex) { Logger.LogErrorLine(ex.Message); ExcelHelper.PrintRow(row); } } else if (!isAllNull) { Logger.LogErrorLine("Invalid string table line:"); ExcelHelper.PrintRow(row); } } if ((PublishTarget.Current.PublishInfo.Language & packageInfo.Language) == packageInfo.Language) { var config = new FuckyString(); foreach (var fuckyStringNode in rootNodes) { FuckyStringNode node = new FuckyStringNode(); fuckyStringNode.Value.Fill(node); config.rootNodes.Add(node); } string tempPath = PathManager.OutputConfigPath + "/" + TableName + pureTableName + ".bin"; using (var file = File.Open(tempPath, FileMode.Create, FileAccess.ReadWrite)) { Serializer.Serialize(file, config); Logger.LogAllLine("Generate:{0}", tempPath); } var resourceFile = new FileListFile(new FileInfo(tempPath), true, true); FileSystemGenerator.AddFileAndTag(resourceFile); } else { Logger.LogAllLine("Ignore:\t{0}", pureTableName); } } }