public override void OnSOCreated(SO so)
 {
     foreach (var inboundClusterProtocol in InboundClusters)
     {
         so.RegisterProtocol(inboundClusterProtocol);
     }
 }
Exemple #2
0
 private bool ProcessSharedObjectPrimitive(BaseRTMPProtocol pFrom, SO pSO, string name, Variant request,
     int primitiveId)
 {
     var primitive = request[Defines.RM_SHAREDOBJECT,Defines.RM_SHAREDOBJECT_PRIMITIVES][ primitiveId];
     switch ((byte)primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_TYPE])
     {
         case Defines.SOT_CS_CONNECT:
             pSO.RegisterProtocol(pFrom);
             return true;
         case Defines.SOT_CS_DISCONNECT:
             UnRegisterProtocol(pFrom);
             return true;
         case Defines.SOT_CSC_DELETE_DATA:
             pSO.UnSet(primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD],pFrom);
             return true;
         case Defines.SOT_CS_SET_ATTRIBUTE:
             if (pSO == null)
             {
                 Logger.FATAL("SO is null");
                 return false;
             }
             foreach (KeyValuePair<string,Variant> item in primitive [Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD])
             {
                 pSO.Set(item.Key, item.Value.Clone(), pFrom);
             }
             return true;
         case Defines.SOT_BW_SEND_MESSAGE:
             pSO?.Send(primitive, pFrom);
             return true;
         default:
             Logger.FATAL("SO primitive not allowed here");
             return false;
     }
 }
Exemple #3
0
 public SOManager(BaseClientApplication application)
 {
     Application = application;
     var soPath = application.SOPath;
     if (!Directory.Exists(soPath)) Directory.CreateDirectory(soPath);
     foreach (var name in Directory.GetFiles(soPath, "*.so").Select(Path.GetFileNameWithoutExtension))
         _sos[name] = new SO(Application, name, true);
 }
Exemple #4
0
        public SOManager(BaseClientApplication application)
        {
            Application = application;
            var soPath = application.SOPath;

            if (!Directory.Exists(soPath))
            {
                Directory.CreateDirectory(soPath);
            }
            foreach (var name in Directory.GetFiles(soPath, "*.so").Select(Path.GetFileNameWithoutExtension))
            {
                _sos[name] = new SO(Application, name, true);
            }
        }
Exemple #5
0
        private bool ProcessSharedObjectPrimitive(BaseRTMPProtocol pFrom, SO pSO, string name, Variant request,
                                                  int primitiveId)
        {
            var primitive = request[Defines.RM_SHAREDOBJECT, Defines.RM_SHAREDOBJECT_PRIMITIVES][primitiveId];

            switch ((byte)primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_TYPE])
            {
            case Defines.SOT_CS_CONNECT:
                pSO.RegisterProtocol(pFrom);
                return(true);

            case Defines.SOT_CS_DISCONNECT:
                UnRegisterProtocol(pFrom);
                return(true);

            case Defines.SOT_CSC_DELETE_DATA:
                pSO.UnSet(primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD], pFrom);
                return(true);

            case Defines.SOT_CS_SET_ATTRIBUTE:
                if (pSO == null)
                {
                    Logger.FATAL("SO is null");
                    return(false);
                }
                foreach (KeyValuePair <string, Variant> item in primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD])
                {
                    pSO.Set(item.Key, item.Value.Clone(), pFrom);
                }
                return(true);

            case Defines.SOT_BW_SEND_MESSAGE:
                pSO?.Send(primitive, pFrom);
                return(true);

            default:
                Logger.FATAL("SO primitive not allowed here");
                return(false);
            }
        }
 public abstract void OnSOCreated(SO so);
Exemple #7
0
 public void OnSOCreated(SO so)
 {
     ClusterAppProtocolHandler.OnSOCreated(so);
 }
Exemple #8
0
 public SO this[string name, bool persistent = false] => _sos.ContainsKey(name) ? _sos[name] : _sos[name] = new SO(Application, name, persistent);
Exemple #9
0
 public SO this[string name, bool persistent = false] => _sos.ContainsKey(name) ? _sos[name] : _sos[name] = new SO(Application, name, persistent);
 public override void OnSOCreated(SO so)
 {
     if(OutboundCluster!=null)so.RegisterProtocol(OutboundCluster);
 }