示例#1
0
        internal override void OnFiles(List <string> aFiles, POINT aPos)
        {
            var goodFiles = aFiles.Where(x => {
                var ext = Path.GetExtension(x).ToLower();
                return(ext == ".png");
            });

            if (goodFiles.Count() == 0)
            {
                Logger.LogMessage("No files to handle");
                return;
            }

            if (CardHandlerMethods.GetActiveCardHandler(out var cardHandler))
            {
                foreach (var file in goodFiles)
                {
                    var bytes = File.ReadAllBytes(file);

                    if (BoyerMoore.ContainsSequence(bytes, CharaToken, out var index))
                    {
                        var sex = new BoyerMoore(SexToken).Search(bytes, index)
                                  .Select(i => bytes[i + SexToken.Length])
                                  .First(b => b == 0 || b == 1);
                        cardHandler.Character_Load(file, aPos, sex);
                    }
                    else if (BoyerMoore.ContainsSequence(bytes, KoiCharaToken, out index))
                    {
                        var sex = new BoyerMoore(SexToken).Search(bytes, index)
                                  .Select(i => bytes[i + SexToken.Length])
                                  .First(b => b == 0 || b == 1);
                        cardHandler.CharacterConvert_Load(file, aPos, sex);
                    }
                    else if (BoyerMoore.ContainsSequence(bytes, CoordinateToken))
                    {
                        cardHandler.Coordinate_Load(file, aPos);
                    }
                    else if (BoyerMoore.ContainsSequence(bytes, KoiCoordinateToken))
                    {
                        cardHandler.CoordinateConvert_Load(file, aPos);
                    }
                    else
                    {
                        Logger.LogMessage("This file does not contain any EmotionCreators related data");
                    }
                }
            }
            else
            {
                Logger.LogMessage("No handler found for this scene");
            }
        }