Exemplo n.º 1
0
        public StreamMessage GetUserHeartbeats(MasterParameterMessage authentication)
        {
            FileStream fileStream = null;

            bool bSuccess = false;

            string aggregatedHeartbeatsFullPath = "";

            // close returned stream and delete sent file on completion
            OperationContext clientContext = OperationContext.Current;

            clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (fileStream != null)
                {
                    // truncate file. there is a probability that the Heartbeat Aggreagator Windows service will lock that file
                    // just before deleting it, so make sure the file is empty.
                    fileStream.SetLength(0);

                    fileStream.Dispose();
                }

                if (aggregatedHeartbeatsFullPath != "" && bSuccess)
                {
                    try
                    {
                        File.Delete(aggregatedHeartbeatsFullPath);
                    }
                    catch (Exception ex)
                    {
                        _eventLog.WriteEntry(ex.ToString(), EventLogEntryType.Error);
                    }
                }
            });

            if (authentication.SystemPassPhrase != _systemPassPhrase)
            {
                return(null);
            }

            string aggregatedHeartbeatsPartialPath = _machineSpecificDataPath + "heartbeat";

            // if file exists, just read it. No need to check for checksum as file will be deleted
            // when transfer is complete
            bSuccess = TryGetAndLockFile(ref fileStream, aggregatedHeartbeatsPartialPath, ref aggregatedHeartbeatsFullPath);

            return(new StreamMessage(fileStream));
        }
 public StreamMessage GetUserHeartbeats(MasterParameterMessage authentication)
 {
     return(Channel.GetUserHeartbeats(authentication));
 }
 public StreamMessage GetCurrentScreenSaverProducts(MasterParameterMessage authentication)
 {
     return(Channel.GetCurrentScreenSaverProducts(authentication));
 }