예제 #1
0
        /// <summary>
        /// Creates a new StageProject from a .stgprj file
        /// </summary>
        /// <param name="path">Path to the .stgproj file</param>
        public StageProject(string path, bool imagesScrambled = true)
        {
            string dir = Path.GetDirectoryName(path);

            string[] text = File.ReadAllLines(path);
            //Get paths from file
            foreach (var line in text)
            {
                if (line.Length <= 0)
                {
                    continue;
                }
                string[] parts    = line.Split(':');
                string   fullPath = Path.Combine(dir, parts[1]);
                switch (parts[0])
                {
                case "map":
                    MapPath = fullPath;
                    break;

                case "eve":
                    EntityPath = fullPath;
                    break;

                case "prt":
                    TilesetPath = fullPath;
                    break;

                case "att":
                    TilesetPropertiesPath = fullPath;
                    break;

                case "uni":
                    SpritesheetPath = fullPath;
                    break;
                }
            }
            //Load in valid ones
            if (!string.IsNullOrWhiteSpace(MapPath))
            {
                Map = new Map(MapPath !);
            }

            if (!string.IsNullOrWhiteSpace(EntityPath))
            {
                Entity = PXEVE.Read(EntityPath !);
            }

            if (!string.IsNullOrWhiteSpace(TilesetPath))
            {
                using (Bitmap b = new Bitmap(TilesetPath))
                    Tileset = imagesScrambled ? Scrambler.Unscramble(b) : new Bitmap(b);
            }

            if (!string.IsNullOrWhiteSpace(TilesetPropertiesPath))
            {
                TilesetProperties = new Map(TilesetPropertiesPath !);
            }

            if (!string.IsNullOrWhiteSpace(SpritesheetPath))
            {
                using (Bitmap b = new Bitmap(SpritesheetPath))
                    Spritesheet = imagesScrambled ? Scrambler.Unscramble(b) : new Bitmap(b);
            }
        }
예제 #2
0
        public string GetAnswerB(bool animate = false)
        {
            var scrambler = new Scrambler();

            return(scrambler.Unscramble("fbgdceah", File.ReadAllLines("Day21_input.txt")));
        }