Kudu.Core.Deployment.DeploymentStatusFile.Open C# (CSharp) Метод

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

public static Open ( string id, IEnvironment environment, IAnalytics analytics, IOperationLock statusLock ) : DeploymentStatusFile
id string
environment IEnvironment
analytics IAnalytics
statusLock IOperationLock
Результат DeploymentStatusFile
        public static DeploymentStatusFile Open(string id, IEnvironment environment, IAnalytics analytics, IOperationLock statusLock)
        {
            return statusLock.LockOperation(() =>
            {
                string path = Path.Combine(environment.DeploymentsPath, id, StatusFile);

                if (!FileSystemHelpers.FileExists(path))
                {
                    return null;
                }

                try
                {
                    XDocument document = null;
                    using (var stream = FileSystemHelpers.OpenRead(path))
                    {
                        document = XDocument.Load(stream);
                    }
                    return new DeploymentStatusFile(id, environment, statusLock, document);
                }
                catch (Exception ex)
                {
                    // in the scenario where w3wp is abruptly terminated while xml is being written,
                    // we may end up with corrupted xml.  we will handle the error and remove the problematic directory.
                    analytics.UnexpectedException(ex);

                    FileSystemHelpers.DeleteDirectorySafe(Path.GetDirectoryName(path), ignoreErrors: true);

                    // it is ok to return null as callers already handle null.
                    return null;
                }
            }, "Getting deployment status", DeploymentStatusManager.LockTimeout);
        }

Usage Example

 public IDeploymentStatusFile Open(string id)
 {
     return(DeploymentStatusFile.Open(id, _environment, _analytics, _statusLock));
 }
All Usage Examples Of Kudu.Core.Deployment.DeploymentStatusFile::Open