void Timer2Tick(object sender, EventArgs e)
        {
            if (!BarcodeScanner2Running)
            {
                return;
            }

            Lib.BarcodeReader reader = new BarcodeReader();
            reader.Number  = Barcode2Counter;
            reader.Barcode = "";
            ReadStatus readStatus = ReadStatus.Blank;

            PLCInt plcInt1     = new PLCInt(Statics.Counter2DB);
            int    realCounter = plcInt1.Value;

            if (Math.Abs(realCounter - CorrectBarcodeScanCounter2) > 1)
            {
                readStatus     = ReadStatus.Blank;
                reader.Status  = readStatus;
                reader.Barcode = "";
                reader.Date    = DateTime.Now;
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    StopMachine2Motor();
                    StopBarcodeReader2();

                    BarcodeReader2Collection.Insert(0, reader);
                }));
            }
        }
        //
        // GET: /Tasks/
        public IEnumerable<object> GetNewMessages(Pagination pagination, string language,
            string typeId, ReadStatus? readStates)
        {
            if (pagination == null)
            {
                pagination = new Pagination(10, 0);
            }

            NewsType type = _messageDaoFactory.NewsTypeDao.Get(typeId);

            IList<PersonalMessage> result =
                _messageDaoFactory.PersonalMessageDao.GetLastMessageForEachUser(
                    OrnamentContext.MemberShip.CurrentUser(),
                    pagination.CurrentPage, pagination.PageSize);

            var r = new List<object>();
            foreach (PersonalMessage msg in result)
            {
                r.Add(new
                {
                    msg.Content,
                    relative = msg.Publisher
                });
            }
            return result;
        }
Beispiel #3
0
 public ReadResult(ReadStatus status, IEnumerable <IDataEntity> entities, IResponseData answer, IDictionary <Key, IResponseData> answerSections)
 {
     Status         = status;
     Entities       = entities;
     Response       = answer;
     AnswerSections = answerSections ?? throw new ArgumentNullException(nameof(answerSections));
 }
Beispiel #4
0
 private static EventSliceReadResult Empty(ReadStatus status, StreamId stream)
 {
     return(new EventSliceReadResult(
                status,
                stream,
                Array.Empty <RecordedEvent>(), 0, true));
 }
            public HIDReport(ReadStatus status)
            {
                Data = new byte[] { };
                Status = status;


            }
Beispiel #6
0
        public static Entry ReadManifestEntry(MemoryStream chunk, out ReadStatus readStatus)
        {
            int entryType = chunk.ReadByte();

            readStatus = ReadStatus.OK;
            switch (entryType)
            {
            case ATLAS_CODE:
                return(AtlasEntry.Read(chunk, true));

            case BINK_ATLAS_CODE:
                return(BinkAtlasEntry.Read(chunk));

            case INCLUDE_PACKAGE_CODE:
                return(IncludePackageEntry.Read(chunk));

            case END_CHUNK_CODE:
                readStatus = ReadStatus.EndOfChunk;
                return(null);

            case (int)byte.MaxValue:
            case -1:
                readStatus = ReadStatus.EndOfFile;
                return(null);

            default:
                throw new PackageReadException(string.Format(ERR_UNKNOWN_MANIFEST_entryType, entryType));
            }
        }
Beispiel #7
0
        private void ReadHeaderMemo(MapData mapData)
        {
            var woditorString = ReadStatus.ReadString();

            mapData.Memo = woditorString.String;
            ReadStatus.AddOffset(woditorString.ByteLength);
        }
Beispiel #8
0
        public string ReadSimpleSelector()
        {
            if (_status != ReadStatus.SimpleSelector)
            {
                throw new InvalidReadingCallException("The function can only be called when reading status in SimpleSelector.");
            }

            int start = _p;

            while (!EndOfStream)
            {
                char ch = _str[_p];
                if (_p > start && IsSimpleSelectorSeparator(ch))
                {
                    break;
                }

                if (IsCombinator(ch))
                {
                    _status = ReadStatus.Combinator;
                    break;
                }

                _p++;
            }

            return(_str.Substring(start, _p - start));
        }
            public async void UpdateReadStatus_FromReadToUnread_ReturnsUpdatedInstance()
            {
                // Arrange
                int        instanceOwnerPartyId = 1337;
                string     instanceGuid         = "d9a586ca-17ab-453d-9fc5-35eaadb3369b";
                ReadStatus expectedReadStus     = ReadStatus.Unread;

                string     requestUri = $"{BasePath}/{instanceOwnerPartyId}/{instanceGuid}/readstatus?status=unread";
                HttpClient client     = GetTestClient();

                string token = PrincipalUtil.GetToken(3, 1337, 2);

                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri);

                // Act
                HttpResponseMessage response = await client.SendAsync(httpRequestMessage);

                string json = await response.Content.ReadAsStringAsync();

                Instance updatedInstance = JsonConvert.DeserializeObject <Instance>(json);

                // Assert
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(expectedReadStus, updatedInstance.Status.ReadStatus);
            }
Beispiel #10
0
            public async void UpdateReadStatus_SetInitialReadStatus_ReturnsUpdatedInstance()
            {
                // Arrange
                int    instanceOwnerPartyId = 1337;
                string instanceGuid         = "824E8304-AD9E-4D79-AC75-BCFA7213223B";

                ReadStatus expectedReadStus = ReadStatus.Read;

                TestDataUtil.PrepareInstance(instanceOwnerPartyId, instanceGuid);

                string requestUri = $"{BasePath}/{instanceOwnerPartyId}/{instanceGuid}/readstatus?status=read";

                HttpClient client = GetTestClient();

                string token = PrincipalUtil.GetToken(3, 1337, 2);

                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri);

                // Act
                HttpResponseMessage response = await client.SendAsync(httpRequestMessage);

                TestDataUtil.DeleteInstance(instanceOwnerPartyId, new Guid(instanceGuid));
                string json = await response.Content.ReadAsStringAsync();

                Instance updatedInstance = JsonConvert.DeserializeObject <Instance>(json);

                // Assert
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(expectedReadStus, updatedInstance.Status.ReadStatus);
            }
Beispiel #11
0
        /// <summary>
        /// Returns the result of Console.ReadLine, but times out if no response.
        /// </summary>
        /// <returns>The read line as a string or null if ReadLine times out.</returns>
        /// <param name="seconds">Number of seconds until timeout occurs.</param>
        /// <param name="timer">If set to <c>true</c> then count down the seconds until timeout.</param>
        static string TimedReadLine(int seconds)
        {
            var        lockObject = new Object();                   // lock for the reading status
            ReadStatus status     = ReadStatus.Waiting;             // initial status is waiting for user input
            string     result     = null;                           // indicates no user input seen so far

            int timeout = seconds * 10;                             // number of 100 millesecond intervals in the timeout seconds

            ThreadPool.QueueUserWorkItem((o) =>                     // background thread to time the ReadLine
            {
                for (int i = 0; i < timeout && result == null; i++) // stop this thread if we have user input!
                {
                    Thread.Sleep(100);                              // sleep for 100 milleseconds each iteration
                    // we're waiting to see if Console.ReadLine returned a response from the user
                }

                // at this point we either timed out or else we detected that we've received user input

                if (result == null)     // it looks like we were still waiting for user input and we timed out
                {
                    Thread.Sleep(10);   // try to eliminate one possible race condition (see below)
                    // this will hopefully give a pending assignment to variable result time to complete ...
                }                       // this may be overkill, and it still doesn't completely prevent all race conditions

                lock (lockObject)       // lock status
                {
                    if (result == null) // test result a second time to see if it's been assigned a value
                    {
                        // it seems we were in fact still waiting for user input, so this is a valid timeout
                        status = ReadStatus.Aborted;                         // indicate that we aborted the ReadLine
                        NativeMethods.PostMessage(hWnd, WM_KEYDOWN, VK_ENTER, 0);
                        // send an Enter keypress to Console.ReadLine to get it to return - assume this works

                        // Note: a side effect of this is that a blank line will appear on the Console
                        // when timeout occurs! The caller should probably be aware of this ...
                    }
                    // if we have received a user response (result != null), don't send an Enter keypress,
                    // just let this background thread expire ...
                }
            });

            result = Console.ReadLine();             // try to read from the keyboard and assign the user's response to result
            // now we either have a valid user response or an empty string sent by the background thread on timeout

            lock (lockObject)                     // lock status
            {
                if (status == ReadStatus.Aborted) // indicates that the background thread timed out
                {
                    return(null);                 // tell that to the caller - there's nothing to return
                }
                return(result);                   // otherwise return the valid user response
            }
            // Note: there is one possible race condition - if the background thread's timeout occurs between when
            // ReadLine returns a response and when it is assigned to result, an extra Enter keypress might be sent.
            // As far as I can tell, there is no way to tell that this has happened, because an empty string is a
            // valid user response returned by ReadLine; however, the window for this race condition is very small,
            // and the extra Thread.Sleep(10) in the background thread may allow a pending assignment to complete.
            // (Of course, that Sleep could interrupt a Console.ReadLine that starts to return after the timeout.)
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReadElementObjectInfo"/> class for a successful read operation.
 /// </summary>
 /// <param name="s">The <see cref="Status"/> of the read operation.</param>
 /// <param name="k">The <see cref="Key"/> of the read operation.</param>
 /// <param name="o">The successfully <see cref="ReadObject"/>.</param>
 public ReadElementObjectInfo(ReadStatus s, string k, object o)
 {
     Status       = s;
     Key          = k;
     ReadObject   = o;
     ErrorMessage = null;
     ErrorLine    = ErrorColumn = -1;
 }
Beispiel #13
0
        private int ReadMapEventLength()
        {
            var length = ReadStatus.ReadInt();

            ReadStatus.IncreaseIntOffset();

            return(length);
        }
Beispiel #14
0
        public bool ContainsKey(string key)
        {
            DbEntry    keyEntry  = DbEntry.InOut(Encoding.Default.GetBytes(key));
            DbEntry    dataEntry = DbEntry.InOut(dataStream.GetBuffer());
            ReadStatus res       = btree.Get(txn, ref keyEntry, ref dataEntry, DbFile.ReadFlags.None);

            return(res == ReadStatus.NotFound);
        }
        private void ProcessingWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            Map         temp     = new Map();
            XmlDocument document = new XmlDocument();

            document.Load($@"{Application.StartupPath}\Map.xml");
            XmlNodeReader xnr    = new XmlNodeReader(document);
            ReadStatus    status = ReadStatus.none;

            while (xnr.Read())
            {
                switch (xnr.NodeType)
                {
                case XmlNodeType.Element:
                    switch (xnr.Name)
                    {
                    case "imgdir":
                        if (IsInteger(xnr.GetAttribute("name")))
                        {
                            temp    = new Map();
                            status  = ReadStatus.id;
                            temp.Id = xnr.GetAttribute("name");
                        }
                        break;

                    case "string":
                        string attr = xnr.GetAttribute("name");
                        switch (attr)
                        {
                        case "streetName":
                            status          = ReadStatus.streetname;
                            temp.StreetName = xnr.GetAttribute("value");
                            break;

                        case "mapName":
                            status       = ReadStatus.mapname;
                            temp.MapName = xnr.GetAttribute("value");
                            break;
                        }
                        break;
                    }

                    break;

                case XmlNodeType.EndElement:
                    switch (xnr.Name)
                    {
                    case "imgdir":
                        if (IsInteger(xnr.GetAttribute("name")))
                        {
                            collection.Add(temp);
                        }
                        break;
                    }
                    break;
                }
            }
        }
Beispiel #16
0
 void ReadData(ReadStatus status)
 {
     switch (status)
     {
     case ReadStatus.Tickets:
         sprites = Resources.LoadAll <Sprite>("Image/Ticket");
         break;
     }
 }
Beispiel #17
0
        public async Task GetTopicReadStatus(User user, PagedTopicContainer container)
        {
            Dictionary <int, DateTime> lastForumReads = null;
            Dictionary <int, DateTime> lastTopicReads = null;

            if (user != null)
            {
                lastForumReads = await _lastReadRepository.GetLastReadTimesForForums(user.UserID);

                lastTopicReads = await _lastReadRepository.GetLastReadTimesForTopics(user.UserID, container.Topics.Select(t => t.TopicID));
            }
            foreach (var topic in container.Topics)
            {
                var status = new ReadStatus();
                if (topic.IsClosed)
                {
                    status |= ReadStatus.Closed;
                }
                else
                {
                    status |= ReadStatus.Open;
                }
                if (topic.IsPinned)
                {
                    status |= ReadStatus.Pinned;
                }
                else
                {
                    status |= ReadStatus.NotPinned;
                }
                if (lastForumReads == null)
                {
                    status |= ReadStatus.NoNewPosts;
                }
                else
                {
                    var lastRead = DateTime.MinValue;
                    if (lastForumReads.ContainsKey(topic.ForumID))
                    {
                        lastRead = lastForumReads[topic.ForumID];
                    }
                    if (lastTopicReads.ContainsKey(topic.TopicID) && lastTopicReads[topic.TopicID] > lastRead)
                    {
                        lastRead = lastTopicReads[topic.TopicID];
                    }
                    if (topic.LastPostTime > lastRead)
                    {
                        status |= ReadStatus.NewPosts;
                    }
                    else
                    {
                        status |= ReadStatus.NoNewPosts;
                    }
                }
                container.ReadStatusLookup.Add(topic.TopicID, status);
            }
        }
        public async Task <bool> SetReadStatus(long emailId, ReadStatus readStatus)
        {
            var entity = this.Attach(emailId);

            entity.ReadStatus = readStatus;
            await this.SaveAsync();

            return(true);
        }
Beispiel #19
0
        private void ReadDBData(DatabaseDat data)
        {
            var length = ReadStatus.ReadInt();

            ReadStatus.IncreaseIntOffset();

            var reader = new DBDataSettingReader();

            data.SettingList.AddRange(reader.Read(ReadStatus, length));
        }
Beispiel #20
0
        private void OnSoftDisconnectReader()
        {
            Log.EntryNormal(LogR, "Reader soft disconnect");
            //Log.Console(info.remote + " reader softly disconnected");

            reader       = null;
            readerStatus = ReadStatus.READY;

            //SoftDisconnect();
        }
Beispiel #21
0
 public async Task AddAsync(string id, string entityType)
 {
     if (!IsExists(id, entityType))
     {
         await _realm.WriteAsync(tempRealm =>
         {
             var readStatus = new ReadStatus(id, entityType);
             tempRealm.Add(readStatus);
         });
     }
 }
Beispiel #22
0
        public int Read(String FileFullName, long Offset, int Count, ref Byte[] Buffer)
        {
            if (_ProtocolV2 == null)
            {
                throw new NFSConnectionException("NFS Client not connected!");
            }

            if (_MountProtocolV2 == null)
            {
                throw new NFSMountConnectionException("NFS Device not connected!");
            }

            int rCount = 0;

            if (Count == 0)
            {
                return(0);
            }


            if (_CurrentItem != FileFullName)
            {
                NFSAttributes Attributes = GetItemAttributes(FileFullName);
                _CurrentItemHandleObject = new NFSHandle(Attributes.Handle, V2.RPC.NFSv2Protocol.NFS_VERSION);
                _CurrentItem             = FileFullName;
            }

            ReadArguments dpArgRead = new ReadArguments();

            dpArgRead.File   = _CurrentItemHandleObject;
            dpArgRead.Offset = (int)Offset;
            dpArgRead.Count  = Count;

            ReadStatus pReadRes =
                _ProtocolV2.NFSPROC_READ(dpArgRead);

            if (pReadRes != null)
            {
                if (pReadRes.Status != NFSStats.NFS_OK)
                {
                    ExceptionHelpers.ThrowException(pReadRes.Status);
                }

                rCount = pReadRes.OK.Data.Length;

                Array.Copy(pReadRes.OK.Data, Buffer, rCount);
            }
            else
            {
                throw new NFSGeneralException("NFSPROC_READ: failure");
            }

            return(rCount);
        }
Beispiel #23
0
        /// <summary>
        /// 動作コマンドリスト
        /// </summary>
        /// <param name="ReadStatus">読み込み経過状態</param>
        /// <exception cref="InvalidOperationException">ファイル仕様が異なる場合</exception>
        private CharaMoveCommandList ReadCharaMoveCommand()
        {
            // 動作コマンド数
            var commandLength = ReadStatus.ReadInt();

            ReadStatus.IncreaseIntOffset();

            // 動作指定コマンド
            var reader = new CharaMoveCommandListReader();
            var result = reader.Read(commandLength, ReadStatus);

            return(new CharaMoveCommandList(result));
        }
Beispiel #24
0
 public EventSliceReadResult(
     ReadStatus status,
     StreamId streamId,
     IReadOnlyCollection <RecordedEvent> events,
     long lastEventNumber,
     bool isEndOfStream)
 {
     Status          = status;
     StreamId        = streamId;
     Events          = events;
     LastEventNumber = lastEventNumber;
     IsEndOfStream   = isEndOfStream;
 }
Beispiel #25
0
        /// <summary>
        /// フッタ
        /// </summary>
        /// <param name="ReadStatus">読み込み経過状態</param>
        /// <exception cref="InvalidOperationException">ファイル仕様が異なる場合</exception>
        private void ReadFooter()
        {
            foreach (var b in MapData.Footer)
            {
                if (ReadStatus.ReadByte() != b)
                {
                    throw new InvalidOperationException(
                              $"フッタが正常に取得できませんでした。(offset:{ReadStatus.Offset})");
                }

                ReadStatus.IncreaseByteOffset();
            }
        }
Beispiel #26
0
        private void ReadHeader()
        {
            foreach (var b in MapData.HeaderBytes)
            {
                if (ReadStatus.ReadByte() != b)
                {
                    throw new InvalidOperationException(
                              $"ファイルヘッダがファイル仕様と異なります(offset:{ReadStatus.Offset})");
                }

                ReadStatus.IncreaseByteOffset();
            }
        }
Beispiel #27
0
        /// <summary>
        /// 修改阅读状态
        /// </summary>
        /// <param name="uid">发件人</param>
        /// <param name="toUids">收件人数组</param>
        /// <param name="pmIds">短消息ID数组</param>
        /// <param name="readStatus">阅读状态</param>
        public void PmReadStatus(decimal uid, IEnumerable <int> toUids, IEnumerable <int> pmIds,
                                 ReadStatus readStatus = ReadStatus.Readed)
        {
            var args = new Dictionary <string, string>
            {
                { "uid", uid.ToString() },
                { "status", ((int)readStatus).ToString() }
            };

            addArray(args, "uids", toUids);
            addArray(args, "pmids", pmIds);
            SendArgs(args, UcPmModelName.ModelName, UcPmModelName.ActionReadStatus);
        }
Beispiel #28
0
        /// <summary>
        /// フッタ
        /// </summary>
        /// <param name="ReadStatus">読み込み経過状態</param>
        /// <exception cref="InvalidOperationException">ファイルフッタが仕様と異なる場合</exception>
        private void ReadFooter()
        {
            foreach (var b in TileSetData.Footer)
            {
                if (ReadStatus.ReadByte() != b)
                {
                    throw new InvalidOperationException(
                              $"ファイルフッタがファイル仕様と異なります(offset:{ReadStatus.Offset})");
                }

                ReadStatus.IncreaseByteOffset();
            }
        }
Beispiel #29
0
        public static ReadStatus ReadBook(string filename)
        {
            ReadStatus    read      = ReadStatus.None;
            string        book      = "Data/Books/" + filename;
            List <string> nextLines = new List <string>();

            if (File.Exists(book))
            {
                try
                {
                    m_BookStream = new StreamReader(book, Encoding.Default, false);
                    read         = ReadStatus.Open;
                }
                catch { read = ReadStatus.IO_Error; }
                finally
                {
                    m_Title  = m_BookStream.ReadLine();
                    m_Author = m_BookStream.ReadLine();

                    while (read == ReadStatus.Open)
                    {
                        try
                        {
                            nextLines = ReadLines();
                        }
                        catch { read = ReadStatus.IO_Error; }
                        finally
                        {
                            for (int x = 0; x < nextLines.Count; x++)
                            {
                                m_Lines.Add(nextLines[x]);
                            }
                        }
                        if (m_BookStream.EndOfStream)
                        {
                            read = ReadStatus.EOF;
                        }
                    }
                    if (read == ReadStatus.EOF)
                    {
                        read = ReadStatus.Finished;
                    }
                }
            }
            else
            {
                read = ReadStatus.BadFile;
            }

            return(read);
        }
Beispiel #30
0
        private void ReadLayerOneLine(MapSizeHeight mapSizeHeight,
                                      ICollection <List <MapChip> > chipList)
        {
            var lineChips = new List <MapChip>();

            for (var y = 0; y < mapSizeHeight; y++)
            {
                var chip = (MapChip)ReadStatus.ReadInt();
                lineChips.Add(chip);
                ReadStatus.IncreaseIntOffset();
            }

            chipList.Add(lineChips);
        }
Beispiel #31
0
        private static List <Dictionary <string, string> > GenerateEmptyList(ReadStatus status)
        {
            // Check if we need to report status
            if (status != null)
            {
                // Move the status to the next phase, and indicate completion
                status.CurrentState = ReadStatus.State.ReadingRowsIntoCells;
                status.SetTotalSteps(1);
                status.CurrentStep = 1;
            }

            // Return empty list
            return(new List <Dictionary <string, string> >(0));
        }
 private void SetFileStatus(HttpContext context)
 {
     if (this.fileStatus == FileStatus.Open)
     {
         this.fs.Flush();
         this.fs.Close();
         this.fileStatus       = FileStatus.Close;
         this.originalFileName = string.Empty;
     }
     else if (this.readStatus == ReadStatus.NoRead)
     {
         this.readStatus = ReadStatus.Read;
         context.Items["EasyOne_Web_Upload_FileStatus"] = this.fileStatus;
     }
 }
 public object Get(ReadStatus? readStatus)
 {
     User user = OrnamentContext.MemberShip.CurrentUser();
     int total;
     IList<SimpleMessage> msgs = _messageDaoFactory.SimpleMessageDao.GetNotifyMessages(user, readStatus, 40,
         0, out total);
     var result = new
     {
         total,
         data = from message in msgs
             select new
             {
                 content = message.Content,
                 createTime = message.CreateTime,
             }
     };
     return result;
 }
 public HidDeviceData(ReadStatus status)
 {
     Data = new byte[] {};
     Status = status;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReadElementObjectInfo"/> class for a successful read operation.
 /// </summary>
 /// <param name="s">The <see cref="Status"/> of the read operation.</param>
 /// <param name="k">The <see cref="Key"/> of the read operation.</param>
 /// <param name="o">The successfully <see cref="ReadObject"/>.</param>
 public ReadElementObjectInfo( ReadStatus s, string k, object o )
 {
     Status = s;
     Key = k;
     ReadObject = o;
     ErrorMessage = null;
     ErrorLine = ErrorColumn = -1;
 }
 public HidDeviceData(byte[] data, ReadStatus status)
 {
     Data = data;
     Status = status;
 }
Beispiel #37
0
        public DeviceData(byte[] data, ReadStatus status, Exception error)
        {
            Bytes = data;
            Status = status;
			Error = error;
        }
Beispiel #38
0
        public char ReadCombinator()
        {
            if (_status != ReadStatus.Combinator)
                throw new InvalidReadingCallException("The function can only be called when reading status in Combinator.");

            int start = _p;
            while (!EndOfStream)
            {
                char ch = _str[_p];
                if (!IsCombinator(ch) && !IsWhiteSpace(ch))
                {
                    _status = ReadStatus.SimpleSelector;
                    break;
                }

                _p++;
            }

            if (EndOfStream)
                return Char.MinValue;

            string s = _str.Substring(start, _p - start);
            if (s.Length > 0)
            {
                s = s.Trim();
                if (s.Length == 0)
                {
                    s = " ";
                }
            }
            if (s.Length != 1)
                throw new InvalidStructureException(String.Format("Invalid combinator reading in sub string {0}.", _str.Substring(start)));

            return s[0];
        }
Beispiel #39
0
 public HidReadResult(ReadStatus status)
 {
     Status = status;
 }
Beispiel #40
0
 public HtmlReader(string html)
 {
     _html = html;
     _status = ReadStatus.Text;
     MoveToNextElement();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="index"> of GenericHIDDevice from which this report comes</param>
 /// <param name="data"></param>
 /// <param name="status"></param>
 public HIDReport(int index,byte[] data, ReadStatus status)
 {
     this._index = index;
     Data = data;
     Status = status;
 }
Beispiel #42
0
 public void InvalidInput()
 {
     Message = String.Format("非法字符。LN{0} COL{1} VAL'{2}'",
         LN, LastCOL, _lastChar);
     Status = ReadStatus.Error;
 }
Beispiel #43
0
 public void SkipBack(bool ignoreError = false)
 {
     if (Status != ReadStatus.Error || ignoreError)
     {
         Status = SkipBackStatus;
     }
 }
Beispiel #44
0
 public void Skip(string skipString, ReadStatus backStatus)
 {
     SkipString     = skipString;
     SkipBackStatus = backStatus;
     Status         = ReadStatus.Skipping;
 }
Beispiel #45
0
		public void GetTopicReadStatus(User user, PagedTopicContainer container)
		{
			Dictionary<int, DateTime> lastForumReads = null;
			Dictionary<int, DateTime> lastTopicReads = null;
			if (user != null)
			{
				lastForumReads = _lastReadRepository.GetLastReadTimesForForums(user.UserID);
				lastTopicReads = _lastReadRepository.GetLastReadTimesForTopics(user.UserID, container.Topics.Select(t => t.TopicID));
			}
			foreach (var topic in container.Topics)
			{
				var status = new ReadStatus();
				if (topic.IsClosed)
					status |= ReadStatus.Closed;
				else
					status |= ReadStatus.Open;
				if (topic.IsPinned)
					status |= ReadStatus.Pinned;
				else
					status |= ReadStatus.NotPinned;
				if (lastForumReads == null)
					status |= ReadStatus.NoNewPosts;
				else
				{
					var lastRead = DateTime.MinValue;
					if (lastForumReads.ContainsKey(topic.ForumID))
						lastRead = lastForumReads[topic.ForumID];
					if (lastTopicReads.ContainsKey(topic.TopicID) && lastTopicReads[topic.TopicID] > lastRead)
						lastRead = lastTopicReads[topic.TopicID];
					if (topic.LastPostTime > lastRead)
						status |= ReadStatus.NewPosts;
					else
						status |= ReadStatus.NoNewPosts;
				}
				container.ReadStatusLookup.Add(topic.TopicID, status);
			}
		}
Beispiel #46
0
		public DeviceData(byte[] data, ReadStatus status)
		{
			Bytes = data;
			Status = status;
		}
Beispiel #47
0
        public string ReadSimpleSelector()
        {
            if (_status != ReadStatus.SimpleSelector)
                throw new InvalidReadingCallException("The function can only be called when reading status in SimpleSelector.");

            int start = _p;
            while (!EndOfStream)
            {
                char ch = _str[_p];
                if (_p > start && IsSimpleSelectorSeparator(ch))
                    break;

                if (IsCombinator(ch))
                {
                    _status = ReadStatus.Combinator;
                    break;
                }

                _p++;
            }

            return _str.Substring(start, _p - start);
        }
Beispiel #48
0
 /// <summary>
 /// 修改阅读状态
 /// </summary>
 /// <param name="uid">发件人</param>
 /// <param name="toUids">收件人</param>
 /// <param name="pmIds">短消息ID</param>
 /// <param name="readStatus">阅读状态</param>
 public void PmReadStatus(decimal uid, int toUids, int pmIds = 0, ReadStatus readStatus = ReadStatus.Readed)
 {
     PmReadStatus(uid, new[] {toUids}, new[] {pmIds}, readStatus);
 }
Beispiel #49
0
 public void IncompletedFormat()
 {
     Message = String.Format("不完整的格式。LN{0} COL{1}",
         LN, LastCOL);
     Status = ReadStatus.Error;
 }
Beispiel #50
0
 /// <summary>
 /// 修改阅读状态
 /// </summary>
 /// <param name="uid">发件人</param>
 /// <param name="toUids">收件人数组</param>
 /// <param name="pmIds">短消息ID数组</param>
 /// <param name="readStatus">阅读状态</param>
 public void PmReadStatus(decimal uid, IEnumerable<int> toUids, IEnumerable<int> pmIds,
                          ReadStatus readStatus = ReadStatus.Readed)
 {
     var args = new Dictionary<string, string>
                    {
                        {"uid", uid.ToString()},
                        {"status", ((int) readStatus).ToString()}
                    };
     addArray(args, "uids", toUids);
     addArray(args, "pmids", pmIds);
     SendArgs(args, UcPmModelName.ModelName, UcPmModelName.ActionReadStatus);
 }
 public WebHIDReport(int index,byte[] data, ReadStatus status):base(index,data,ReadStatus.NoDataRead)
 {
    
 }
Beispiel #52
0
        public bool MoveToNextElement()
        {
            if (EndOfReading)
                return false;

            if (_status == ReadStatus.Tag)
            {
                MoveToTagEnd();
                SkipTagEnd();

                if (EndOfReading)
                    return false;

                _status = IsTagStart() ? ReadStatus.Tag : ReadStatus.Text;
            }
            else
            {
                while (!EndOfReading && !(IsTagStart() && !IsCDATAStart()))
                    _p++;

                if (EndOfReading)
                    return false;

                _status = ReadStatus.Tag;
            }

            return true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReadElementObjectInfo"/> class when an error occured.
        /// </summary>
        /// <param name="s">The <see cref="Status"/> of the read operation.</param>
        /// <param name="r">The xml stream.</param>
        /// <param name="errorMessage">Error message. Must not be null nor empty.</param>
        internal ReadElementObjectInfo( ReadStatus s, XmlReader r, string errorMessage )
        {
            Debug.Assert( (s & ReadStatus.ErrorMask) != 0, "The status must be on error." );
            Debug.Assert( errorMessage != null && errorMessage.Length > 0, "Error message must be set." );
            Status = s;
            Key = null;
            ReadObject = null;
            ErrorMessage = errorMessage;

            // r is a XmlTextReaderImpl (Inherits from XmlReader) and not a XmlTextReader 
            XmlTextReader textReader = r as XmlTextReader;

            if( textReader != null )
            {
                ErrorLine = textReader.LineNumber;
                ErrorColumn = textReader.LinePosition;
            }
            else ErrorLine = ErrorColumn = -1;
        }
Beispiel #54
0
 public HidReadResult(byte[] data, ReadStatus status)
 {
     Data = data;
       Status = status;
 }
Beispiel #55
0
        private void SkipToNextNode()
        {
            SkipWhiteSpace();
            if (EndOfStream)
                return;

            if (_str[_p] == AtRule.StartToken)
            {
                _status = ReadStatus.AtRule;
            }
            else if (_str.Substring(_p, 2) == Comment.StartToken)
            {
                _status = ReadStatus.Comment;
            }
            else
            {
                _status = ReadStatus.RuleSet;
            }
        }
Beispiel #56
0
 private void UnknownEntityTag(Entity e)
 {
     Message = String.Format("未知实体POS ID {0} \"{1}\"",
         e.PosId, e.Content);
     Status  = ReadStatus.Error;
 }
Beispiel #57
0
 public SelectorReader(string str)
 {
     _str = str.Trim();
     _status = ReadStatus.SimpleSelector;
 }