private static INetworkService Instance(Priority priority)
        {
            Func<HttpMessageHandler, INetworkService> createClient = messageHandler =>
            {
                // service registration
                var networkServiceSettings = new RefitSettings
                {
                    JsonSerializerSettings = new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore,
                        Error = (sender, args) => Debug.WriteLine(args)
                    }
                };

                var client = new HttpClient(messageHandler)
                {
                    BaseAddress = new Uri("http://vmkrcmar21.informatik.tu-muenchen.de/wordpress/")
                };

                return RestService.For<INetworkService>(client, networkServiceSettings);
            };

            return
                new SafeNetworkService(
                    createClient(new RateLimitedHttpMessageHandler(new NativeMessageHandler(), priority)));
        }
Exemplo n.º 2
0
 public void Log(string message, Category category, Priority priority)
 {
     switch (category)
     {
         case Category.Debug:
             _logger.Debug(message);
             break;
         case Category.Exception:
             if (priority == Priority.High)
             {
                 _logger.Fatal(message);
             }
             else
             {
                 _logger.Error(message);
             }
             break;
         case Category.Info:
             _logger.Info(message);
             break;
         case Category.Warn:
             _logger.Warn(message);
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(category), category, null);
     }
 }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     blackBoard = new Blackboard(this.gameObject);
     Node root = new Priority(
         new Node[]
         {
             new Sequence(
                 new Node[]
                 {
                     new ButtonPressed("X"),
                     new MemSequence(
                         new Node[]
                         {
                             new ChangeColor(Color.blue),
                             new Wait(1.0f),
                             new ChangePosition(Vector3.zero, Vector3.one*10.0f)
                            // new ChangeColor(Color.red)
                         }
                     )
                 }
             ),
             new ChangeColor(Color.red)
         }
     );
     behaviourTree = new BehaviourTree.Tree(root);
 }
 public FieldsForFeature()
 {
     priority = new Priority();
     assignee = new Assignee();
     project = new Project();
     issuetype = new IssueType();
 }
Exemplo n.º 5
0
        public void Log(string message, Category category, Priority priority)
        {
            lock (this)
            {
                Trace.WriteLine(message, category.ToString());
                var data = new LogMessage();
                data.Message = message;
                data.Category = category;
                data.Priority = priority;

                try
                {
                    if (!container.IsRegistered<LogViewer>()) throw new NotImplementedException();

                    var aggregator = container.Resolve<IEventAggregator>();
                    while (failedMessages.Any())
                    {
                        var item = failedMessages.Dequeue();
                        aggregator.GetEvent<LogEvent>().Publish(item);
                    }
                    aggregator.GetEvent<LogEvent>().Publish(data);
                }
                catch (Exception)
                {
                    failedMessages.Enqueue(data);
                }
            }
        }
Exemplo n.º 6
0
 public static void Play(string filename, Priority priority)
 {
     if (filename != null && filename != "")
     {
         SoundClip newSound;
         switch (priority)
         {
             case Priority.High:
                 newSound = new SoundClip(GameRef.Content, filename);
                 HighPrioritySounds.Add(newSound);
                 newSound.Play(volume, false);
                 break;
             case Priority.Normal:
                 if (NormalSounds.Count < MaxNormalSounds)
                 {
                     newSound = new SoundClip(GameRef.Content, filename);
                     NormalSounds.Add(newSound);
                     newSound.Play(volume, false);
                 }
                 break;
             case Priority.WindNoise:
                 newSound = new SoundClip(GameRef.Content, filename);
                 WindNoise = newSound;
                 newSound.Play(volume, true);
                 break;
         }
     }
     Update();
 }
 public void Log(string message, Category category, Priority priority)
 {
     _bootLogger.Log(String.Format("{0}|{1}: {2}",
         FormatString(category.ToString(), 9),
         FormatString(priority.ToString(), 6),
         message));
 }
 public void LogException(string message, Exception exception, Priority priority)
 {
     _bootLogger.Log(String.Format("{0}|{1}: {2}",
                     FormatString(Category.Exception.ToString(), 9),
                    FormatString(priority.ToString(), 6),
                    message), exception);
 }
Exemplo n.º 9
0
 //constructors
 public Task(string name, string category = "to-do", Color color = Color.Magenta,
     Priority priority = Priority.Medium, string location = "", string comment = "")
     : base(name, color, priority, comment)
 {
     this.Location = location;
     this.CategoryType = category;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Group.GroupSave method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnGroupSaveEvent(method, priority, plugin));
     Organize();
 }
Exemplo n.º 11
0
		public void Log(string message, Category category, Priority priority)
		{
			LogLevel nLevel = null;

			switch (category)
			{
				case Category.Debug:
					nLevel = LogLevel.Debug;
					break;

				case Category.Exception:
					nLevel = LogLevel.Error;
					break;

				case Category.Info:
					nLevel = LogLevel.Info;
					break;

				case Category.Warn:
					nLevel = LogLevel.Warn;
					break;
			}

			_logger.Log(nLevel, message);

		}
 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Server.OnConsoleCommand method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnConsoleCommandEvent(method, priority, plugin));
     Organize();
 }
Exemplo n.º 13
0
        /// <summary>
        /// Write a new log entry with the specified category and priority.
        /// </summary>
        /// <param name="message">Message body to log.</param>
        /// <param name="category">Category of the entry.</param>
        /// <param name="priority">The priority of the entry.</param>
        public void Log(string message, Category category, Priority priority)
        {
            string messageToLog = String.Format(CultureInfo.InvariantCulture, Resources.DefaultTextLoggerPattern, DateTime.Now,
                                                category.ToString().ToUpper(CultureInfo.InvariantCulture), message, priority.ToString());

            writer.WriteLine(messageToLog);
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            int i;
            SortedArr<double> srt1 = new
               SortedArr<double>(doubleIsGreater, doubleIsEqual);

            srt1.add(22.2);
            srt1.add(66.6);
            srt1.add(22.2);
            srt1.add(33.3);
            srt1.add(55.5);
            srt1.add(77.7);
            srt1.add(11.1);
            srt1.add(44.4);
            srt1.delete(55.5);

            Console.WriteLine("\nsrt1:");
            for (i = 0; i < srt1.N; i++)
                Console.WriteLine(srt1.Geti(i));

            Priority<int> pri1 = new Priority<int>(intIsGreater, intIsEqual);
            pri1.add(11);
            pri1.add(33);
            pri1.add(77);
            pri1.add(44);
            pri1.add(55);
            pri1.add(66);
            pri1.add(22);

            Console.WriteLine("\npri1:");
            while (pri1.N > 0)
                Console.WriteLine(pri1.removeMax());
        }
Exemplo n.º 15
0
 /// <summary>
 /// create a new assembla ticket
 /// </summary>
 /// <param name="summary"></param>
 /// <param name="desc"></param>
 /// <param name="pri"></param>
 /// <param name="stat"></param>
 public AssemblaTicket(string summary, string desc, Priority pri, TicketStatus stat)
 {
     _stat = stat;
     _pri = pri;
     _sum = summary;
     _desc = desc;
 }
Exemplo n.º 16
0
        public int InsertElement(int Index, int Minutes, Priority Priority)
        {
            Time UsableTime = Times.ElementAt(Index);

            //
            if ((int)UsableTime.Span.TotalMinutes == Minutes) {
                UsableTime.Priority = Priority;
                Times.RemoveAt(Index);
                Times.Insert(Index, UsableTime);
                return 0;
            }
            else if ((int)UsableTime.Span.TotalMinutes < Minutes) {
                Time NewTime1 = new Time();
                Time NewTime2 = new Time();

                NewTime2.Span = new TimeSpan(0, (int)UsableTime.Span.TotalMinutes - Minutes, 0);
                NewTime1.Span = new TimeSpan(0, (int)UsableTime.Span.TotalMinutes - (int)UsableTime.Span.TotalMinutes, 0);
                NewTime2.Priority = Priority.FREE;
                NewTime1.Priority = Priority;

                Times.RemoveAt(Index);
                Times.Insert(Index, NewTime1);
                Times.Insert(Index++, NewTime2);
                return 0;
            }
            else {
                UsableTime.Priority = Priority;
                Times.RemoveAt(Index);
                Times.Insert(Index, UsableTime);
                return Minutes - (int) UsableTime.Span.TotalMinutes;
            }
        }
Exemplo n.º 17
0
        public async Task<List<Event>> GetEvents (Priority priority)
        {
            var cache = BlobCache.LocalMachine;
            var cachedEvents = cache.GetAndFetchLatest ("events", () => GetRemoteEventsAsync (priority));

            return await cachedEvents.FirstOrDefaultAsync ();
        }
Exemplo n.º 18
0
        public async Task<List<Event>> GetRemoteEventsAsync (Priority priority)
        {
            List<Event> events = new List<Event> ();
            Task<List<Event>> getEventsTask;

            switch (priority) {
            case Priority.Background:
                getEventsTask = _apiService.Background.GetEvents (ApiService.Device);
                break;
            case Priority.UserInitiated:
                getEventsTask = _apiService.UserInitiated.GetEvents (ApiService.Device);
                break;
            case Priority.Speculative:
                getEventsTask = _apiService.Speculative.GetEvents (ApiService.Device);
                break;
            default:
                getEventsTask = _apiService.Background.GetEvents (ApiService.Device);
                break;
            }

            if (CrossConnectivity.Current.IsConnected)
            {
                events = await Policy
                    .Handle<WebException> ()
                    .WaitAndRetryAsync (5, retryAttempt => TimeSpan.FromSeconds (Math.Pow (2, retryAttempt)))
                    .ExecuteAsync (async () => await getEventsTask);
            }

            return events;
        }
Exemplo n.º 19
0
        /// <summary>
        ///  Create an outgoing frame
        /// </summary>
        /// <param name="streamId">Stream id</param>
        /// <param name="headerBytes">Header bytes</param>
        /// <param name="priority">Priority</param>
        public HeadersFrame(int streamId, byte[] headerBytes, Priority priority = Priority.Pri7)
        {
            //PRIORITY (0x8):  Bit 4 being set indicates that the first four octets
            //of this frame contain a single reserved bit and a 31-bit priority;
            //If this bit is not set, the four bytes do not
            //appear and the frame only contains a header block fragment.
            bool hasPriority = (priority != Priority.None);

            int preambleLength = hasPriority
                ? PreambleSizeWithPriority
                : PreambleSizeWithoutPriority;

            _buffer = new byte[headerBytes.Length + preambleLength];
            HasPriority = hasPriority;

            StreamId = streamId;
            FrameType = FrameType.Headers;
            FrameLength = Buffer.Length - Constants.FramePreambleSize;
            if (HasPriority)
            {
                Priority = priority;
            }

            // Copy in the headers
            System.Buffer.BlockCopy(headerBytes, 0, Buffer, preambleLength, headerBytes.Length);
        }
        public void Log(string message, Category category, Priority priority)
        {
            switch (category)
            {
                case Category.Debug:
                {
                    Logger.Debug(message);
                }
                    break;
                case Category.Info:
                {
                    Logger.Info(message);
                }
                    break;
                case Category.Warn:
                {
                    Logger.Warn(message);
                }
                    break;
                case Category.Exception:
                {
                    Logger.Error(message);
                }
                    break;

            }
        }
        public Alachisoft.NCache.Common.Enum.Priority GetDistributionPriority()
        {
            Priority priority;
            lock (this)
            {
                switch (_currentPriority)
                {
                    case Priority.Normal:
                        if (_messageCount >= _noOfNormalPriorityMessages)
                        {
                            _messageCount = 0;
                            _currentPriority = Priority.Low;
                        }
                        break;

                    case Priority.Low:
                        if (_messageCount >= _noOfLowPriorityMessages)
                        {
                            _messageCount = 0;
                            _currentPriority = Priority.Normal;
                        }
                        break;
                }

                _messageCount++;
                priority = _currentPriority;
            }

            return priority;
        }
Exemplo n.º 22
0
 public Limit(Priority a_priority, Server server, ulong limiterOrder)
 {
     Event = new AutoResetEvent(false);
     Priority = a_priority;
     Server = server;
     LimiterOrder = limiterOrder;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Gets the trace level based on category and priority
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="priority">The priority.</param>
        /// <returns>System.Int32.</returns>
        public int GetTraceLevel(Category category, Priority priority)
        {
            switch (priority)
            {
                // No logging if priority = none
                case Priority.None:
                    return 0;           // None

                // Category now determines trace level
                default:
                    switch (category)
                    {
                        case Category.Exception:
                            return 1;   // Error

                        case Category.Warn:
                            return 2;   // Warning

                        case Category.Info:
                            return 3;   // Info

                        case Category.Debug:
                            return 4;   // Verbose
                    }
                    return 0;
            }
        }
Exemplo n.º 24
0
 public void Log(string message, Category category, Priority priority)
 {
     if(category >= CurrentCategory)
     {
         EventAggregator.Value.Publish(new LoggingEvent(message, category, priority));
     }
 }
 private StatisticColumn(string columnName, Func<Statistics, double> calc, Priority priority, bool isTimeColumn = true)
 {
     this.calc = calc;
     this.priority = priority;
     this.isTimeColumn = isTimeColumn;
     ColumnName = columnName;
 }
Exemplo n.º 26
0
 public PriorityFrame(Priority priority, int streamId)
 {
     Contract.Assert(streamId != 0);
     StreamId = streamId;
     Priority = priority;
     FrameType = FrameType.Priority;
 }
 private async Task<List<ConferenceDto>> GetRemoteConferencesAsync(Priority priority)
 {
     List<ConferenceDto> conferences = null;
     Task<List<ConferenceDto>> getConferencesTask;
     switch (priority)
     {
         case Priority.Background:
             getConferencesTask = _apiService.Background.GetConferences();
             break;
         case Priority.UserInitiated:
             getConferencesTask = _apiService.UserInitiated.GetConferences();
             break;
         case Priority.Speculative:
             getConferencesTask = _apiService.Speculative.GetConferences();
             break;
         default:
             getConferencesTask = _apiService.UserInitiated.GetConferences();
             break;
     }
     
     if (CrossConnectivity.Current.IsConnected)
     {
         conferences = await Policy
               .Handle<WebException>()
               .WaitAndRetry
               (
                 retryCount:5, 
                 sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
               )
               .ExecuteAsync(async () => await getConferencesTask);
     }
     return conferences;
 }
        public async Task<ConferenceDto> GetRemoteConference(Priority priority, string slug)
        {
            ConferenceDto conference = null;

            Task<ConferenceDto> getConferenceTask;
            switch (priority)
            {
                case Priority.Background:
                    getConferenceTask = _apiService.Background.GetConference(slug);
                    break;
                case Priority.UserInitiated:
                    getConferenceTask = _apiService.UserInitiated.GetConference(slug);
                    break;
                case Priority.Speculative:
                    getConferenceTask = _apiService.Speculative.GetConference(slug);
                    break;
                default:
                    getConferenceTask = _apiService.UserInitiated.GetConference(slug);
                    break;
            }

            if (CrossConnectivity.Current.IsConnected)
            {
                conference = await Policy
                    .Handle<Exception>()
                    .RetryAsync(retryCount: 5)
                    .ExecuteAsync(async () => await getConferenceTask);
            }

            return conference;
        }
Exemplo n.º 29
0
        public async Task<List<Article>> GetRemoteArticlesAsync (Priority priority)
        {
            List<Article> articles = new List<Article> ();
            Task<List<Article>> getArticlesTask;

            switch (priority) {
            case Priority.Background:
                getArticlesTask = _apiService.Background.GetArticles (ApiService.Device);
                break;
            case Priority.UserInitiated:
                getArticlesTask = _apiService.UserInitiated.GetArticles (ApiService.Device);
                break;
            case Priority.Speculative:
                getArticlesTask = _apiService.Speculative.GetArticles (ApiService.Device);
                break;
            default:
                getArticlesTask = _apiService.UserInitiated.GetArticles (ApiService.Device);
                break;
            }

            if (CrossConnectivity.Current.IsConnected)
            {
                articles = await Policy
                    .Handle<WebException> ()
                    .WaitAndRetryAsync (5, retryAttempt => TimeSpan.FromSeconds (Math.Pow (2, retryAttempt)))
                    .ExecuteAsync(async () => await getArticlesTask);
            }

            return articles.Select(article => {
                article.ImageUrl = ApiService.ApiBaseAddress + article.ImageUrl;
                return article;
            }).ToList();
        }
Exemplo n.º 30
0
 public static void Register(Player.OnSpritChange method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnPlayerSprintEvent(method, priority, plugin));
     Organize();
 }
Exemplo n.º 31
0
 public void Log(string message, Category category, Priority priority)
 {
     Debug.WriteLine($"{DateTime.Now.ToLongDateString()} {DateTime.Now.ToLongTimeString()} (Category={category}, Priority={priority}): {message}");
 }
Exemplo n.º 32
0
 public void Log(string message, Category category, Priority priority)
 {
     Debug.WriteLine($"{category} - {priority}: {message}");
 }
Exemplo n.º 33
0
        /// <summary>
        /// Enqueues the specified action.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="priority">The priority.</param>
        public static void Enqueue(Action action, Priority priority = Priority.Normal)
        {
            Validation.Validator.AgainstNullArgument(nameof(action), action);

            Processor.Enqueue(new ActionJob(action, priority));
        }
Exemplo n.º 34
0
 public static bool Add(string from, string toRecipient, string ccRecipients, string bccRecipients, string subject, string body, Priority priority, string listUnsubscribe = null, string plainText = null)
 {
     return(Add(from, toRecipient, ccRecipients, bccRecipients, subject, body, GetDateByPriority(priority), null, listUnsubscribe: listUnsubscribe, plainText: plainText));
 }
Exemplo n.º 35
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Goal;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Start != null)
                {
                    dest.Start = (Hl7.Fhir.Model.Element)Start.DeepCopy();
                }
                if (Target != null)
                {
                    dest.Target = (Hl7.Fhir.Model.Element)Target.DeepCopy();
                }
                if (Category != null)
                {
                    dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
                }
                if (DescriptionElement != null)
                {
                    dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Goal.GoalStatus>)StatusElement.DeepCopy();
                }
                if (StatusDateElement != null)
                {
                    dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopy();
                }
                if (StatusReason != null)
                {
                    dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopy();
                }
                if (Author != null)
                {
                    dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopy();
                }
                if (Priority != null)
                {
                    dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopy();
                }
                if (Addresses != null)
                {
                    dest.Addresses = new List <Hl7.Fhir.Model.ResourceReference>(Addresses.DeepCopy());
                }
                if (Note != null)
                {
                    dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
                }
                if (Outcome != null)
                {
                    dest.Outcome = new List <Hl7.Fhir.Model.Goal.OutcomeComponent>(Outcome.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemplo n.º 36
0
 internal OnPlayerChatEvent(Player.OnPlayerChat method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
Exemplo n.º 37
0
        public void Event(string title, string text, int?dateHappened = null, string hostName = null, string aggregationKey = null, Priority priority = Priority.Normal, string sourceTypeName = null, AlertType alertType = AlertType.Info, string[] tags = null, bool truncateText = true)
        {
            if (isNull)
            {
                return;
            }

            var command = DogStatsDFormatter.Event(title, text, dateHappened, hostName, aggregationKey, priority, sourceTypeName, alertType, WithDefaultTag(tags), truncateText);

            Send(command);
        }
Exemplo n.º 38
0
 public Action(Priority pr, Type ty)
 {
     type     = ty;
     priority = pr;
 }
     public MailParameters(string projectName, DateTime startTime, DateTime endTime, IEnumerable <MailLang> languages, Priority priority)
 {
     ProjectName = projectName;
     StartTime   = startTime;
     EndTime     = endTime;
     Languages   = languages.Cast <int>();
     Priority    = (int)priority;
 }
Exemplo n.º 40
0
 public Issue(float effortManHours, string description, Priority priority)
     : this(effortManHours, description)
 {
     this.Priority = priority;
 }
Exemplo n.º 41
0
 public TaskUnit(Task task, Priority piority)
 {
     _task         = task;
     _priorityTask = piority;
 }
 protected NaturalGameEvent(GameTick occursAt, Priority priority)
 {
     this._eventId  = Guid.NewGuid().ToString();
     this._occursAt = occursAt;
     this._priority = priority;
 }
Exemplo n.º 43
0
 /// <summary>
 /// create a new assembla ticket in a given space using a given account
 /// </summary>
 /// <param name="space"></param>
 /// <param name="username"></param>
 /// <param name="pw"></param>
 /// <param name="summary"></param>
 /// <param name="desc"></param>
 /// <param name="pri"></param>
 /// <param name="stat"></param>
 public AssemblaTicket(string space, string username, string pw, string summary, string desc, Priority pri, TicketStatus stat)
 {
     _space = space;
     _un    = username;
     _pw    = pw;
     _stat  = stat;
     _pri   = pri;
     _sum   = summary;
     _desc  = desc;
 }
 public MailParameters(string projectName, DateTime startTime, DateTime endTime, MailLang language, Priority priority)
     : this(projectName, startTime, endTime, new[] { language }, priority)
 /// <summary>
 /// Constructor to specify the full URL of the Troubleshooting configuration file for the Extension library.
 /// </summary>
 /// <param name="url">Url containing the Troubleshooting configuration file.</param>
 /// <param name="priority">Priority of the source.</param>
 public TroubleshootingSourceAttribute([RegularExpression(@"(https?|ftp)://[^\s/$.?#].[^\s]*\.json")] string url,
                                       Priority priority)
 {
     Url      = url;
     Priority = priority;
 }
Exemplo n.º 46
0
        public static int Create(string space, string user, string password, string summary, string description, TicketStatus status, Priority priority)
        {
            int           stat = (int)status;
            int           pri  = (int)priority;
            string        url  = GetTicketUrl(space);
            StringBuilder data = new StringBuilder();

            data.AppendLine("<ticket>");
            data.AppendLine("<status>" + stat.ToString() + "</status>");
            data.AppendLine("<priority>" + pri.ToString() + "</priority>");
            data.AppendLine("<summary>");
            data.AppendLine(System.Web.HttpUtility.HtmlEncode(summary));
            data.AppendLine("</summary>");
            data.AppendLine("<description>");
            data.AppendLine(System.Web.HttpUtility.HtmlEncode(description));
            data.AppendLine("</description>");
            data.AppendLine("</ticket>");

            // prepare id
            int    id = 0;
            string rs = string.Empty;

            try
            {
                qc.gopost(url, user, password, data.ToString(), SendDebug, out rs);


                XmlDocument xd = new XmlDocument();
                xd.LoadXml(rs);
                XmlNodeList xnl = xd.GetElementsByTagName("id");
                string      val = xnl[0].InnerText;
                if ((val != null) && (val != string.Empty))
                {
                    id = Convert.ToInt32(val);
                }
                // display it
                if (SendDebug != null)
                {
                    SendDebug(rs);
                }
            }
            catch (Exception ex)
            {
                if (SendDebug != null)
                {
                    SendDebug("error on data: " + rs + " err: " + ex.Message + ex.StackTrace);
                }
                return(0);
            }
            return(id);
        }
Exemplo n.º 47
0
 public void UpdateConsumerPriority(PowerConsumerComponent consumer, Priority oldPriority, Priority newPriority)
 {
 }
Exemplo n.º 48
0
 public void Log(string message, Category category, Priority priority)
 {
     Logger.Write(message, category.ToString(), (int)priority);
 }
Exemplo n.º 49
0
 public void AddEventHandlers(IEventHandler handler, Priority priority = Priority.Normal)
 {
     eventManager.AddEventHandlers(this, handler, priority);
 }
Exemplo n.º 50
0
 public NesMenuFolder(string name = "Folder", string imageId = "folder")
 {
     Name     = name;
     Position = Priority.Right;
     ImageId  = imageId;
 }
Exemplo n.º 51
0
 public static void SetPriority(int id, Priority priority)
 {
     Internal_SetPriority_Enum(id, priority);
 }
Exemplo n.º 52
0
 public void AddEventHandler(Type eventType, IEventHandler handler, Priority priority = Priority.Normal)
 {
     eventManager.AddEventHandler(this, eventType, handler, priority);
 }
Exemplo n.º 53
0
 public void Enqueue(TQueue item,
                     Priority priority = Priority.Normal)
 {
     Enqueue(new PriorityItem <TQueue>(priority, item));
 }
Exemplo n.º 54
0
 public void LoadData(Priority priority, IDataFetcherDataCallback callback) =>
 callback.OnDataReady(_model);
Exemplo n.º 55
0
        public virtual void TestContainerKillOnMemoryOverflow()
        {
            if (!ProcfsBasedProcessTree.IsAvailable())
            {
                return;
            }
            containerManager.Start();
            FilePath    scriptFile       = new FilePath(tmpDir, "scriptFile.sh");
            PrintWriter fileWriter       = new PrintWriter(scriptFile);
            FilePath    processStartFile = new FilePath(tmpDir, "start_file.txt").GetAbsoluteFile
                                               ();

            fileWriter.Write("\numask 0");
            // So that start file is readable by the
            // test.
            fileWriter.Write("\necho Hello World! > " + processStartFile);
            fileWriter.Write("\necho $$ >> " + processStartFile);
            fileWriter.Write("\nsleep 15");
            fileWriter.Close();
            ContainerLaunchContext containerLaunchContext = recordFactory.NewRecordInstance <ContainerLaunchContext
                                                                                             >();
            // ////// Construct the Container-id
            ApplicationId        appId        = ApplicationId.NewInstance(0, 0);
            ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(appId, 1);
            ContainerId          cId          = ContainerId.NewContainerId(appAttemptId, 0);
            int port           = 12345;
            URL resource_alpha = ConverterUtils.GetYarnUrlFromPath(localFS.MakeQualified(new
                                                                                         Path(scriptFile.GetAbsolutePath())));
            LocalResource rsrc_alpha = recordFactory.NewRecordInstance <LocalResource>();

            rsrc_alpha.SetResource(resource_alpha);
            rsrc_alpha.SetSize(-1);
            rsrc_alpha.SetVisibility(LocalResourceVisibility.Application);
            rsrc_alpha.SetType(LocalResourceType.File);
            rsrc_alpha.SetTimestamp(scriptFile.LastModified());
            string destinationFile = "dest_file";
            IDictionary <string, LocalResource> localResources = new Dictionary <string, LocalResource
                                                                                 >();

            localResources[destinationFile] = rsrc_alpha;
            containerLaunchContext.SetLocalResources(localResources);
            IList <string> commands = new AList <string>();

            commands.AddItem("/bin/bash");
            commands.AddItem(scriptFile.GetAbsolutePath());
            containerLaunchContext.SetCommands(commands);
            Resource r = BuilderUtils.NewResource(8 * 1024 * 1024, 1);
            ContainerTokenIdentifier containerIdentifier = new ContainerTokenIdentifier(cId,
                                                                                        context.GetNodeId().ToString(), user, r, Runtime.CurrentTimeMillis() + 120000, 123
                                                                                        , DummyRmIdentifier, Priority.NewInstance(0), 0);
            Token containerToken = BuilderUtils.NewContainerToken(context.GetNodeId(), containerManager
                                                                  .GetContext().GetContainerTokenSecretManager().CreatePassword(containerIdentifier
                                                                                                                                ), containerIdentifier);
            StartContainerRequest scRequest = StartContainerRequest.NewInstance(containerLaunchContext
                                                                                , containerToken);
            IList <StartContainerRequest> list = new AList <StartContainerRequest>();

            list.AddItem(scRequest);
            StartContainersRequest allRequests = StartContainersRequest.NewInstance(list);

            containerManager.StartContainers(allRequests);
            int timeoutSecs = 0;

            while (!processStartFile.Exists() && timeoutSecs++ < 20)
            {
                Sharpen.Thread.Sleep(1000);
                Log.Info("Waiting for process start-file to be created");
            }
            NUnit.Framework.Assert.IsTrue("ProcessStartFile doesn't exist!", processStartFile
                                          .Exists());
            // Now verify the contents of the file
            BufferedReader reader = new BufferedReader(new FileReader(processStartFile));

            NUnit.Framework.Assert.AreEqual("Hello World!", reader.ReadLine());
            // Get the pid of the process
            string pid = reader.ReadLine().Trim();

            // No more lines
            NUnit.Framework.Assert.AreEqual(null, reader.ReadLine());
            BaseContainerManagerTest.WaitForContainerState(containerManager, cId, ContainerState
                                                           .Complete, 60);
            IList <ContainerId> containerIds = new AList <ContainerId>();

            containerIds.AddItem(cId);
            GetContainerStatusesRequest gcsRequest = GetContainerStatusesRequest.NewInstance(
                containerIds);
            ContainerStatus containerStatus = containerManager.GetContainerStatuses(gcsRequest
                                                                                    ).GetContainerStatuses()[0];

            NUnit.Framework.Assert.AreEqual(ContainerExitStatus.KilledExceededVmem, containerStatus
                                            .GetExitStatus());
            string expectedMsgPattern = "Container \\[pid=" + pid + ",containerID=" + cId + "\\] is running beyond virtual memory limits. Current usage: "
                                        + "[0-9.]+ ?[KMGTPE]?B of [0-9.]+ ?[KMGTPE]?B physical memory used; " + "[0-9.]+ ?[KMGTPE]?B of [0-9.]+ ?[KMGTPE]?B virtual memory used. "
                                        + "Killing container.\nDump of the process-tree for " + cId + " :\n";

            Sharpen.Pattern pat = Sharpen.Pattern.Compile(expectedMsgPattern);
            NUnit.Framework.Assert.AreEqual("Expected message pattern is: " + expectedMsgPattern
                                            + "\n\nObserved message is: " + containerStatus.GetDiagnostics(), true, pat.Matcher
                                                (containerStatus.GetDiagnostics()).Find());
            // Assert that the process is not alive anymore
            NUnit.Framework.Assert.IsFalse("Process is still alive!", exec.SignalContainer(user
                                                                                           , pid, ContainerExecutor.Signal.Null));
        }
Exemplo n.º 56
0
 private static extern void Internal_SetPriority_Enum(int id, Priority priority);
Exemplo n.º 57
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Identity != null)
            {
                p.AddRange(Identity.Select(prop => new KeyValuePair <string, string>("Identity", prop)));
            }

            if (Tag != null)
            {
                p.AddRange(Tag.Select(prop => new KeyValuePair <string, string>("Tag", prop)));
            }

            if (Body != null)
            {
                p.Add(new KeyValuePair <string, string>("Body", Body));
            }

            if (Priority != null)
            {
                p.Add(new KeyValuePair <string, string>("Priority", Priority.ToString()));
            }

            if (Ttl != null)
            {
                p.Add(new KeyValuePair <string, string>("Ttl", Ttl.Value.ToString()));
            }

            if (Title != null)
            {
                p.Add(new KeyValuePair <string, string>("Title", Title));
            }

            if (Sound != null)
            {
                p.Add(new KeyValuePair <string, string>("Sound", Sound));
            }

            if (Action != null)
            {
                p.Add(new KeyValuePair <string, string>("Action", Action));
            }

            if (Data != null)
            {
                p.Add(new KeyValuePair <string, string>("Data", Serializers.JsonObject(Data)));
            }

            if (Apn != null)
            {
                p.Add(new KeyValuePair <string, string>("Apn", Serializers.JsonObject(Apn)));
            }

            if (Gcm != null)
            {
                p.Add(new KeyValuePair <string, string>("Gcm", Serializers.JsonObject(Gcm)));
            }

            if (Sms != null)
            {
                p.Add(new KeyValuePair <string, string>("Sms", Serializers.JsonObject(Sms)));
            }

            if (FacebookMessenger != null)
            {
                p.Add(new KeyValuePair <string, string>("FacebookMessenger", Serializers.JsonObject(FacebookMessenger)));
            }

            if (Fcm != null)
            {
                p.Add(new KeyValuePair <string, string>("Fcm", Serializers.JsonObject(Fcm)));
            }

            if (Segment != null)
            {
                p.AddRange(Segment.Select(prop => new KeyValuePair <string, string>("Segment", prop)));
            }

            if (Alexa != null)
            {
                p.Add(new KeyValuePair <string, string>("Alexa", Serializers.JsonObject(Alexa)));
            }

            if (ToBinding != null)
            {
                p.AddRange(ToBinding.Select(prop => new KeyValuePair <string, string>("ToBinding", prop)));
            }

            return(p);
        }
Exemplo n.º 58
0
 public PriorityItem(Priority priority,
                     T item)
 {
     Priority = priority;
     Item     = item;
 }
Exemplo n.º 59
0
        public void CreatePriorityThrowsError()
        {
            var client = CommonMethods.GetClientByRoute(TargetProcessRoutes.Route.Priorities);

            var priority = new Priority();
        }
Exemplo n.º 60
0
 public Operator(string symbol, Priority priority, Func <double, double, double> operation)
 {
     Symbol    = symbol;
     Priority  = priority;
     Operation = operation;
 }