Exemplo n.º 1
0
        public WebRecordingFileInfo GetRecordingFileInfo(int id)
        {
            string filename = String.Empty;
            try
            {
                filename = GetRecordingById(id).FileName;

                bool tryImpersonation = false;
                try
                {
                    var fileInfo = new WebRecordingFileInfo(new FileInfo(filename));
                    if (fileInfo != null && fileInfo.Exists)
                        return fileInfo;

                    tryImpersonation = PathUtil.MightBeOnNetworkDrive(filename);
                }
                catch (UnauthorizedAccessException)
                {
                    tryImpersonation = true;
                }

                if (tryImpersonation && Configuration.Services.NetworkImpersonation.IsEnabled())
                {
                    using (var context = NetworkContextFactory.CreateImpersonationContext())
                    {
                        var ret = new WebRecordingFileInfo(context.RewritePath(filename));
                        ret.IsLocalFile = true;
                        ret.OnNetworkDrive = true;
                        return ret;
                    }
                }
            }
            catch (FileNotFoundException)
            {
                Log.Info("Failed to load fileinfo for recording {0} because it does not exists at path {1}", id, filename);
            }
            catch (Exception ex)
            {
                Log.Warn("Failed to load fileinfo for recording", ex);
            }

            return new WebRecordingFileInfo();
        }
Exemplo n.º 2
0
 public static string GetFullInfoString(WebMediaInfo info, WebRecordingFileInfo fileInfo)
 {
     return GetFullInfoString(info, fileInfo.Size);
 }
Exemplo n.º 3
0
        public WebRecordingFileInfo GetRecordingFileInfo(int id)
        {
            try
            {
                string filename = GetRecordingById(id).FileName;
                try
                {
                    return new WebRecordingFileInfo(new FileInfo(filename));
                }
                catch (UnauthorizedAccessException)
                {
                    // access denied, try impersonation when on a network share
                    if (new Uri(filename).IsUnc)
                    {
                        using (NetworkShareImpersonator impersonation = new NetworkShareImpersonator())
                        {
                            var ret = new WebRecordingFileInfo(filename);
                            ret.IsLocalFile = Configuration.Services.NetworkImpersonation.ReadInStreamingService;
                            ret.OnNetworkDrive = true;
                            return ret;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Warn("Failed to load fileinfo for recording", ex);
            }

            return new WebRecordingFileInfo();
        }
Exemplo n.º 4
0
 public static string GetFullInfoString(bool accessible, WebMediaInfo info, WebRecordingFileInfo fileInfo)
 {
     return accessible ? GetFullInfoString(info, fileInfo) : UIStrings.FileInaccessible;
 }
Exemplo n.º 5
0
 public static string GetFullInfoString(bool accessible, WebMediaInfo info, WebRecordingFileInfo fileInfo)
 {
     return GetFullInfoString(accessible, info, fileInfo.Size);
 }