示例#1
0
文件: ServiceIDs.cs 项目: subor/sdk
    /// <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);
    }
示例#2
0
文件: ServiceIDs.cs 项目: subor/sdk
    /// <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);
        }
    }
示例#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);
 }
示例#4
0
文件: ServiceIDs.cs 项目: subor/sdk
    /// <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);
        }
    }
示例#5
0
文件: ServiceIDs.cs 项目: subor/sdk
 /// <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]);
     }
 }
示例#6
0
文件: ServiceIDs.cs 项目: subor/sdk
 /// <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());
 }
示例#7
0
文件: ServiceIDs.cs 项目: subor/sdk
 /// <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());
 }
示例#8
0
文件: ServiceIDs.cs 项目: subor/sdk
 /// <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());
 }
示例#9
0
文件: ServiceIDs.cs 项目: subor/sdk
 /// <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());
 }