示例#1
0
    private static void BuildWrappers(List<Type> typeList, string classNamespace, bool createAsControl, bool exposeNullables, string codeBasePath)
    {
      foreach (Type aspectType in typeList)
      {
        AspectModelBuilder amb = new AspectModelBuilder();
        string source = amb.BuildCodeTemplate(aspectType, classNamespace, createAsControl, exposeNullables);
        string targetFileName = string.Format("{0}Wrapper.cs", aspectType.Name);
        if (!Directory.Exists(codeBasePath))
          Directory.CreateDirectory(codeBasePath);

        string targetPath = codeBasePath + targetFileName;
        using (FileStream file = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
        using (StreamWriter sw = new StreamWriter(file))
          sw.Write(source);
      }
    }
示例#2
0
        private static void BuildWrappers(List <Type> typeList, string classNamespace, bool createAsControl, bool exposeNullables, string codeBasePath)
        {
            foreach (Type aspectType in typeList)
            {
                AspectModelBuilder amb            = new AspectModelBuilder();
                string             source         = amb.BuildCodeTemplate(aspectType, classNamespace, createAsControl, exposeNullables);
                string             targetFileName = string.Format("{0}Wrapper.cs", aspectType.Name);
                if (!Directory.Exists(codeBasePath))
                {
                    Directory.CreateDirectory(codeBasePath);
                }

                string targetPath = codeBasePath + targetFileName;
                using (FileStream file = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
                    using (StreamWriter sw = new StreamWriter(file))
                        sw.Write(source);
            }
        }
示例#3
0
    static void Main(string[] args)
    {
      const string classNamespace = "MediaPortal.UiComponents.Media.Models.AspectWrappers";
      const bool createAsControl = true;
      const bool exposeNullables = true;

      List<Type> typeList = new List<Type> { typeof(MediaAspect), typeof(VideoAspect), typeof(AudioAspect), typeof(ImageAspect), typeof(MovieAspect), typeof(SeriesAspect) };

      foreach (Type aspectType in typeList)
      {
        AspectModelBuilder amb = new AspectModelBuilder();
        string source = amb.BuildCodeTemplate(aspectType, classNamespace, createAsControl, exposeNullables);
        string targetFileName = string.Format("{0}Wrapper.cs", aspectType.Name);
        string targetPath = @"..\..\..\..\..\Source\UI\UiComponents\Media\Models\AspectWrappers\" + targetFileName;
        using (FileStream file = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
        using(StreamWriter sw = new StreamWriter(file))
          sw.Write(source);
      }
    }
示例#4
0
        static void Main(string[] args)
        {
            const string classNamespace  = "MediaPortal.UiComponents.Media.Models.AspectWrappers";
            const bool   createAsControl = true;
            const bool   exposeNullables = true;

            List <Type> typeList = new List <Type> {
                typeof(MediaAspect), typeof(VideoAspect), typeof(AudioAspect), typeof(ImageAspect), typeof(MovieAspect), typeof(SeriesAspect)
            };

            foreach (Type aspectType in typeList)
            {
                AspectModelBuilder amb            = new AspectModelBuilder();
                string             source         = amb.BuildCodeTemplate(aspectType, classNamespace, createAsControl, exposeNullables);
                string             targetFileName = string.Format("{0}Wrapper.cs", aspectType.Name);
                string             targetPath     = @"..\..\..\..\..\Source\UI\UiComponents\Media\Models\AspectWrappers\" + targetFileName;
                using (FileStream file = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
                    using (StreamWriter sw = new StreamWriter(file))
                        sw.Write(source);
            }
        }