private void SavePollingStepDataBuffers(PollingStepDB pollingStep)
        {
            for (int i = 1; i <= 4; i++) {
                string dataFile = string.Empty;
                byte[] buffer = null;

                switch (i) {
                case 1:
                    if (!string.IsNullOrEmpty (pollingStep.PollingData1File)) {
                        dataFile = System.IO.Path.Combine (ContentPath, pollingStep.PollingData1File);
                        buffer = pollingStep.PollingData1;
                    }
                    break;
                case 2:
                    if (!string.IsNullOrEmpty (pollingStep.PollingData2File)) {
                        dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData2File);
                        buffer = pollingStep.PollingData2;
                    }
                    break;
                case 3:
                    if (!string.IsNullOrEmpty (pollingStep.PollingData3File)) {
                        dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData3File);
                        buffer = pollingStep.PollingData3;
                    }
                    break;
                case 4:
                    if (!string.IsNullOrEmpty (pollingStep.PollingData4File)) {
                        dataFile = System.IO.Path.Combine (this.ContentPath, pollingStep.PollingData4File);
                        buffer = pollingStep.PollingData4;
                    }
                    break;
                }//end switch

                if (null != buffer && buffer.Length > 0) {
                    try {
                        File.WriteAllBytes (dataFile, buffer);
                    } catch (IOException e) {
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("Unable to save polling step");
                        #endif
                    }
                }
            }
        }
        private bool CheckPhotoPollStepFilesExist(PollingStepDB pollingStep)
        {
            if (null != pollingStep) {
                bool exist = true;
                if (!string.IsNullOrEmpty (pollingStep.PollingData1File))
                    exist &= File.Exists (Path.Combine (ContentPath, pollingStep.PollingData1File));

                if (!string.IsNullOrEmpty (pollingStep.PollingData2File))
                    exist &= File.Exists (Path.Combine (ContentPath, pollingStep.PollingData2File));

                if (!string.IsNullOrEmpty (pollingStep.PollingData3File))
                    exist &= File.Exists (Path.Combine (ContentPath, pollingStep.PollingData3File));

                if (!string.IsNullOrEmpty (pollingStep.PollingData4File))
                    exist &= File.Exists (Path.Combine (ContentPath, pollingStep.PollingData4File));
                return exist;
            } else
                return false;
        }
        private void SavePhotoPollBuffers(PollingStepDB pollStepToSave)
        {
            if (null != pollStepToSave.PollingData1 && pollStepToSave.PollingData1.Length > 0)
                pollStepToSave.PollingData1File = StringUtils.ConstructPollingStepDataFile(1, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

            if (null != pollStepToSave.PollingData2 && pollStepToSave.PollingData2.Length > 0)
                pollStepToSave.PollingData2File = StringUtils.ConstructPollingStepDataFile(2, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

            if (null != pollStepToSave.PollingData3 && pollStepToSave.PollingData3.Length > 0)
                pollStepToSave.PollingData3File = StringUtils.ConstructPollingStepDataFile(3, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

            if (null != pollStepToSave.PollingData4 && pollStepToSave.PollingData4.Length > 0)
                pollStepToSave.PollingData4File = StringUtils.ConstructPollingStepDataFile(4, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

            SavePollingStepDataBuffers(pollStepToSave);
        }
        public void SavePhotoPollBuffers(PollingStepDB pollStepToSave)
        {
            lock (this.cacheLock) {
                // Poll is photo poll
                if (null != pollStepToSave.PollingData1 && pollStepToSave.PollingData1.Length > 0)
                    pollStepToSave.PollingData1File = StringUtils.ConstructPollingStepDataFile (1, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

                if (null != pollStepToSave.PollingData2 && pollStepToSave.PollingData2.Length > 0)
                    pollStepToSave.PollingData2File = StringUtils.ConstructPollingStepDataFile (2, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

                if (null != pollStepToSave.PollingData3 && pollStepToSave.PollingData3.Length > 0)
                    pollStepToSave.PollingData3File = StringUtils.ConstructPollingStepDataFile (3, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

                if (null != pollStepToSave.PollingData4 && pollStepToSave.PollingData4.Length > 0)
                    pollStepToSave.PollingData4File = StringUtils.ConstructPollingStepDataFile (4, pollStepToSave.MessageGuid, pollStepToSave.StepNumber);

                // Save buffers to file system
                SavePollingStepDataBuffers (pollStepToSave);
            }//end lock
        }
 private bool checkPhotoPollStepFileExists(PollingStepDB pollStep)
 {
     string contentpath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
     if (pollStep != null)
     {
         bool exist = true;
         if (!string.IsNullOrEmpty(pollStep.PollingData1File))
             exist &= File.Exists(System.IO.Path.Combine(contentpath, pollStep.PollingData1File));
         if (!string.IsNullOrEmpty(pollStep.PollingData2File))
             exist &= File.Exists(System.IO.Path.Combine(contentpath, pollStep.PollingData2File));
         if (!string.IsNullOrEmpty(pollStep.PollingData3File))
             exist &= File.Exists(System.IO.Path.Combine(contentpath, pollStep.PollingData3File));
         if (!string.IsNullOrEmpty(pollStep.PollingData4File))
             exist &= File.Exists(System.IO.Path.Combine(contentpath, pollStep.PollingData4File));
         return exist;
     } else
         return false;
 }