当前位置: 首页>>代码示例>>C#>>正文


C# Server.UpdateConfiguration方法代码示例

本文整理汇总了C#中Server.UpdateConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# Server.UpdateConfiguration方法的具体用法?C# Server.UpdateConfiguration怎么用?C# Server.UpdateConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server的用法示例。


在下文中一共展示了Server.UpdateConfiguration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: bGetDatasetList

      /// <summary>
      /// Get the list of datasets for a particular path
      /// </summary>
      /// <param name="oServer"></param>
      /// <param name="strHierarchy"></param>
      /// <param name="iTimestamp"></param>
      /// <param name="oBounds"></param>
      /// <param name="bAOIFilter"></param>
      /// <param name="bTextFilter"></param>
      /// <param name="strSearchString"></param>
      /// <returns>true if server's cache version changed or some other error occured</returns>
      internal bool bGetDatasetList(Server oServer, string strHierarchy, int iTimestamp, BoundingBox oBounds, bool bAOIFilter, bool bTextFilter, string strSearchString)
      {
         string strEdition;
         System.Xml.XmlDocument oDoc = null;
         string strKey = oServer.Url + ':' + strHierarchy;

         if (!bAOIFilter && !bTextFilter)
            oDoc = oServer.Command.GetCatalog(strHierarchy, 1, 0, 0, null, null, null);
         else if (!bAOIFilter && bTextFilter)
            oDoc = oServer.Command.GetCatalog(strHierarchy, 1, 0, 0, strSearchString, null, null);
         else if (bAOIFilter && !bTextFilter)
            oDoc = oServer.Command.GetCatalog(strHierarchy, 1, 0, 0, null, oBounds, null);
         else if (bAOIFilter && bTextFilter)
            oDoc = oServer.Command.GetCatalog(strHierarchy, 1, 0, 0, strSearchString, oBounds, null);

         if (bTextFilter)
            strKey += "_" + strSearchString;
         if (bAOIFilter)
				strKey += "_" + oBounds.GetHashCode().ToString(CultureInfo.InvariantCulture);

			string strFile = Path.Combine(oServer.CacheDir, strKey.GetHashCode().ToString(CultureInfo.InvariantCulture) + ".dap_datasetlist.gz");

         FolderDatasetList oDataset = FolderDatasetList.Parse(oServer, strKey, iTimestamp, oDoc, out strEdition);

         if (strEdition != oServer.CacheVersion)
         {
            oServer.UpdateConfiguration();
            return false;
         }

         if (oDataset != null)
         {
            try
            {
               if (File.Exists(strFile))
                  File.Delete(strFile);

               // --- Use SOAP formatting and GZip compression to disk  ---
               // --- This way we have a nice human readable format and ---
               // --- we may later move caching to database based.      ---
               SoapFormatter formatter = new SoapFormatter();
               
               using (Stream stream = new FileStream(strFile, FileMode.Create, FileAccess.Write, FileShare.None))
               {
                  using (GZipStream compStream = new GZipStream(stream, CompressionMode.Compress, true))
                  {
                     formatter.Serialize(compStream, oDataset);
                     compStream.Close();
                     stream.Close();
                  }
               }
            }
            catch
            {
            }
         }

         return true;
      }
开发者ID:paladin74,项目名称:Dapple,代码行数:70,代码来源:CatalogCacheManager.cs

示例2: GetCatalogHierarchyRoot


//.........这里部分代码省略.........

               if (File.Exists(strFile))
                  File.Delete(strFile);
            }
         }

         if (oDoc == null)
         {
            try
            {
               if (!bAOIFilter && !bTextFilter)
                  oDoc = oServer.Command.GetCatalogHierarchy();
               else if (!bAOIFilter && bTextFilter)
                  oDoc = oServer.Command.GetCatalogHierarchy(strSearchString);
               else if (bAOIFilter && !bTextFilter)
                  oDoc = oServer.Command.GetCatalogHierarchy(oBounds);
               else if (bAOIFilter && bTextFilter)
                  oDoc = oServer.Command.GetCatalogHierarchy(strSearchString, oBounds);
            }
            catch (DapException)
            {
               // Assume the server is older
               bEntireCatalogMode = true;
               return null;
            }
            catch
            {
               oDoc = null;
            }

            if (oDoc == null)
            {
               // --- do something to disable server ---

#if !DAPPLE
               m_oServerTree.NoResponseError();
#else
					if (m_oServerTree != null)
						m_oServerTree.NoResponseError(oServer);
#endif
               return null;
            }

#if DAPPLE
            // --- Looks like the server is online now ---
				if (m_oServerTree != null)
					m_oServerTree.ReenableServer(oServer);
#endif
            CatalogFolder oCatalogFolder = CatalogFolder.Parse(oDoc, out strEdition);

            if (oCatalogFolder == null)
            {
               // --- check to see if this is an unknown request ---

               System.Xml.XmlNodeList oNodeList;
               System.Xml.XmlNode oNode;

               oNodeList = oDoc.SelectNodes("//" + Geosoft.Dap.Xml.Common.Constant.Tag.ERROR_TAG);
               if (oNodeList != null && oNodeList.Count > 0)
               {
                  oNode = oNodeList[0];
                  if (oNode != null && oNode.InnerText.ToLower() == "unknown request.")
                     bEntireCatalogMode = true;
               }
            }
            else
            {
               if (strEdition != oServer.CacheVersion)
               {
                  oServer.UpdateConfiguration();
                  return null;
               }

               try
               {
                  if (File.Exists(strFile))
                     File.Delete(strFile);

                  // --- Use GZip compression to disk  ---
                  using (Stream stream = new FileStream(strFile, FileMode.Create, FileAccess.Write, FileShare.None))
                  {
                     using (GZipStream compStream = new GZipStream(stream, CompressionMode.Compress, true))
                     {
                        XmlWriter writer = XmlWriter.Create(compStream);
                        oDoc.Save(writer);
                        compStream.Close();
                        stream.Close();
                     }
                  }
               }
               catch
               {
               }
   
               return oCatalogFolder;
            }
         }

         return null;
      }
开发者ID:paladin74,项目名称:Dapple,代码行数:101,代码来源:CatalogCacheManager.cs


注:本文中的Server.UpdateConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。