예제 #1
0
        public Platform.AbstractPlatform GetPlatform(string name)
        {
            if (platforms == null)
            {
                platforms = new Dictionary <string, Platform.AbstractPlatform>();
                foreach (System.Reflection.Assembly assembly in GetRawAssemblies())
                {
                    Platform.AbstractPlatform platform = this.GetPlatformInstance(assembly);
                    platform.PlatformProvider = this;
                    string key = platform.Name;
                    if (platforms.ContainsKey(key))
                    {
                        throw new InvalidOperationException("Multiple platforms with the same ID: '" + key + "'");
                    }
                    platforms[key] = platform;
                }
            }

            if (name != null && platforms.ContainsKey(name))
            {
                return(platforms[name]);
            }

            return(null);
        }
예제 #2
0
        public TemplateReader(Common.PkgAwareFileUtil fileUtil, AbstractPlatform platform)
        {
            this.fileUtil = fileUtil;
            AbstractPlatform walker = platform;

            while (walker != null)
            {
                platformNamesMostGeneralFirst.Add(walker.Name);
                walker = walker.ParentPlatform;
            }
            platformNamesMostGeneralFirst.Reverse();
        }
예제 #3
0
        public TemplateReader(Wax.PkgAwareFileUtil fileUtil, AbstractPlatform platform, string activeCrayonSourceRoot)
        {
            this.activeCrayonSourceRoot = activeCrayonSourceRoot;
            this.fileUtil = fileUtil;
            AbstractPlatform walker = platform;

            while (walker != null)
            {
                platformNamesMostGeneralFirst.Add(walker.Name);
                walker = walker.ParentPlatform;
            }
            platformNamesMostGeneralFirst.Reverse();
        }
예제 #4
0
 public byte[] LoadBinaryResource(string resourcePath)
 {
     byte[] bytes = Util.ReadAssemblyFileBytes(this.GetType().Assembly, resourcePath);
     if (bytes == null)
     {
         AbstractPlatform parent = this.ParentPlatform;
         if (parent == null)
         {
             return(null);
         }
         return(parent.LoadBinaryResource(resourcePath));
     }
     return(bytes);
 }
예제 #5
0
        public string LoadTextResource(string resourcePath, Dictionary <string, string> replacements)
        {
            string content = Util.ReadAssemblyFileText(this.GetType().Assembly, resourcePath, true);

            if (content == null)
            {
                AbstractPlatform parent = this.ParentPlatform;
                if (parent == null)
                {
                    throw new Exception("Resource not found: '" + resourcePath + "'");
                }
                return(parent.LoadTextResource(resourcePath, replacements));
            }

            return(this.ApplyReplacements(content, replacements));
        }
 public LibraryNativeInvocationTranslatorProvider(Dictionary <string, Library> libraries, Platform.AbstractPlatform platform)
 {
     this.libraries = libraries;
     this.platform  = platform;
 }