Exemple #1
0
        public IConfiguration Restore(ConfigurationDTO dto)
        {
            var configuration = new ConfigurationImpl();
            var count         = dto.Subjects.Length;

            for (int i = 0; i < count; i++)
            {
                configuration.Subject(_subjectAssembler.Restore(dto[i]));
            }

            for (int i = 0; i < count; i++)
            {
                // finish wiring up the RelationFields now that our configuration is set up
                // assumes Subject and Field order is equivalent between DTO's and model objects
                for (int f = 0; f < configuration[i].Count; f++)
                {
                    if (configuration[i][f] is IRelationField)
                    {
                        ((IRelationField)configuration[i][f]).RelatedSubject = configuration[dto.Subjects[i].Fields[f].RelatedSubjectIndex];
                    }
                }

                // now complete the matrix nodes
                for (int j = 0; j < count; j++)
                {
                    var m = dto[i, j];
                    configuration.Matrix(configuration[i], configuration[j], m.Query, m.ToolTip);
                }
            }

            return(configuration);
        }
        public void Fluent_config()
        {
            var sql    = "SELECT * FROM Table";
            var config = new ConfigurationImpl();

            config
            .Subject(new Subject()
                     .Sql(sql)
                     .Field(new Field("column1", "display1", typeof(string)))
                     .Field(new Field("column2", "display2", typeof(int))));

            Assert.AreEqual(config.Count, 1);

            var s = config[0];

            Assert.AreEqual(s.Source, sql);
            Assert.AreEqual(s.Count, 2);

            var f1 = s[0];
            var f2 = s[1];

            Assert.AreEqual(f1.SourceName, "column1");
            Assert.AreEqual(f1.DisplayName, "display1");
            Assert.AreEqual(f1.DataType, typeof(string));

            Assert.AreEqual(f2.SourceName, "column2");
            Assert.AreEqual(f2.DisplayName, "display2");
            Assert.AreEqual(f2.DataType, typeof(int));
        }
        /**
         * @brief Sets the custom langauage.
         * @param customLanguage custom language.
         */
        public static void SetCustomLanguage(string customLanguage)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetCustomLanguage(customLanguage);
        }
        public static void SetGMC2Url(string url)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetGMC2Url(url);
        }
        /**
         * @brief Sets whether use Facebook login inapp webView.
         * @param use Use of Facebook login inapp webView.
         */
        public static void SetUseFacebookLoginViewInApp(bool use)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetUseFacebookLoginViewInApp(use);
        }
        /**
         * @brief Gets the SDK language.
         * if return value is null, SDK use the langauge set in device.
         * @return SDK language.
         * @see Language
         */
        public static Language GetLanguage()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return((Language)0);
            }

            return((Language)(ConfigurationImpl.GetLanguage()));
        }
        /**
         * @brief Sets the timeout interval for HTTP requests.
         * @param sec Timeout interval second. (unit: second).
         */
        public static void SetHttpTimeOutSec(int sec)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetHttpTimeOutSec(sec);
        }
        /**
         * @brief Gets whether use Facebook login inapp webView.
         * @return Use of Facebook login inapp webView.
         */
        public static bool GetUseFacebookLoginViewInApp()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(false);
            }

            return(ConfigurationImpl.GetUseFacebookLoginViewInApp());
        }
        /**
         * @brief Gets the timeout interval for HTTP requests.
         * @return Timeout interval second. (unit: second).
         */
        public static int GetHttpTimeOutSec()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(0);
            }

            return(ConfigurationImpl.GetHttpTimeOutSec());
        }
        /**
         * @brief Sets the market.
         * @param market Market.
         */
        public static void SetMarket(string market)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetMarket(market);
        }
        /**
         * @brief Sets the zone.
         * @param zone Zone. ex)alpha, dev, real
         */
        public static void SetZone(string zone)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetZone(zone);
        }
        /**
         * @brief Sets the SDK langauage.
         * if sets null, SDK use the langauage set in device.
         *
         * @param language SDK language.
         * @see Language
         */
        public static void SetLanguage(Language language)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetLanguage(language);
        }
        /**
         * @brief Sets whether use fixed playerID.
         * @param use Use of fixed playerID.
         */
        public static void SetUseFixedPlayerID(bool use)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetUseFixedPlayerId(use);
        }
        /**
         * @brief Gets whether use fixed playerID.
         * @return Use of Fixed PlayerID.
         */
        public static bool GetUseFixedPlayerID()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(false);
            }

            return(ConfigurationImpl.GetUseFixedPlayerId());
        }
        public static string GetGMC2Url()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(null);
            }

            return(ConfigurationImpl.GetGMC2Url());
        }
        public static bool GetIsInReview()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(false);
            }

            return(ConfigurationImpl.GetIsInReview());
        }
        public static void SetIsInReview(bool isInReview)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetIsInReview(isInReview);
        }
        /**
         * @brief 공지사항의 TitleBar를 숨김.
         * @param isHidden 디폴트 NO, Rolling형 YES.
         */
        public static void SetIsHiddenNoticeTitleBar(bool isHidden)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetIsHiddenNoticeTitleBar(isHidden);
        }
        /**
         * @brief 다국어 지원 처리 단계 설정
         * @param localizedLevel 디폴트 value는 1 (번역만 지원 : 1, 번역 and UI 지원 : 2)
         */
        public static void SetLocalizedLevel(string localizedLevel)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetLocalizedLevel(localizedLevel);
        }
        /**
         * @brief Sets the OTP history period.
         * @param OTPHistoryPeriod The history period of OTP.
         */
        public static void SetOTPHistoryPeriod(int otpHistoryPeriod)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetOTPHistoryPeriod(otpHistoryPeriod);
        }
        /**
         * @brief 공지사항 TitleBar 숨김 여부 조회.
         */
        public static bool GetIsHiddenNoticeTitleBar()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(false);
            }

            return(ConfigurationImpl.GetIsHiddenNoticeTitleBar());
        }
        /**
         * @brief Sets the OTP life cycle.
         * @param OTPLifeCycle The life cycle of OTP.
         */
        public static void SetOTPLifeCycle(int otpLifeCycle)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetOTPLifeCycle(otpLifeCycle);
        }
        /**
         * @brief Gets the OTP history period.
         * @return OTPHistoryPeriod.
         */
        public static int GetOTPHistoryPeriod()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(0);
            }

            return(ConfigurationImpl.GetOTPHistoryPeriod());
        }
        /**
         * @brief Gets the OTP life cycle.
         * @return OTPLifeCycle.
         */
        public static int GetOTPLifeCycle()
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return(0);
            }

            return(ConfigurationImpl.GetOTPLifeCycle());
        }
        /**
         * @brief Sets the OTP length.
         * @param OTPLength The length of OTP.
         */
        public static void SetOTPLength(int otpLength)
        {
            if (CallbackManager.NetmarbleGameObject == null)
            {
                return;
            }

            ConfigurationImpl.SetOTPLength(otpLength);
        }
        /// <summary>
        /// Augments <paramref name="cmdLineConfiguration"/> (which came from command line arguments) with configuration options that were read from a DScript config file.
        /// </summary>
        /// <remarks>
        /// The <paramref name="cmdLineConfiguration"/> is used as a main instance and the configuration converted from a DScript config file provides only missing values.
        /// It means that if the configuration already has a member, this member will stay in the resulting instance.
        /// </remarks>
        public static IConfiguration AugmentConfigurationWith(FrontEndContext context, IConfiguration cmdLineConfiguration, ObjectLiteral configLiteral)
        {
            Contract.Requires(context != null);
            Contract.Requires(configLiteral != null);
            Contract.Requires(cmdLineConfiguration != null);

            var targetInstance = new ConfigurationImpl(cmdLineConfiguration);

            return(Convert(context, configLiteral, targetInstance));
        }
        private GraphReuseResult ReloadPipGraphOnly(
            EngineSerializer serializer,
            LoggingContext loggingContext,
            EngineState engineState,
            InputTracker.InputChanges inputChanges)
        {
            Tuple <PipGraph, EngineContext> t = null;

            try
            {
                t = EngineSchedule.LoadPipGraphAsync(
                    Context,
                    serializer,
                    Configuration,
                    loggingContext,
                    engineState).GetAwaiter().GetResult();
            }
            catch (BuildXLException e)
            {
                Logger.Log.FailedReloadPipGraph(loggingContext, e.ToString());
            }

            if (t == null)
            {
                return(GraphReuseResult.CreateForNoReuse(inputChanges));
            }

            var newContext = t.Item2;

            if (!ShouldReuseReloadedEngineContextGivenHistoricData(loggingContext, newContext.NextHistoricTableSizes))
            {
                return(GraphReuseResult.CreateForNoReuse(inputChanges));
            }

            var newPathTable = newContext.PathTable;
            var pathRemapper = new PathRemapper(Context.PathTable, newPathTable);

            Configuration = new ConfigurationImpl(Configuration, pathRemapper);

            m_initialCommandLineConfiguration = new CommandLineConfiguration(m_initialCommandLineConfiguration, pathRemapper);

            // Invalidate the old context to ensure nothing uses it anymore
            // Update engine state to deserialized state
            Context.Invalidate();
            Context = newContext;

            // Additionally recreate front end controller, because the old one uses the invalidated context.
            //   - to fully initialize the front end, we have to go through all the steps that have already been
            //     executed on the old controller; those steps are (1) InitializeHost, and (2) ParseConfig
            FrontEndController = m_frontEndControllerFactory.Create(Context.PathTable, Context.SymbolTable);
            FrontEndController.InitializeHost(Context.ToFrontEndContext(loggingContext), m_initialCommandLineConfiguration);
            FrontEndController.ParseConfig(m_initialCommandLineConfiguration);

            return(GraphReuseResult.CreateForPartialReuse(t.Item1, inputChanges));
        }
Exemple #28
0
        /// <summary>
        /// Conceptually, converts a given <paramref name="workspace"/> into "evaluation AST" (which can next be evaluated/interpreted).
        ///
        /// In reality, this "evaluation AST" is so tightly coupled with the engine, so this method has no choice but to
        /// create a big hairball of hosts/controllers/resolvers/contexts/configurations/etc to make evaluation possible.
        ///
        /// This method tries to bypass as much of the front-end stuff as possible.  For example, it doesn't start evaluation from
        /// <see cref="FrontEndHost"/>, but instead it creates a single resolver (namely <see cref="DScriptSourceResolver"/>
        /// and uses that resolver directly to evaluate the AST.
        ///
        /// Any errors can be retrieved via the <see cref="CreateTestResult"/> method.
        /// </summary>
        public async Task <TestResult <Interpreter> > ConvertNoErrorCheckAsync(Workspace workspace, [CanBeNull] PipGraph oldPipGraph)
        {
            var nonPreludeModules = NonPreludeModules(workspace).ToArray();
            var moduleRegistry    = new ModuleRegistry(SymbolTable);

            var configStringPath = Path.Combine(SrcRoot.ToString(PathTable), Names.ConfigDsc);

            var configuration = new ConfigurationImpl()
            {
                FrontEnd =
                {
                    EnableIncrementalFrontEnd              = false,
                    ReloadPartialEngineStateWhenPossible   = false,
                    UseSpecPublicFacadeAndAstWhenAvailable = false,
                    ConstructAndSaveBindingFingerprint     = false,
                    UsePartialEvaluation                   = false,
                }
            };
            var frontEndHost = FrontEndHostController.CreateForTesting(FrontEndContext, Engine, moduleRegistry, configStringPath, FrontEndLogger);
            var frontEnd     = new DScriptFrontEnd(FrontEndStatistics, AstLogger, null);

            frontEnd.InitializeFrontEnd(frontEndHost, FrontEndContext, configuration);

            var resolver = (DScriptSourceResolver)frontEnd.CreateResolver(KnownResolverKind.DScriptResolverKind);
            var packages = nonPreludeModules.Select(module => CreatePackageForModule(module)).ToList();

            resolver.InitResolverForTesting("Test", packages);

            frontEndHost.InitializeResolvers(new[] { resolver });

            // convert all modules and assert it succeeds
            var convertTasks = nonPreludeModules.Select(module => frontEndHost.ConvertWorkspaceToEvaluationAsync(workspace));
            await Task.WhenAll(convertTasks);

            // prepare for evaluation
            var graphBuilder = new PipGraph.Builder(
                new PipTable(PathTable, SymbolTable, initialBufferSize: 16, maxDegreeOfParallelism: Environment.ProcessorCount, debug: false),
                new EngineContext(CancellationToken.None, PathTable, SymbolTable, new QualifierTable(PathTable.StringTable), FrontEndContext.FileSystem, new TokenTextTable()),
                global::BuildXL.Pips.Tracing.Logger.Log,
                FrontEndContext.LoggingContext,
                // For tests, allow writes outside of mounts unles defined otherwise
                new ConfigurationImpl()
            {
                Engine = { UnsafeAllowOutOfMountWrites = true }
            },
                new MountPathExpander(PathTable));

            IMutablePipGraph pipGraph = oldPipGraph != null
                ? new PatchablePipGraph(oldPipGraph.DataflowGraph, oldPipGraph.PipTable, graphBuilder, maxDegreeOfParallelism: Environment.ProcessorCount)
                : (IMutablePipGraph)graphBuilder;

            frontEndHost.SetState(Engine, pipGraph, configuration);

            return(new TestResult <Interpreter>(frontEndHost, Diagnostics));
        }
        internal IntegrationDatabaseConfiguration(DatabaseConfiguration database)
        {
            if (database == null)
            {
                throw new ArgumentNullException(nameof(database));
            }

            _configuration = new ConfigurationImpl();

            Database = database;
        }
Exemple #30
0
        /// <summary>
        /// Creates an instance of <see cref="TestPipGraphFragment"/>.
        /// </summary>
        public TestPipGraphFragment(LoggingContext loggingContext, string sourceRoot, string objectRoot, string redirectedRoot, string moduleName, bool useTopSort = false)
        {
            Contract.Requires(loggingContext != null);
            Contract.Requires(!string.IsNullOrEmpty(sourceRoot));
            Contract.Requires(!string.IsNullOrEmpty(objectRoot));
            Contract.Requires(!string.IsNullOrEmpty(moduleName));

            Context          = BuildXLContext.CreateInstanceForTesting();
            m_loggingContext = loggingContext;
            m_sourceRoot     = AbsolutePath.Create(Context.PathTable, sourceRoot);
            m_objectRoot     = AbsolutePath.Create(Context.PathTable, objectRoot);
            m_expander       = new MountPathExpander(Context.PathTable);

            var configuration = new ConfigurationImpl()
            {
                Schedule =
                {
                    UseFixedApiServerMoniker     = true,
                    ComputePipStaticFingerprints = true,
                }
            };

            m_useTopSort = useTopSort;
            PipGraph     = m_useTopSort
                ? new PipGraphFragmentBuilderTopSort(Context, configuration, m_expander)
                : new PipGraphFragmentBuilder(Context, configuration, m_expander);

            ModuleName = moduleName;
            var specFileName = moduleName + ".dsc";

            m_specPath = m_sourceRoot.Combine(Context.PathTable, specFileName);
            m_moduleId = ModuleId.Create(StringId.Create(Context.StringTable, moduleName));
            var modulePip = ModulePip.CreateForTesting(
                Context.StringTable,
                m_specPath,
                m_moduleId);

            PipGraph.AddModule(modulePip);
            PipGraph.AddSpecFile(new SpecFilePip(new FileArtifact(m_specPath), new LocationData(m_specPath, 0, 0), modulePip.Module));

            m_defaultConstructionHelper = PipConstructionHelper.CreateForTesting(
                Context,
                objectRoot: m_objectRoot,
                redirectedRoot: AbsolutePath.Create(Context.PathTable, redirectedRoot),
                pipGraph: PipGraph,
                moduleName: moduleName,
                specRelativePath: Path.Combine(m_sourceRoot.GetName(Context.PathTable).ToString(Context.StringTable), specFileName),
                specPath: m_specPath,
                symbol: moduleName + "_defaultValue");
        }
Exemple #31
0
   private void Initialize(
 )
   {
       configuration = new ConfigurationImpl(this);
   }