Exemple #1
0
 /// <summary>
 /// Initialize a GameState to a level as defined by the level model.
 /// </summary>
 /// <param name="stack"></param>
 /// <param name="level"></param>
 public GameState(GameStateStack stack, SharedContent.LevelModel level)
     : this(stack)
 {
     foreach (SharedContent.CreepSpawner spawner in level.SpawnPoints)
         nonInteractives.Add(new Entity(spawner, Resources.res.content));
     gameObjectives.Add(Resources.getPrototype(level.GameObjectiveAsset));
     leveltime = leveltimeleft = level.Duration;
 }
        private void ReadXmlContents(XmlReader reader)
        {
            string startElement = reader.Name;

            Debug.Assert(String.Equals(startElement, "contents"));

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (!reader.IsEmptyElement && String.Equals(reader.Name, "content",
                                                                StringComparison.OrdinalIgnoreCase))
                    {
                        switch (reader.GetAttribute("type").ToLower())
                        {
                        case "shared":
                            if (_sharedContent == null)
                            {
                                _sharedContent = new SharedContent();
                            }
                            if (reader.ReadToDescendant(SharedContent.TagName))
                            {
                                _sharedContent.ReadXml(reader);
                            }
                            break;

                        case "include":
                            if (_includeContent == null)
                            {
                                _includeContent = new IncludeContent();
                            }
                            if (reader.ReadToDescendant(IncludeContent.TagName))
                            {
                                _includeContent.ReadXml(reader);
                            }
                            break;
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, startElement, StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
        private SharedContent InsertSharedContent(string name, Table dataTable, string graph = constants.publish)
        {
            SharedContent newItem = dataTable.CreateInstance <SharedContent>();

            newItem.uri = context.GenerateUri(name, graph);
            String cypher = CypherHelper.GenerateCypher <SharedContent>(newItem, name);

            var response = context.GetGraphConnection(graph).ExecuteTableQuery(cypher, null);

            context.StoreUri(newItem.uri, string.Empty, name, newItem, TeardownOption.Graph);
            context.StoreToken($"__URI{context.GetNumberOfStoredUris()}__", newItem.uri);
            return(newItem);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class
        /// with parameters copied from the specified instance of the
        /// <see cref="BuildEngineSettings"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="BuildEngineSettings"/> class from which the
        /// initialization parameters or values will be copied.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the parameter <paramref name="source"/> is <see langword="null"/>.
        /// </exception>
        protected BuildEngineSettings(BuildEngineSettings source)
            : base(source)
        {
            _engineName = source._engineName;
            _engineType = source._engineType;
            _properties = source._properties;

            _sharedContent  = source._sharedContent;
            _includeContent = source._includeContent;

            _configurations                = source._configurations;
            _pluginConfigurations          = source._pluginConfigurations;
            _componentConfigurations       = source._componentConfigurations;
            _pluginComponentConfigurations = source._pluginComponentConfigurations;
        }
        /// <overloads>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class.
        /// </overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class
        /// with the default parameters.
        /// </summary>
        /// <param name="name">
        /// The name uniquely identifying this engine settings.
        /// </param>
        /// <param name="engineType">
        /// The engine type implementing this settings.
        /// </param>
        protected BuildEngineSettings(string name, BuildEngineType engineType)
        {
            BuildExceptions.NotNullNotEmpty(name, "name");

            _engineName     = name;
            _engineType     = engineType;
            _properties     = new BuildProperties();
            _sharedContent  = new SharedContent(_engineType.ToString());
            _includeContent = new IncludeContent(_engineType.ToString());

            _configurations                = new BuildConfigurationList(_engineType);
            _pluginConfigurations          = new BuildConfigurationList(_engineType);
            _componentConfigurations       = new BuildComponentConfigurationList(_engineType);
            _pluginComponentConfigurations = new BuildComponentConfigurationList(_engineType);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            MarkdownGenerator markdownGenerator = new MarkdownGenerator();
            SharedContent     sharedContent     = new SharedContent();

            MetricsGenerator metricsGenerator = new MetricsGenerator(sharedContent);

            metricsGenerator.Generate();

            ConfigGenerator configGenerator = new ConfigGenerator(sharedContent);

            configGenerator.Generate();

            RpcAndCliGenerator rpcAndCliGenerator = new RpcAndCliGenerator(markdownGenerator, sharedContent);

            rpcAndCliGenerator.Generate();

            SampleConfigGenerator sampleConfigGenerator = new SampleConfigGenerator(markdownGenerator, sharedContent);

            sampleConfigGenerator.Generate();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            MarkdownGenerator markdownGenerator = new MarkdownGenerator();
            SharedContent     sharedContent     = new SharedContent();

            JsonRpcGenerator rpcGenerator = new JsonRpcGenerator(markdownGenerator, sharedContent);

            rpcGenerator.Generate();

            CliGenerator cliGenerator = new CliGenerator(markdownGenerator, sharedContent);

            cliGenerator.Generate();

            MetricsGenerator metricsGenerator = new MetricsGenerator(sharedContent);

            metricsGenerator.Generate();

            ConfigGenerator configGenerator = new ConfigGenerator(sharedContent);

            configGenerator.Generate();
        }
        public ActionResult EventShare(ShareFormDL shareForm)
        {
            SharedContent sc       = new SharedContent();
            var           FindUser = context.Users.Where(x => x.PhoneNumber == shareForm.PhoneNumber &&
                                                         x.UserID == shareForm.UserID
                                                         ).FirstOrDefault();

            if (ModelState.IsValid && FindUser != null)
            {
                sc.EventID          = (int)TempData["EventID"];
                sc.UserID           = (int)Session["UserId"];
                sc.SharedWithUserID = shareForm.UserID;
                context.SharedContents.Add(sc);
                context.SaveChanges();

                return(RedirectToAction("Event"));
            }
            if (ModelState.IsValid && FindUser == null)
            {
                ViewBag.ValidationError = "You Entered wrong user id or password";
            }
            return(View("EventShare"));
        }
Exemple #9
0
 public static GameState Create(GameStateStack stack, SharedContent.LevelModel level, List<Entity> players)
 {
     GameState ret = new GameState(stack, level);
     foreach (Entity player in players)
         ret.addPlayer(player);
     return ret;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SharedContentConfigurator"/> class.
 /// </summary>
 public SharedContentConfigurator()
 {
     _ruleContent   = new RuleContent();
     _sharedContent = new SharedContent();
     _configContent = new ConfiguratorContent();
 }
        // look up shared content
        protected override string GetContent(string key, string[] parameters)
        {
            if (String.IsNullOrEmpty(key) || _settings == null)
            {
                return(base.GetContent(key, parameters));
            }

            bool       isFound = false;
            string     value   = String.Empty;
            SharedItem item    = null;

            if (_sharedContent != null && _sharedContent.Count > 0)
            {
                item = _sharedContent[key];
                if (item != null)
                {
                    isFound = true;
                    value   = item.Value;
                }
            }

            // 2. Consider the shared contents from the groups...
            if (item == null)
            {
                BuildEngineSettings engineSettings =
                    _settings.EngineSettings[_engineType];

                if (engineSettings != null)
                {
                    SharedContent shared = engineSettings.SharedContent;
                    if (shared != null && shared.Count != 0)
                    {
                        item = shared[key];
                        if (item != null)
                        {
                            isFound = true;
                            value   = item.Value;
                        }
                    }
                }
            }

            // 3. If not found, consider a common/default contents....
            if (item == null)
            {
                SharedContent shared = _settings.SharedContent;
                if (shared != null && shared.Count != 0)
                {
                    item = shared[key];
                    if (item != null)
                    {
                        isFound = true;
                        value   = item.Value;
                    }
                }
            }

            if (isFound)
            {
                if (parameters != null && parameters.Length != 0)
                {
                    try
                    {
                        value = String.Format(value, parameters);
                    }
                    catch
                    {
                        LogMessage(BuildLoggerLevel.Error, String.Format(
                                       "The shared content item '{0}' could not be formatted with {1} parameters.",
                                       key, parameters.Length));
                    }
                }

                return(value);
            }

            return(base.GetContent(key, parameters));
        }