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 Pack(PublishTarget target) { if (target.IsOptimzed) { Optimze(); } Logger.LogInfoLine("Packing:"); var merger = new ImageMerger(); foreach (var imageGroup in ImageGroups) { if (imageGroup.Value.Count > 1 || PublishTarget.Current.IsPVR) { var resultImages = merger.Generate(imageGroup.Key, imageGroup.Value); foreach (var resultImage in resultImages) { resultImage.Key.Save(); resultImage.Key.TryConvertSelfToPVR(); uint id = FileSystemGenerator.AddFileAndTag(resultImage.Key); if (id != uint.MaxValue) { foreach (var subImage in resultImage.Value.UsedImages) { FileSystemGenerator.AddImageTagItem(subImage, id); } } } } else { if (imageGroup.Value.Count > 0) { imageGroup.Value[0].IsPacked = false; } //FileSystemGenerator.AddFileAndTag(imageGroup.Value[0]); } OnPackingProgressEvent(1); } foreach (var image in Images) { if (!image.Key.IsPacked) { FileSystemGenerator.CopyFileToOutput(image.Key); } else { if (!PublishTarget.Current.IsPack) { Logger.LogErrorLine("Lose file:{0}", image.Key.FileInfo.FullName); } } } }
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); } } }