예제 #1
0
        public long SendContentedNuntias(KeyValuePair <JObject, byte[]> nuntiasData)     //key contains the JsonObject, Value contains the file bytes
        {
            Output.ShowLog("SendContentedNuntias() => " + nuntiasData.Key + nuntiasData.Value.Length);
            Nuntias newNuntias = new Nuntias(nuntiasData.Key);
            long?   nuntiasId  = NuntiasRepository.Instance.Insert(newNuntias);

            newNuntias.Id = nuntiasId ?? 0;
            if (newNuntias.Id > 0)
            {
                Output.ShowLog("Called " + newNuntias.Id);
                ContentFileAccess.StoreNuntiasContentFile(nuntiasData.Value, newNuntias.Id);
                ClientManager.Instance.SendNuntiasToConsumers(newNuntias, Context.Headers["mac_address"]);
            }
            return(newNuntias.Id);
        }
예제 #2
0
        public byte[] GetNuntiasContentFile(long nuntiasId)
        {
            string contentPath = ContentFileAccess.GetNuntiasContentFilePath(nuntiasId);

            return((contentPath == null) ? null : File.ReadAllBytes(contentPath));
        }