Пример #1
0
        public static IDataStorage CreateDataStorage(eStorageType i_Type, params object[] i_CreationParams)
        {
            switch (i_Type)
            {
                case eStorageType.XmlFile:
                    if (i_CreationParams.Length < 1)
                    {
                        throw new ArgumentException("XmlFile storage requires file name as a parameter");
                    }

                    return new XmlFileStorage(i_CreationParams[0] as string);
                default:
                    throw new ArgumentException("Unsupported storage type");
            }
        }
Пример #2
0
        public static IDataStorage CreateDataStorage(eStorageType i_Type, params object[] i_CreationParams)
        {
            switch (i_Type)
            {
            case eStorageType.XmlFile:
                if (i_CreationParams.Length < 1)
                {
                    throw new ArgumentException("XmlFile storage requires file name as a parameter");
                }

                return(new XmlFileStorage(i_CreationParams[0] as string));

            default:
                throw new ArgumentException("Unsupported storage type");
            }
        }
Пример #3
0
        private void SocketOnReceivedData(string receivedString)
        {
            try
            {
                //Debug.WriteSuccess("Extron Rx", receivedString);

                var match = Regex.Match(receivedString, @"RcdrY(\d+)");
                if (match.Success)
                {
                    return;
                }

                match = Regex.Match(receivedString,
                                    @"<ChA(\d)\*ChB(\d)>\*<(\w+)>\*<(\w+)(?:\*(.+))?>\*<(\d+)(?:\*(.+))?>\*<([\d:]+)>\*<([\d:]+)(?:\*([\d:]+))?>");
                if (match.Success)
                {
                    try
                    {
                        RecordStatus = (eRecordStatus)Enum.Parse(typeof(eRecordStatus), match.Groups[3].Value, true);
                    }
                    catch (Exception e)
                    {
                        //CloudLog.Error(e.Message + " value = " + match.Groups[3].Value);
                    }
                    try
                    {
                        _storageLocation = (eStorageType)Enum.Parse(typeof(eStorageType), match.Groups[4].Value, true);
                    }
                    catch
                    {
                        _storageLocation = eStorageType.Unknown;
                    }
                    _bytesAvailable = long.Parse(match.Groups[6].Value) * 1000;
                    _timer          = TimeFromString(match.Groups[8].Value);
                    _timeAvailable  = TimeFromString(match.Groups[9].Value);
                    OnStatusUpdated(this);
                }
                else
                {
                    CloudLog.Warn("No match for received string: \"{0}\"", receivedString);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }