Esempio n. 1
0
        public SplitEventEditor(IEventWork <T> block, IEnumerable <string> work, IEnumerable <string> flag)
        {
            Block = block;
            // load lines
            var worklines = work.Where(z => !string.IsNullOrWhiteSpace(z) && z.Length > 5);

            Work = EventWorkUtil.GetVars(worklines, (index, t, data) => new EventWork <T>(index, t, data));
            var flaglines = flag.Where(z => !string.IsNullOrWhiteSpace(z) && z.Length > 5);

            Flag = EventWorkUtil.GetVars(flaglines, (index, t, data) => new EventFlag(index, t, data));

            // initialize lines
            foreach (var g in Work)
            {
                foreach (var item in g.Vars)
                {
                    item.RawIndex = block.GetWorkRawIndex(item.Type, item.RelativeIndex);
                    ((EventWork <T>)item).Value = block.GetWork(item.RawIndex);
                }
            }
            foreach (var g in Flag)
            {
                foreach (var item in g.Vars)
                {
                    item.RawIndex          = block.GetFlagRawIndex(item.Type, item.RelativeIndex);
                    ((EventFlag)item).Flag = block.GetFlag(item.RawIndex);
                }
            }
        }
Esempio n. 2
0
        protected override void Diff(SaveFile s1, SaveFile s2)
        {
            if (!SanityCheckSaveInfo(s1, s2))
            {
                return;
            }

            EventWorkUtil.DiffSavesFlag(((SAV7b)s1).EventWork, ((SAV7b)s2).EventWork, SetFlags, ClearedFlags);
            EventWorkUtil.DiffSavesWork(((SAV7b)s1).EventWork, ((SAV7b)s2).EventWork, WorkChanged, WorkDiff);
            S1 = s1;
        }