Ejemplo n.º 1
0
        private static void InitCachingExtensions()
        {
            string path = "Base/Constants/FileSystem.config";

            if (VirtualFile.Exists(path))
            {
                TextBlock textBlock = TextBlockUtils.LoadFromVirtualFile(path);
                if (textBlock != null)
                {
                    TextBlock textBlock2 = textBlock.FindChild("cachingExtensions");
                    if (textBlock2 != null)
                    {
                        foreach (TextBlock.Attribute current in textBlock2.Attributes)
                        {
                            string value = current.Value;
                            cachingExtensions.Add(value, 0);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadComponent(string p)
        {
            string    arg;
            TextBlock textBlock = TextBlockUtils.LoadFromRealFile(p, out arg);

            if (textBlock != null)
            {
                try
                {
                    ComponentInfo componentInfo = new ComponentInfo();
                    componentInfo.name = Path.GetFileNameWithoutExtension(p);
                    if (this.componentsDic.ContainsKey(componentInfo.name))
                    {
                        Log.Fatal("EngineComponentManager: ParseComponentFile: The component with a name \"{0}\" is already registered.", componentInfo.name);
                        return;
                    }

                    this.componentsDic.Add(componentInfo.name, componentInfo);
                    componentInfo.fullName = textBlock.GetAttribute("fullName", "[FULL NAME IS NOT SPECIFIED]");
                    if (textBlock.IsAttributeExist("componentTypes"))
                    {
                        componentInfo.componentTypeFlag = (ComponentTypeFlags)Enum.Parse(typeof(ComponentTypeFlags), textBlock.GetAttribute("componentTypes"));
                    }
                    if (textBlock.IsAttributeExist("platforms"))
                    {
                        componentInfo.platformFlag = (PlatformFlags)Enum.Parse(typeof(PlatformFlags), textBlock.GetAttribute("platforms"));
                    }
                    if (textBlock.IsAttributeExist("enableByDefaultPlatforms"))
                    {
                        string attribute = textBlock.GetAttribute("enableByDefaultPlatforms");
                        if (!string.IsNullOrEmpty(attribute))
                        {
                            componentInfo.enableByDefaultPlatforms = (PlatformFlags)Enum.Parse(typeof(PlatformFlags), attribute);
                        }
                        else
                        {
                            componentInfo.enableByDefaultPlatforms = (ComponentManager.PlatformFlags) 0;
                        }
                    }
                    foreach (TextBlock current in textBlock.Children)
                    {
                        if (current.Name == "path")
                        {
                            ComponentInfo.PathInfo pathInfo = new ComponentInfo.PathInfo();
                            pathInfo.path = current.GetAttribute("path");
                            if (current.IsAttributeExist("platforms"))
                            {
                                pathInfo.platformFlags = (PlatformFlags)Enum.Parse(typeof(PlatformFlags), current.GetAttribute("platforms"));
                            }
                            if (current.IsAttributeExist("entryPoint"))
                            {
                                pathInfo.entryPoint = bool.Parse(current.GetAttribute("entryPoint"));
                            }
                            componentInfo.af.Add(pathInfo);
                        }
                    }
                    if (textBlock.IsAttributeExist("macOSXApplicationName"))
                    {
                        componentInfo.applicationName_MacOSX = textBlock.GetAttribute("macOSXApplicationName");
                    }
                    return;
                }
                catch (Exception ex)
                {
                    Log.Warning("EngineComponentManager: Parsing file \"{0}\" failed ({1}).", p, ex.Message);
                    return;
                }
            }
            Log.Warning("EngineComponentManager: Parsing file \"{0}\" failed ({1}).", p, arg);
        }