MetaDataServices

本文详细介绍了元数据服务API的功能及使用方法,包括类型到模式的转换、从URL获取模式、模式到代码源的转换等关键操作。适用于.NET环境下进行远程服务元数据处理的开发者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. // ==++==
  2. // 
  3. //   
  4. //    Copyright (c) 2002 Microsoft Corporation.  All rights reserved.
  5. //   
  6. //    The use and distribution terms for this software are contained in the file
  7. //    named license.txt, which can be found in the root of this distribution.
  8. //    By using this software in any fashion, you are agreeing to be bound by the
  9. //    terms of this license.
  10. //   
  11. //    You must not remove this notice, or any other, from this software.
  12. //   
  13. // 
  14. // ==--==
  15. //============================================================
  16. //
  17. // File:    MetaDataServices
  18. // Purpose: Defines APIs for Metadata
  19. //
  20. // Date:    April 01, 2000
  21. //
  22. //============================================================
  23. namespace System.Runtime.Remoting.MetadataServices
  24. {
  25.     using System;
  26.     using System.Threading;
  27.     using System.Collections;
  28.     using System.Reflection;
  29.     using System.Xml;
  30.     using System.Diagnostics;
  31.     using System.IO;
  32.     using System.Net;
  33.     using System.Text;
  34.     using System.Runtime.InteropServices;
  35.     using System.Runtime.Remoting.Channels;
  36.     using System.Runtime.Remoting.Metadata;
  37.     using Microsoft.CSharp;
  38.     /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData"]/*' />
  39.     public class MetaData
  40.     {
  41.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertTypesToSchemaToFile"]/*' />
  42.         public static void ConvertTypesToSchemaToFile(Type[] types, SdlType sdlType, String path)
  43.         {
  44.             Util.Log("MetaData.ConvertTypesToSchemaToFile 1 "+path);                        
  45.             ConvertTypesToSchemaToStream(types, sdlType, File.Create(path));
  46.         } // ConvertTypesToSchemaToFile
  47.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertTypesToSchemaToStream"]/*' />
  48.         public static void ConvertTypesToSchemaToStream(Type[] types, SdlType sdlType, Stream outputStream)
  49.         {
  50.             Util.Log("MetaData.ConvertTypesToSchemaToFile 2 ");                        
  51.             ServiceType[] serviceTypes = new ServiceType[types.Length];
  52.             for (int i=0; i<types.Length; i++)
  53.                 serviceTypes[i] = new ServiceType(types[i]);
  54.             ConvertTypesToSchemaToStream(serviceTypes, sdlType, outputStream);
  55.         } // ConvertTypesToSchemaToStream
  56.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertTypesToSchemaToFile1"]/*' />
  57.         public static void ConvertTypesToSchemaToFile(ServiceType[] types, SdlType sdlType, String path)
  58.         {
  59.             Util.Log("MetaData.ConvertTypesToSchemaToFile 3 "+path);
  60.             ConvertTypesToSchemaToStream(types, sdlType, File.Create(path));
  61.         } // ConvertTypesToSchemaToFile
  62.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertTypesToSchemaToFile2"]/*' />
  63.         public static void ConvertTypesToSchemaToStream(ServiceType[] serviceTypes, SdlType sdlType, Stream outputStream)
  64.         {
  65.             Util.Log("MetaData.ConvertTypesToSchemaToStream 4");            
  66.             TextWriter tw = new StreamWriter(outputStream, new UTF8Encoding(falsetrue));
  67.             SUDSGenerator sgen = new SUDSGenerator(serviceTypes, sdlType, tw);
  68.             sgen.Generate();
  69.             tw.Flush();
  70.         } // ConvertTypesToSchemaToStream
  71.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.RetrieveSchemaFromUrlToStream"]/*' />
  72.         public static void RetrieveSchemaFromUrlToStream(String url, Stream outputStream)
  73.         {
  74.             WebRequest              Request;
  75.             WebResponse             Response;
  76.             Stream                  RespStream;
  77.             Util.Log("MetaData.RetrieveSchemaFromUrlToStream "+url);                        
  78.             TextWriter tw = new StreamWriter(outputStream, new UTF8Encoding(falsetrue));
  79.             Request = WebRequest.Create(url);
  80.             Response = Request.GetResponse();
  81.             RespStream = Response.GetResponseStream();
  82.             StreamReader sr = new StreamReader(RespStream);
  83.             tw.Write(sr.ReadToEnd());
  84.             tw.Flush();
  85.         }
  86.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.RetrieveSchemaFromUrlToFile"]/*' />
  87.         public static void RetrieveSchemaFromUrlToFile(String url, String path)
  88.         {
  89.             Util.Log("MetaData.RetrieveSchemaFromUrlToFile "+url+" file "+path);                                    
  90.             RetrieveSchemaFromUrlToStream(url, File.Create(path));
  91.         }
  92.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertSchemaStreamToCodeSourceStream"]/*' />
  93.         public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, String outputDirectory, Stream inputStream, ArrayList outCodeStreamList, String proxyUrl, String proxyNamespace)
  94.         {
  95.             Util.Log("MetaData.ConvertSchemaStreamToCodeSourceStream 1 "+outputDirectory+" proxyUrl "+proxyNamespace);                                    
  96.             TextReader input;
  97.             input = (TextReader) new StreamReader(inputStream);
  98.             SUDSParser parser = new SUDSParser(input, outputDirectory, outCodeStreamList, proxyUrl, clientProxy, proxyNamespace);
  99.             parser.Parse();
  100.         }
  101.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertSchemaStreamToCodeSourceStream2"]/*' />
  102.         public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, String outputDirectory, Stream inputStream, ArrayList outCodeStreamList, String proxyUrl)
  103.         {
  104.             Util.Log("MetaData.ConvertSchemaStreamToCodeSourceStream 3 "+outputDirectory);                                    
  105.           ConvertSchemaStreamToCodeSourceStream(clientProxy, outputDirectory, inputStream, outCodeStreamList, proxyUrl, "");
  106.         }
  107.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertSchemaStreamToCodeSourceStream1"]/*' />
  108.         public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, String outputDirectory, Stream inputStream, ArrayList outCodeStreamList)
  109.         {
  110.             Util.Log("MetaData.ConvertSchemaStreamToCodeSourceStream 2 "+outputDirectory);                                    
  111.           ConvertSchemaStreamToCodeSourceStream(clientProxy, outputDirectory, inputStream, outCodeStreamList, """");
  112.         }
  113.         
  114.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertCodeSourceStreamToAssemblyFile"]/*' />
  115.         public static void ConvertCodeSourceStreamToAssemblyFile(ArrayList outCodeStreamList, String assemblyPath, String strongNameFilename)
  116.         {
  117.             throw new NotImplementedException("Not Implemented in Rotor");
  118.         }
  119. /*
  120. /target:module -> Name="target", Value="module"
  121. /target:library -> Name="target", Value="library"
  122. /main:MyClass -> Name="m", Value="MyClass"
  123. /debug+ -> Name="debug", Value=true
  124. // The dictionary of options takes almost ALL of the normal command-line options, but only using their 'short form' and without the preceding slash or dash.
  125. */
  126.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.ConvertCodeSourceFileToAssemblyFile"]/*' />
  127.         public static void ConvertCodeSourceFileToAssemblyFile(String codePath, String assemblyPath, String strongNameFilename)
  128.         {
  129.             Util.Log("MetaData.ConvertCodeSourceFileToAssemblyFile codePath "+codePath+" assemblyPath "+assemblyPath);                                                
  130.             ArrayList arrayList = new ArrayList();
  131.             arrayList.Add(codePath);
  132.             ConvertCodeSourceStreamToAssemblyFile(arrayList, assemblyPath, strongNameFilename);
  133.         }
  134.         // Helpers
  135.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="MetaData.SaveStreamToFile"]/*' />
  136.         public static void SaveStreamToFile(Stream inputStream, String path)
  137.         {
  138.             Util.Log("MetaData.SaveStreamToFile "+path);            
  139.             Stream outputStream = File.Create(path);
  140.             TextWriter tw = new StreamWriter(outputStream, new UTF8Encoding(falsetrue));
  141.             StreamReader sr = new StreamReader(inputStream);
  142.             tw.Write(sr.ReadToEnd());
  143.             tw.Flush();
  144.             tw.Close();
  145.             outputStream.Close();
  146.         }
  147.     } // class MetaData
  148.         
  149.         
  150.     /// <include file='doc/MetaData.uex' path='docs/doc[@for="ServiceType"]/*' />
  151.     public class ServiceType
  152.         {
  153.         private Type    _type;  // Type of object being exported.
  154.         private String  _url;   // This may be null if no address is available.
  155.         
  156.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="ServiceType.ServiceType"]/*' />
  157.         public ServiceType(Type type)
  158.         {
  159.             _type = type;
  160.             _url = null;
  161.         } // ServiceType
  162.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="ServiceType.ServiceType1"]/*' />
  163.         public ServiceType(Type type, String url)
  164.             {
  165.             _type = type;
  166.             _url = url;
  167.         } // ServiceType
  168.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="ServiceType.ObjectType"]/*' />
  169.         public Type   ObjectType { get { return _type; } }
  170.         /// <include file='doc/MetaData.uex' path='docs/doc[@for="ServiceType.Url"]/*' />
  171.         public String Url { get { return _url; } }        
  172.        
  173.     } // ServiceType
  174.         
  175.         
  176. // namespace System.Runtime.Remoting.MetadataServices
 
内容概要:本文档详细介绍了基于MATLAB实现多目标差分进化(MODE)算法进行无人机三维路径规划的项目实例。项目旨在提升无人机在复杂三维环境中路径规划的精度、实时性、多目标协调处理能力、障碍物避让能力和路径平滑性。通过引入多目标差分进化算法,项目解决了传统路径规划算法在动态环境和多目标优化中的不足,实现了路径长度、飞行安全距离、能耗等多个目标的协调优化。文档涵盖了环境建模、路径编码、多目标优化策略、障碍物检测与避让、路径平滑处理等关键技术模块,并提供了部分MATLAB代码示例。 适合人群:具备一定编程基础,对无人机路径规划和多目标优化算法感兴趣的科研人员、工程师和研究生。 使用场景及目标:①适用于无人机在军事侦察、环境监测、灾害救援、物流运输、城市管理等领域的三维路径规划;②通过多目标差分进化算法,优化路径长度、飞行安全距离、能耗等多目标,提升无人机任务执行效率和安全性;③解决动态环境变化、实时路径调整和复杂障碍物避让等问题。 其他说明:项目采用模块化设计,便于集成不同的优化目标和动态环境因素,支持后续算法升级与功能扩展。通过系统实现和仿真实验验证,项目不仅提升了理论研究的实用价值,还为无人机智能自主飞行提供了技术基础。文档提供了详细的代码示例,有助于读者深入理解和实践该项目。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值