public ReplyTo(DestinationType desination, bool isQueue, bool isTemporary, bool isTopic) { this.desination = desination; this.isQueue = isQueue; this.isTemporary = isTemporary; this.isTopic = isTopic; }
/// <summary> /// Get the destination by parsing the embedded type prefix. /// </summary> /// <param name="session">Session object to use to get the destination.</param> /// <param name="destinationName">Name of destination with embedded prefix. The embedded prefix can be one of the following: /// <list type="bullet"> /// <item>queue://</item> /// <item>topic://</item> /// <item>temp-queue://</item> /// <item>temp-topic://</item> /// </list> /// </param> /// <param name="defaultType">Default type if no embedded prefix is specified.</param> /// <returns></returns> public static IDestination GetDestination(ISession session, string destinationName, DestinationType defaultType) { IDestination destination = null; DestinationType destinationType = defaultType; if(null != destinationName) { if(destinationName.Length > QueuePrefix.Length && 0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix, false)) { destinationType = DestinationType.Queue; destinationName = destinationName.Substring(QueuePrefix.Length); } else if(destinationName.Length > TopicPrefix.Length && 0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix, false)) { destinationType = DestinationType.Topic; destinationName = destinationName.Substring(TopicPrefix.Length); } else if(destinationName.Length > TempQueuePrefix.Length && 0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), TempQueuePrefix, false)) { destinationType = DestinationType.TemporaryQueue; destinationName = destinationName.Substring(TempQueuePrefix.Length); } else if(destinationName.Length > TempTopicPrefix.Length && 0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), TempTopicPrefix, false)) { destinationType = DestinationType.TemporaryTopic; destinationName = destinationName.Substring(TempTopicPrefix.Length); } } switch(destinationType) { case DestinationType.Queue: if(null != destinationName) { destination = session.GetQueue(destinationName); } break; case DestinationType.Topic: if(null != destinationName) { destination = session.GetTopic(destinationName); } break; case DestinationType.TemporaryQueue: destination = session.CreateTemporaryQueue(); break; case DestinationType.TemporaryTopic: destination = session.CreateTemporaryTopic(); break; } return destination; }
/// <summary>Initializes a new instance of the <see cref="Binding"/> class.</summary> /// <param name="destination">The destination.</param> /// <param name="destinationType">The destination type.</param> /// <param name="exchange">The exchange.</param> /// <param name="routingKey">The routing key.</param> /// <param name="arguments">The arguments.</param> public Binding(string destination, DestinationType destinationType, string exchange, string routingKey, IDictionary arguments) { this.destination = destination; this.destinationType = destinationType; this.exchange = exchange; this.routingKey = routingKey; this.arguments = arguments; }
public Destination(string destinationName) { if (string.IsNullOrEmpty(destinationName)) throw new ArgumentException("Argument 'destination' cannot be null, empty or whitespace."); this.destinationName = destinationName; this.destinationType = DestinationType.DestinationName; }
public Destination(IDestination destination) { if (destination == null) throw new ArgumentNullException("destination"); this.destination = destination; this.destinationType = DestinationType.Destination; }
/// <summary> /// Delete the named destination by parsing the embedded type prefix. /// </summary> /// <param name="session">Session object to use to get the destination.</param> /// <param name="destinationName">Name of destination with embedded prefix. The embedded prefix can be one of the following: /// <list type="bullet"> /// <item>queue://</item> /// <item>topic://</item> /// <item>temp-queue://</item> /// <item>temp-topic://</item> /// </list> /// </param> /// <param name="defaultType">Default type if no embedded prefix is specified.</param> /// <returns></returns> public static void DeleteDestination(ISession session, string destinationName, DestinationType defaultType) { IDestination destination = SessionUtil.GetDestination(session, destinationName, defaultType); if(null != destination) { session.DeleteDestination(destination); } }
//=============================================================== public DwollaSendResponse Send(int userPIN, String destinationID, decimal amount, DestinationType destinationType = DestinationType.Email, String notes = null) { var client = CreateClient(); var request = CreateRequest("transactions/send", Method.POST); var body = new { pin = userPIN, destinationId = destinationID, destinationType = ToDestinationTypeString(destinationType), amount = amount, notes = notes }; request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody); var response = client.Execute(request); return JsonConvert.DeserializeObject<DwollaSendResponse>(response.Content); }
/// <summary> /// Sets all of the attributes of this <code>JobAttributes</code> to /// the same values as the attributes of obj. /// </summary> /// <param name="obj"> the <code>JobAttributes</code> to copy </param> public void Set(JobAttributes obj) { Copies_Renamed = obj.Copies_Renamed; DefaultSelection_Renamed = obj.DefaultSelection_Renamed; Destination_Renamed = obj.Destination_Renamed; Dialog_Renamed = obj.Dialog_Renamed; FileName_Renamed = obj.FileName_Renamed; FromPage_Renamed = obj.FromPage_Renamed; MaxPage_Renamed = obj.MaxPage_Renamed; MinPage_Renamed = obj.MinPage_Renamed; MultipleDocumentHandling_Renamed = obj.MultipleDocumentHandling_Renamed; // okay because we never modify the contents of pageRanges PageRanges_Renamed = obj.PageRanges_Renamed; PrFirst = obj.PrFirst; PrLast = obj.PrLast; Printer_Renamed = obj.Printer_Renamed; Sides_Renamed = obj.Sides_Renamed; ToPage_Renamed = obj.ToPage_Renamed; }
public void TestStartAfterSend(MsgDeliveryMode deliveryMode, DestinationType destinationType) { using (IConnection connection = CreateConnection(TEST_CLIENT_ID)) { ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); IDestination destination = CreateDestination(session, destinationType); IMessageConsumer consumer = session.CreateConsumer(destination); // Send the messages SendMessages(session, destination, deliveryMode, 1); // Start the conncection after the message was sent. connection.Start(); // Make sure only 1 message was delivered. Assert.IsNotNull(consumer.Receive(TimeSpan.FromMilliseconds(1000))); Assert.IsNull(consumer.ReceiveNoWait()); } }
public static MessageSource <TMessage> CreateSource <TMessage, TServiceMessage>( Lazy <IConnection> lazyConnection, string destination, DestinationType destinationType, IMessageDeserializerFactory deserializerFactory, Func <IDictionary, bool> propertyFilter, Func <Assembly, bool> assemblyFilter = null, Func <Type, bool> typeFilter = null, string selector = null, AcknowledgementMode mode = AcknowledgementMode.AutoAcknowledge) where TMessage : class where TServiceMessage : class { return(new MessageSource <TMessage>( lazyConnection, deserializerFactory.Create <TMessage, TServiceMessage>(assemblyFilter, typeFilter), CreateDestination(destination, destinationType), mode, selector, propertyFilter)); }
public EndpointPath GetEndpointPath(DestinationType protocol) { switch (protocol) { case DestinationType.NetworkFolder: case DestinationType.LocalFolder: return(FileSharePath); case DestinationType.Ftp: return(FtpPath); case DestinationType.Http: case DestinationType.Https: return(HttpPath); default: throw new NotSupportedException($"Protocol '{protocol}' not supported."); } }
public void TestDontStart( [Values(MsgDeliveryMode.NonPersistent)] MsgDeliveryMode deliveryMode, [Values(DestinationType.Queue, DestinationType.Topic)] DestinationType destinationType) { using (IConnection connection = CreateConnection()) { ISession session = connection.CreateSession(); IDestination destination = CreateDestination(session, destinationType); IMessageConsumer consumer = session.CreateConsumer(destination); // Send the messages SendMessages(session, destination, deliveryMode, 1); // Make sure no messages were delivered. Assert.IsNull(consumer.Receive(TimeSpan.FromMilliseconds(1000))); } }
public void TestSendReceiveTransacted( [Values(MsgDeliveryMode.NonPersistent, MsgDeliveryMode.Persistent)] MsgDeliveryMode deliveryMode, [Values(DestinationType.Queue, DestinationType.Topic, DestinationType.TemporaryQueue, DestinationType.TemporaryTopic)] DestinationType destinationType) { string testDestinationRef; switch (destinationType) { case DestinationType.Queue: testDestinationRef = DEFAULT_TEST_QUEUE; break; case DestinationType.Topic: testDestinationRef = DEFAULT_TEST_TOPIC; break; default: testDestinationRef = ""; break; } base.TestSendReceiveTransacted(deliveryMode, destinationType, testDestinationRef); }
public void ExpectedMembersAreMapped() { var mapper = new MemberMapper(); mapper.CreateMapProposal(typeof(SourceType), typeof(DestinationType)).FinalizeMap(); var source = new SourceType { ID = 5, Name = "Source" }; var destination = new DestinationType(); destination = mapper.Map(source, destination); Assert.AreEqual(destination.ID, 5); Assert.AreEqual(destination.Name, "Source"); }
public IDestination CreateDestination(ISession session, DestinationType type, string name) { switch (type) { case DestinationType.Queue: if (string.IsNullOrEmpty(name)) { name = "queue://TEST." + this.GetType().Name + "." + Guid.NewGuid().ToString(); } break; case DestinationType.Topic: if (string.IsNullOrEmpty(name)) { name = "topic://TEST." + this.GetType().Name + "." + Guid.NewGuid().ToString(); } break; case DestinationType.TemporaryQueue: if (string.IsNullOrEmpty(name)) { name = "temp-queue://TEST." + this.GetType().Name + "." + Guid.NewGuid().ToString(); } break; case DestinationType.TemporaryTopic: if (string.IsNullOrEmpty(name)) { name = "temp-topic://TEST." + this.GetType().Name + "." + Guid.NewGuid().ToString(); } break; default: throw new ArgumentException("type: " + type); } return(CreateDestination(session, name)); }
private string MapCurrentDirectionType(DestinationType directionType) { switch (directionType) { case DestinationType.North: return("N"); case DestinationType.South: return("S"); case DestinationType.East: return("E"); case DestinationType.West: return("W"); default: return("Destination is not true"); } }
public async Task <IHttpActionResult> Put(int id, [FromBody] DestinationType model) { if (!ModelState.IsValid) { Validate(model); return(BadRequest(ModelState)); } // Set ID because Ember doesn't send it model.Id = id; var result = await _sql.UpdateAsync(model); if (!result) { return(BadRequest()); } return(Ok(model)); }
public override void Dump(SourceWriter sw, int indentChange) { sw.Write("("); DestinationType.Dump(sw); sw.Write(") "); if (!Child.IsPrimaryExpression) { sw.Write("("); } Child.Dump(sw, indentChange); if (!Child.IsPrimaryExpression) { sw.Write(")"); } }
private DirectoryInfo GetFolder(string basePath, DestinationType destination) { using (var dialog = new CommonOpenFileDialog { IsFolderPicker = true, Title = "Select a folder. The folder you pick will be created as a solution folder and containing files will be added to it.", InitialDirectory = basePath }) //using (var dialog = new FolderBrowserDialog()) { var r = dialog.ShowDialog(); if (r == CommonFileDialogResult.Ok) { return(new DirectoryInfo(dialog.FileName)); } } return(null); }
/// <summary> /// Chooses the shortest path to a particular destination, indicated by the DestinationType enum. /// </summary> /// <param name="destination">Indicates the type of destination that a path needs to be found to.</param> /// <returns>Returns the shortest path to the desired destination type, null if no path is found/walkable.</returns> protected List <Tile> ChoosePath(DestinationType destination) { List <List <Tile> > paths = null; if (destination == DestinationType.Exit) { paths = Simulation.PathFactory.FindPathsToExits(location); } else if (destination == DestinationType.Window) { paths = Simulation.PathFactory.FindPathsToWindows(location); } else if (destination == DestinationType.FireExtinguisher) { paths = Simulation.PathFactory.FindPathsToFireExtinguishers(location); } else if (destination == DestinationType.Fire) { paths = Simulation.PathFactory.FindPathsToFire(location); } List <Tile> bestPath = null; foreach (List <Tile> path in paths) { if (path != null) { if (bestPath == null) { bestPath = path; } else if (path.Count < bestPath.Count) { bestPath = path; } } } return(bestPath); }
public void TestSendReceiveTransacted(MsgDeliveryMode deliveryMode, DestinationType destinationType) { using (IConnection connection = CreateConnection(TEST_CLIENT_ID)) { // Send a message to the broker. connection.Start(); ISession session = connection.CreateSession(AcknowledgementMode.Transactional); IDestination destination = CreateDestination(session, destinationType); IMessageConsumer consumer = session.CreateConsumer(destination); IMessageProducer producer = session.CreateProducer(destination); producer.DeliveryMode = deliveryMode; producer.Send(session.CreateTextMessage("Test")); // Message should not be delivered until commit. Thread.Sleep(1000); Assert.IsNull(consumer.ReceiveNoWait()); session.Commit(); // Make sure only 1 message was delivered. IMessage message = consumer.Receive(TimeSpan.FromMilliseconds(1000)); Assert.IsNotNull(message); Assert.IsFalse(message.NMSRedelivered); Assert.IsNull(consumer.ReceiveNoWait()); // Message should be redelivered is rollback is used. session.Rollback(); // Make sure only 1 message was delivered. message = consumer.Receive(TimeSpan.FromMilliseconds(2000)); Assert.IsNotNull(message); Assert.IsTrue(message.NMSRedelivered); Assert.IsNull(consumer.ReceiveNoWait()); // If we commit now, the message should not be redelivered. session.Commit(); Thread.Sleep(1000); Assert.IsNull(consumer.ReceiveNoWait()); } }
public static MessagePublisher <TMessage> CreatePublisher <TMessage>( Lazy <IConnection> lazyConnection, string destination, DestinationType destinationType, IMessageSerializer messageSerializer, Func <TMessage, Dictionary <string, object> > propertyProvider, TaskScheduler scheduler = null, Func <TMessage, MsgDeliveryMode> deliveryMode = null, Func <TMessage, MsgPriority> priority = null, Func <TMessage, TimeSpan> timeToLive = null) where TMessage : class { return(new MessagePublisher <TMessage>( lazyConnection, CreateDestination(destination, destinationType), messageSerializer, propertyProvider, scheduler ?? new LimitedConcurrencyLevelTaskScheduler(1), deliveryMode, priority, timeToLive)); }
internal static bool TryGetWriter(Type type, DestinationType destination, out ValueWriter writer) { var effective = Nullable.GetUnderlyingType(type) ?? type; // TODO support enums as strings too - this won't apply then if (effective.IsEnum) { effective = effective.GetEnumUnderlyingType(); } // check for common (no options writer first) var lookup = new Lookup(effective); if (_Writers.TryGetValue(lookup, out writer)) { return(true); } // fallback to using the destination lookup = new Lookup(effective, destination); return(_Writers.TryGetValue(lookup, out writer)); }
/// <summary> /// Gets a destination URI. /// </summary> /// <param name="type">Destination type</param> /// <param name="destinationRef">Configuration node name for the /// destination URI</param> /// <returns>Destination URI</returns> public virtual string GetDestinationURI( DestinationType type, string destinationRef) { string uri = null; if (!string.IsNullOrEmpty(destinationRef)) { XmlElement uriNode = GetURINode(); if (uriNode != null) { uri = GetNodeValueAttribute(uriNode, destinationRef, null); } } if (string.IsNullOrEmpty(uri)) { uri = NewDestinationURI(type); } return(uri); }
//[Test] public virtual void TestStartAfterSend( //[Values(MsgDeliveryMode.Persistent, MsgDeliveryMode.NonPersistent)] MsgDeliveryMode deliveryMode, //[Values(DestinationType.Queue, DestinationType.Topic)] DestinationType destinationType, string testDestinationRef) { using (IConnection connection = CreateConnection(GetTestClientId())) { ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); IDestination destination = GetClearDestination(session, destinationType, testDestinationRef); IMessageConsumer consumer = session.CreateConsumer(destination); // Send the messages SendMessages(session, destination, deliveryMode, 1); // Start the conncection after the message was sent. connection.Start(); // Make sure only 1 message was delivered. Assert.IsNotNull(consumer.Receive(TimeSpan.FromMilliseconds(1000))); Assert.IsNull(consumer.ReceiveNoWait()); } }
// Leave the seat and go to random point private void LeaveSeat() { System.Random rnd = new System.Random(); int x1 = rnd.Next(-95, 95); int z1 = 0; bool isPositiveZ; if (x1 < 80 || x1 > -80) { z1 = rnd.Next(80, 95); isPositiveZ = rnd.NextDouble() >= 0.5; Debug.Log(isPositiveZ); if (isPositiveZ == false) { z1 = -z1; } } else { z1 = rnd.Next(-95, 95); } float x = (float)x1 / 10; float z = (float)z1 / 10; Vector3 randomPoint = new Vector3(x, 0, z); m_isEating = false; m_isOutOfTable = true; _navMeshAgent.SetDestination(randomPoint); m_waiting_timer = 0; _tailCollider.enabled = false; destination = DestinationType.RANDOM; }
public IDestination CreateDestination(ISession session, DestinationType type, string name) { if(name == "") { name = "TEST." + this.GetType().Name + "." + Guid.NewGuid(); } switch(type) { case DestinationType.Queue: return session.GetQueue(name); case DestinationType.Topic: return session.GetTopic(name); case DestinationType.TemporaryQueue: return session.CreateTemporaryQueue(); case DestinationType.TemporaryTopic: return session.CreateTemporaryTopic(); default: throw new ArgumentException("type: " + type); } }
public Task <IDestination> GetDestination(string destination, DestinationType destinationType) { return(_executor.Run(() => SessionUtil.GetDestination(_session, destination, destinationType), CancellationToken)); }
public OutputEventArg(String message, OutputType type, DestinationType destinationType) : this(message, type) { this.destinationType = destinationType; }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { this.destination = iprot.ReadString(); this.__isset.destination = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { this.subscription = iprot.ReadString(); this.__isset.subscription = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { this.destination_type = (DestinationType)iprot.ReadI32(); this.__isset.destination_type = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Struct) { this.message = new BrokerMessage(); this.message.Read(iprot); this.__isset.message = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
private TDestination SetValues(TSource source) { var sourceProperties = typeof(TSource).GetProperties(); var destinationProperties = DestinationType.GetProperties(); TDestination destination = Activator.CreateInstance <TDestination>(); foreach (var sourceProperty in sourceProperties) { var propertyName = sourceProperty.Name.ToLower(); try { if ((sourceProperty.PropertyType.IsClass || sourceProperty.PropertyType.IsValueType) && !PrimitiveTypes.Contains(sourceProperty.PropertyType)) { var destinationComplexProperties = destinationProperties .Where(x => x.Name.ToLower().StartsWith(propertyName)); if (destinationComplexProperties.Any()) { if (destinationComplexProperties.Count() == 1) { var destinationComplexProperty = destinationComplexProperties.First(); if (destinationComplexProperty.PropertyType == sourceProperty.PropertyType && destinationComplexProperty.Name.ToLower() == propertyName) { var sourceValue = sourceProperty.GetValue(source); destinationComplexProperty.SetValue(destination, sourceValue); continue; } } SetComplexProperties(source, destination, sourceProperty, destinationComplexProperties, 1); } } else { var destinationProperty = destinationProperties .FirstOrDefault(x => x.Name.ToLower() == propertyName && x.PropertyType == sourceProperty.PropertyType); if (destinationProperty != null) { var sourceValue = sourceProperty.GetValue(source); destinationProperty.SetValue(destination, sourceValue); } } } catch (Exception) { continue; } } return(destination); }
/// <summary> /// Extension function to get the destination by parsing the embedded type prefix. /// </summary> public static IDestination GetDestination(this ISession session, string destinationName, DestinationType defaultType) { return(SessionUtil.GetDestination(session, destinationName, defaultType)); }
public Destination(ResourceId id) { type = DestinationType.resource; destination_data.ressource_id = id; }
public void NoExplicitMapCreationStillResultsInMap() { var mapper = new MemberMapper(); var source = new SourceType { ID = 5, Name = "Source" }; var destination = new DestinationType(); destination = mapper.Map(source, destination); Assert.AreEqual(destination.ID, 5); Assert.AreEqual(destination.Name, "Source"); }
internal GeneralViewNode(TaskHost taskHost, IDtsConnectionService connectionService) { this.iDtsConnection = connectionService; this.myTaskHost = taskHost; this._variableService = this.myTaskHost.Site.GetService(typeof (IDtsVariableService)) as IDtsVariableService; // Extract common values from the Task Host name = taskHost.Name; description = taskHost.Description; // Extract values from the task object ExecuteAzureMLBatch task = taskHost.InnerObject as ExecuteAzureMLBatch; if (task == null) { string msg = string.Format(CultureInfo.CurrentCulture, "Type mismatch for taskHost inner object. Received: {0} Expected: {1}", taskHost.InnerObject.GetType().Name, typeof(ExecuteAzureMLBatch).Name); throw new ArgumentException(msg); } connection = task.Connection; azureMLUrl = task.AzureMLBaseURL; azureMLKey = task.AzureMLAPIKey; blobName = task.BlobName; sourceType = task.InputSource; destinationType = task.OutputDestination; switch (sourceType) { case (SourceType.BlobPath): sourceBlobPath = task.Source; break; case (SourceType.DirectInput): sourceDirect = task.Source; break; case (SourceType.FileConnection): source = task.Source; break; case (SourceType.Variable): sourceVariable = task.Source; break; default: break; } switch (destinationType) { case (DestinationType.FileConnection): destination = task.Destination; break; case (DestinationType.Variable): destinationVariable = task.Destination; break; default: break; } }
public OutputEventArg(String message, OutputType type) { this.message = message; this.type = type; this.destinationType = RS485Events.DestinationType.None; }
public DemandMVVM(Airport destination, int passengers, int cargo,DestinationType type) { this.Cargo = cargo; this.Passengers = passengers; this.Destination = destination; this.Type = type; }
public IDestination CreateDestination(ISession session, DestinationType type) { return CreateDestination(session, type, ""); }
/// <summary> /// Delete the named destination by parsing the embedded type prefix. /// </summary> /// <param name="session">Session object to use to get the destination.</param> /// <param name="destinationName">Name of destination with embedded prefix. The embedded prefix can be one of the following: /// <list type="bullet"> /// <item>queue://</item> /// <item>topic://</item> /// <item>temp-queue://</item> /// <item>temp-topic://</item> /// </list> /// </param> /// <param name="defaultType">Default type if no embedded prefix is specified.</param> /// <returns></returns> public static void DeleteDestination(ISession session, string destinationName, DestinationType defaultType) { IDestination destination = SessionUtil.GetDestination(session, destinationName, defaultType); if (null != destination) { session.DeleteDestination(destination); } }
//-------------------------------------------------- // fill the pgo struct and initialize PasswordGenerator class with it static void ProcessCmdline() { // password length if (!CommandLineArgs.ContainsKey("--length")) { ReportErrorAndExit("ERROR: required argument is absent: --length", ExitCodes.cmdlineArgError); } if (!int.TryParse(CommandLineArgs["--length"].ToString(), out pgo.pswLength) || pgo.pswLength <= 0) { ReportErrorAndExit("ERROR: incorrect argument value: --length:" + CommandLineArgs["--length"].ToString(), ExitCodes.cmdlineArgError); } // quantity if (!CommandLineArgs.ContainsKey("--quantity")) { ReportErrorAndExit("ERROR: required argument is absent: --quantity", ExitCodes.cmdlineArgError); } if (!int.TryParse(CommandLineArgs["--quantity"].ToString(), out pgo.quantity) || pgo.quantity <= 0) { ReportErrorAndExit("ERROR: incorrect argument value: --quantity:" + CommandLineArgs["--quantity"].ToString(), ExitCodes.cmdlineArgError); } // charsets if (!CommandLineArgs.ContainsKey("--charsets")) { ReportErrorAndExit("ERROR: required argument is absent: --charsets", ExitCodes.cmdlineArgError); } string charsets = CommandLineArgs["--charsets"].ToString(); if (charsets.Length == 0) { ReportErrorAndExit("ERROR: required argument value is empty: --charsets", ExitCodes.cmdlineArgError); } // fill the pgo.charsets array pgo.charsets = new string[0]; Hashtable cs; cs = pswgen.Charsets; foreach (string charset in charsets.Split(',')) { if (charset.Length == 0) { ReportErrorAndExit("ERROR: incorrect argument value: --charsets:" + charsets, ExitCodes.cmdlineArgError); } if (!cs.ContainsKey(charset)) { ReportErrorAndExit("ERROR: unknown charset in the \"--charsets\" argument: " + charset, ExitCodes.cmdlineArgError); } Array.Resize(ref pgo.charsets, pgo.charsets.Length + 1); pgo.charsets[pgo.charsets.Length - 1] = charset; } // user defined charset if (pgo.charsets.Contains("userDefined")) { if(!CommandLineArgs.ContainsKey("--userDefinedCharset")) { ReportErrorAndExit("ERROR: required argument is absent: --userDefinedCharset", ExitCodes.cmdlineArgError); } string udc = CommandLineArgs["--userDefinedCharset"].ToString(); if (udc.Length == 0) { ReportErrorAndExit("ERROR: argument value is empty: --userDefinedCharset", ExitCodes.cmdlineArgError); } pgo.userDefinedCharset = udc; } // generate easy-to-type passwords if (CommandLineArgs.ContainsKey("--easytotype")) { string ett = CommandLineArgs["--easytotype"].ToString(); if (ett.Length != 0) { ReportErrorAndExit("ERROR: incorrect argument value (must be empty!): --easytotype:" + ett, ExitCodes.cmdlineArgError); } pgo.easyToType = true; } // exclude confusing characters if (CommandLineArgs.ContainsKey("--excludeConfusingCharacters")) { string ecc = CommandLineArgs["--excludeConfusingCharacters"].ToString(); if (ecc.Length != 0) { ReportErrorAndExit("ERROR: incorrect argument value (must be empty!): --excludeConfusingCharacters:" + ecc, ExitCodes.cmdlineArgError); } pgo.excludeConfusing = true; } // destination if (!CommandLineArgs.ContainsKey("--destination")) { ReportErrorAndExit("ERROR: required argument is absent: --destination", ExitCodes.cmdlineArgError); } string dest = CommandLineArgs["--destination"].ToString(); if (dest.Length == 0) { ReportErrorAndExit("ERROR: required argument value is empty: --destination", ExitCodes.cmdlineArgError); } string destType = GetLongArgOrValueName(dest.Split(':')[0]); switch (destType) { case "console": destinationType = DestinationType.console; break; case "file": if (dest.Split(':').Length < 3) { ReportErrorAndExit("ERROR: incorrect destination: --destination:" + dest, ExitCodes.cmdlineArgError); } string destFileAccessMethod = GetLongArgOrValueName(dest.Split(':')[1]); switch (destFileAccessMethod) { case "append": appendToFile = true; break; case "replace": appendToFile = false; break; default: ReportErrorAndExit("ERROR: unknown file access method: --destination:" + dest, ExitCodes.cmdlineArgError); break; } //fileName; int pos = dest.IndexOf(':', 0); pos = dest.IndexOf(':', pos + 1); fileName = dest.Substring(pos + 1); if (fileName.Length == 0) { ReportErrorAndExit("ERROR: file name is empty: --destination:" + dest, ExitCodes.cmdlineArgError); } destinationType = DestinationType.file; break; default: ReportErrorAndExit("ERROR: unknown destination type: --destination:" + dest.Split(':')[0], ExitCodes.cmdlineArgError); break; } // initialize class pswgen = new PasswordGenerator(pgo); if (!pswgen.isReady) { ReportErrorAndExit("ERROR: some errors in command line arguments", ExitCodes.cmdlineArgError); } }
/// <summary> /// Get the destination by parsing the embedded type prefix. /// </summary> /// <param name="session">Session object to use to get the destination.</param> /// <param name="destinationName">Name of destination with embedded prefix. The embedded prefix can be one of the following: /// <list type="bullet"> /// <item>queue://</item> /// <item>topic://</item> /// <item>temp-queue://</item> /// <item>temp-topic://</item> /// </list> /// </param> /// <param name="defaultType">Default type if no embedded prefix is specified.</param> /// <returns></returns> public static IDestination GetDestination(ISession session, string destinationName, DestinationType defaultType) { IDestination destination = null; DestinationType destinationType = defaultType; if (null != destinationName) { if (destinationName.Length > QueuePrefix.Length && 0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix, false)) { destinationType = DestinationType.Queue; destinationName = destinationName.Substring(QueuePrefix.Length); } else if (destinationName.Length > TopicPrefix.Length && 0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix, false)) { destinationType = DestinationType.Topic; destinationName = destinationName.Substring(TopicPrefix.Length); } else if (destinationName.Length > TempQueuePrefix.Length && 0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), TempQueuePrefix, false)) { destinationType = DestinationType.TemporaryQueue; destinationName = destinationName.Substring(TempQueuePrefix.Length); } else if (destinationName.Length > TempTopicPrefix.Length && 0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), TempTopicPrefix, false)) { destinationType = DestinationType.TemporaryTopic; destinationName = destinationName.Substring(TempTopicPrefix.Length); } } switch (destinationType) { case DestinationType.Queue: if (null != destinationName) { destination = session.GetQueue(destinationName); } break; case DestinationType.Topic: if (null != destinationName) { destination = session.GetTopic(destinationName); } break; case DestinationType.TemporaryQueue: destination = session.CreateTemporaryQueue(); break; case DestinationType.TemporaryTopic: destination = session.CreateTemporaryTopic(); break; } return(destination); }
/// <summary> /// Extension function to get the destination by parsing the embedded type prefix. /// </summary> public static IDestination GetDestination(this ISession session, string destinationName, DestinationType defaultType) { return SessionUtil.GetDestination(session, destinationName, defaultType); }
public SendTransportContext(IActiveMqHostConfiguration hostConfiguration, ISessionContextSupervisor sessionContextSupervisor, IPipe <SessionContext> configureTopologyPipe, string entityName, DestinationType destinationType) : base(hostConfiguration) { SessionContextSupervisor = sessionContextSupervisor; ConfigureTopologyPipe = configureTopologyPipe; EntityName = entityName; DestinationType = destinationType; }
/// <summary> /// Extension function to delete the named destination by parsing the embedded type prefix. /// </summary> public static void DeleteDestination(this ISession session, string destinationName, DestinationType defaultType) { SessionUtil.DeleteDestination(session, destinationName, defaultType); }
private static NetAction.DestinationType translate( DestinationType destinationType) { switch(destinationType) { case DestinationType.QUEUE: return NetAction.DestinationType.QUEUE; case DestinationType.TOPIC: return NetAction.DestinationType.TOPIC; case DestinationType.VIRTUAL_QUEUE: return NetAction.DestinationType.VIRTUAL_QUEUE; } throw new Exception("Unexpected DestinationType while unmarshalling message " + destinationType.ToString() ); }
// returns next zone of path towards given destination public Zone FindPathTo(Zone zone, DestinationType destination, List <Instruction> instructions) { Dictionary <Zone, Zone> predecessors = new Dictionary <Zone, Zone>(); List <Zone> queue = new List <Zone>(); Zone currentZone; // breadth first search bool isFound = false; predecessors.Add(zone, zone); queue.Add(zone); do { currentZone = queue[0]; queue.RemoveAt(0); for (int i = 0; i < currentZone.Links.Count && !isFound; i++) { Zone linkedZone = currentZone.Links[i]; if (!predecessors.ContainsKey(linkedZone)) { predecessors.Add(linkedZone, currentZone); queue.Add(linkedZone); switch (destination) { case DestinationType.MY_BASE: isFound = linkedZone == ZoneManager.MyBase; break; case DestinationType.OPPONENT_BASE: isFound = linkedZone == ZoneManager.OpponentBase; break; case DestinationType.NOT_OWNED_ZONE: bool isBeingExplored = false; for (int j = 0; j < instructions.Count && !isBeingExplored; j++) { if (instructions[j].Destination == linkedZone) { isBeingExplored = true; } } isFound = linkedZone.ZoneOwner != Zone.Owner.ME && !isBeingExplored && linkedZone.IsVisible; break; } if (isFound) { currentZone = linkedZone; } } } } while(!isFound && queue.Any()); // travels back to origin through predecessors and returns the zone just before it Zone path; do { path = currentZone; currentZone = predecessors[currentZone]; } while(currentZone != zone); return(path); }
/// <summary> /// Try to parse an HTTP header and populate this instance properties /// </summary> /// <param name="headerValue">The value (without name) from the HTTP header</param> /// <returns></returns> public bool TryParseHeader(string headerValue) { Match m; m = faxReg.Match(headerValue); if (m.Success) { this.Type = DestinationType.Fax; this.Data = m.Groups["faxNumber"].Value; return true; } m = ediReg.Match(headerValue); if (m.Success) { Enum.TryParse<DestinationType>(m.Groups["ediType"].Value, true, out this.Type); this.Data = m.Groups["ediData"].Value; return true; } return false; }
public Destination(NodeId id) { type = DestinationType.node; destination_data.node_id = id; }
public OutputMenagerSettings(RowCollectionMenager rowCollectionMenager, DestinationType destinationType) { this.rowCollectionMenager = rowCollectionMenager; this.destinationType = destinationType; }
public IDestination CreateDestination(ISession session, DestinationType type) { return(CreateDestination(session, type, "")); }
//=============================================================== private String ToDestinationTypeString(DestinationType type) { switch (type) { case DestinationType.Dwolla: return "dwolla"; case DestinationType.Twitter: return "twitter"; case DestinationType.Facebook: return "facebook"; case DestinationType.Phone: return "phone"; case DestinationType.Email: return "email"; default: throw new ArgumentException("Unknown destination type encountered"); } }
public DemandMVVM(Airport destination, int passengers, int cargo, DestinationType type) { this.Cargo = cargo; this.Passengers = passengers; this.Destination = destination; this.Type = type; this.Contracted = this.Destination.AirlineContracts.Exists(c => c.Airline == GameObject.GetInstance().HumanAirline); }
private static IDestination CreateDestination(string name, DestinationType type) { return(type == DestinationType.Queue ? (IDestination) new ActiveMQQueue(name) : new ActiveMQTopic(name)); }