Exemple #1
0
        /// <include file='doc\MyWeb.uex' path='docs/doc[@for="MyWebApplication.Update"]/*' />
        /// <devdoc>
        ///    <para>Marked internal for Beta 1 per ErikOls.</para>
        /// </devdoc>
        public int Update()
        {
            if (!MyWeb.IsAdminApp())
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Operation_requires_url_to_be_myweb_home));
            }

            MyWebManifest manifest = MyWeb.GetManifest(Manifest.ApplicationUrl);

            if (manifest == null)
            {
                return(0);
            }

            StringBuilder strError = new StringBuilder(1024);
            int           iReturn  = 0;

            iReturn = NativeMethods.MyWebReInstallApp(manifest.CabFile,
                                                      manifest.ApplicationUrl,
                                                      manifest.InstalledLocation,
                                                      manifest.ManifestFile,
                                                      strError,
                                                      1024);

            if (iReturn != 0 && iReturn != 1)
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Literal, strError.ToString()));
            }

            _Manifest = manifest;
            return(iReturn);
        }
Exemple #2
0
 //////////////////////////////////////////////////////////////////////
 // Get a Manifest from a dir
 /// <include file='doc\MyWeb.uex' path='docs/doc[@for="MyWeb.GetManifestForLocalApplication"]/*' />
 /// <internalonly/>
 /// <devdoc>
 ///    <para>Marked internal for Beta 1 per ErikOls.</para>
 /// </devdoc>
 static public MyWebManifest GetManifestForLocalApplication(String strDir)
 {
     if (!RunningOnMyWeb || !IsAdminApp())
     {
         return(null);
     }
     if (!strDir.EndsWith("\\"))
     {
         strDir += "\\";
     }
     return(MyWebManifest.CreateFromFile(strDir + "myweb.osd",
                                         "", false, true));
 }
Exemple #3
0
        //////////////////////////////////////////////////////////////////////
        // Get a Manifest for an URL
        /// <include file='doc\MyWeb.uex' path='docs/doc[@for="MyWeb.GetManifest"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para>Marked internal for Beta 1 per ErikOls.</para>
        ///    <para>Retrieves a MyWebManifest object for the given MyWeb Uri. If an application
        ///       for that Uri does not exist, it returns <see langword='null'/>.</para>
        /// </devdoc>
        static public MyWebManifest GetManifest(String strUrl)
        {
            if (!RunningOnMyWeb || !IsAdminApp())
            {
                return(null);
            }
            StringBuilder strBFile   = new StringBuilder(300);
            StringBuilder strBAppUrl = new StringBuilder(strUrl.Length + 2);
            int           iRet       = 0;

            while (strUrl != null && strUrl.Length > 0)
            {
                Debug.Trace("myweb", "Attempting to get manifest for url " + strUrl);
                iRet = NativeMethods.MyWebGetApplicationManifestFile(strUrl, strBFile, 300, strBAppUrl, strUrl.Length + 2);
                if (iRet != 0)
                {
                    Debug.Trace("myweb", "faled to get manifest for url " + strUrl);
                    return(null);
                }

                try {
                    MyWebManifest manifest = MyWebManifest.CreateFromFile(strBFile.ToString(), strBAppUrl.ToString(), false, false);
                    if (manifest != null)
                    {
                        return(manifest);
                    }
                }
                catch (Exception) {
                }
                Debug.Trace("myweb", "no softpkg in url " + strUrl);
                int iPos = strUrl.LastIndexOf('/');
                if (iPos < 0)
                {
                    strUrl = null;
                }
                else
                {
                    strUrl = strUrl.Substring(0, iPos);
                }
            }
            return(null);
        }
Exemple #4
0
        ////////////////////////////////////////////////////////////////////////
        // CTor: Create from an installed app
        internal MyWebApplication(int iIndex)
        {
            if (!MyWeb.IsAdminApp())
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Operation_requires_url_to_be_myweb_home));
            }

            StringBuilder strBFile = new StringBuilder(300);
            StringBuilder strBUrl  = new StringBuilder(1024);

            long [] pLongs = new long[3];

            if (NativeMethods.MyWebGetApplicationDetails(iIndex, strBFile, 300, strBUrl, 1024, pLongs) != 0)
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Unable_to_create_app_object));
            }

            _Manifest         = MyWebManifest.CreateFromFile(strBFile.ToString() + "\\myweb.osd", strBUrl.ToString(), true, true);
            _InstalledDate    = DateTime.FromFileTime(pLongs[0]);
            _LastAccessDate   = DateTime.FromFileTime(pLongs[1]);
            _LocalApplication = (pLongs[2] != 0);
        }
Exemple #5
0
 ////////////////////////////////////////////////////////////////////////
 // CTor: Create from a manifest that just got installed
 internal MyWebApplication(MyWebManifest manifest)
 {
     _Manifest       = manifest;
     _InstalledDate  = DateTime.Now;
     _LastAccessDate = DateTime.Now;
 }