Exemple #1
0
        private static Resource LoadContent(string path)
        {
            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                return(null);
            }

            Log.Core.Write("Loading Ressource '{0}'...", path);
            Log.Core.PushIndent();

            // Load the Resource and register it
            Resource res = Resource.Load <Resource>(path, r =>
            {
                // Registering takes place in the callback - before initializing the Resource, because
                // that may result in requesting more Resources and an infinite loop if two Resources request
                // each other in their initialization code.
                if (r != null)
                {
                    AddContent(path, r);
                }
            });

            Log.Core.PopIndent();
            return(res);
        }
Exemple #2
0
        private static Resource LoadContent(string path)
        {
            if (DualityApp.ExecContext == DualityApp.ExecutionContext.Terminated)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(path) || IsDefaultContentPath(path) || !FileOp.Exists(path))
            {
                return(null);
            }

            Console.WriteLine("Loading Resource '{0}'", path);
            //Log.Core.PushIndent();

            // Load the Resource and register it
            Resource res = Resource.Load <Resource>(path, r => {
                // Registering takes place in the callback - before initializing the Resource, because
                // that may result in requesting more Resources and an infinite loop if two Resources request
                // each other in their initialization code.
                if (r != null)
                {
                    AddContent(path, r);
                }
            });

            //Log.Core.PopIndent();
            return(res);
        }