TvController_StartRecording() публичный статический Метод

public static TvController_StartRecording ( IUser &user, string &fileName ) : TvResult
user IUser
fileName string
Результат TvResult
        protected override string OnStartRecording(RecorderCallbackServiceAgent callbackAgent, ref string errorMessage)
        {
            string baseFileName = _suggestedBaseFileName;

            if (String.IsNullOrEmpty(baseFileName))
            {
                baseFileName = Common.Utility.BuildRecordingBaseFileName(null, this.RecordingProgram);
            }
            else
            {
                this.UsedSuggestedBaseFileName = true;
            }

            string fileName  = Path.Combine(_recordOnCard.RecordingFolder, baseFileName);
            string extension = (_recordOnCard.RecordingFormat == 0) ? ".ts" : ".mpg";

            _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension, 0);
            string tve3RecordingDirectory = Path.GetDirectoryName(_tve3RecordingFileName);

            if (!Directory.Exists(tve3RecordingDirectory))
            {
                Directory.CreateDirectory(tve3RecordingDirectory);
            }

            string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(tve3RecordingDirectory);

            if (String.IsNullOrEmpty(uncRecordingFolder))
            {
                errorMessage = "Failed to convert '" + Path.GetDirectoryName(_tve3RecordingFileName) + "' to UNC path, please add required share";
                return(null);
            }

            bool argusIsRecordingOnCard;

            if (!EnsureCardFree(false, ref errorMessage, out argusIsRecordingOnCard))
            {
                if (!WaitCardFree(argusIsRecordingOnCard, ref errorMessage))
                {
                    return(null);
                }
            }

            IChannel tuningChannel = Utility.FindTuningChannelOnCard(_channel, _recordOnCard.IdCard);

            if (tuningChannel == null)
            {
                errorMessage = "Failed to find tuning details for channel " + _channel.DisplayName;
                return(null);
            }

            // Make sure only one thread can tune and start a recording at the same time.
            lock (_startRecordingLock)
            {
                if (TvServerPlugin.TvController_Tune(ref _tve3User, tuningChannel, _channel.IdChannel) != TvResult.Succeeded)
                {
                    errorMessage = "Failed to tune to channel " + _channel.DisplayName;
                    return(null);
                }

                if (TvServerPlugin.TvController_StartRecording(ref _tve3User, ref _tve3RecordingFileName) != TvResult.Succeeded)
                {
                    errorMessage = "TV Server failed to start recording on channel " + _channel.DisplayName;
                    return(null);
                }
            }

            return(Path.Combine(uncRecordingFolder, Path.GetFileName(_tve3RecordingFileName)));
        }