public void Main()
        {
            Setting.EnableLoopCommandUnrolling = true;
            var loop_unrolled_objects = StoryboardParserHelper.GetStoryboardObjects(file_path).Where(x => x.ContainLoop).ToList();

            Setting.EnableLoopCommandUnrolling = false;
            var normal_objects = StoryboardParserHelper.GetStoryboardObjects(file_path).Where(x => x.ContainLoop);

            var object_pair = from a in loop_unrolled_objects
                              join b in normal_objects on a.FileLine equals b.FileLine
                              select(a, b);

            int count = 0;

            foreach (var(a, b) in object_pair)
            {
                Utils.ExecuteComparer.CompareStoryboardObjects(a, b);
                count++;
            }

            Assert.AreEqual(count, normal_objects.Count());
            Assert.AreEqual(count, loop_unrolled_objects.Count());
        }
Esempio n. 2
0
        public static StoryboardInstance Load(BeatmapFolderInfoEx info)
        {
            StoryboardInstance instance = new StoryboardInstance();

            instance.Info = info;

            using (StopwatchRun.Count("Load and Parse osb/osu file"))
            {
                List <StoryboardObject> temp_objs_list = new List <StoryboardObject>(), parse_osb_Storyboard_objs = new List <StoryboardObject>();

                //get objs from osu file
                List <StoryboardObject> parse_osu_Storyboard_objs = string.IsNullOrWhiteSpace(info.osu_file_path) ? new List <StoryboardObject>() : StoryboardParserHelper.GetStoryboardObjects(info.osu_file_path);
                AdjustZ(parse_osu_Storyboard_objs);

                if ((!string.IsNullOrWhiteSpace(info.osb_file_path)) && File.Exists(info.osb_file_path))
                {
                    parse_osb_Storyboard_objs = StoryboardParserHelper.GetStoryboardObjects(info.osb_file_path);
                    AdjustZ(parse_osb_Storyboard_objs);
                }

                temp_objs_list = CombineStoryboardObjects(parse_osb_Storyboard_objs, parse_osu_Storyboard_objs);

                void AdjustZ(List <StoryboardObject> list)
                {
                    list.Sort((a, b) => (int)(a.FileLine - b.FileLine));
                }

                List <StoryboardObject> CombineStoryboardObjects(List <StoryboardObject> osb_list, List <StoryboardObject> osu_list)
                {
                    List <StoryboardObject> result = new List <StoryboardObject>();

                    Add(Layer.Background);
                    Add(Layer.Fail);
                    Add(Layer.Pass);
                    Add(Layer.Foreground);
                    Add(Layer.Overlay);

                    int z = 0;

                    foreach (var obj in result)
                    {
                        obj.Z = z++;
                    }

                    return(result);

                    void Add(Layer layout)
                    {
                        result.AddRange(osu_list.Where(x => x.layer == layout));//先加osu
                        result.AddRange(osb_list.Where(x => x.layer == layout).Select(x =>
                        {
                            x.FromOsbFile = true;
                            return(x);
                        }));//后加osb覆盖
                    }
                }

                instance.Updater = new StoryboardUpdater(temp_objs_list);
            }

            return(instance);
        }
Esempio n. 3
0
        private void GenerateOsbin(string file_path, Feature feature)
        {
            objectsA = StoryboardParserHelper.GetStoryboardObjects(file_path);

            StoryboardBinaryFormatter.Serialize(feature, objectsA, stream);
        }
Esempio n. 4
0
        private void GenerateCompressionOsbin(string file_path, int v)
        {
            objectsA = StoryboardParserHelper.GetStoryboardObjects(file_path);

            StoryboardBinaryFormatter.ZipSerialize(0, objectsA, stream);
        }