示例#1
0
    static void Main(string[] args)
    {
        ReadWriter myReadWriter = new ReadWriter(new ConsoleReaderWriterFactory());
        string     test         = myReadWriter.Read();

        myReadWriter.Write("this is abstract factory power");
    }
        public ApplicationViewModel()
        {
            db     = new HoteldbContext();
            dbSize = db.Hotels.Count();

            Hotels = new ObservableCollection <HotelInfo>();

            Cache     = new Caching <HotelInfo>();
            CacheList = new ObservableCollection <HotelInfo>();

            Favorites = JDeserializer <ObservableCollection <HotelInfo> > .Deser(ReadWriter <ObservableCollection <HotelInfo> > .Read())
                        ?? new ObservableCollection <HotelInfo>();
        }
示例#3
0
            public void Read(object data)
            {
                var buf = data as BufData;

                int idx = 0;

                while (idx < buf.length)
                {
                    if (readSize)
                    {
                        for (; idx < buf.length && readPos < 2; idx++)
                        {
                            sizeBuf[readPos] = buf.buf[idx];
                            readPos++;
                        }

                        if (readPos == 2)
                        {
                            if (!BitConverter.IsLittleEndian)
                            {
                                Array.Reverse(sizeBuf);
                            }
                            dataSize = BitConverter.ToUInt16(sizeBuf, 0);
                            dataBuf  = new byte[dataSize];
                            readPos  = 0;
                            readSize = false;
                        }
                    }
                    else
                    {
                        for (; idx < buf.length && readPos < dataSize; idx++)
                        {
                            dataBuf[readPos] = buf.buf[idx];
                            readPos++;
                        }
                        if (readPos == dataSize)
                        {
                            readWriter.Read(new BufData(dataBuf.Length, dataBuf));
                            readSize = true;
                            readPos  = 0;
                        }
                    }
                }
            }
示例#4
0
        public ApplicationViewModel()
        {
            db     = new CompetitionsListsdbContext();
            dbSize = db.CompetitionsLists.Count();

            CompetitionsLists = new ObservableCollection <CompetitionsListInfo>();

            Cache     = new Caching <CompetitionsListInfo>();
            CacheList = new ObservableCollection <CompetitionsListInfo>();

            Favorites = JDeserializer <ObservableCollection <CompetitionsListInfo> > .Deser(ReadWriter <ObservableCollection <CompetitionsListInfo> > .Read())
                        ?? new ObservableCollection <CompetitionsListInfo>();
        }
示例#5
0
        public ApplicationViewModel()
        {
            db     = new PriorityproductsdbContext();
            dbSize = db.Priorityproducts.Count();

            Priorityproducts = new ObservableCollection <PriorityproductInfo>();

            Cache     = new Caching <PriorityproductInfo>();
            CacheList = new ObservableCollection <PriorityproductInfo>();

            Favorites = JDeserializer <ObservableCollection <PriorityproductInfo> > .Deser(ReadWriter <ObservableCollection <PriorityproductInfo> > .Read())
                        ?? new ObservableCollection <PriorityproductInfo>();
        }
示例#6
0
文件: TCPClient.cs 项目: seminsim/shu
 private void OnRecvData(Byte[] bytes, int length)
 {
     readWriter.Read(new BufData(length, bytes));
 }
示例#7
0
        public ApplicationViewModel()
        {
            db     = new TransportNodesdbContext();
            dbSize = db.TransportNodes.Count();

            TransportNodes = new ObservableCollection <TransportNodeInfo>();

            Cache     = new Caching <TransportNodeInfo>();
            CacheList = new ObservableCollection <TransportNodeInfo>();

            Favorites = JDeserializer <ObservableCollection <TransportNodeInfo> > .Deser(ReadWriter <ObservableCollection <TransportNodeInfo> > .Read())
                        ?? new ObservableCollection <TransportNodeInfo>();
        }
示例#8
0
        public ApplicationViewModel()
        {
            db     = new FootballFieldsdbContext();
            dbSize = db.FootballFields.Count();

            FootballFields = new ObservableCollection <FootballFieldInfo>();

            Cache     = new Caching <FootballFieldInfo>();
            CacheList = new ObservableCollection <FootballFieldInfo>();

            Favorites = JDeserializer <ObservableCollection <FootballFieldInfo> > .Deser(ReadWriter <ObservableCollection <FootballFieldInfo> > .Read())
                        ?? new ObservableCollection <FootballFieldInfo>();
        }