public static Client CreateClient(APPID App, string ConfigPath)
        {
            if (!Clients.ContainsKey(App))
            {
                lock (SynObject)
                {
                    if (!Clients.ContainsKey(App))
                    {
                        foreach (var v in Apps)
                        {
                            if (v.id == App)
                            {
                                switch (v.type)
                                {
                                case APPTYPE.App2Res:
                                    Client c1 = new ClientApp(v, ConfigPath);
                                    Clients.Add(App, c1);
                                    break;

                                case APPTYPE.App2App:
                                    Client c2 = new ClientP2P(v, ConfigPath);
                                    Clients.Add(App, c2);
                                    break;

                                case APPTYPE.Res2App:
                                    Client c3 = new ClientRes(v, ConfigPath);
                                    Clients.Add(App, c3);
                                    break;

                                case APPTYPE.Authorization:
                                    Client c4 = new ClientAuthor(v, ConfigPath);
                                    Clients.Add(App, c4);
                                    break;

                                case APPTYPE.Moniter:
                                    Client c5 = new ClientMoniter(v, ConfigPath);
                                    Clients.Add(App, c5);
                                    break;

                                default:
                                    break;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            return(Clients[App]);
        }
 public static Client CreateClient(APPID App, string ConfigPath)
 {
     if (!Clients.ContainsKey(App))
     {
         lock (SynObject)
         {
             if (!Clients.ContainsKey(App))
             {
                 foreach (var v in Apps)
                 {
                     if (v.id == App)
                     {
                         switch (v.type)
                         {
                             case APPTYPE.App2Res:
                                 Client c1 = new ClientApp(v, ConfigPath);
                                 Clients.Add(App, c1);
                                 break;
                             case APPTYPE.App2App:
                                 Client c2 = new ClientP2P(v, ConfigPath);
                                 Clients.Add(App, c2);
                                 break;
                             case APPTYPE.Res2App:
                                 Client c3 = new ClientRes(v, ConfigPath);
                                 Clients.Add(App, c3);
                                 break;
                             case APPTYPE.Authorization:
                                 Client c4 = new ClientAuthor(v, ConfigPath);
                                 Clients.Add(App, c4);
                                 break;
                             case APPTYPE.Moniter:
                                 Client c5 = new ClientMoniter(v, ConfigPath);
                                 Clients.Add(App, c5);
                                 break;
                             default:
                                 break;
                         }
                         break;
                     }
                 }
             }
         }
     }
     return Clients[App];
 }