private static void KKChaFileCoordinateLoadHook(KoikatsuCharaFile.ChaFileCoordinate coordinate, BinaryReader br) { var originalPosition = br.BaseStream.Position; try { var marker = br.ReadString(); var version = br.ReadInt32(); var length = br.ReadInt32(); if (marker == Marker && version == DataVersion && length > 0) { var bytes = br.ReadBytes(length); var dictionary = MessagePackDeserialize <Dictionary <string, PluginData> >(bytes); _internalCoordinateImportDictionary.Set(coordinate, dictionary); } else { br.BaseStream.Position = originalPosition; } } catch (EndOfStreamException) { /* Incomplete/non-existant data */ br.BaseStream.Position = originalPosition; } catch (InvalidOperationException) { /* Invalid/unexpected deserialized data */ br.BaseStream.Position = originalPosition; } }
internal static void ConvertCoordinateFile(ChaFileCoordinate emcoorde, KoikatsuCharaFile.ChaFileCoordinate kkcoorde) { // Move data from import dictionary to normal dictionary before the imported cards are saved so the imported data is written var result = _internalCoordinateImportDictionary.Get(kkcoorde); if (result != null) { CoordinateImportEvent(result); internalCoordinateDictionary.Set(emcoorde, result); } }
public override void CoordinateConvert_Load(string path, POINT pos) { KoikatsuCharaFile.ChaFileCoordinate kkcoord = new KoikatsuCharaFile.ChaFileCoordinate(); kkcoord.LoadFile(path, false); ChaFileCoordinate container = new ChaFileCoordinate(); ConvertChaFile.ConvertCoordinateFile(container, kkcoord); var filepath = GetTempPath(true); container.SaveFile(filepath, (int)GameSystem.Instance.language); Coordinate_Load(filepath, pos); File.Delete(filepath); }