Esempio n. 1
0
        public InitializeCommandProcessor(IActorRef writer, GlobalOptions options)
        {
            Argument.RequiresNotNull(writer, nameof(writer));
            Argument.RequiresNotNull(options, nameof(options));

            this.Writer = writer;
            this.Options = options;
        }
Esempio n. 2
0
        public InitializeProjection(IActorRef projectionStreamSupervisor, GlobalOptions options)
        {
            Argument.RequiresNotNull(projectionStreamSupervisor, nameof(projectionStreamSupervisor));
            Argument.RequiresNotNull(options, nameof(options));

            this.ProjectionStreams = projectionStreamSupervisor;
            this.Options = options;
        }
Esempio n. 3
0
            public TestContainer(TestKitBase testKit, GlobalOptions options = null, Type replayWorkerType = null)
            {
                var query = new ProjectionStreamQuery();
                Reader = testKit.CreateTestProbe();
                Writer = testKit.CreateTestProbe();
                options = options ?? new GlobalOptions();

                var props = Even.ProjectionStream.CreateProps(query, Reader, Writer, options);
                ProjectionStream = testKit.Sys.ActorOf(props);
            }
Esempio n. 4
0
        public InitializeAggregate(IActorRef reader, IActorRef writer, GlobalOptions options)
        {
            Argument.RequiresNotNull(reader, nameof(reader));
            Argument.RequiresNotNull(writer, nameof(writer));
            Argument.RequiresNotNull(options, nameof(options));

            this.Reader = reader;
            this.Writer = writer;
            this.Options = options;
        }
Esempio n. 5
0
 void Awake()
 {
     options = GlobalOptions.Instance;
     LevelBuilder = GameObject.Find("LevelBuilder").GetComponent<LevelBuilder>();
     brickBuilder = GameObject.Find("LevelBuilder").GetComponent<BrickBuilder>();
     if (brickBuilder != null) {
         totalPoints = brickBuilder.totalPoints;
     }
     //numberOfTeams = GameObject.Find("LevelBuilder").GetComponent<LevelBuilder>().numberOfTeams;
 }
Esempio n. 6
0
 public void InitializeTestGateway(GlobalOptions options = null)
 {
     TestGateway = new EvenGateway(new EvenServices
     {
         Aggregates = AggregatesProbe,
         CommandProcessors = CommandProcessorsProbe,
         EventProcessors = EventProcessorsProbe,
         Projections = ProjectionsProbe,
         Reader = ReaderProbe,
         Writer = WriterProbe
     }, Sys, options ?? new GlobalOptions());
 }
Esempio n. 7
0
        public Main()
        {
            InitializeComponent();

            Options = new GlobalOptions();
            typist = new Typist();

            cgDefault.Options = Options.Defaults;
            cgAssociations.Options = Options.Associations;
            cgComplexProp.Options = Options.ComplexProps;
            cgComplexTypes.Options = Options.ComplexTypes;
            cgEntitySets.Options = Options.EntitySets;
            cgEntityTypes.Options = Options.EntityTypes;
            cgMethods.Options = Options.Methods;
            cgNavProps.Options = Options.NavigationProps;
            cgScalars.Options = Options.ScalarMembers;
        }
Esempio n. 8
0
        private IActorRef CreateAndInitializeTestProjection(GlobalOptions options = null)
        {
            var sup = Sys.ActorOf(conf =>
            {
                conf.Receive<ProjectionSubscriptionRequest>((r, ctx) =>
                {
                    _testStream = r.Query.ProjectionStream;
                    ctx.Sender.Tell(new ProjectionReplayFinished(r.RequestID));
                });
            });

            var props = Props.Create<TestProjection>(TestActor);
            var proj = Sys.ActorOf(props);

            proj.Tell(new InitializeProjection(sup, options ?? new GlobalOptions()));
            ExpectMsg<InitializationResult>(i => i.Initialized);

            return proj;
        }
Esempio n. 9
0
        public void Throws_on_checkpoint_timeout()
        {
            var options = new GlobalOptions
            {
                ReadRequestTimeout = TimeSpan.FromMilliseconds(300)
            };

            var props = ProjectionStream.CreateProps(new ProjectionStreamQuery(), ActorRefs.Nobody, ActorRefs.Nobody, options);

            Sys.ActorOf(c =>
            {
                c.OnPreStart = ctx => ctx.ActorOf(props);
                c.Strategy = new OneForOneStrategy(ex =>
                {
                    TestActor.Tell(ex);
                    return Directive.Stop;
                });
            });

            ExpectMsg<Exception>();
        }
Esempio n. 10
0
 void Awake()
 {
     PlayerManager = transform.parent.GetComponent<PlayerManager>();
     AllButtons = transform.Find("Buttons").gameObject;
     RebindBackground = transform.Find("RebindBackground").gameObject;
     RebindInstructionsRenderer = transform.Find("RebindBackground/Instructions").renderer;
     ProgressMeter = transform.Find("ProgressMeter").gameObject;
     TeamToggleButton = transform.Find("Buttons/TeamToggle").gameObject.GetComponentInChildren<TeamToggle>();
     //JoinText = transform.Find("JoinText").GetComponent<TextMesh>();
     //RebindText = transform.Find("RebindText").GetComponent<TextMesh>();
     CharacterPortrait = transform.Find("Buttons/CharacterPortrait").GetComponent<MeshRenderer>();
     options = GlobalOptions.Instance;
 }
 public TemplateController(GlobalOptions globalOptions)
 {
     this._globalOptions = globalOptions;
 }
Esempio n. 12
0
        private void UpdateSpecific()
        {
            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;
            GlobalOptions options = GlobalOptions.Instance;

            txtName.Items.Clear();
            txtName.Items.AddRange(options.NameFilters.ToArray());
            txtName.Items.Insert(0, "*");

            cmbResidence.Items.Clear();
            cmbResidence.Items.AddRange(options.ResidenceFilters.ToArray());
            cmbResidence.Items.Insert(0, "*");

            cmbEventVal.Items.Clear();
            cmbEventVal.Items.AddRange(options.EventFilters.ToArray());

            int lifeSel;
            if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                lifeSel = (int)iFilter.FilterLifeMode;
                rgLife.Enabled = true;
                txtAliveBeforeDate.Text = iFilter.AliveBeforeDate;
            } else {
                lifeSel = -1;
                rgLife.Enabled = false;
                txtAliveBeforeDate.Text = "";
            }

            switch (lifeSel) {
                case 0:
                    rbAll.Checked = true;
                    break;
                case 1:
                    rbOnlyLive.Checked = true;
                    break;
                case 2:
                    rbOnlyDead.Checked = true;
                    break;
                case 3:
                    rbAliveBefore.Checked = true;
                    break;
            }

            int sexSel = (int)iFilter.Sex;
            switch (sexSel) {
                case 0:
                    rbSexAll.Checked = true;
                    break;
                case 1:
                    rbSexMale.Checked = true;
                    break;
                case 2:
                    rbSexFemale.Checked = true;
                    break;
            }

            txtName.Text = iFilter.Name;
            cmbResidence.Text = iFilter.Residence;
            cmbEventVal.Text = iFilter.EventVal;
            chkOnlyPatriarchs.Checked = iFilter.PatriarchOnly;

            GEDCOMTree tree = Base.Context.Tree;

            cmbGroup.Items.Clear();
            cmbGroup.Sorted = true;
            int num = tree.RecordsCount;
            for (int i = 0; i < num; i++) {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMGroupRecord) {
                    cmbGroup.Items.Add(new GKComboItem((rec as GEDCOMGroupRecord).GroupName, rec));
                }
            }
            cmbGroup.Sorted = false;
            cmbGroup.Items.Insert(0, new GKComboItem(LangMan.LS(LSID.LSID_SrcAll), null));
            cmbGroup.Items.Insert(1, new GKComboItem(LangMan.LS(LSID.LSID_SrcNot), null));
            cmbGroup.Items.Insert(2, new GKComboItem(LangMan.LS(LSID.LSID_SrcAny), null));
            if (iFilter.FilterGroupMode != FilterGroupMode.Selected) {
                cmbGroup.SelectedIndex = (int)iFilter.FilterGroupMode;
            } else {
                GEDCOMGroupRecord groupRec = tree.XRefIndex_Find(iFilter.GroupRef) as GEDCOMGroupRecord;
                if (groupRec != null) cmbGroup.Text = groupRec.GroupName;
            }

            cmbSource.Items.Clear();
            cmbSource.Sorted = true;
            for (int i = 0; i < tree.RecordsCount; i++) {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMSourceRecord) {
                    cmbSource.Items.Add(new GKComboItem((rec as GEDCOMSourceRecord).FiledByEntry, rec));
                }
            }
            cmbSource.Sorted = false;
            cmbSource.Items.Insert(0, new GKComboItem(LangMan.LS(LSID.LSID_SrcAll), null));
            cmbSource.Items.Insert(1, new GKComboItem(LangMan.LS(LSID.LSID_SrcNot), null));
            cmbSource.Items.Insert(2, new GKComboItem(LangMan.LS(LSID.LSID_SrcAny), null));
            if (iFilter.SourceMode != FilterGroupMode.Selected) {
                cmbSource.SelectedIndex = (int)iFilter.SourceMode;
            } else {
                GEDCOMSourceRecord sourceRec = tree.XRefIndex_Find(iFilter.SourceRef) as GEDCOMSourceRecord;
                if (sourceRec != null) cmbSource.Text = sourceRec.FiledByEntry;
            }
        }
Esempio n. 13
0
 public CategoryService(PortalDbContext dbContext, IOptionsMonitor <GlobalOptions> globalOptions)
 {
     DbContext     = dbContext;
     GlobalOptions = globalOptions.CurrentValue;
 }
Esempio n. 14
0
 // Use this for initialization
 void Start()
 {
     options = GlobalOptions.Instance;
     SlotPlayers();
 }
Esempio n. 15
0
 void Start()
 {
     fermaAchievementCollect.SetMissionEmmitter(GlobalOptions.GetMissionEmmitters().collectMissionEmmitter);
     fermaAchievementRun.SetMissionEmmitter(GlobalOptions.GetMissionEmmitters().runMissionEmmitter);
 }
Esempio n. 16
0
        public bool LoadFor(IWorkingEnvironment environment, Section section)
        {
            Verify.Argument.IsNotNull(environment, nameof(environment));

            if (section != null)
            {
                var providerName = section.GetValue <string>("AccessorProvider", string.Empty);
                if (!string.IsNullOrWhiteSpace(providerName))
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.FirstOrDefault(
                        prov => prov.Name == providerName);
                }
                if (ActiveGitAccessorProvider == null)
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.First();
                }
                var gitAccessorSection = section.TryGetSection(ActiveGitAccessorProvider.Name);
                if (gitAccessorSection != null)
                {
                    GitAccessor.LoadFrom(gitAccessorSection);
                }
            }
            else
            {
                ActiveGitAccessorProvider = GitAccessorProviders.First();
            }
            Version gitVersion;

            try
            {
                gitVersion = _gitAccessor.GitVersion;
            }
            catch (Exception exc) when(!exc.IsCritical())
            {
                gitVersion = null;
            }
            if (gitVersion == null || gitVersion < MinimumRequiredGitVersion)
            {
                using (var dlg = new VersionCheckDialog(environment, this, MinimumRequiredGitVersion, gitVersion))
                {
                    dlg.Run(environment.MainForm);
                    gitVersion = dlg.InstalledVersion;
                    if (gitVersion == null || gitVersion < _minVersion)
                    {
                        return(false);
                    }
                }
            }
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    GitOptionsPage.Guid,
                    Resources.StrGit,
                    null,
                    PropertyPageFactory.RootGroupGuid,
                    env => new GitOptionsPage(env)));
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    ConfigurationPage.Guid,
                    Resources.StrConfig,
                    null,
                    GitOptionsPage.Guid,
                    env => new ConfigurationPage(env)));
            _environment   = environment;
            _configSection = section;
            return(true);
        }
Esempio n. 17
0
        public override void Fetch(GDMRecord aRec)
        {
            fRec = (aRec as GDMIndividualRecord);
            if (fRec == null)
            {
                return;
            }

            buf_fullname    = GKUtils.GetNameString(fRec, true, false);
            buf_bd          = null;
            buf_dd          = null;
            buf_residence   = "";
            buf_religion    = "";
            buf_nationality = "";
            buf_education   = "";
            buf_occupation  = "";
            buf_caste       = "";
            buf_mili        = "";
            buf_mili_ind    = "";
            buf_mili_dis    = "";
            buf_mili_rank   = "";
            buf_title       = "";

            GlobalOptions gOptions = GlobalOptions.Instance;

            int num = fRec.Events.Count;

            for (int i = 0; i < num; i++)
            {
                GDMCustomEvent ev      = fRec.Events[i];
                GEDCOMTagType  evtType = ev.GetTagType();

                if (evtType == GEDCOMTagType.BIRT && buf_bd == null)
                {
                    buf_bd = ev;
                }
                else if (evtType == GEDCOMTagType.DEAT && buf_dd == null)
                {
                    buf_dd = ev;
                }
                else if (evtType == GEDCOMTagType.RESI && buf_residence == "")
                {
                    buf_residence = GKUtils.GetPlaceStr(ev, gOptions.PlacesWithAddress);
                }
                else if (evtType == GEDCOMTagType.RELI && buf_religion == "")
                {
                    buf_religion = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType.NATI && buf_nationality == "")
                {
                    buf_nationality = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType.EDUC && buf_education == "")
                {
                    buf_education = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType.OCCU && buf_occupation == "")
                {
                    buf_occupation = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType.CAST && buf_caste == "")
                {
                    buf_caste = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType._MILI && buf_mili == "")
                {
                    buf_mili = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType._MILI_IND && buf_mili_ind == "")
                {
                    buf_mili_ind = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType._MILI_DIS && buf_mili_dis == "")
                {
                    buf_mili_dis = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType._MILI_RANK && buf_mili_rank == "")
                {
                    buf_mili_rank = ev.StringValue;
                }
                else if (evtType == GEDCOMTagType.TITL && buf_title == "")
                {
                    buf_title = ev.StringValue;
                }
            }
        }
Esempio n. 18
0
 public EmailSenderFactory(IOptions <GlobalOptions> globalOptions, SendGridEmailSender sendGridEmailSender)
 {
     _globalConfig        = globalOptions.Value;
     _sendGridEmailSender = sendGridEmailSender;
 }
Esempio n. 19
0
        protected override async Task ProduceTagsAsync(
            TaggerContext <InheritanceMarginTag> context,
            DocumentSnapshotSpan spanToTag,
            int?caretPosition,
            CancellationToken cancellationToken)
        {
            var document = spanToTag.Document;

            if (document == null)
            {
                return;
            }

            if (document.Project.Solution.WorkspaceKind == WorkspaceKind.Interactive)
            {
                return;
            }

            var inheritanceMarginInfoService = document.GetLanguageService <IInheritanceMarginService>();

            if (inheritanceMarginInfoService == null)
            {
                return;
            }

            if (GlobalOptions.GetOption(FeatureOnOffOptions.ShowInheritanceMargin, document.Project.Language) == false)
            {
                return;
            }

            var includeGlobalImports = GlobalOptions.GetOption(FeatureOnOffOptions.InheritanceMarginIncludeGlobalImports, document.Project.Language);

            // Use FrozenSemantics Version of document to get the semantics ready, therefore we could have faster
            // response. (Since the full load might take a long time)
            // We also subscribe to CompilationAvailableTaggerEventSource, so this will finally reach the correct state.
            document = document.WithFrozenPartialSemantics(cancellationToken);

            var spanToSearch           = spanToTag.SnapshotSpan.Span.ToTextSpan();
            var stopwatch              = SharedStopwatch.StartNew();
            var inheritanceMemberItems = await inheritanceMarginInfoService.GetInheritanceMemberItemsAsync(
                document,
                spanToSearch,
                includeGlobalImports,
                frozenPartialSemantics : true,
                cancellationToken).ConfigureAwait(false);

            var elapsed = stopwatch.Elapsed;

            if (inheritanceMemberItems.IsEmpty)
            {
                return;
            }

            InheritanceMarginLogger.LogGenerateBackgroundInheritanceInfo(elapsed);

            // One line might have multiple members to show, so group them.
            // For example:
            // interface IBar { void Foo1(); void Foo2(); }
            // class Bar : IBar { void Foo1() { } void Foo2() { } }
            var lineToMembers = inheritanceMemberItems.GroupBy(item => item.LineNumber);

            var snapshot = spanToTag.SnapshotSpan.Snapshot;

            foreach (var(lineNumber, membersOnTheLine) in lineToMembers)
            {
                var membersOnTheLineArray = membersOnTheLine.ToImmutableArray();

                // One line should at least have one member on it.
                Contract.ThrowIfTrue(membersOnTheLineArray.IsEmpty);

                var line = snapshot.GetLineFromLineNumber(lineNumber);
                // We only care about the line, so just tag the start.
                context.AddTag(new TagSpan <InheritanceMarginTag>(
                                   new SnapshotSpan(snapshot, line.Start, length: 0),
                                   new InheritanceMarginTag(lineNumber, membersOnTheLineArray)));
            }
        }
Esempio n. 20
0
 public DefaultRenamer(RuleSet ruleSet, GlobalOptions opts)
 {
     Inflector = new Flexer(ruleSet);
     Options = opts;
 }
Esempio n. 21
0
 public MongoSource(GlobalOptions globalOptions, TriggerUpdatesFromMongoOptions cliOptions)
 {
     _cliOptions = cliOptions;
 }
Esempio n. 22
0
 void Awake()
 {
     sprite = GetComponentInChildren<OTAnimatingSprite>();
     options = GlobalOptions.Instance;
 }
Esempio n. 23
0
 protected void getPlayer()
 {
     playerScript = GlobalOptions.GetPlayerScript();
 }
Esempio n. 24
0
 // Use this for initialization
 void Start()
 {
     options = GlobalOptions.Instance;
     Team winningTeam = options.GetMostRecentWinningTeam();
     GetComponent<TextMesh>().text = winningTeam.teamName;
 }
Esempio n. 25
0
 /// <summary>
 /// Global options that don't apply to each chart. These options, like the lang options, must be set using the Highcharts.setOptions method.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public Highcharts SetOptions(GlobalOptions options)
 {
     Options = options;
     return(this);
 }
Esempio n. 26
0
 /// <summary>
 /// Global options that don't apply to each chart. These options, like the lang options, must be set using the Highstock.setOptions method.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public new Highstock SetOptions(GlobalOptions options)
 {
     base.SetOptions(options);
     return(this);
 }
Esempio n. 27
0
        /// <summary>
        /// Configure services
        /// </summary>
        /// <param name="services">Service collection</param>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers()
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            services.AddSession();

            #region Inject AppSetting configuration

            services.Configure <AppSettings>(this.configuration);

            // Set static AppSettingProvider
            var globalOptions = new GlobalOptions();
            configuration.GetSection("Global").Bind(globalOptions);
            AppSettingProvider.Global = globalOptions;
            #endregion

            #region OpenAPI specification (Swagger)
            services.AddOpenApiSpec <CustomSwaggerConfig>();
            #endregion

            #region IISOptions
            services.Configure <IISOptions>(options =>
            {
                options.AutomaticAuthentication   = false;
                options.AuthenticationDisplayName = "Windows";
            });
            #endregion

            #region Identity Server

            var builder = services.AddIdentityServer(options =>
            {
                // options.PublicOrigin = "https://localhost:6001";
                // options.IssuerUri = "https://localhost:6001";
                options.Events.RaiseErrorEvents       = true;
                options.Events.RaiseInformationEvents = true;
                options.Events.RaiseFailureEvents     = true;
                options.Events.RaiseSuccessEvents     = true;

                options.Discovery.ResponseCacheInterval = 60;
            });

            // Signing credential
            if (this.env.IsDevelopment())
            {
                builder.AddDeveloperSigningCredential();
            }
            else
            {
                // 1. Store in file (Support renew manually)
                // builder.AddSigningCredentialsByFile(this.appSettings);

                // 2. Store in Redis (Support renew automatically)
                builder.AddSigningCredentialByRedis(this.appSettings);

                // 3. Use cert
                // builder.AddSigningCredentialByCert(this.appSettings, isFromWindowsCertStore: true);
            }

            // Set in-memory, code config
            builder.AddInMemoryIdentityResources(InMemoryInitConfig.GetIdentityResources());
            builder.AddInMemoryApiResources(InMemoryInitConfig.GetApiResources());
            builder.AddInMemoryClients(InMemoryInitConfig.GetClients());
            builder.AddLdapUsers <OpenLdapAppUser>(this.configuration.GetSection("LdapServer"), UserStore.InMemory); // OpenLDAP
            //builder.AddLdapUsers<ActiveDirectoryAppUser>(this.configuration.GetSection("LdapServer"), UserStore.InMemory); // ActiveDirectory

            builder.AddProfileService <ProfileService>();

            #endregion

            #region  Inject Cache service
            services.AddMemoryCache();
            services.AddCacheServices();
            #endregion

            #region Custom sinks
            services.AddScoped <IEventSink, UserProfileCacheSink>();
            #endregion

            #region Custom services
            services.AddSingleton <LdapUserManager>();
            #endregion
        }
Esempio n. 28
0
        public void Run(string source, RuleSet ruleSet, GlobalOptions options, Type customRenamerType = null)
        {
            var edmxFile = new EdmxFile(source);

            MModel = new MetaModel(edmxFile);

            Options = options;

            if (customRenamerType != null)
            {
                //Renamer = (IRenamer) Activator.CreateInstance(customRenamerType, ruleSet, Options);
            }
            else
                Renamer = new DefaultRenamer(ruleSet, Options);

            ProcessCSDL(edmxFile.Concept);
            ProcessMSL(edmxFile.Mapping);
            ProcessDesigner(edmxFile.Diagram);

            edmxFile.Save(options.GetOutputPath(source));
        }
 public async Task <ConvertFile> ConvertAsync(InputBase input, ConvertFile output, GlobalOptions globalOptions, PageOptions pageOptions, CancellationToken cancellationToken = default)
 {
     return(await ConvertAsync(new List <InputBase> {
         input
     }, output, globalOptions, pageOptions, cancellationToken));
 }
Esempio n. 30
0
        /// <summary>
        /// Main entry point. Parses any global options and initializes the logging system, then invokes the appropriate command.
        /// </summary>
        /// <param name="ArgumentsArray">Command line arguments</param>
        /// <returns>Zero on success, non-zero on error</returns>
        private static int Main(string[] ArgumentsArray)
        {
            SingleInstanceMutex Mutex = null;

            try
            {
                // Start capturing performance info
                Timeline.Start();

                // Parse the command line arguments
                CommandLineArguments Arguments = new CommandLineArguments(ArgumentsArray);

                // Parse the global options
                GlobalOptions Options = new GlobalOptions(Arguments);

                // Configure the log system
                Log.OutputLevel       = Options.LogOutputLevel;
                Log.IncludeTimestamps = Options.bLogTimestamps;
                Log.IncludeProgramNameWithSeverityPrefix = Options.bLogFromMsBuild;

                // Configure the progress writer
                ProgressWriter.bWriteMarkup = Options.bWriteProgressMarkup;

                // Add the log writer if requested. When building a target, we'll create the writer for the default log file later.
                if (Options.LogFileName != null)
                {
                    Log.AddFileWriter("LogTraceListener", Options.LogFileName);
                }

                // Ensure we can resolve any external assemblies that are not in the same folder as our assembly.
                AssemblyUtils.InstallAssemblyResolver(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetOriginalLocation()));

                // Change the working directory to be the Engine/Source folder. We are likely running from Engine/Binaries/DotNET
                // This is critical to be done early so any code that relies on the current directory being Engine/Source will work.
                DirectoryReference.SetCurrentDirectory(UnrealBuildTool.EngineSourceDirectory);

                // Get the type of the mode to execute, using a fast-path for the build mode.
                Type ModeType = typeof(BuildMode);
                if (Options.Mode != null)
                {
                    // Find all the valid modes
                    Dictionary <string, Type> ModeNameToType = new Dictionary <string, Type>(StringComparer.OrdinalIgnoreCase);
                    foreach (Type Type in Assembly.GetExecutingAssembly().GetTypes())
                    {
                        if (Type.IsClass && !Type.IsAbstract && Type.IsSubclassOf(typeof(ToolMode)))
                        {
                            ToolModeAttribute Attribute = Type.GetCustomAttribute <ToolModeAttribute>();
                            if (Attribute == null)
                            {
                                throw new BuildException("Class '{0}' should have a ToolModeAttribute", Type.Name);
                            }
                            ModeNameToType.Add(Attribute.Name, Type);
                        }
                    }

                    // Try to get the correct mode
                    if (!ModeNameToType.TryGetValue(Options.Mode, out ModeType))
                    {
                        Log.TraceError("No mode named '{0}'. Available modes are:\n  {1}", Options.Mode, String.Join("\n  ", ModeNameToType.Keys));
                        return(1);
                    }
                }

                // Get the options for which systems have to be initialized for this mode
                ToolModeOptions ModeOptions = ModeType.GetCustomAttribute <ToolModeAttribute>().Options;

                // Start prefetching the contents of the engine folder
                if ((ModeOptions & ToolModeOptions.StartPrefetchingEngine) != 0)
                {
                    using (Timeline.ScopeEvent("FileMetadataPrefetch.QueueEngineDirectory()"))
                    {
                        FileMetadataPrefetch.QueueEngineDirectory();
                    }
                }

                // Read the XML configuration files
                if ((ModeOptions & ToolModeOptions.XmlConfig) != 0)
                {
                    using (Timeline.ScopeEvent("XmlConfig.ReadConfigFiles()"))
                    {
                        string XmlConfigMutexName = SingleInstanceMutex.GetUniqueMutexForPath("UnrealBuildTool_Mutex_XmlConfig", Assembly.GetExecutingAssembly().CodeBase);
                        using (SingleInstanceMutex XmlConfigMutex = new SingleInstanceMutex(XmlConfigMutexName, true))
                        {
                            FileReference XmlConfigCache = Arguments.GetFileReferenceOrDefault("-XmlConfigCache=", null);
                            XmlConfig.ReadConfigFiles(XmlConfigCache);
                        }
                    }
                }

                // Acquire a lock for this branch
                if ((ModeOptions & ToolModeOptions.SingleInstance) != 0 && !Options.bNoMutex)
                {
                    using (Timeline.ScopeEvent("SingleInstanceMutex.Acquire()"))
                    {
                        string MutexName = SingleInstanceMutex.GetUniqueMutexForPath("UnrealBuildTool_Mutex", Assembly.GetExecutingAssembly().CodeBase);
                        Mutex = new SingleInstanceMutex(MutexName, Options.bWaitMutex);
                    }
                }

                // Register all the build platforms
                if ((ModeOptions & ToolModeOptions.BuildPlatforms) != 0)
                {
                    using (Timeline.ScopeEvent("UEBuildPlatform.RegisterPlatforms()"))
                    {
                        UEBuildPlatform.RegisterPlatforms(false, false);
                    }
                }
                if ((ModeOptions & ToolModeOptions.BuildPlatformsHostOnly) != 0)
                {
                    using (Timeline.ScopeEvent("UEBuildPlatform.RegisterPlatforms()"))
                    {
                        UEBuildPlatform.RegisterPlatforms(false, true);
                    }
                }
                if ((ModeOptions & ToolModeOptions.BuildPlatformsForValidation) != 0)
                {
                    using (Timeline.ScopeEvent("UEBuildPlatform.RegisterPlatforms()"))
                    {
                        UEBuildPlatform.RegisterPlatforms(true, false);
                    }
                }

                // Create the appropriate handler
                ToolMode Mode = (ToolMode)Activator.CreateInstance(ModeType);

                // Execute the mode
                int Result = Mode.Execute(Arguments);
                if ((ModeOptions & ToolModeOptions.ShowExecutionTime) != 0)
                {
                    Log.TraceInformation("Total execution time: {0:0.00} seconds", Timeline.Elapsed.TotalSeconds);
                }
                return(Result);
            }
            catch (CompilationResultException Ex)
            {
                // Used to return a propagate a specific exit code after an error has occurred. Does not log any message.
                Log.TraceLog(ExceptionUtils.FormatExceptionDetails(Ex));
                return((int)Ex.Result);
            }
            catch (BuildException Ex)
            {
                // BuildExceptions should have nicely formatted messages. We can log these directly.
                Log.TraceError(ExceptionUtils.FormatException(Ex));
                Log.TraceLog(ExceptionUtils.FormatExceptionDetails(Ex));
                return((int)CompilationResult.OtherCompilationError);
            }
            catch (Exception Ex)
            {
                // Unhandled exception.
                Log.TraceError("Unhandled exception: {0}", ExceptionUtils.FormatException(Ex));
                Log.TraceLog(ExceptionUtils.FormatExceptionDetails(Ex));
                return((int)CompilationResult.OtherCompilationError);
            }
            finally
            {
                // Cancel the prefetcher
                using (Timeline.ScopeEvent("FileMetadataPrefetch.Stop()"))
                {
                    FileMetadataPrefetch.Stop();
                }

                // Print out all the performance info
                Timeline.Print(TimeSpan.FromMilliseconds(20.0), LogEventType.Log);

                // Make sure we flush the logs however we exit
                Trace.Close();

                // Dispose of the mutex. Must be done last to ensure that another process does not startup and start trying to write to the same log file.
                if (Mutex != null)
                {
                    Mutex.Dispose();
                }
            }
        }
Esempio n. 31
0
 // Use this for initialization
 void Start()
 {
     options = GlobalOptions.Instance;
 }
Esempio n. 32
0
 public LogsModel(IOptions <GlobalOptions> globalSettings)
 {
     _globalSettings = globalSettings.Value;
 }
Esempio n. 33
0
    // Use this for initialization

    public override void OnHit(Collider other)
    {
        GlobalOptions.GetMissionEmmitters().NotifyJumpOverHaystack(1);
    }
        public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities)
        {
            var serverCapabilities = new VSInternalServerCapabilities();

            // If the LSP editor feature flag is enabled advertise support for LSP features here so they are available locally and remote.
            var isLspEditorEnabled = GlobalOptions.GetOption(LspOptions.LspEditorFeatureFlag);

            if (isLspEditorEnabled)
            {
                serverCapabilities = (VSInternalServerCapabilities)_defaultCapabilitiesProvider.GetCapabilities(clientCapabilities);
            }
            else
            {
                // Even if the flag is off, we want to include text sync capabilities.
                serverCapabilities.TextDocumentSync = new TextDocumentSyncOptions
                {
                    Change    = TextDocumentSyncKind.Incremental,
                    OpenClose = true,
                };
            }

            serverCapabilities.ProjectContextProvider = true;
            serverCapabilities.BreakableRangeProvider = true;

            var isPullDiagnostics = GlobalOptions.IsPullDiagnostics(InternalDiagnosticsOptions.NormalDiagnosticMode);

            if (isPullDiagnostics)
            {
                serverCapabilities.SupportsDiagnosticRequests     = true;
                serverCapabilities.MultipleContextSupportProvider = new VSInternalMultipleContextFeatures {
                    SupportsMultipleContextsDiagnostics = true
                };
            }

            // This capability is always enabled as we provide cntrl+Q VS search only via LSP in ever scenario.
            serverCapabilities.WorkspaceSymbolProvider = true;
            // This capability prevents NavigateTo (cntrl+,) from using LSP symbol search when the server also supports WorkspaceSymbolProvider.
            // Since WorkspaceSymbolProvider=true always to allow cntrl+Q VS search to function, we set DisableGoToWorkspaceSymbols=true
            // when not running the experimental LSP editor.  This ensures NavigateTo uses the existing editor APIs.
            // However, when the experimental LSP editor is enabled we want LSP to power NavigateTo, so we set DisableGoToWorkspaceSymbols=false.
            serverCapabilities.DisableGoToWorkspaceSymbols = !isLspEditorEnabled;

            var isLspSemanticTokensEnabled = GlobalOptions.GetOption(LspOptions.LspSemanticTokensFeatureFlag);

            if (isLspSemanticTokensEnabled)
            {
                // Using only range handling has shown to be more performant than using a combination of full/edits/range handling,
                // especially for larger files. With range handling, we only need to compute tokens for whatever is in view, while
                // with full/edits handling we need to compute tokens for the entire file and then potentially run a diff between
                // the old and new tokens.
                serverCapabilities.SemanticTokensOptions = new SemanticTokensOptions
                {
                    Full   = false,
                    Range  = true,
                    Legend = new SemanticTokensLegend
                    {
                        TokenTypes     = SemanticTokenTypes.AllTypes.Concat(SemanticTokensHelpers.RoslynCustomTokenTypes).ToArray(),
                        TokenModifiers = new string[] { SemanticTokenModifiers.Static }
                    }
                };
            }

            return(serverCapabilities);
        }
Esempio n. 35
0
    // Use this for initialization

    public override void OnHit(Collider other)
    {
        GlobalOptions.GetMissionEmmitters().NotifySlideUnderSomething(1);
    }
Esempio n. 36
0
 protected override void MakeOnStop()
 {
     GlobalOptions.GetGuiLayer().ShowGameOverScreen();
 }
Esempio n. 37
0
 private bool IsXamlLspIntelliSenseEnabled()
 => GlobalOptions.GetOption(XamlOptions.EnableLspIntelliSenseFeatureFlag);
Esempio n. 38
0
 public TriggerUpdatesHost(GlobalOptions options, ITriggerUpdatesSource source, IRabbitMqAdapter rabbitMqAdapter = null)
     : base(options, rabbitMqAdapter)
 {
     this._source = source;
     _producer    = RabbitMqAdapter.SetupProducer(options.TriggerUpdatesOptions, isBatch: false);
 }
Esempio n. 39
0
        private static int OnParse(GlobalOptions globals, IsIdentifiableReviewerOptions opts)
        {
            FansiImplementations.Load();

            Deserializer  d = new Deserializer();
            List <Target> targets;

            try
            {
                var file = new FileInfo(opts.TargetsFile);

                if (!file.Exists)
                {
                    Console.Write($"Could not find '{file.FullName}'");
                    return(1);
                }

                var contents = File.ReadAllText(file.FullName);

                if (string.IsNullOrWhiteSpace(contents))
                {
                    Console.Write($"Targets file is empty '{file.FullName}'");
                    return(2);
                }

                targets = d.Deserialize <List <Target> >(contents);

                if (!targets.Any())
                {
                    Console.Write($"Targets file did not contain any valid targets '{file.FullName}'");
                    return(3);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error deserializing '{opts.TargetsFile}'");
                Console.WriteLine(e.Message);
                return(4);
            }

            if (opts.OnlyRules)
            {
                Console.WriteLine("Skipping Connection Tests");
            }
            else
            {
                Console.WriteLine("Running Connection Tests");

                try
                {
                    foreach (Target t in targets)
                    {
                        Console.WriteLine(t.Discover().Exists()
                            ? $"Successfully connected to {t.Name}"
                            : $"Failed to connect to {t.Name}");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error Validating Targets");
                    Console.WriteLine(e.ToString());
                    return(10);
                }
            }

            //for updater try to match the ProblemValue words
            var updater = new RowUpdater(new FileInfo(opts.RedList))
            {
                RulesOnly    = opts.OnlyRules,
                RulesFactory = new MatchProblemValuesPatternFactory()
            };

            //for Ignorer match the whole string
            var ignorer = new IgnoreRuleGenerator(new FileInfo(opts.IgnoreList));

            try
            {
                if (!string.IsNullOrWhiteSpace(opts.UnattendedOutputPath))
                {
                    //run unattended
                    if (targets.Count != 1)
                    {
                        throw new Exception("Unattended requires a single entry in Targets");
                    }

                    var unattended = new UnattendedReviewer(opts, targets.Single(), ignorer, updater);
                    return(unattended.Run());
                }
                else
                {
                    Console.WriteLine("Press any key to launch GUI");
                    Console.ReadKey();

                    //run interactive
                    Application.Init();
                    var mainWindow = new MainWindow(opts, ignorer, updater);
                    Application.Top.Add(mainWindow);
                    Application.Run();
                    return(0);
                }
            }
            catch (Exception e)
            {
                Console.Write(e.Message);

                int tries = 5;
                while (Application.Top != null && tries-- > 0)
                {
                    try
                    {
                        Application.RequestStop();
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Failed to terminate GUI on crash");
                    }
                }

                return(99);
            }
        }
        public async Task <ConvertFile> ConvertAsync(List <InputBase> inputs, ConvertFile output, GlobalOptions globalOptions, PageOptions pageOptions, CancellationToken cancellationToken = default)
        {
            var parameters = new WKHtmltopdfParameters
            {
                Task          = Enums.WKHtmltopdfTask.Convert,
                InputFiles    = inputs.ToArray(),
                OutputFile    = output,
                GlobalOptions = globalOptions,
                PageOptions   = pageOptions
            };

            await ExecuteAsync(parameters, cancellationToken);

            return(parameters.OutputFile);
        }
Esempio n. 41
0
 public IndexModel(CategoryService categoryService, IOptions <GlobalOptions> globalSettings)
 {
     _categoryService = categoryService;
     _globalSettings  = globalSettings.Value;
 }
        private static List <Settlement> Create([ItemNotNull][NotNull] List <SimpleModularHousehold> simpleHHs, [NotNull] Simulator sim,
                                                [NotNull] GlobalOptions globalOptions)
        {
            var finishedHHs    = new List <ModularHousehold>();
            var finishedHouses = new List <House>();

            foreach (var smhh in simpleHHs)
            {
                var name   = globalOptions.HouseholdName + " - " + smhh.Name;
                var oldMhh = sim.ModularHouseholds.It.FirstOrDefault(x => x.Name == name);
                if (oldMhh != null)
                {
                    sim.ModularHouseholds.DeleteItem(oldMhh);
                    Logger.Warning("Deleted the previously created household with the name " + name);
                }
                var mhh = sim.ModularHouseholds.CreateNewItem(sim.ConnectionString);
                finishedHHs.Add(mhh);
                mhh.EnergyIntensityType = globalOptions.EnergyIntensityType;

                mhh.Name = name;
                Logger.Info("Created a household named: " + mhh.Name);

                mhh.Description     = globalOptions.Description ?? "";
                mhh.DeviceSelection = sim.DeviceSelections.It.First(x => x.PrettyName == globalOptions.DeviceSelection);
                mhh.Vacation        = sim.Vacations.It.FirstOrDefault(x => x.PrettyName == smhh.Vacation);
                mhh.SaveToDB();
                foreach (var tagName in globalOptions.Tags)
                {
                    var tag = sim.HouseholdTags.It.FirstOrDefault(x => x.PrettyName == tagName);
                    if (tag == null)
                    {
                        throw new LPGException("Could not recognize Tag: " + tagName);
                    }
                    mhh.AddHouseholdTag(tag);
                }
                if (mhh.Vacation == null)
                {
                    throw new LPGException("Could not identify vacation with the name: " + smhh.Vacation);
                }
                var personCount = 0;
                foreach (SimplePerson sp in smhh.Persons.Values)
                {
                    if (sp.Traits.Count > 0)
                    {
                        var personName = sp.Name + " - " + smhh.Name;
                        var oldPerson  = sim.Persons.It.FirstOrDefault(x => x.Name == personName);
                        if (oldPerson != null)
                        {
                            sim.Persons.DeleteItem(oldPerson);
                            Logger.Warning("Deleted the previously created person with the name " + personName);
                        }

                        var p = sim.Persons.CreateNewItem(sim.ConnectionString);
                        p.Name = personName;
                        p.Age  = sp.Age;
                        p.AverageSicknessDuration = sp.SicknessDuration;
                        p.Gender = sp.Gender?.ToLower(CultureInfo.CurrentCulture) == "male"
                            ? PermittedGender.Male
                            : PermittedGender.Female;
                        p.SickDays = sp.AverageSickDays;
                        personCount++;
                        TraitTag tag = sim.TraitTags.FindFirstByName(sp.TraitTag);
                        if (tag == null)
                        {
                            throw new LPGException("Tag not found");
                        }
                        mhh.AddPerson(p, tag);

                        foreach (var traitName in sp.Traits)
                        {
                            var trait = sim.HouseholdTraits.It.FirstOrDefault(x => x.PrettyName == traitName);
                            if (trait == null)
                            {
                                trait = sim.HouseholdTraits.It.FirstOrDefault(x => x.PrettyNameOld == traitName);
                            }
                            if (trait == null)
                            {
                                throw new LPGException("Could not find a trait with the name: " + traitName);
                            }
                            mhh.AddTrait(trait, ModularHouseholdTrait.ModularHouseholdTraitAssignType.Name, p);
                        }
                        Logger.Info("Added " + sp.Traits.Count + " traits to the person " + p.PrettyName);
                        p.SaveToDB();
                    }
                    else
                    {
                        Logger.Info("Person " + sp.Name + " has no traits for " + smhh.Name);
                    }
                }
                Logger.Info("Imported " + personCount + " persons.");
                var house = MakeHouse(sim, globalOptions, smhh, mhh);
                finishedHouses.Add(house);
            }
            var resultingSettlements = new List <Settlement>();

            Logger.Info("Finished creating households.");
            // now make the settlement for the modular household testing
            Logger.Info("Creating a settlement");
            var settlementName = "Test settlement for imported " + globalOptions.HouseholdName;
            var oldSett        = sim.Settlements.It.FirstOrDefault(x => x.Name == settlementName);

            if (oldSett != null)
            {
                sim.Settlements.DeleteItem(oldSett);
                Logger.Warning("Deleted old settlement " + settlementName);
            }
            var sett = sim.Settlements.CreateNewItem(sim.ConnectionString);

            foreach (var modularHousehold in finishedHHs)
            {
                sett.AddHousehold(modularHousehold, 1);
            }
            sett.Name = settlementName;
            sett.SaveToDB();
            resultingSettlements.Add(sett);
            // make the settlement for the house testing
            Logger.Info("Creating a settlement for the houses");
            var houseSettlementName = "Test settlement for imported houses for " + globalOptions.HouseholdName;
            var oldHouseSett        = sim.Settlements.It.FirstOrDefault(x => x.Name == houseSettlementName);

            if (oldHouseSett != null)
            {
                sim.Settlements.DeleteItem(oldHouseSett);
                Logger.Warning("Deleted old house settlement " + houseSettlementName);
            }
            var houseSett = sim.Settlements.CreateNewItem(sim.ConnectionString);

            foreach (var house in finishedHouses)
            {
                houseSett.AddHousehold(house, 1);
            }
            houseSett.Name = houseSettlementName;
            houseSett.SaveToDB();
            resultingSettlements.Add(houseSett);

            return(resultingSettlements);
        }
Esempio n. 43
0
    // Use this for initialization

    public override void OnHit(Collider other)
    {
        base.OnHit(other);
        GlobalOptions.GetMissionEmmitters().NotifyScarecrowDeath(1);
    }
Esempio n. 44
0
        public void Throws_on_read_timeout()
        {
            bool checkpointRead = false;

            var reader = Sys.ActorOf(conf =>
            {
                conf.Receive<ReadProjectionCheckpointRequest>((r, ctx) =>
                {
                    ctx.Sender.Tell(new ReadProjectionCheckpointResponse(r.RequestID, 0));
                    checkpointRead = true;
                });
            });

            var options = new GlobalOptions
            {
                ReadRequestTimeout = TimeSpan.FromMilliseconds(300)
            };

            var props = ProjectionStream.CreateProps(new ProjectionStreamQuery(), reader, ActorRefs.Nobody, options);

            Sys.ActorOf(c =>
            {
                c.OnPreStart = ctx => ctx.ActorOf(props);
                c.Strategy = new OneForOneStrategy(ex =>
                {
                    TestActor.Tell(ex);
                    return Directive.Stop;
                });
            });

            ExpectMsg<Exception>();
            Assert.True(checkpointRead);
        }
Esempio n. 45
0
 public IndexModel(GameService gameService, IOptions <GlobalOptions> globalSettings)
 {
     _gameService    = gameService;
     _globalSettings = globalSettings.Value;
 }
Esempio n. 46
0
 public void FlyXYZRotateXYZStop()
 {
     GlobalOptions.GetPlayerScript().RemovePosilka();
     Destroy(gameObject, 0.1f);
 }
Esempio n. 47
0
        public void Test_Options()
        {
            using (IniFile iniFile = new IniFile()) {
                GlobalOptions globalOptions = GlobalOptions.Instance;
                Assert.IsNotNull(globalOptions);

                Assert.IsNotNull(globalOptions.TreeChartOptions);
                Assert.IsNotNull(globalOptions.CircleChartOptions);

                /*globalOptions.DefCharacterSet = GEDCOMCharacterSet.csUNICODE;
                 * Assert.AreEqual(GEDCOMCharacterSet.csUNICODE, globalOptions.DefCharacterSet);*/
                Assert.AreEqual(GEDCOMCharacterSet.csUTF8, globalOptions.DefCharacterSet);

                globalOptions.DefDateFormat = DateFormat.dfDD_MM_YYYY;
                Assert.AreEqual(DateFormat.dfDD_MM_YYYY, globalOptions.DefDateFormat);

                globalOptions.ShowDatesSign = true;
                Assert.AreEqual(true, globalOptions.ShowDatesSign);

                globalOptions.DefNameFormat = NameFormat.nfF_N_P;
                Assert.AreEqual(NameFormat.nfF_N_P, globalOptions.DefNameFormat);

                Assert.IsNotNull(globalOptions.EventFilters);

                globalOptions.InterfaceLang = 1000;
                Assert.AreEqual(1000, globalOptions.InterfaceLang);

                globalOptions.LastDir = "c:\\";
                Assert.AreEqual("c:\\", globalOptions.LastDir);

                Assert.IsNotNull(globalOptions.MRUFiles);

                globalOptions.MWinRect = ExtRect.CreateEmpty();
                Assert.IsTrue(globalOptions.MWinRect.IsEmpty());

                globalOptions.MWinState = WindowState.Maximized;
                Assert.AreEqual(WindowState.Maximized, globalOptions.MWinState);

                Assert.IsNotNull(globalOptions.NameFilters);

                Assert.IsNotNull(globalOptions.PedigreeOptions);

                globalOptions.PlacesWithAddress = true;
                Assert.AreEqual(true, globalOptions.PlacesWithAddress);

                Assert.IsNotNull(globalOptions.Proxy);

                Assert.IsNotNull(globalOptions.Relations);

                Assert.IsNotNull(globalOptions.ResidenceFilters);

                globalOptions.FileBackup = FileBackup.fbOnlyPrev;
                Assert.AreEqual(FileBackup.fbOnlyPrev, globalOptions.FileBackup);

                globalOptions.ShowTips = true;
                Assert.AreEqual(true, globalOptions.ShowTips);

                globalOptions.ListHighlightUnmarriedPersons = true;
                Assert.AreEqual(true, globalOptions.ListHighlightUnmarriedPersons);

                globalOptions.ListHighlightUnparentedPersons = true;
                Assert.AreEqual(true, globalOptions.ListHighlightUnparentedPersons);

                Assert.IsNotNull(globalOptions.IndividualListColumns);

                globalOptions.ShowDatesCalendar = true;
                Assert.AreEqual(true, globalOptions.ShowDatesCalendar);

                globalOptions.Autosave = true;
                Assert.AreEqual(true, globalOptions.Autosave);

                globalOptions.AutosaveInterval = 10;
                Assert.AreEqual(10, globalOptions.AutosaveInterval);

                globalOptions.ExtendedNames = true;
                Assert.AreEqual(true, globalOptions.ExtendedNames);

                globalOptions.UseExtendedNotes = true;
                Assert.AreEqual(true, globalOptions.UseExtendedNotes);
                globalOptions.UseExtendedNotes = false;

                globalOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMaiden;
                Assert.AreEqual(WomanSurnameFormat.wsfMaiden, globalOptions.WomanSurnameFormat);

                globalOptions.AddLastBase("sample.ged");
                Assert.AreEqual(1, globalOptions.GetLastBasesCount());
                Assert.AreEqual("sample.ged", globalOptions.GetLastBase(0));
                globalOptions.ClearLastBases();

                Assert.IsNotNull(globalOptions.Languages);

                globalOptions.FindLanguages();


                globalOptions.SaveToFile(iniFile);
                globalOptions.LoadFromFile(iniFile);

                IniFile ini = null;
                Assert.Throws(typeof(ArgumentNullException), () => { globalOptions.SaveToFile(ini); });
                Assert.Throws(typeof(ArgumentNullException), () => { globalOptions.LoadFromFile(ini); });

                string iniFN = null;
                Assert.Throws(typeof(ArgumentNullException), () => { globalOptions.SaveToFile(iniFN); });
                Assert.Throws(typeof(ArgumentNullException), () => { globalOptions.LoadFromFile(iniFN); });

                iniFN = TestUtils.GetTempFilePath("options.ini");
                globalOptions.SaveToFile(iniFN);
                globalOptions.LoadFromFile(iniFN);


                MRUFile mruFile = new MRUFile();
                Assert.IsNotNull(mruFile);

                mruFile = new MRUFile("test.ged");
                Assert.IsNotNull(mruFile);
                Assert.AreEqual(-1, globalOptions.MRUFiles_IndexOf("test.ged"));
                globalOptions.MRUFiles.Add(mruFile);
                Assert.AreEqual(0, globalOptions.MRUFiles_IndexOf("test.ged"));

                mruFile.SaveToFile(iniFile, "xxx");
                mruFile.LoadFromFile(iniFile, "xxx");
                MRUFile.DeleteKeys(iniFile, "xxx");
                Assert.Throws(typeof(ArgumentNullException), () => { mruFile.SaveToFile(null, "xxx"); });
                Assert.Throws(typeof(ArgumentNullException), () => { mruFile.LoadFromFile(null, "xxx"); });
                Assert.Throws(typeof(ArgumentNullException), () => { MRUFile.DeleteKeys(null, "xxx"); });
            }
        }
Esempio n. 48
0
 public CustomRenamerExample(RuleSet ruleSet, GlobalOptions opts)
     : base(ruleSet, opts)
 {
 }
        public void Worker_requests_until_all_events_are_read()
        {
            var canFinish = false;

            var reader = Sys.ActorOf(conf =>
            {
                conf.Receive<ReadIndexedProjectionStreamRequest>((r, ctx) =>
                {
                    var start = r.InitialSequence;
                    int end;

                    if (canFinish)
                        end = start + r.Count;
                    else
                        end = start + 2;

                    for (var i = start; i <= end; i++)
                    {
                        var e = MockPersistedStreamEvent.Create(new TestEvent(), i, i);
                        ctx.Sender.Tell(new ReadIndexedProjectionStreamResponse(r.RequestID, e));
                    }

                    ctx.Sender.Tell(new ReadIndexedProjectionStreamFinished(r.RequestID, end));
                });
            });

            var request = new ProjectionSubscriptionRequest(new ProjectionStreamQuery(), 0);
            var options = new GlobalOptions { ProjectionReplayRetryInterval = TimeSpan.FromMilliseconds(600) };
            var worker = Sys.ActorOf<ProjectionReplayWorker>();
            worker.Tell(new InitializeProjectionReplayWorker(reader, TestActor, request, 5, new GlobalOptions()));

#pragma warning disable 4014
            Task.Delay(500).ContinueWith(_ => canFinish = true);
#pragma warning restore 4014

            ExpectMsg<ProjectionReplayEvent>(m => m.Event.StreamSequence == 1);
            ExpectMsg<ProjectionReplayEvent>(m => m.Event.StreamSequence == 2);
            ExpectMsg<ProjectionReplayEvent>(m => m.Event.StreamSequence == 3);
            ExpectMsg<ProjectionReplayEvent>(m => m.Event.StreamSequence == 4);
            ExpectMsg<ProjectionReplayEvent>(m => m.Event.StreamSequence == 5);
            ExpectMsg<ProjectionReplayFinished>();
        }