示例#1
0
        public override bool Run(string[] args)
        {
            Byt3.ADL.Debug.DefaultInitialization();
            EmbeddedFileIOManager.Initialize();

            OpenFLDebugConfig.Settings.MinSeverity = Verbosity.Level3;

            ManifestReader.RegisterAssembly(Assembly
                                            .GetExecutingAssembly());            //Register this assembly(where the files will be embedded in)
            ManifestReader.RegisterAssembly(typeof(OpenFLDebugConfig).Assembly); //Register the OpenFL.Common Assembly as it contains the CL kernels
            ManifestReader.PrepareManifestFiles(false);                          //First Read Assembly files
            ManifestReader
            .PrepareManifestFiles(true);                                         //Replace Any Loaded assembly files with files on the file system.


            if (IOManager.FileExists("assemblyList.txt")) //Alternative, load assembly list to register from text file.
            {
                Logger.Log(DebugChannel.Log, "Loading Assembly List", 1);

                ManifestReader.LoadAssemblyListFromFile("assemblyList.txt");
            }


            GameEngine engine = new GameEngine(EngineSettings.DefaultSettings);

            engine.Initialize();
            engine.InitializeScene <HoBMenuScene>();
            engine.Run();
            engine.Dispose();

            HandleBase.DisposeAllHandles();
            EngineStatisticsManager.DisposeAllHandles();

            return(true);
        }
示例#2
0
        public ActionResult Map(string applicationName, string artifactid, string version)
        {
            Manifest manifest = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);

            BizTalkInstallation installation = InstallationReader.GetBizTalkInstallation(manifest);

            BizTalkApplication application = installation.Applications[applicationName];

            Transform transform = application.Maps[artifactid];

            var breadCrumbs = new List <BizTalkBaseObject>
            {
                application,
                transform
            };

            return(View(new TransformViewModel(
                            application,
                            ManifestReader.GetAllManifests(Request.PhysicalApplicationPath),
                            manifest,
                            breadCrumbs,

                            installation.Applications.Values,
                            installation.Hosts.Values,
                            transform)));
        }
示例#3
0
        private ManifestReader CreateManifestReader()
        {
            ManifestReader reader = new ManifestReader();

            reader.VersionProvider = versionProvider.Object;
            return(reader);
        }
示例#4
0
        public override bool Run(string[] args)
        {
            ADL.Debug.DefaultInitialization();
            EmbeddedFileIOManager.Initialize();

            ManifestReader.RegisterAssembly(Assembly
                                            .GetExecutingAssembly()); //Register this assembly(where the files will be embedded in)
            ManifestReader.PrepareManifestFiles(false);               //First Read Assembly files
            ManifestReader
            .PrepareManifestFiles(true);                              //Replace Any Loaded assembly files with files on the file system.


            if (IOManager.FileExists("assemblyList.txt")) //Alternative, load assembly list to register from text file.
            {
                Logger.Log(DebugChannel.Log, "Loading Assembly List", 1);

                ManifestReader.LoadAssemblyListFromFile("assemblyList.txt");
            }


            GameEngine engine = new GameEngine(EngineSettings.DefaultSettings);

            engine.Initialize();
            engine.InitializeScene <PhysicsDemoScene>();
            engine.Run();
            engine.Dispose();

            HandleBase.DisposeAllHandles();
            EngineStatisticsManager.DisposeAllHandles();

            return(true);
        }
示例#5
0
        public ActionResult Assembly(string applicationName, string artifactid, string version)
        {
            Manifest manifest = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);

            BizTalkInstallation installation = InstallationReader.GetBizTalkInstallation(manifest);

            BizTalkApplication application = installation.Applications[applicationName];

            BizTalkAssembly assembly = application.Assemblies[artifactid];

            var breadCrumbs = new List <BizTalkBaseObject>
            {
                application,
                assembly
            };

            return(View(new AssemblyViewModel(
                            application,
                            ManifestReader.GetAllManifests(Request.PhysicalApplicationPath),
                            manifest,
                            breadCrumbs,

                            installation.Applications.Values,
                            installation.Hosts.Values,
                            assembly)));
        }
示例#6
0
        public ActionResult SendPortGroup(string applicationName, string artifactid, string version)
        {
            Manifest manifest = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);

            BizTalkInstallation installation = InstallationReader.GetBizTalkInstallation(manifest);

            BizTalkApplication application = installation.Applications[applicationName];

            SendPortGroup sendPortGroup = application.SendPortGroups[artifactid];

            var breadCrumbs = new List <BizTalkBaseObject>
            {
                application,
                sendPortGroup
            };

            return(View(new SendPortGroupViewModel(
                            application,
                            ManifestReader.GetAllManifests(Request.PhysicalApplicationPath),
                            manifest,
                            breadCrumbs,

                            installation.Applications.Values,
                            installation.Hosts.Values,
                            sendPortGroup)));
        }
示例#7
0
        public void ShouldCreateTasksWithCorrectExecutionOrder()
        {
            // Arrange
            ManifestReader reader = this.CreateManifestReader();

            Mock <IDatabaseTaskFactory> factory = new Mock <IDatabaseTaskFactory>();
            Mock <IDatabaseTask>        task    = new Mock <IDatabaseTask>();

            factory.Setup(f => f.CanCreate(It.IsAny <XElement>())).Returns(true);
            factory.Setup(f => f.Create(It.IsAny <XElement>(), It.IsAny <int>(), It.IsAny <IDatabaseVersion>())).Returns(task.Object);

            reader.Factories = new[] { factory.Object };

            // Act
            IDatabaseVersion version = reader.Read(GetManifest(), ManifestPath, this.databaseArchive.Object);

            // Assert
            int expectedOrder = 0;

            foreach (IDatabaseTask createdTask in version.Tasks)
            {
                factory.Verify(f => f.Create(It.IsAny <XElement>(), expectedOrder, It.IsAny <IDatabaseVersion>()));
                expectedOrder++;
            }
        }
示例#8
0
        public ActionResult ReceivePort(string applicationName, string artifactid, string version)
        {
            Manifest manifest = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);

            BizTalkInstallation installation = InstallationReader.GetBizTalkInstallation(manifest);

            BizTalkApplication application = installation.Applications[applicationName];

            ReceivePort receivePort = application.ReceivePorts[artifactid];

            var breadCrumbs = new List <BizTalkBaseObject>
            {
                application,
                receivePort
            };

            return(View(new ReceivePortViewModel(
                            application,
                            ManifestReader.GetAllManifests(Request.PhysicalApplicationPath),
                            manifest,
                            breadCrumbs,

                            installation.Applications.Values,
                            installation.Hosts.Values,
                            receivePort)));
        }
示例#9
0
 private static void LoadEmbeddedFiles()
 {
     ManifestReader.RegisterAssembly(Assembly.GetExecutingAssembly());
     ManifestReader.RegisterAssembly(typeof(OpenFLBenchmarks).Assembly);
     ManifestReader.RegisterAssembly(typeof(KernelFLInstruction).Assembly);
     ManifestReader.PrepareManifestFiles(false);
     EmbeddedFileIOManager.Initialize();
 }
示例#10
0
        public void LoadAssembly(String asm)
        {
            if (!File.Exists(asm))
            {
                throw new Exception(String.Format("Assembly file '{0}' does not exist! Load failed.", asm));
            }

            String extension = Path.GetExtension(asm).ToLower();

            if (extension == ".pe")
            {
                _emulatorNative.LoadPE(asm);
            }
            else if (extension == ".dat")
            {
                _emulatorNative.LoadDatabase(asm);
            }
            else if (extension == ".manifest" || extension == ".exe" || extension == ".dll")
            {
                String manifestPath = asm;

                if (extension == ".exe" || extension == ".dll")
                {
                    manifestPath += ".manifest";
                }

                if (!File.Exists(manifestPath))
                {
                    throw new Exception(String.Format("Manifest file '{0}' does not exist! Load failed.", manifestPath));
                }

                Manifest manifest = ManifestReader.ReadManifest(manifestPath, false);

                String manifestDirectoryPath = Path.GetDirectoryName(manifestPath);
                String exePePath             = FullPathToPe(manifestDirectoryPath, manifest.EntryPoint.TargetPath);

                foreach (AssemblyReference ar in manifest.AssemblyReferences)
                {
                    if (ar.AssemblyIdentity.Name == "Microsoft.Windows.CommonLanguageRuntime")
                    {
                        continue; // the manifest will always include the desktop CLR, which we will to ignore.
                    }
                    String pePath = FullPathToPe(manifestDirectoryPath, ar.TargetPath);
                    if (pePath == exePePath) // Skip this one for now to do last
                    {
                        continue;
                    }

                    LoadAssembly(pePath);
                }

                LoadAssembly(exePePath);
            }
            else
            {
                throw new Exception("Unrecognized assembly format: " + asm);
            }
        }
示例#11
0
        /// <summary>
        /// Public constructor
        /// </summary>
        /// <param name="settings">Settings to be used</param>
        public GameEngine(EngineSettings settings) : base(EngineDebugConfig.Settings)
        {
            if (settings != null)
            {
                SetSettings(settings);
            }

            ManifestReader.RegisterAssembly(Assembly.GetExecutingAssembly());
        }
示例#12
0
        /// <summary>
        /// Validate the manifest. Errors and warnings are returned in the results
        /// </summary>
        /// <param name="manifestReader">The <c>ManifestReader</c> to validate.</param>
        public static void Validate(ManifestReader manifestReader)
        {
            if (manifestReader == null)
            {
                throw new ArgumentNullException("reader");
            }

            ValidateNode(manifestReader);
        }
示例#13
0
 private static void InitializeResourceSystem()
 {
     TypeAccumulator.RegisterAssembly(typeof(OpenFLDebugConfig).Assembly);
     ManifestReader.RegisterAssembly(Assembly.GetExecutingAssembly());
     ManifestReader.RegisterAssembly(typeof(FLRunner).Assembly);
     ManifestReader.PrepareManifestFiles(false);
     ManifestReader.PrepareManifestFiles(true);
     EmbeddedFileIOManager.Initialize();
 }
示例#14
0
        static void Main(string[] args)
        {
            GameEngine ge = new GameEngine(EngineSettings.DefaultSettings);

            ManifestReader.PrepareManifestFiles(true);
            ManifestReader.PrepareManifestFiles(false);
            ge.Initialize();
            ge.InitializeScene <AudioScene>();
            ge.Run();
        }
示例#15
0
        public void ShouldThrowExceptionIfManifestStreamIsNull()
        {
            // Arrange
            ManifestReader reader = this.CreateManifestReader();

            // Act
            Exception exception = Record.Exception(() => reader.Read(null, ManifestPath, databaseArchive.Object));

            // Assert
            Assert.IsType <ArgumentNullException>(exception);
        }
        void Initialize()
        {
            IsNonELearning = PackageValidator.ValidateIsELearning(reader).HasErrors;

            if (IsNonELearning == false)
            {
                ValidatePackage();

                ManifestReader     manifestReader = new ManifestReader(reader, new ManifestReaderSettings(true, true));
                MetadataNodeReader metadataReader = manifestReader.Metadata;

                // set <title> to the title to display for the package, using these rules:
                //   1. if there's a Title column value, use it;
                //   2. otherwise, if there's a title specified in the package metadata, use it;
                //   3. otherwise, use the file name without the extension
                if (String.IsNullOrEmpty(file.Title) == false)
                {
                    Title = file.Title;
                }
                else
                {
                    string titleFromMetadata = metadataReader.GetTitle(culture.Culture);
                    if (string.IsNullOrEmpty(titleFromMetadata) == false)
                    {
                        Title = titleFromMetadata;
                    }
                    else
                    {
                        Title = System.IO.Path.GetFileNameWithoutExtension(file.Name);
                    }
                }

                // set description to the package description specified in metadata, or null if none
                IList <string> descriptions = metadataReader.GetDescriptions(culture.Culture);
                if (descriptions.Count > 0)
                {
                    Description = descriptions[0];
                    if (Description == null)
                    {
                        Description = string.Empty;
                    }
                }
                else
                {
                    Description = string.Empty;
                }

                // populate the drop-down list of organizations; hide the entire row containing that
                // drop-down if there's only one organization
                Organizations         = manifestReader.Organizations;
                DefaultOrganizationId = manifestReader.DefaultOrganization.Id;
                PackageFormat         = manifestReader.PackageFormat;
            }
        }
示例#17
0
        public void ShouldThrowExceptionIfDatabaseArchiveIsNull()
        {
            // Arrange
            ManifestReader reader = this.CreateManifestReader();

            // Act
            Exception exception = Record.Exception(() => reader.Read(GetManifest(), ManifestPath, null));

            // Assert
            Assert.IsType <ArgumentNullException>(exception);
        }
示例#18
0
        public void ShouldSetManifestPath()
        {
            // Arrange
            ManifestReader reader = this.CreateManifestReader();

            // Act
            IDatabaseVersion version = reader.Read(GetManifest(), ManifestPath, databaseArchive.Object);

            // Assert
            Assert.Equal(ManifestPath, version.ManifestPath);
        }
示例#19
0
 /// <summary>
 /// Reads the deploy manifest.
 /// </summary>
 /// <param name="ManifestFileName">Name of the manifest file.</param>
 /// <returns></returns>
 internal static DeployManifest ReadDeployManifest(string ManifestFileName)
 {
     if ((new FileInfo(ManifestFileName)).Exists)
     {
         Manifest mm = ManifestReader.ReadManifest(ManifestFileName, false);
         return(mm as DeployManifest);
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// Loads specified app manifest and populates the manifest variable
        /// </summary>
        /// <param name="assemManifestPath">Path to the app manifest to load</param>
        /// <returns>Application manifest reference</returns>
        public static ApplicationManifest LoadAppManifest(string assemManifestPath)
        {
            Manifest            manifest    = ManifestReader.ReadManifest(assemManifestPath, false);
            ApplicationManifest appManifest = manifest as ApplicationManifest;

            if (appManifest == null)
            {
                throw new FileNotFoundException("Unable to open referenced application manifest", assemManifestPath);
            }

            return(appManifest);
        }
示例#21
0
        static void Main(string[] args)
        {
            GameEngine ge = new GameEngine(EngineSettings.DefaultSettings);

            ManifestReader.RegisterAssembly(Assembly.GetExecutingAssembly()); //Register this assembly(where the files will be embedded in)
            ManifestReader.PrepareManifestFiles(false);                       //First Read Assembly files
            ManifestReader.PrepareManifestFiles(true);                        //Replace Any Loaded assembly files with files on the file system.

            ge.Initialize();
            ge.InitializeScene <FLRunnerScene>();
            ge.Run();
        }
示例#22
0
        public async Task <IHttpActionResult> UploadModuleArchive()
        {
            EnsureModulesCatalogInitialized();

            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotAcceptable, "This request is not properly formatted"));
            }

            webModel.ModuleDescriptor retVal = null;
            var uploadsPath    = HostingEnvironment.MapPath(_uploadsUrl);
            var streamProvider = new CustomMultipartFormDataStreamProvider(uploadsPath);

            await Request.Content.ReadAsMultipartAsync(streamProvider).ContinueWith(t =>
            {
                if (t.IsFaulted || t.IsCanceled)
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            });

            var fileData = streamProvider.FileData.FirstOrDefault();

            using (var packageStream = File.Open(fileData.LocalFileName, FileMode.Open))
                using (var package = new ZipArchive(packageStream, ZipArchiveMode.Read))
                {
                    var entry = package.GetEntry("module.manifest");
                    if (entry != null)
                    {
                        using (var manifestStream = entry.Open())
                        {
                            var manifest           = ManifestReader.Read(manifestStream);
                            var module             = new ManifestModuleInfo(manifest);
                            var alreadyExistModule = _moduleCatalog.Modules.OfType <ManifestModuleInfo>().FirstOrDefault(x => x.Equals(module));
                            if (alreadyExistModule != null)
                            {
                                module = alreadyExistModule;
                            }
                            else
                            {
                                //Force dependency validation for new module
                                _moduleCatalog.CompleteListWithDependencies(new[] { module }).ToList().Clear();
                                _moduleCatalog.AddModule(module);
                            }

                            module.Ref = fileData.LocalFileName;
                            retVal     = module.ToWebModel();
                        }
                    }
                }

            return(Ok(retVal));
        }
示例#23
0
        public BinaryFileResult Schema(string artifactid, string version)
        {
            Manifest mainfest = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);

            string filePath = Path.Combine(Path.Combine(mainfest.Path, "Assets/Schemas"), string.Concat(artifactid, ".gz"));

            Encoding encoding = GetEncoding(filePath);

            return(new BinaryFileResult(filePath, "text/xml")
            {
                Charset = encoding.HeaderName,
                ContentEncoding = "gzip"
            });
        }
示例#24
0
        public ActionResult Index(string version)
        {
            Manifest            manifest     = ManifestReader.GetCurrentManifest(version, Request.PhysicalApplicationPath);
            BizTalkInstallation installation = InstallationReader.GetBizTalkInstallation(manifest);

            var breadCrumbs = new List <BizTalkBaseObject>();

            return(View(new HomeViewModel(
                            ManifestReader.GetAllManifests(Request.PhysicalApplicationPath),
                            manifest,
                            breadCrumbs,
                            installation.Applications.Values,
                            installation.Hosts.Values)));
        }
示例#25
0
        private static DeployManifest GetManifest()
        {
            if (AppDomain.CurrentDomain.ActivationContext == null)
            {
                return(null);
            }

            using (var stream = new MemoryStream(AppDomain.CurrentDomain
                                                 .ActivationContext
                                                 .DeploymentManifestBytes))
            {
                return((DeployManifest)ManifestReader.ReadManifest("Deployment", stream, true));
            }
        }
        private IDictionary <string, ModuleManifest> GetModuleManifests()
        {
            var result = new Dictionary <string, ModuleManifest>();

            if (Directory.Exists(_modulesLocalPath))
            {
                foreach (var manifestFile in Directory.EnumerateFiles(_modulesLocalPath, "module.manifest", SearchOption.AllDirectories))
                {
                    var manifest = ManifestReader.Read(manifestFile);
                    result.Add(manifestFile, manifest);
                }
            }
            return(result);
        }
示例#27
0
        static void Main(string[] args)
        {
            if (!Directory.Exists("./assets"))
            {
                Directory.CreateDirectory("./assets");
            }
            string[]    files  = Directory.GetFiles("./assets", "*.dll", SearchOption.AllDirectories);
            List <Type> scenes = new List <Type>();
            Type        target = typeof(AbstractScene);

            for (int i = 0; i < files.Length; i++)
            {
                try
                {
                    Assembly asm = Assembly.LoadFile(Path.GetFullPath(files[i]));
                    if (asm == Assembly.GetExecutingAssembly())
                    {
                        continue;
                    }
                    Type[] types    = asm.GetTypes();
                    bool   hasScene = false;
                    for (int j = 0; j < types.Length; j++)
                    {
                        if (target != types[j] && target.IsAssignableFrom(types[j]) && !scenes.Contains(types[j]))
                        {
                            hasScene = true;
                            scenes.Add(types[j]);
                        }
                    }

                    if (hasScene)
                    {
                        ManifestReader.RegisterAssembly(asm);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }


            GameEngine ge = new GameEngine(EngineSettings.DefaultSettings);

            ManifestReader.PrepareManifestFiles(true);
            ManifestReader.PrepareManifestFiles(false);
            ge.Initialize();
            ge.InitializeScene <StartScene>();
            ge.Run();
        }
示例#28
0
        public void ShouldUseProviderToCreateVersion()
        {
            // Arrange
            ManifestReader reader         = this.CreateManifestReader();
            NumericVersion numericVersion = new NumericVersion(14);

            versionProvider.Setup(v => v.CreateVersion("14")).Returns(numericVersion);

            // Act
            IDatabaseVersion version = reader.Read(GetManifest(), ManifestPath, databaseArchive.Object);

            // Assert
            Assert.Equal(numericVersion, version.Version);
        }
示例#29
0
        public EngineSceneRunCommand() : base(new[] { "--engine", "-e" },
                                              "Start Engine Test Shell.")
        {
            CommandAction = (info, strings) => EngineTest(strings);

            EmbeddedFileIOManager.Initialize();

            ManifestReader.RegisterAssembly(Assembly
                                            .GetExecutingAssembly()); //Register this assembly(where the files will be embedded in)
            ManifestReader.PrepareManifestFiles(false);               //First Read Assembly files
            ManifestReader
            .PrepareManifestFiles(true);                              //Replace Any Loaded assembly files with files on the file system.

            ge = new GameEngine(EngineSettings.DefaultSettings);
        }
        private DeployManifest DownloadDeployManifest(string url, out string urlRedirect)
        {
            var            result   = CrawlContent(url, out urlRedirect);
            DeployManifest manifest = null;

            using (var ms = new MemoryStream())
            {
                byte[] buffer = System.Text.Encoding.Default.GetBytes(result);
                ms.Write(buffer, 0, buffer.Length);
                ms.Seek(0, SeekOrigin.Begin);

                manifest = (DeployManifest)ManifestReader.ReadManifest(ms, false);
                ms.Close();
            }
            return(manifest);
        }