Beispiel #1
0
    /// <summary>
    /// if the service is a splitter service
    /// </summary>
    /// <param name="sid">the service ID</param>
    public static bool IsSplitter(this ServiceIDs sid)
    {
        if (sid == ServiceIDs.LOW_POWER_START || sid == ServiceIDs.LOW_POWER_END ||
            sid == ServiceIDs.HIGH_POWER_START || sid == ServiceIDs.HIGH_POWER_END ||
            sid == ServiceIDs.OPTIONAL_HIGH_POWER_START || sid == ServiceIDs.OPTIONAL_HIGH_POWER_END)
        {
            return(true);
        }

        return(false);
    }
Beispiel #2
0
    /// <summary>
    /// if the service exist
    /// </summary>
    /// <param name="swi">the service ID</param>
    public static bool ExistWorker(this ServiceIDs swi)
    {
        switch (swi)
        {
        case ServiceIDs.VALIDATOR:
            return(false);

        default:
            return(true);
        }
    }
Beispiel #3
0
 public static bool IsLayer1Service(this ServiceIDs sid)
 {
     switch (sid)
     {
     case ServiceIDs.INPUTMANAGER_INTERNAL:
     case ServiceIDs.INPUTMANAGER_EXTERNAL:
     case ServiceIDs.LAUNCHER:
     case ServiceIDs.UPDATESERVICE:
     case ServiceIDs.POWERMANAGER:
         return(true);
     }
     return(false);
 }
Beispiel #4
0
    /// <summary>
    /// if the service exist
    /// </summary>
    /// <param name="swi">the service ID</param>
    public static bool ExistForwarder(this ServiceIDs swi)
    {
        switch (swi)
        {
        case ServiceIDs.HTTP_LISTENER:
        case ServiceIDs.SYS_REPORTER:
        case ServiceIDs.L2FORWARDER:
        case ServiceIDs.LAYER1:
        case ServiceIDs.UPDATESERVICE:
            return(false);

        default:
            return(true);
        }
    }
Beispiel #5
0
 /// <summary>
 /// short string of the service
 /// </summary>
 /// <param name="swi">the service ID</param>
 public static string ShortString(this ServiceIDs swi)
 {
     lock (locker)
     {
         if (!shortNames.ContainsKey(swi))
         {
             shortNames.Add(swi, swi.ToString()
                            .Replace("INTERNAL", "Int")
                            .Replace("EXTERNAL", "Ext")
                            .Replace("MANAGER", "Mgr")
                            .Replace("SERVICE", "Serv")
                            .Replace("SYSTEM", "Sys"));
         }
         return(shortNames[swi]);
     }
 }
Beispiel #6
0
 /// <summary>
 /// forwarder ID of the service
 /// </summary>
 /// <param name="swi">the service ID</param>
 /// <returns></returns>
 public static string ForwarderID(this ServiceIDs swi)
 {
     return("FWD_" + swi.ShortString());
 }
Beispiel #7
0
 /// <summary>
 /// work ID of the service
 /// Notice: we treat worker and service as the same mostly in layer0 because currently one service only got one worker.
 /// </summary>
 /// <param name="swi">the service ID</param>
 /// <returns></returns>
 public static string WorkerID(this ServiceIDs swi)
 {
     return("WRK_" + swi.ShortString());
 }
Beispiel #8
0
 /// <summary>
 /// the service publish to topic
 /// </summary>
 /// <param name="swi">the service ID</param>
 public static string PubChannelID(this ServiceIDs swi)
 {
     return("service/" + swi.ShortString().ToLower());
 }
Beispiel #9
0
 /// <summary>
 /// string convertion of service ID
 /// </summary>
 /// <param name="swi">the service ID</param>
 /// <returns>the string of the service ID</returns>
 public static string ServiceID(this ServiceIDs swi)
 {
     return("SER_" + swi.ToString());
 }