Esempio n. 1
0
        private static void CreateSceneObject()
        {
            var obj = new GameObject("GameFramework");

            SceneObject = obj.AddComponent <FrameworkComponent>();

            Object.DontDestroyOnLoad(obj);

            SceneObject.OnInitFramework();
        }
        /// <summary>
        /// The get device type project data.
        /// </summary>
        /// <param name="projectFile">
        /// The project file.
        /// </param>
        /// <param name="dtmStudioTestData">
        /// The dtm studio test data.
        /// </param>
        public DTMstudioTestData GetDeviceTypeProjectData(string projectFile, DTMstudioTestData dtmStudioTestData)
        {
            if (File.Exists(projectFile))
            {
                var commonTaskInfrastructure = new CommonTaskInfrastructure(projectFile, new NoLoggingLogger());

                try
                {
                    var fdtDeviceTypeName = commonTaskInfrastructure.Information.GetDeviceTypeName();
                    Trace.Assert(fdtDeviceTypeName != string.Empty, "FDTDeviceTypeName == null");
                    dtmStudioTestData.DeviceTypeProject.FDTDeviceTypeName = fdtDeviceTypeName;
                }
                catch (Exception ex)
                {
                    Log.ErrorEx(this, ex, "GetDeviceTypeProjectData GetDeviceTypeProjectGuid " + ex.Message);
                }

                try
                {
                    var guid = commonTaskInfrastructure.Information.GetDeviceTypeProjectGuid();
                    Trace.Assert(guid.ToString() != string.Empty, "FDTDeviceType guid == null");
                    dtmStudioTestData.DeviceTypeProject.Guid = guid;
                }
                catch (Exception ex)
                {
                    Log.ErrorEx(this, ex, "GetDeviceTypeProjectData GetDeviceTypeProjectGuid " + ex.Message);
                }

                var version = new Version();

                try
                {
                    var versionString = commonTaskInfrastructure.Information.GetDeviceTypeVersion();
                    Trace.Assert(versionString != string.Empty, "Device Type Version == string.Empty");

                    if (versionString != string.Empty)
                    {
                        version = new Version(versionString);
                    }

                    var deviceTypeFramework = new DeviceTypeFramework {
                        VersionString = versionString, Version = version
                    };
                    Trace.Assert(deviceTypeFramework != null, "deviceTypeFramework == null");

                    dtmStudioTestData.DeviceTypeProject.DeviceTypeFramework = deviceTypeFramework;
                }
                catch (Exception ex)
                {
                    Log.ErrorEx(this, ex, "GetDeviceTypeProjectData GetDeviceTypeVersion " + ex.Message);
                }

                try
                {
                    dtmStudioTestData.DeviceTypeProject.DeviceTypeFramework.FrameworkComponents = new List <FrameworkComponent>();
                    foreach (var projectPackage in commonTaskInfrastructure.Information.GetProjectPackages())
                    {
                        var frameworkComponent = new FrameworkComponent {
                            Name = projectPackage.Value.Name, DisplayName = projectPackage.Value.Title, VersionString = projectPackage.Value.Version, Version = new Version(projectPackage.Value.Version)
                        };

                        dtmStudioTestData.DeviceTypeProject.DeviceTypeFramework.FrameworkComponents.Add(frameworkComponent);
                    }
                }
                catch (Exception ex)
                {
                    Log.ErrorEx(this, ex, "GetDeviceTypeProjectData GetProjectPackages " + ex.Message);
                }

                try
                {
                    dtmStudioTestData.DeviceTypeProject.DeviceFunctions.Clear();

                    Dictionary <string, IModuleInfo> moduleInfos = commonTaskInfrastructure.Information.GetCodiaModuleInfos(0);

                    foreach (var modulInfo in moduleInfos)
                    {
                        if (modulInfo.Value.Version.Split('.').Length == 4)
                        {
                            var deviceFunctionMapping = this.GetdeviceFunctionMapping(modulInfo.Value.Name, dtmStudioTestData);

                            var deviceFunction = new DeviceFunction
                            {
                                Active               = ((modulInfo.Value.Flags & ModuleState.Enabled) == ModuleState.Enabled),
                                DisplayName          = deviceFunctionMapping.DisplayName != string.Empty ? deviceFunctionMapping.DisplayName : modulInfo.Value.Name,
                                Name                 = modulInfo.Value.Name,
                                FrameworkMappingName = deviceFunctionMapping.TestFrameworkDeviceFunctionName,
                                CompilerVariable     = modulInfo.Value.Name.ToUpper().Replace(".", string.Empty), VersionString = modulInfo.Value.Version, Version = new Version(modulInfo.Value.Version)
                            };

                            dtmStudioTestData.DeviceTypeProject.DeviceFunctions.Add(deviceFunction);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.ErrorEx(this, ex, "GetDeviceTypeProjectData GetCodiaModuleInfos " + ex.Message);
                }
            }

            return(dtmStudioTestData);
        }