Наследование: MonoBehaviour
Пример #1
14
        public void Execute(string[] args)
        {
            Options options = new Options(args);

            int threadsCount = options.ThreadsCount > 0
                ? options.ThreadsCount
                : Environment.ProcessorCount;

            _loopsPerThread = options.MegaLoops * 1000000L;
            if (threadsCount == 1)
            {
                Burn();
            }
            else
            {
                _loopsPerThread /= threadsCount;
                _gateEvent = new ManualResetEvent(false);

                Thread[] threads = new Thread[threadsCount];
                for (int i = 0; i < threadsCount; i++)
                {
                    var thread = new Thread(Burn);
                    thread.IsBackground = true;
                    thread.Start();
                    threads[i] = thread;
                }
                _gateEvent.Set();

                foreach (var thread in threads)
                    thread.Join();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            bool showHelp = false;
            IEnumerable<string> assemblies = Enumerable.Empty<string>();

            var optionSet = new Options() {
                { "h|help", "show this message and exit", x => showHelp = x != null},
                { "a=|assemblies=", "comma-seperated list of the names of assemblies to test", x => assemblies = x.Split(',') }
            };

            try
            {
                optionSet.Parse(args);
                if (showHelp)
                {
                    ShowHelp(optionSet);
                    return;
                }
                if (!assemblies.Any())
                {
                    throw new InvalidOperationException("No assemblies specified.");
                }
            }
            catch (InvalidOperationException exception)
            {
                Console.Write(string.Format("{0}: ", AppDomain.CurrentDomain.FriendlyName));
                Console.WriteLine(exception.Message);
                Console.WriteLine("Try {0} --help for more information", AppDomain.CurrentDomain.FriendlyName);
                return;
            }
            assemblies.ForEach(x => new PrintFailuresOutputter().Output(x, SimpleRunner.RunAllInAssembly(x)));
        }
        public void TestDayOfWeekModifierWithSundayStartOne()
        {
            Options options = new Options();
            options.DayOfWeekStartIndexZero = false;

            Assert.AreEqual("Op 12:23 PM, op de tweede zondag van de maand", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options));
        }
Пример #4
0
        /// <summary>
        /// Starts the nodelet.
        /// </summary>
        /// <param name="options">The nodelet command options.</param>
        public void Start(Options options)
        {
            using (var context = ZmqContext.Create())
            using (var client = context.CreateSocket(SocketType.REQ))
            {
                var endpoint = string.Format("tcp://{0}", options.SocketConnection);
                Console.WriteLine("Connecting to: {0}", endpoint);
                client.Connect(endpoint);

                var sw = new Stopwatch();

                foreach(var i in Enumerable.Range(1, NumberOfMessages))
                {
                    Console.WriteLine("Message {0} of {1} sent", i, NumberOfMessages);
                    var message = DateTime.UtcNow.Ticks.ToString();

                    sw.Restart();

                    client.Send(message, Encoding.Unicode);
                    var reply = client.Receive(Encoding.Unicode);

                    sw.Stop();

                    var messageIsMatch = message == reply ? 1 : 0;
                    Console.WriteLine("{0}: Reply received in {1}ms", messageIsMatch, sw.ElapsedMilliseconds);
                }

            }
        }
Пример #5
0
        public void TestNoInternal()
        {
            PolicyTemplate template = new PolicyTemplate();
            template.Load(policyFile);

            Options options = new Options(pdfExternal);

            SortedList<int, IAction> internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            SortedList<int, IAction> externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(1, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);

            PdfPolicy pdfPolicy = new PdfPolicy(template, options);
            pdfPolicy.Apply();

            string runtimePolicy = System.IO.Path.GetTempFileName();
            string myPolicy = System.IO.Path.GetTempFileName();
            template.Save(myPolicy, runtimePolicy);

            PolicyTemplate modifedTemplate = new PolicyTemplate();
            modifedTemplate.Load(myPolicy);

            internalActions = modifedTemplate[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            externalActions = modifedTemplate[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(0, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);

            modifedTemplate.Close();

            System.IO.File.Delete(runtimePolicy);
            System.IO.File.Delete(myPolicy);
        }
Пример #6
0
        public InlineLexer(IDictionary<string, LinkObj> links, Options options)
        {
            _options = options ?? new Options();

            this.links = links;
            _rules = new NormalInlineRules();

            if (this.links == null)
            {
                throw new Exception("Tokens array requires a `links` property.");
            }

            if (_options.Gfm)
            {
                if (_options.Breaks)
                {
                    _rules = new BreaksInlineRules();
                }
                else
                {
                    _rules = new GfmInlineRules();
                }
            }
            else if (_options.Pedantic)
            {
                _rules = new PedanticInlineRules();
            }
        }
Пример #7
0
        internal frmOptions(Options options)
        {
            InitializeComponent();

            this.Options = options;
            SetOptions(options);
        }
Пример #8
0
 public Builder(Options options, AppLocations appLocations, IBuilderEvent builderEvent)
     : base(options, appLocations)
 {
     Counters = new List<string>();
     traceListener = new BuilderEventListener(this);
     BuilderEvent = builderEvent;
 }
        public void TestDayOfWeekModifierWithSundayStartOne()
        {
            Options options = new Options();
            options.DayOfWeekStartIndexZero = false;

            Assert.AreEqual("At 12:23 PM, on the second Sunday of the month", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options));
        }
Пример #10
0
        public void WriteClasses(List<string> classes, Options options)
        {
            WriteLine("[JsType(JsMode.Json)]");
            Bracket((options.AccessInternal ? "internal" : "public") + " static class Classes");
            if (options.MinimizeNames)
                WriteLine("#if DEBUG");

            foreach (string c in classes)
            {
                string cc = Name.ToCamelCase(c);
                WriteLine("public const string " + cc + " = \"" + c + "\";");
            }
            if (options.MinimizeNames)
            {
                WriteLine("#else");
                foreach (string c in classes)
                {
                    string cc = Name.ToCamelCase(c);
                    string co = ob.ObfuscateClass(c);
                    WriteLine("public const string " + cc + " = \"" + co + "\";");
                }
                WriteLine("#endif");
            }
            EndBracket();
        }
Пример #11
0
 private static ICompression LoadCompressor(string compressor, string file, Options options)
 {
     var tmp = DynamicLoader.CompressionLoader.GetModule(compressor, file, options.RawOptions);
     if (tmp == null)
         throw new Exception(string.Format("Unable to create {0} decompressor on file {1}", compressor, file));
     return tmp;
 }
Пример #12
0
        static int Main( string[] args )
        {
            var options = new Options();
            var parser = new CommandLine.Parser( with => with.HelpWriter = Console.Error );

            if ( parser.ParseArgumentsStrict( args, options, () => Environment.Exit( -2 ) ) )
            {
                if ( string.IsNullOrEmpty( options.PathToRockWeb ) )
                {
                    string removeString = "Dev Tools\\Applications";
                    string currentDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location;
                    int index = currentDirectory.IndexOf( removeString );
                    string rockDirectory = ( index < 0 )
                        ? currentDirectory
                        : currentDirectory.Substring( 0, index );

                    options.PathToRockWeb = Path.Combine( rockDirectory, "RockWeb" );

                }

                if ( !Directory.Exists( options.PathToRockWeb ) )
                {
                    Console.WriteLine( "Error: unable to find directory: " + options.PathToRockWeb );
                    return -1;
                }

                Run( options );
            }

            return 0;
        }
Пример #13
0
        private static void Main(string[] args)
        {
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                if (options.CsvHeaders)
                {
                    Console.WriteLine("Type,File name");
                }

                foreach (string fileName in options.FileNames)
                {
                    Console.WriteLine(new FileProperties(fileName).ToCsvLine());
                }

                if (options.Interactive)
                {
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
            }
            else
            {
                options.GetUsage();
            }
        }
Пример #14
0
        public JsGlobal(ExecutionVisitor visitor, Options options)
        {
            this.Options = options;
            this.Visitor = visitor;

            this["null"] = JsNull.Instance;

            #region Global Classes
            this["Object"] = ObjectClass = new JsObjectConstructor(this);
            this["Function"] = FunctionClass = new JsFunctionConstructor(this);
            this["Array"] = ArrayClass = new JsArrayConstructor(this);
            this["Boolean"] = BooleanClass = new JsBooleanConstructor(this);
            this["Date"] = DateClass = new JsDateConstructor(this);

            this["Error"] = ErrorClass = new JsErrorConstructor(this, "Error");
            this["EvalError"] = EvalErrorClass = new JsErrorConstructor(this, "EvalError");
            this["RangeError"] = RangeErrorClass = new JsErrorConstructor(this, "RangeError");
            this["ReferenceError"] = ReferenceErrorClass = new JsErrorConstructor(this, "ReferenceError");
            this["SyntaxError"] = SyntaxErrorClass = new JsErrorConstructor(this, "SyntaxError");
            this["TypeError"] = TypeErrorClass = new JsErrorConstructor(this, "TypeError");
            this["URIError"] = URIErrorClass = new JsErrorConstructor(this, "URIError");

            this["Number"] = NumberClass = new JsNumberConstructor(this);
            this["RegExp"] = RegExpClass = new JsRegExpConstructor(this);
            this["String"] = StringClass = new JsStringConstructor(this);
            this["Math"] = MathClass = new JsMathConstructor(this);
            this.Prototype = ObjectClass.Prototype;
            #endregion


            MathClass.Prototype = ObjectClass.Prototype;

            foreach (JsInstance c in this.GetValues())
            {
                if (c is JsConstructor)
                {
                    ((JsConstructor)c).InitPrototype(this);
                }
            }

            #region Global Properties
            this["NaN"] = NumberClass["NaN"];  // 15.1.1.1
            this["Infinity"] = NumberClass["POSITIVE_INFINITY"]; // // 15.1.1.2
            this["undefined"] = JsUndefined.Instance; // 15.1.1.3
            this[JsInstance.THIS] = this;
            #endregion

            #region Global Functions
            this["eval"] = new JsFunctionWrapper(Eval); // 15.1.2.1
            this["parseInt"] = new JsFunctionWrapper(ParseInt); // 15.1.2.2
            this["parseFloat"] = new JsFunctionWrapper(ParseFloat); // 15.1.2.3
            this["isNaN"] = new JsFunctionWrapper(IsNaN);
            this["isFinite"] = new JsFunctionWrapper(isFinite);
            this["decodeURI"] = new JsFunctionWrapper(DecodeURI);
            this["encodeURI"] = new JsFunctionWrapper(EncodeURI);
            this["decodeURIComponent"] = new JsFunctionWrapper(DecodeURIComponent);
            this["encodeURIComponent"] = new JsFunctionWrapper(EncodeURIComponent);
            #endregion

        }
Пример #15
0
 protected ElementFinder(Driver driver, string locator, DriverScope scope, Options options)
 {
     Driver = driver;
     this.locator = locator;
     Scope = scope;
     this.options = options;
 }
Пример #16
0
		private int Process(CommandType command)
		{
			var options = new Options { DatabaseUrl = DatabaseUrl.Text, BaseDirectory = BaseDirectory.Text, Command = command };

			var directoryPath = !string.IsNullOrWhiteSpace(options.BaseDirectory) ? options.BaseDirectory : Environment.CurrentDirectory;

			var baseDirectory = new DirectoryInfo(directoryPath);
			if (!baseDirectory.Exists)
			{
				MessageBox.Show(@"Provided directory {0} does not exist.", options.BaseDirectory);
				return IncorrectOptionsReturnCode;
			}

			var password = Environment.GetEnvironmentVariable(PasswordEnvVar);
			var url = new Lazy<Uri>(() => ParseDatabaseUrl(options));

			try
			{
				ExecuteCommand(options.Command, baseDirectory, url, password);
			}
			catch (Exception e)
			{
				MessageBox.Show(e.ToString());
				return UnknownErrorReturnCode;
			}

			return OkReturnCode;
		}
Пример #17
0
 internal Visitor(Options options, IEnumerable<System.Data.Linq.SqlClient.SqlParameter> parentParameters, SqlFactory sqlFactory) {
     this.options = options;
     this.sql = sqlFactory;
     this.canJoin = true;
     this.isTopLevel = true;
     this.parentParameters = parentParameters;
 }
        /// <summary>
        /// Basic run through, timer setup for read and data save from G4
        /// </summary>
        /// <param name="options">Parsed command line parameters</param>
        private static void Run(Options options)
        {
            if (!string.IsNullOrEmpty(options.Time))
            {
                HeadingInfo.WriteMessage(string.Format("G4 will be polled every {0} milliseconds", options.Time));
            }

            if (!string.IsNullOrEmpty(options.OutputFile))
            {
                HeadingInfo.WriteMessage(string.Format("Writing G4 data to: {0}", options.OutputFile));
            }
            else
            {
                HeadingInfo.WriteMessage("G4 data could not be written.");
                Console.WriteLine("[...]");
            }

            Timer myTimer = new Timer();
            myTimer.Elapsed += new ElapsedEventHandler((sender, e) => ReadAndSaveEGV(sender, e, options));
            myTimer.Interval = Int32.Parse(options.Time);
            myTimer.Start();

            while (Console.Read() != 'q')
            {
                ;    // do nothing...
            }
        }
Пример #19
0
        private void TranslateEnumGroups(XmlSpecData spec, DotNetApiData api, Options options)
        {
            foreach (var specEnumGroup in spec.EnumGroups.Where(x => options.EnumGroupFilter(x.Name)))
            {
                var enumGroupData = new DotNetEnumGroupData()
                {
                    Name = specEnumGroup.Name,
                };

                foreach (var enumName in specEnumGroup.Enums.Distinct())
                {
                    var xmlEnumData = spec.Enums.SingleOrDefault(x => x.Name == enumName);

                    if (xmlEnumData == null || !options.EnumFilter(xmlEnumData))
                        continue;

                    var enumData = api.Enums.SingleOrDefault(x => x.OriginalName == enumName);

                    if (enumData == null)
                        continue;

                    enumGroupData.Enums.Add(enumData);

                    if (spec.Enums.Single(x => x.Name == enumName).Type == "bitmask")
                        enumGroupData.IsFlags = true;
                }

                api.EnumGroups.Add(enumGroupData);
            }
        }
Пример #20
0
 public Core(IRequestExecuter requestExecuter, ICoreRequestGenerator requestGenerator, Options options)
 {
     OAuth2 = new OAuth2(requestExecuter, requestGenerator.OAuth2, options);
     Accounts = new Accounts(requestExecuter, requestGenerator.Accounts);
     Metadata = new Metadata(requestExecuter, requestGenerator.Metadata, options);
     FileOperations = new FileOperations(requestExecuter, requestGenerator.FileOperations, options);
 }
Пример #21
0
 public PoResourceReader(Stream stream, Options aOptions)
 {
     data = new Dictionary<string, PoItem>();
     s = stream;
     options = aOptions;
     Load();
 }
Пример #22
0
		private string InflectEnumName(string input, Options options)
		{
			string[] parts = input.Substring(options.Prefix.Length + 1).Split('_');
			string[] temp = new string[parts.Length];

			for (int i = 0; i < parts.Length; i++)
			{
				if (parts[i].Length > 0)
				{
					int capitalizeLength = 1;

					if (parts[i].Length > 1 && char.IsDigit(parts[i][0]))
						capitalizeLength = 2;

					temp[i] = parts[i].Substring(0, capitalizeLength).ToUpper() + parts[i].Substring(capitalizeLength).ToLower();
				}
			}

			string name = string.Join(string.Empty, temp);

			if (char.IsDigit(name[0]))
				name = "_" + name;

			return name;
		}
Пример #23
0
        static void Main(string[] args)
        {
            var options = new Options();
            var parser = new CommandLineParser(new CommandLineParserSettings(Console.Error));
            try
            {
                if (!parser.ParseArguments(args, options))
                {
                    Console.Read();
                    Environment.Exit(0);
                }
            }
            catch (Exception ex)
            {
                errorPrompt("When parsing command line arguments an exception occurred:\n{0}", ex.Message);
            }

            if (options.writeMode)
            {
                writeDataMatrix(options);
                Console.Read();
                Environment.Exit(0);
            }

            if (options.readMode)
            {
                readDataMatrix(options);
                Console.Read();
                Environment.Exit(0);
            }
        }
Пример #24
0
 /// <summary>
 /// Save user settings for grammar and spelling checking.
 /// </summary>
 /// <param name="addin">A reference to the <code>XWikiAddin</code>.</param>
 public static void Save(ref XWord2003AddIn addin)
 {
     wordOptions = addin.Application.Options;
     checkGrammarAsYouType = wordOptions.CheckGrammarAsYouType;
     checkGrammarWithSpelling = wordOptions.CheckGrammarWithSpelling;
     checkSpellingAsYouType = wordOptions.CheckSpellingAsYouType;
 }
        public void TestDayOfWeekModifierWithSundayStartOne()
        {
            Options options = new Options();
            options.DayOfWeekStartIndexZero = false;

            Assert.AreEqual("在 12:23 PM, 在 第二个星期日 每月", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options));
        }
Пример #26
0
        static int Main(string[] args)
        {
            _options = new Options();
            CommandLineParser parser = new CommandLineParser(_options);
            parser.Parse();

            if (_options.Help)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, false));
                return 0;
            }

            if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            if(_options.Test)
                Test();
            if (_options.TestString != null)
                TestString();
            else
                RunDec0de();

            return 0;
        }
Пример #27
0
 /// <summary>
 /// Инициализирует объект типа Script и преобрзует код сценария во внутреннее представление.
 /// </summary>
 /// <param name="code">Код скрипта на языке JavaScript.</param>
 /// <param name="parentContext">Родительский контекст для контекста выполнения сценария.</param>
 /// <param name="messageCallback">Делегат обратного вызова, используемый для вывода сообщений компилятора</param>
 public Script(string code, Context parentContext, CompilerMessageCallback messageCallback, Options options)
 {
     if (code == null)
         throw new ArgumentNullException();
     Code = code;
     int i = 0;
     root = CodeBlock.Parse(new ParsingState(Tools.RemoveComments(code, 0), Code, messageCallback), ref i).Statement;
     if (i < code.Length)
         throw new System.ArgumentException("Invalid char");
     CompilerMessageCallback icallback = messageCallback != null ? (level, cord, message) =>
         {
             messageCallback(level, CodeCoordinates.FromTextPosition(code, cord.Column, cord.Length), message);
         } : null as CompilerMessageCallback;
     var stat = new FunctionStatistics();
     Parser.Build(ref root, 0, new System.Collections.Generic.Dictionary<string, VariableDescriptor>(), _BuildState.None, icallback, stat, options);
     var body = root as CodeBlock;
     Context = new Context(parentContext ?? NiL.JS.Core.Context.globalContext, true, pseudoCaller);
     Context.thisBind = new GlobalObject(Context);
     Context.variables = (root as CodeBlock).variables;
     Context.strict = (root as CodeBlock).strict;
     for (i = body.localVariables.Length; i-- > 0; )
     {
         var f = Context.DefineVariable(body.localVariables[i].name);
         body.localVariables[i].cacheRes = f;
         body.localVariables[i].cacheContext = Context;
         if (body.localVariables[i].Inititalizator != null)
             f.Assign(body.localVariables[i].Inititalizator.Evaluate(Context));
         if (body.localVariables[i].isReadOnly)
             body.localVariables[i].cacheRes.attributes |= JSObjectAttributesInternal.ReadOnly;
         body.localVariables[i].captured |= stat.ContainsEval;
     }
     var bd = body as CodeNode;
     body.Optimize(ref bd, null, icallback, options, stat);
 }
 static void Main(string[] args)
 {
     var options = new Options();
     if (Parser.Default.ParseArguments(args, options))
     {
         if (!options.ConsoleIn && options.InputFile == null
             || !options.ConsoleOut && options.OutputFile == null)
         {
             Console.WriteLine(options.GetUsage());
             return;
         }
         // consume Options instance properties
         var inReader = options.ConsoleIn
             ? Console.In
             : new StreamReader(options.InputFile);
         using (var outWriter = options.ConsoleIn
             ? Console.Out
             : new StreamWriter(options.OutputFile)
             )
         {
             var xml = inReader.ReadToEnd();
             var doc = XDocument.Parse(xml);
             var md = doc.Root.ToMarkDown();
             outWriter.Write(md);
             outWriter.Close();
         }
     }
     else
     {
         // Display the default usage information
         Console.WriteLine(options.GetUsage());
     }
 }
        public void TestDayOfWeekModifierWithSundayStartOne()
        {
            Options options = new Options();
            options.DayOfWeekStartIndexZero = false;

            Assert.AreEqual("Saat 12:23, ayın ikinci Pazar günü", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options));
        }
Пример #30
0
 private ParsingInfo(Options options, char initiator, char terminator, Func<string, Quantifier, IElement> parseToken)
 {
     this.options = options;
     this.initiator = initiator;
     this.terminator = terminator;
     this.parseToken = parseToken;
 }
Пример #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessagePackHubProtocol"/> class.
 /// </summary>
 public MessagePackHubProtocol()
     : this(Options.Create(new MessagePackHubProtocolOptions()))
 {
 }
Пример #32
0
 protected override IEnumerable<SevenZipVolume> LoadVolumes(IEnumerable<Stream> streams, Options options)
 {
     foreach (Stream s in streams)
     {
         if (!s.CanRead || !s.CanSeek)
         {
             throw new ArgumentException("Stream is not readable and seekable");
         }
         SevenZipVolume volume = new SevenZipVolume(s, options);
         yield return volume;
     }
 }
        public async Task WhenPatialValidationEnabled_AndPropertyNotRequired_DoesNotThrowError()
        {
            _dicomCastConfig.Features.IgnoreSyncOfInvalidTagValue = true;

            _propertySynchronizer.When(synchronizer => synchronizer.Synchronize(Arg.Any <DicomDataset>(), Arg.Any <Patient>(), isNewPatient: false)).Do(synchronizer => { throw new InvalidDicomTagValueException("invalid tag", "invalid tag"); });

            IEnumerable <IPatientPropertySynchronizer> patientPropertySynchronizers = new List <IPatientPropertySynchronizer>()
            {
                _propertySynchronizer,
            };

            PatientSynchronizer patientSynchronizer = new PatientSynchronizer(patientPropertySynchronizers, Options.Create(_dicomCastConfig), _exceptionStore);

            FhirTransactionContext context = new FhirTransactionContext(ChangeFeedGenerator.Generate(metadata: DefaultDicomDataset));
            var patient = new Patient();

            await patientSynchronizer.SynchronizeAsync(context, patient, false, DefaultCancellationToken);
        }
Пример #34
0
 static void SetScale(Game g, string v, ref float target, string optKey)
 {
     target = Utils.ParseDecimal(v);
     Options.Set(optKey, v);
     g.Gui.RefreshHud();
 }
Пример #35
0
 void SetFont(Game g, string v)
 {
     g.FontName = v;
     Options.Set(OptionsKey.FontName, v);
     HandleFontChange();
 }
Пример #36
0
 static void SetChatlines(Game g, string v)
 {
     g.ChatLines = Int32.Parse(v);
     Options.Set(OptionsKey.ChatLines, v);
     g.Gui.RefreshHud();
 }
Пример #37
0
        public void WhenApplicationMethodIsThroughFaaVacancy_ShouldOverwriteApplicationInstructionsAsNull()
        {
            var user    = VacancyOrchestratorTestData.GetVacancyUser();
            var vacancy = VacancyOrchestratorTestData.GetPart1CompleteVacancy();

            _mockVacancyClient.Setup(x => x.GetVacancyAsync(vacancy.Id))
            .ReturnsAsync(vacancy);
            _mockVacancyClient.Setup(x => x.Validate(vacancy, VacancyRuleSet.ApplicationMethod))
            .Returns(new EntityValidationResult());
            _mockVacancyClient.Setup(x => x.UpdateDraftVacancyAsync(It.IsAny <Vacancy>(), user));

            var sut = new ApplicationProcessOrchestrator(_mockClient.Object, _mockVacancyClient.Object, Options.Create(new ExternalLinksConfiguration()), Mock.Of <ILogger <ApplicationProcessOrchestrator> >(), Mock.Of <IReviewSummaryService>());

            var applicationProcessEditModel = new ApplicationProcessEditModel
            {
                EmployerAccountId       = vacancy.EmployerAccountId,
                VacancyId               = vacancy.Id,
                ApplicationMethod       = ApplicationMethod.ThroughFindAnApprenticeship,
                ApplicationInstructions = "just do it"
            };

            var result = sut.PostApplicationProcessEditModelAsync(applicationProcessEditModel, user);

            vacancy.ApplicationMethod.HasValue.Should().BeTrue();
            vacancy.ApplicationMethod.Value.Should().Be(ApplicationMethod.ThroughFindAnApprenticeship);
            vacancy.ApplicationInstructions.Should().BeNull();
            _mockVacancyClient.Verify(x => x.UpdateDraftVacancyAsync(vacancy, user), Times.Once);
        }
Пример #38
0
        public Machine(Options options)
        {
            _options = options;

            _state = new Subject <IState>();
        }
Пример #39
0
 /// <summary>
 /// Takes a seekable Stream as a source
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="options"></param>
 public static SevenZipArchive Open(Stream stream, Options options)
 {
     stream.CheckNotNull("stream");
     return new SevenZipArchive(stream, options);
 }
Пример #40
0
 internal SevenZipArchive(Stream stream, Options options)
     : base(ArchiveType.SevenZip, stream.AsEnumerable(), options)
 {
 }
Пример #41
0
 public GZipVolume(FileInfo fileInfo, Options options)
     : base(fileInfo.OpenRead(), options)
 {
 }
Пример #42
0
 public GZipVolume(Stream stream, Options options)
     : base(stream, options)
 {
 }
Пример #43
0
 /// <summary>
 /// Takes multiple seekable Streams for a multi-part archive
 /// </summary>
 /// <param name="streams"></param>
 /// <param name="options"></param>
 internal RarArchive(IEnumerable <Stream> streams, Options options)
     : base(ArchiveType.Rar, streams, options)
 {
 }
Пример #44
0
 protected override IEnumerable <RarVolume> LoadVolumes(IEnumerable <Stream> streams, Options options)
 {
     return(RarArchiveVolumeFactory.GetParts(streams, options));
 }
Пример #45
0
 /// <summary>
 /// Constructor with a FileInfo object to an existing file.
 /// </summary>
 /// <param name="fileInfo"></param>
 /// <param name="options"></param>
 internal RarArchive(FileInfo fileInfo, Options options)
     : base(ArchiveType.Rar, fileInfo, options)
 {
 }
Пример #46
0
 protected override IEnumerable <RarVolume> LoadVolumes(FileInfo file, Options options)
 {
     return(RarArchiveVolumeFactory.GetParts(file, options));
 }
Пример #47
0
 /// <summary>
 /// Takes a seekable Stream as a source
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="options"></param>
 public static RarArchive Open(Stream stream, Options options)
 {
     stream.CheckNotNull("stream");
     return(Open(stream.AsEnumerable(), options));
 }
Пример #48
0
 /// <summary>
 /// Takes multiple seekable Streams for a multi-part archive
 /// </summary>
 /// <param name="streams"></param>
 /// <param name="options"></param>
 public static RarArchive Open(IEnumerable <Stream> streams, Options options)
 {
     streams.CheckNotNull("streams");
     return(new RarArchive(streams, options));
 }
Пример #49
0
 /// <summary>
 /// Constructor expects a filepath to an existing file.
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="options"></param>
 public static RarArchive Open(string filePath, Options options)
 {
     filePath.CheckNotNullOrEmpty("filePath");
     return(Open(new FileInfo(filePath), options));
 }
Пример #50
0
 /// <summary>
 /// Constructor with a FileInfo object to an existing file.
 /// </summary>
 /// <param name="fileInfo"></param>
 /// <param name="options"></param>
 public static RarArchive Open(FileInfo fileInfo, Options options)
 {
     fileInfo.CheckNotNull("fileInfo");
     return(new RarArchive(fileInfo, options));
 }
Пример #51
0
 public override List <CONEquivalenceDetail> FindAll(CONEquivalenceDetail data, Options option)
 {
     return(base.FindAll(data, option));
 }
        private static IApplicationBuilder ConfigurePipeline(IApplicationBuilder app, Options options)
        {
            EnsureValidApiOptions(options);

            var embeddedResourcesAssembly = typeof(UIResource).Assembly;

            app.Map(options.ApiPath, appBuilder =>
            {
                appBuilder
                .UseMiddleware <UIApiRequestLimitingMidleware>()
                .UseMiddleware <UIApiEndpointMiddleware>();
            });

            app.Map(options.WebhookPath, appBuilder => appBuilder.UseMiddleware <UIWebHooksApiMiddleware>());

            app.Map($"{options.ApiPath}/{Keys.HEALTHCHECKSUI_SETTINGS_PATH}", appBuilder => appBuilder.UseMiddleware <UISettingsMiddleware>());

            new UIResourcesMapper(
                new UIEmbeddedResourcesReader(embeddedResourcesAssembly))
            .Map(app, options);

            return(app);
        }
Пример #53
0
 internal NotificationHelper(Options options)
 {
     _options = options;
 }
Пример #54
0
 public EventTestSynchronizer(Options options, TestComponentContainer testComponentContainer) : base(options, testComponentContainer)
 {
 }
Пример #55
0
        // sync
        public static TransactionDetail Retrieve(RetrieveTransactionDetailRequest request, Options options)
        {
            String url = options.BaseUrl
                         + "/v2/reporting/payment/details?paymentConversationId="
                         + request.PaymentConversationId;

            return(RestHttpClientV2.Create().Get <TransactionDetail>(url, GetHttpHeadersWithUrlParams(request, url, options)));
        }
Пример #56
0
        /// <summary>
        /// Initialized a singleton; after calling this, use Analytics.Track() for each event.
        /// </summary>
        /// <param name="apiSecret">The segment.com apiSecret</param>
        /// <param name="userInfo">Information about the user that you have previous collected</param>
        /// <param name="propertiesThatGoWithEveryEvent">A set of key-value pairs to send with *every* event</param>
        /// <param name="allowTracking">If false, this will not do any communication with segment.io</param>
        /// <param name="retainPii">If false, userInfo will be stripped/hashed/adjusted to prevent communication of
        /// personally identifiable information to the analytics server.</param>
        public Analytics(string apiSecret, UserInfo userInfo, Dictionary <string, string> propertiesThatGoWithEveryEvent, bool allowTracking = true, bool retainPii = false)
        {
            if (_singleton != null)
            {
                throw new ApplicationException("You can only construct a single Analytics object.");
            }
            _singleton = this;
            _propertiesThatGoWithEveryEvent = propertiesThatGoWithEveryEvent;

            _userInfo = retainPii ? userInfo : userInfo.CreateSanitized();

            AllowTracking = allowTracking;

            // UrlThatReturnsExternalIpAddress is a static and should really be set before this is called, so don't mess with it if the client has given us a different url to us
            if (string.IsNullOrEmpty(UrlThatReturnsExternalIpAddress))
            {
                UrlThatReturnsGeolocationJson = "http://ip-api.com/json/";
            }

            if (!AllowTracking)
            {
                return;
            }

            //bring in settings from any previous version
            if (AnalyticsSettings.Default.NeedUpgrade)
            {
                //see http://stackoverflow.com/questions/3498561/net-applicationsettingsbase-should-i-call-upgrade-every-time-i-load
                AnalyticsSettings.Default.Upgrade();
                AnalyticsSettings.Default.NeedUpgrade = false;
                AnalyticsSettings.Default.Save();
            }

            if (string.IsNullOrEmpty(AnalyticsSettings.Default.IdForAnalytics))
            {
                // Apparently a first-time install. Any chance we can migrate settings from another channel of this app?
                // We really want to use the same ID if possible to keep our statistics valid.
                try
                {
                    AttemptToGetUserIdSettingsFromDifferentChannel();
                }
                catch (Exception)
                {
                    // Oh, well, we tried.
                }
            }

            Segment.Analytics.Initialize(apiSecret);
            Segment.Analytics.Client.Failed    += Client_Failed;
            Segment.Analytics.Client.Succeeded += Client_Succeeded;

            if (string.IsNullOrEmpty(AnalyticsSettings.Default.IdForAnalytics))
            {
                AnalyticsSettings.Default.IdForAnalytics = Guid.NewGuid().ToString();
                AnalyticsSettings.Default.Save();
            }

            var context = new Segment.Model.Context();

            context.Add("language", _userInfo.UILanguageCode);

            _options = new Options();
            _options.SetContext(context);

            UpdateSegmentIOInformationOnThisUser();
            ReportIpAddressOfThisMachineAsync();             //this will take a while and may fail, so just do it when/if we can
            string versionNumberWithBuild = "";

            try
            {
                versionNumberWithBuild = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
            }
            catch (NullReferenceException)
            {
                try
                {
                    // GetEntryAssembly is null for MAF plugins
                    versionNumberWithBuild = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                }
                catch (NullReferenceException)
                {
                    // This probably can't happen, but if it does, just roll with it.
                }
            }
            string versionNumber = versionNumberWithBuild.Split('.').Take(2).Aggregate((a, b) => a + "." + b);

            SetApplicationProperty("Version", versionNumber);
            SetApplicationProperty("FullVersion", versionNumberWithBuild);
            SetApplicationProperty("UserName", GetUserNameForEvent());
            SetApplicationProperty("Browser", GetOperatingSystemLabel());
            SetApplicationProperty("64bit OS", Environment.Is64BitOperatingSystem.ToString());
            SetApplicationProperty("64bit App", Environment.Is64BitProcess.ToString());


            if (string.IsNullOrEmpty(AnalyticsSettings.Default.LastVersionLaunched))
            {
                //"Created" is a special property that segment.io understands and coverts to equivalents in various analytics services
                //So it's not as descriptive for us as "FirstLaunchOnSystem", but it will give the best experience on the analytics sites.
                TrackWithApplicationProperties("Created");
            }
            else if (AnalyticsSettings.Default.LastVersionLaunched != versionNumberWithBuild)
            {
                TrackWithApplicationProperties("Upgrade", new Properties
                {
                    { "OldVersion", AnalyticsSettings.Default.LastVersionLaunched },
                });
            }

            // We want to record the launch event independent of whether we also recorded a special first launch
            // But that is done after we retrieve (or fail to retrieve) our external ip address.
            // See http://issues.bloomlibrary.org/youtrack/issue/BL-4011.

            AnalyticsSettings.Default.LastVersionLaunched = versionNumberWithBuild;
            AnalyticsSettings.Default.Save();
        }
Пример #57
0
 private void OnDisable()
 {
     m_fade.Begin(FADE_TYPE.FADE_OUT, 0.0f, null); m_options = null;
 }
Пример #58
0
 /// <summary>
 /// Constructs a <see cref="OneVersusAllTrainer"/> trainer supplying a <see cref="Options"/>.
 /// </summary>
 /// <param name="env">The private <see cref="IHostEnvironment"/> for this estimator.</param>
 /// <param name="options">The legacy <see cref="Options"/></param>
 internal OneVersusAllTrainer(IHostEnvironment env, Options options)
     : base(env, options, LoadNameValue)
 {
     _options = options;
 }
Пример #59
0
        public static IContainer Build(Options options, params object[] singletons)
        {
            var builder = new ContainerBuilder();

            if (options.HasFlag(Options.ResolveDialogFromContainer))
            {
                builder.RegisterModule(new DialogModule());
            }
            else
            {
                builder.RegisterModule(new DialogModule_MakeRoot());
            }

            // make a "singleton" MockConnectorFactory per unit test execution
            IConnectorClientFactory factory = null;

            builder
            .Register((c, p) => factory ?? (factory = new MockConnectorFactory(c.Resolve <IAddress>().BotId)))
            .As <IConnectorClientFactory>()
            .InstancePerLifetimeScope();

            if (options.HasFlag(Options.Reflection))
            {
                builder.RegisterModule(new ReflectionSurrogateModule());
            }

            var r =
                builder
                .Register <Queue <IMessageActivity> >(c => new Queue <IMessageActivity>())
                .AsSelf();

            if (options.HasFlag(Options.ScopedQueue))
            {
                r.InstancePerLifetimeScope();
            }
            else
            {
                r.SingleInstance();
            }

            builder
            .RegisterType <BotToUserQueue>()
            .AsSelf()
            .InstancePerLifetimeScope();

            builder
            .Register(c => new MapToChannelData_BotToUser(
                          c.Resolve <BotToUserQueue>(),
                          new List <IMessageActivityMapper> {
                new KeyboardCardMapper()
            }))
            .As <IBotToUser>()
            .InstancePerLifetimeScope();

            if (options.HasFlag(Options.LastWriteWinsCachingBotDataStore))
            {
                builder.Register <CachingBotDataStore>(c => new CachingBotDataStore(c.Resolve <ConnectorStore>(), CachingBotDataStoreConsistencyPolicy.LastWriteWins))
                .As <IBotDataStore <BotData> >()
                .AsSelf()
                .InstancePerLifetimeScope();
            }

            foreach (var singleton in singletons)
            {
                builder
                .Register(c => singleton)
                .Keyed(FiberModule.Key_DoNotSerialize, singleton.GetType());
            }

            return(builder.Build());
        }
Пример #60
0
        JsonResult IDriver.Init(string retTarget, string isModal, bool initReceivedFolder)
        {
            //if (HttpContext.Current.Session[RetTarget]!=null && !ReferenceEquals(HttpContext.Current.Session[RetTarget], ""))
            //{
            //    return ((IDriver)this).Open(HttpContext.Current.Session[RetTarget].ToString(),false);
            //}
            WebDavRoot lroot = !initReceivedFolder?
                               this.roots.FirstOrDefault(x => x.Directory.DisplayName == Upload) :
                                   this.roots.FirstOrDefault(x => x.Directory.DisplayName == Recived);

            if (lroot == null)
            {
                throw new ArgumentNullException(string.Format("Не найдена ожидаемая папка({0} или {1})", Upload, Recived));
            }


            string mytarget = lroot.Directory.RelPath;

            if (!string.IsNullOrEmpty(retTarget))
            {
                lroot    = GetRoot(retTarget);
                mytarget = GetCorectTarget(retTarget);
                mytarget = DecodeTarget(mytarget);
            }
            List <DirInfo> filesFormWebFav = client.GetDirectories(mytarget, true);

            if (filesFormWebFav == null)
            {
                return(null);
            }

            List <DirInfo> directories = filesFormWebFav.FindAll(d => d.IsDirectory);

            DirInfo targetDirInfo = directories[0];

            //var parent = getParent(targetDirInfo);
            targetDirInfo.HasSubDirectories = filesFormWebFav != null && directories != null && directories.Count > 1;

            Options options = new Options
            {
                Path          = mytarget,
                ThumbnailsUrl = "Thumbnails/"
            };

            var curDir = lroot.DTO;

            if (!string.IsNullOrEmpty(retTarget))
            {
                DirInfo parentDirInfo = this.GetParent(targetDirInfo);
                curDir = DTOBase.Create(targetDirInfo, parentDirInfo, lroot);
            }
            //curDir = lroot.DTO;

            InitResponse answer = new InitResponse(curDir, options);

            if (filesFormWebFav != null)
            {
                filesFormWebFav.Remove(targetDirInfo);
                foreach (DirInfo dirInfo in filesFormWebFav)
                {
                    dirInfo.HasSubDirectories = IsConstainsChild(dirInfo);
                    answer.Files.Add(DTOBase.Create(dirInfo, targetDirInfo, lroot));
                }
            }


            foreach (WebDavRoot item in this.roots)
            {
                answer.Files.Add(item.DTO);
            }



            List <DTOBase> filteredFiles = new List <DTOBase>();

            foreach (DTOBase dtoBase in answer.Files)
            {
                string fileName = (dtoBase.Name);
                string ext      = Path.GetExtension(fileName);
                if (isModal != "1")
                {
                    //поиск по неподписан и не зашифрован
                    if (ext != ".sig" && ext != ".enc")
                    {
                        filteredFiles.Add(dtoBase);
                    }
                    //filteredFiles.Add(dtoBase);
                }
                else
                {
                    filteredFiles.Add(dtoBase);
                }
            }
            answer.Files.Clear();
            answer.Files.AddRange(filteredFiles);
            //var answer1 = new InitResponse(answer.Files[0], options);
            //answer1.Files.AddRange(answer.Files);


            return(Json(answer));
        }