コード例 #1
0
        private static bool DeserializeSubscriptions(SharedVariableInfo svInfo, string serialized, ref int cc, out SubscriptionInfo[] subscriptions, out Exception ex)
        {
            SubscriptionInfo subscription;
            List<SubscriptionInfo> lstSubscription;

            subscriptions = null;
            ex = null;
            Scanner.SkipSpaces(serialized, ref cc);
            if (!Scanner.ReadString("subscriptions=", serialized, ref cc))
                return true;

            if (!Scanner.ReadChar('{', serialized, ref cc))
            {
                ex = new Exception("Invalid subscriptions segment, expected '{'");
                return false;
            }

            lstSubscription = new List<SubscriptionInfo>();
            while ((cc < serialized.Length) && (serialized[cc] == '{'))
            {
                if (!DeserializeSubscription(svInfo, serialized, ref cc, out subscription, out ex))
                    return false;
                lstSubscription.Add(subscription);
            }

            if (!Scanner.ReadChar('}', serialized, ref cc))
            {
                ex = new Exception("Invalid subscriptions segment, expected '}'");
                return false;
            }

            subscriptions = lstSubscription.ToArray();
            return true;
        }
コード例 #2
0
        private static bool DeserializeSubscription(SharedVariableInfo svInfo, string serialized, ref int cc, out SubscriptionInfo subscription, out Exception ex)
        {
            //int bcc;
            string subscriber;
            SharedVariableSubscriptionType sType;
            SharedVariableReportType rType;
            string writer = null;

            subscription = null;
            if (!Scanner.ReadChar('{', serialized, ref cc))
            {
                ex = new Exception("Invalid subscriptions segment, expected '{'");
                return false;
            }

            if (!DeserializeSubscriber(serialized, ref cc, out subscriber, out ex))
                return false;
            if (!DeserializeSubscriptionType(serialized, ref cc, out sType, out ex))
                return false;
            if (!DeserializeReportType(serialized, ref cc, out rType, out ex))
                return false;
            if ((sType == SharedVariableSubscriptionType.WriteModule) && !DeserializeSubscriptionWriter(serialized, ref cc, out writer, out ex))
                return false;

            if (!Scanner.ReadChar('}', serialized, ref cc))
            {
                ex = new Exception("Invalid subscriptions segment, expected '}'");
                return false;
            }

            subscription = new SubscriptionInfo(svInfo);
            subscription.ModuleName = subscriber;
            subscription.SubscriptionType = sType;
            subscription.ReportType = rType;
            subscription.WriterModule = writer;
            return true;
        }