/////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////
        public override object GetStreamVersion(string streamName)
        {
#if FEATURE_PAL // FEATURE_PAL: singelton version
            return(s_version);
#else
            // for now, assume it is the same
            // return s_version;
            bool exists;
            long size, createDate, lastWriteDate;
            WindowsImpersonationContext wiContext = null;

            try {
                if (_Identity != null)
                {
                    wiContext = _Identity.Impersonate();
                }

                try {
                    //////////////////////////////////////////////////////////////////
                    // Step 3: Get the type and create the object on the remote server
                    IRemoteWebConfigurationHostServer remoteSrv = CreateRemoteObject(_Server, _Username, _Domain, _Password);
                    try {
                        //////////////////////////////////////////////////////////////////
                        // Step 4: Call the API
                        remoteSrv.GetFileDetails(streamName, out exists, out size, out createDate, out lastWriteDate);
                    }
                    finally {
                        while (Marshal.ReleaseComObject(remoteSrv) > 0)
                        {
                        }                                                   // release the COM object
                    }
                }
                finally {
                    if (wiContext != null)
                    {
                        wiContext.Undo(); // revert impersonation
                    }
                }
            }
            catch {
                // Wrap finally clause with a try to avoid exception clauses being run
                // while the thread is impersonated.
                throw;
            }

            return(new FileDetails(exists, size, DateTime.FromFileTimeUtc(createDate), DateTime.FromFileTimeUtc(lastWriteDate)));
#endif // FEATURE_PAL
        }
Exemple #2
0
        public override object GetStreamVersion(string streamName)
        {
            bool flag;
            long num;
            long num2;
            long num3;
            WindowsImpersonationContext context = null;

            try
            {
                if (this._Identity != null)
                {
                    context = this._Identity.Impersonate();
                }
                try
                {
                    IRemoteWebConfigurationHostServer o = CreateRemoteObject(this._Server, this._Username, this._Domain, this._Password);
                    try
                    {
                        o.GetFileDetails(streamName, out flag, out num, out num2, out num3);
                    }
                    finally
                    {
                        while (Marshal.ReleaseComObject(o) > 0)
                        {
                        }
                    }
                }
                finally
                {
                    if (context != null)
                    {
                        context.Undo();
                    }
                }
            }
            catch
            {
                throw;
            }
            return(new FileDetails(flag, num, DateTime.FromFileTimeUtc(num2), DateTime.FromFileTimeUtc(num3)));
        }