当前位置: 首页>>代码示例>>C#>>正文


C# IFolder.GetContent方法代码示例

本文整理汇总了C#中IFolder.GetContent方法的典型用法代码示例。如果您正苦于以下问题:C# IFolder.GetContent方法的具体用法?C# IFolder.GetContent怎么用?C# IFolder.GetContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFolder的用法示例。


在下文中一共展示了IFolder.GetContent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MapStub

        public MapStub(IFolder container)
        {
            Container = container;
            var yaml = MiniYaml.FromStream(Container.GetContent("map.yaml"));
            FieldLoader.Load( this, new MiniYaml( null, yaml ) );

            Uid = Container.GetContent("map.uid").ReadAllText();
        }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:8,代码来源:MapStub.cs

示例2: MapStub

        public MapStub(IFolder package)
        {
            Package = package;
            var yaml = MiniYaml.FromStream(Package.GetContent("map.yaml"));
            FieldLoader.Load( this, new MiniYaml( null, yaml ) );

            Uid = Package.GetContent("map.uid").ReadAllText();
        }
开发者ID:pdovy,项目名称:OpenRA,代码行数:8,代码来源:MapStub.cs

示例3: MapStub

        public MapStub(IFolder package)
        {
            Package = package;
            var yaml = MiniYaml.FromStream(Package.GetContent("map.yaml"));
            FieldLoader.LoadFields(this, yaml, Fields);

            // Waypoints
            foreach (var wp in yaml["Waypoints"].Nodes)
            {
                string[] loc = wp.Value.Value.Split(',');
                Waypoints.Add(wp.Key, new int2(int.Parse(loc[0]), int.Parse(loc[1])));
            }

            Uid = Package.GetContent("map.uid").ReadAllText();
        }
开发者ID:mgatland,项目名称:OpenRA,代码行数:15,代码来源:MapStub.cs

示例4: MapStub

        public MapStub(string path)
        {
            Path = path;
            Container = FileSystem.OpenPackage(path, int.MaxValue);
            var yaml = MiniYaml.FromStream(Container.GetContent("map.yaml"));
            FieldLoader.Load( this, new MiniYaml( null, yaml ) );

            Bounds = Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y);
            Uid = ComputeHash();
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:10,代码来源:MapStub.cs

示例5: Map

        public Map(string path)
        {
            Path = path;
            container = FileSystem.OpenPackage(path, null, int.MaxValue);

            AssertExists("map.yaml");
            AssertExists("map.bin");

            var yaml = new MiniYaml(null, MiniYaml.FromStream(container.GetContent("map.yaml")));
            FieldLoader.Load(this, yaml);
            Uid = ComputeHash();

            // Support for formats 1-3 dropped 2011-02-11.
            // Use release-20110207 to convert older maps to format 4
            // Use release-20110511 to convert older maps to format 5
            if (MapFormat < 5)
                throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path));

            // Load players
            foreach (var kv in yaml.NodesDict["Players"].NodesDict)
            {
                var player = new PlayerReference(kv.Value);
                Players.Add(player.Name, player);
            }

            Actors = Lazy.New(() =>
            {
                var ret = new Dictionary<string, ActorReference>();
                foreach (var kv in yaml.NodesDict["Actors"].NodesDict)
                    ret.Add(kv.Key, new ActorReference(kv.Value.Value, kv.Value.NodesDict));
                return ret;
            });

            // Smudges
            Smudges = Lazy.New(() =>
            {
                var ret = new List<SmudgeReference>();
                foreach (var kv in yaml.NodesDict["Smudges"].NodesDict)
                {
                    var vals = kv.Key.Split(' ');
                    var loc = vals[1].Split(',');
                    ret.Add(new SmudgeReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), int.Parse(vals[2])));
                }

                return ret;
            });

            Rules = MiniYaml.NodesOrEmpty(yaml, "Rules");
            Sequences = MiniYaml.NodesOrEmpty(yaml, "Sequences");
            VoxelSequences = MiniYaml.NodesOrEmpty(yaml, "VoxelSequences");
            Weapons = MiniYaml.NodesOrEmpty(yaml, "Weapons");
            Voices = MiniYaml.NodesOrEmpty(yaml, "Voices");
            Notifications = MiniYaml.NodesOrEmpty(yaml, "Notifications");

            CustomTerrain = new string[MapSize.X, MapSize.Y];

            MapTiles = Lazy.New(() => LoadMapTiles());
            MapResources = Lazy.New(() => LoadResourceTiles());
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:59,代码来源:Map.cs

示例6: Map

        // The standard constructor for most purposes
        public Map(string path)
        {
            Path = path;
            Container = GlobalFileSystem.OpenPackage(path, null, int.MaxValue);

            AssertExists("map.yaml");
            AssertExists("map.bin");

            var yaml = new MiniYaml(null, MiniYaml.FromStream(Container.GetContent("map.yaml"), path));
            FieldLoader.Load(this, yaml);

            // Support for formats 1-3 dropped 2011-02-11.
            // Use release-20110207 to convert older maps to format 4
            // Use release-20110511 to convert older maps to format 5
            // Use release-20141029 to convert older maps to format 6
            if (MapFormat < 6)
                throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path));

            var nd = yaml.ToDictionary();

            // Format 6 -> 7 combined the Selectable and UseAsShellmap flags into the Class enum
            if (MapFormat < 7)
            {
                MiniYaml useAsShellmap;
                if (nd.TryGetValue("UseAsShellmap", out useAsShellmap) && bool.Parse(useAsShellmap.Value))
                    Visibility = MapVisibility.Shellmap;
                else if (Type == "Mission" || Type == "Campaign")
                    Visibility = MapVisibility.MissionSelector;
            }

            SpawnPoints = Exts.Lazy(() =>
            {
                var spawns = new List<CPos>();
                foreach (var kv in ActorDefinitions.Where(d => d.Value.Value == "mpspawn"))
                {
                    var s = new ActorReference(kv.Value.Value, kv.Value.ToDictionary());

                    spawns.Add(s.InitDict.Get<LocationInit>().Value(null));
                }

                return spawns.ToArray();
            });

            RuleDefinitions = MiniYaml.NodesOrEmpty(yaml, "Rules");
            SequenceDefinitions = MiniYaml.NodesOrEmpty(yaml, "Sequences");
            VoxelSequenceDefinitions = MiniYaml.NodesOrEmpty(yaml, "VoxelSequences");
            WeaponDefinitions = MiniYaml.NodesOrEmpty(yaml, "Weapons");
            VoiceDefinitions = MiniYaml.NodesOrEmpty(yaml, "Voices");
            NotificationDefinitions = MiniYaml.NodesOrEmpty(yaml, "Notifications");
            TranslationDefinitions = MiniYaml.NodesOrEmpty(yaml, "Translations");
            PlayerDefinitions = MiniYaml.NodesOrEmpty(yaml, "Players");

            ActorDefinitions = MiniYaml.NodesOrEmpty(yaml, "Actors");
            SmudgeDefinitions = MiniYaml.NodesOrEmpty(yaml, "Smudges");

            MapTiles = Exts.Lazy(LoadMapTiles);
            MapResources = Exts.Lazy(LoadResourceTiles);
            MapHeight = Exts.Lazy(LoadMapHeight);

            TileShape = Game.ModData.Manifest.TileShape;
            SubCellOffsets = Game.ModData.Manifest.SubCellOffsets;
            LastSubCell = (SubCell)(SubCellOffsets.Length - 1);
            DefaultSubCell = (SubCell)Game.ModData.Manifest.SubCellDefaultIndex;

            if (Container.Exists("map.png"))
                using (var dataStream = Container.GetContent("map.png"))
                    CustomPreview = new Bitmap(dataStream);

            PostInit();

            // The Uid is calculated from the data on-disk, so
            // format changes must be flushed to disk.
            // TODO: this isn't very nice
            if (MapFormat < 7)
                Save(path);

            Uid = ComputeHash();
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:79,代码来源:Map.cs

示例7: Map

		// Support upgrading format 5 maps to a more
		// recent version by defining upgradeForMod.
		public Map(string path, string upgradeForMod)
		{
			Path = path;
			Container = GlobalFileSystem.OpenPackage(path, null, int.MaxValue);

			AssertExists("map.yaml");
			AssertExists("map.bin");

			var yaml = new MiniYaml(null, MiniYaml.FromStream(Container.GetContent("map.yaml")));
			FieldLoader.Load(this, yaml);

			// Support for formats 1-3 dropped 2011-02-11.
			// Use release-20110207 to convert older maps to format 4
			// Use release-20110511 to convert older maps to format 5
			if (MapFormat < 5)
				throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path));

			// Format 5 -> 6 enforces the use of RequiresMod
			if (MapFormat == 5)
			{
				if (upgradeForMod == null)
					throw new InvalidDataException("Map format {0} is not supported, but can be upgraded.\n File: {1}".F(MapFormat, path));

				Console.WriteLine("Upgrading {0} from Format 5 to Format 6", path);

				// TODO: This isn't very nice, but there is no other consistent way
				// of finding the mod early during the engine initialization.
				RequiresMod = upgradeForMod;
			}

			var nd = yaml.ToDictionary();

			// Load players
			foreach (var my in nd["Players"].ToDictionary().Values)
			{
				var player = new PlayerReference(my);
				Players.Add(player.Name, player);
			}

			Actors = Exts.Lazy(() =>
			{
				var ret = new Dictionary<string, ActorReference>();
				foreach (var kv in nd["Actors"].ToDictionary())
					ret.Add(kv.Key, new ActorReference(kv.Value.Value, kv.Value.ToDictionary()));
				return ret;
			});

			// Smudges
			Smudges = Exts.Lazy(() =>
			{
				var ret = new List<SmudgeReference>();
				foreach (var name in nd["Smudges"].ToDictionary().Keys)
				{
					var vals = name.Split(' ');
					var loc = vals[1].Split(',');
					ret.Add(new SmudgeReference(vals[0], new int2(
							Exts.ParseIntegerInvariant(loc[0]),
							Exts.ParseIntegerInvariant(loc[1])),
							Exts.ParseIntegerInvariant(vals[2])));
				}

				return ret;
			});

			RuleDefinitions = MiniYaml.NodesOrEmpty(yaml, "Rules");
			SequenceDefinitions = MiniYaml.NodesOrEmpty(yaml, "Sequences");
			VoxelSequenceDefinitions = MiniYaml.NodesOrEmpty(yaml, "VoxelSequences");
			WeaponDefinitions = MiniYaml.NodesOrEmpty(yaml, "Weapons");
			VoiceDefinitions = MiniYaml.NodesOrEmpty(yaml, "Voices");
			NotificationDefinitions = MiniYaml.NodesOrEmpty(yaml, "Notifications");
			TranslationDefinitions = MiniYaml.NodesOrEmpty(yaml, "Translations");

			MapTiles = Exts.Lazy(() => LoadMapTiles());
			MapResources = Exts.Lazy(() => LoadResourceTiles());
			TileShape = Game.modData.Manifest.TileShape;

			// The Uid is calculated from the data on-disk, so
			// format changes must be flushed to disk.
			// TODO: this isn't very nice
			if (MapFormat < 6)
				Save(path);

			Uid = ComputeHash();

			if (Container.Exists("map.png"))
				CustomPreview = new Bitmap(Container.GetContent("map.png"));

			PostInit();
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:91,代码来源:Map.cs


注:本文中的IFolder.GetContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。