示例#1
0
 public IEnumerable <ResourceFolder> GetFolders(ResourceFolder resourceFolder)
 {
     return(Ctx.Resources
            .Single(f => f.ResourceId == resourceFolder.ResourceId)
            .Children
            .OfType <ResourceFolder>());
 }
        private void WriteTree(ResourceNode node)
        {
            ResourceFolder asFolder = node as ResourceFolder;
            ResourceItem   asItem   = node as ResourceItem;

            if (asFolder != null)
            {
                Write("public class ");
                WriteLine(asFolder.name);
                WriteLine("{");
                PushIndent(indent);
                for (int i = 0; i < asFolder.children.Count; i++)
                {
                    WriteTree(asFolder.children[i]);
                }
                PopIndent();
                WriteLine("}");
                WriteLine(string.Empty);
            }
            else if (asItem != null)
            {
                Write("public const string ");
                Write(NamingUtility.ToVariableName(asItem.name));
                Write(" = \"");
                Write(asItem.name + asItem.extension);
                WriteLine("\";");
            }
        }
        public List <ResourceItem> ImportResources(ResourceFolder parent, IEnumerable <string> pathes, IProgressMonitor monitor, CancellationToken token, HashSet <string> fileTypeSuffix = null)
        {
            List <ResourceItem>  resourceItemList = new List <ResourceItem>();
            ImportResourceResult dic = FileOptionHelp.CopyToDic(parent, pathes, monitor, token, (IEnumerable <string>)fileTypeSuffix);

            return(dic.AddResourcePanelItems.Union <ResourceItem>((IEnumerable <ResourceItem>)dic.ImportResources).ToList <ResourceItem>());
        }
示例#4
0
 public IEnumerable <ResourceFile> GetFiles(ResourceFolder folder)
 {
     return
         (from f in Ctx.Resources.OfType <ResourceFile>()
          where f.Parent.Id == folder.Id
          select f);
 }
示例#5
0
        public static ImportResourceResult CopyToDic(ResourceFolder parentDic, IEnumerable <string> files, IProgressMonitor monitor, CancellationToken token, IEnumerable <string> fileTypeSuffix = null)
        {
            ImportResourceResult importResult = new ImportResourceResult();

            importResult.FileTypeSuffix = fileTypeSuffix;
            importResult.Token          = token;
            List <FileOptionHelp.FileData> dealDithFiles = new List <FileOptionHelp.FileData>();

            FileOptionHelp.IsMainThread();
            int pathsFileSystemCount = FileOptionHelp.GetPathsFileSystemCount(files);

            monitor.BeginTask(LanguageInfo.Menu_File_ImportFile, pathsFileSystemCount);
            foreach (FileOptionHelp.FileData fileData in FileOptionHelp.CreateFileDatas(files))
            {
                if (!token.IsCancellationRequested)
                {
                    ResourceItem resourceItem = !File.Exists((string)fileData.FilePath) || fileData.Attributes.HasFlag((Enum)FileAttributes.Hidden) ? FileOptionHelp.CopyDir(parentDic, fileData, ref importResult, dealDithFiles, monitor) : FileOptionHelp.CopyFile(parentDic, fileData, ref importResult, dealDithFiles, monitor);
                    if (resourceItem != null)
                    {
                        importResult.ImportResources.Add(resourceItem);
                        importResult.AddResourcePanelItems.Add(resourceItem);
                    }
                }
                else
                {
                    break;
                }
            }
            return(importResult);
        }
        private void ValidateFolder(ResourceFolder folder)
        {
            // Search for resources with the same name as a folder in the same directory
            for (var i = 0; i < folder.Resources.Count; i++)
            {
                var r = folder.Resources[i];

                if (folder.Folders.Any(p => p.Name == r.Name))
                {
                    TSLog.LogWarning(LogCategory.Compile,
                                     string.Format("Name for resource at [{0}] conflicts with a folder of the same name.", r.FullPath),
                                     AssetDatabase.LoadAssetAtPath(r.FullPath, typeof(Object)));

                    // Remove existing resource
                    if (!Remove(r))
                    {
                        throw new Exception("Fatal error, failed removing resource from ResourceDatabase. ");
                    }

                    // Add again with new name
                    folder.Resources.Add(new ResourceDefinition("_" + r.Name, r.Path, r.FullPath, r.Type));
                }
            }

            foreach (var resourceFolder in folder.Folders)
            {
                ValidateFolder(resourceFolder);
            }
        }
示例#7
0
        private void DrawResourceFolder(ResourceFolder folder)
        {
            bool expand = IsExpandedResourceFolder(folder);

            EditorGUILayout.BeginHorizontal();
            {
                bool foldout = EditorGUI.Foldout(new Rect(18f + 14f * folder.Depth, 20f * m_CurrentResourceRowOnDraw + 4f, int.MaxValue, 14f), expand, string.Empty, true);
                if (expand != foldout)
                {
                    expand = !expand;
                    SetExpandedResourceFolder(folder, expand);
                }

                GUI.DrawTexture(new Rect(32f + 14f * folder.Depth, 20f * m_CurrentResourceRowOnDraw + 3f, 16f, 16f), ResourceFolder.Icon);
                EditorGUILayout.LabelField(string.Empty, GUILayout.Width(44f + 14f * folder.Depth), GUILayout.Height(18f));
                EditorGUILayout.LabelField(folder.Name);
            }
            EditorGUILayout.EndHorizontal();

            m_CurrentResourceRowOnDraw++;

            if (expand)
            {
                foreach (ResourceFolder subFolder in folder.GetFolders())
                {
                    DrawResourceFolder(subFolder);
                }

                foreach (ResourceItem resourceItem in folder.GetItems())
                {
                    DrawResourceItem(resourceItem);
                }
            }
        }
示例#8
0
 public static ResourceFolderModel MapToModel(this ResourceFolder folder)
 {
     return(new ResourceFolderModel()
     {
         Name = folder.Name
     });
 }
示例#9
0
 public AddResponse(ResourceFolder newDir, Root root)
 {
     _added = new List <DTOBase>()
     {
         DTOBase.Create(newDir, root)
     };
 }
        private ResourceFolder GetFolderForPath(string path)
        {
            var components = path.Split('/');

            var f = RootFolder;

            for (var i = 0; i < components.Length - 1; i++)
            {
                var c = CompilerUtil.GetSafeName(components[i], true);

                var isDuplicate = f.Name == c;
                var folderName  = isDuplicate ? "_" + c : c;

                var folder = f.Folders.FirstOrDefault(p => p.Name == folderName);

                if (folder == null)
                {
                    var folderPath = components.Take(i).ToArray();

                    // Post warning the first time this folder is encountered
                    if (isDuplicate)
                    {
                        TSLog.LogWarning(LogCategory.Compile,
                                         string.Format(Strings.Warning_FolderNameCannotBeSameAsParent, string.Join("/", folderPath)));
                    }

                    folder = new ResourceFolder(folderName, string.Join("/", folderPath));
                    f.Folders.Add(folder);
                }

                f = folder;
            }

            return(f);
        }
        public IProgressMonitor ImportResourcesAsync(ResourceFolder parent, IEnumerable <string> pathes, List <ResourceItem> resourceItems, System.Action <IProgressMonitor> continueAction = null)
        {
            MessageDialogProgressMonitor monitor     = Services.ProgressMonitors.GetMessageDialogProgreeMonitor();
            CancellationTokenSource      tokenSource = new CancellationTokenSource();
            CancellationToken            token       = tokenSource.Token;
            Task task = Task.Factory.StartNew((System.Action)(() =>
            {
                IEnumerable <ResourceItem> collection = (IEnumerable <ResourceItem>) this.ImportResources(parent, pathes, (IProgressMonitor)monitor, token, (HashSet <string>)null);
                if (resourceItems == null || collection == null)
                {
                    return;
                }
                resourceItems.AddRange(collection);
            }), token);

            monitor.CancelRequested += (MonitorHandler)(m => tokenSource.Cancel());
            task.ContinueWith((System.Action <Task>)(a =>
            {
                Services.ProjectOperations.CurrentSelectedSolution.Save(Services.ProgressMonitors.Default);
                if (continueAction != null)
                {
                    continueAction((IProgressMonitor)monitor);
                }
                int num = (int)GLib.Timeout.Add(0U, (TimeoutHandler)(() =>
                {
                    monitor.Dispose();
                    if (monitor != null && monitor.Errors.Count == 0 && monitor.Warnings.Count == 0)
                    {
                        monitor.CloseDialogs();
                    }
                    return(false);
                }));
            }));
            return((IProgressMonitor)monitor);
        }
        public static void WriteResources(CodeTypeDeclaration type, ResourceFolder folder)
        {
            var containerType    = new CodeTypeReference(GetIResourceType(), 1);
            var createExpression = new CodeArrayCreateExpression(containerType);

            if (folder.Resources.Count > 0)
            {
                for (var i = 0; i < folder.Resources.Count; i++)
                {
                    var rd = folder.Resources[i];

                    // Add it to the array initializers
                    createExpression.Initializers.Add(GetResourceCreateExpression(rd));

                    WriteResourceProperty(type, rd, i);
                }
            }

            var containerField = new CodeMemberField(GetIResourceIListType(), CollectionMemberName)
            {
                InitExpression = new CodeObjectCreateExpression(GetIResourceReadOnlyCollectionType(), createExpression),
                Attributes     = MemberAttributes.Private | MemberAttributes.Static
            };

            type.Members.Add(containerField);
        }
示例#13
0
        private void DirectoryCopy(ResourceFolder sourceDir, ResourceFolder parentdestDir, string destName, bool copySubDirs)
        {
            var dirs = sourceDir.Children.OfType <ResourceFolder>().ToArray();

            // If the destination directory does not exist, create it.
            var destFolder = ResourceManager.Instance.CreateFolder(parentdestDir, destName);

            // Get the file contents of the directory to copy.
            var files = sourceDir.Children.OfType <ResourceFile>().ToArray();

            foreach (var file in files)
            {
                // Create the path to the new copy of the file.
                var newFile = new ResourceFile();
                file.CopyProperties <ResourceFile>(newFile);
                ResourceManager.Instance.AddResource(newFile);
            }

            // If copySubDirs is true, copy the subdirectories.
            if (copySubDirs)
            {
                foreach (var subdir in dirs)
                {
                    // Create the subdirectory.
                    var newFolder = ResourceManager.Instance.CreateFolder(parentdestDir, subdir.Name);
                    // Copy the subdirectories.
                    DirectoryCopy(subdir, newFolder, destName, true);
                }
            }
        }
            public ResourceFolder(string name, ResourceFolder folder)
            {
                m_Folders = new List <ResourceFolder>();
                m_Items   = new List <ResourceItem>();

                Name   = name;
                Folder = folder;
            }
示例#15
0
 public bool FolderExists(ResourceFolder resourceFolder, string newName)
 {
     return
         (Ctx.Resources
          .Single(f => f.ResourceId == resourceFolder.ResourceId)
          .Children
          .Any(f => f.Name == newName));
 }
示例#16
0
 public AddResourcesArgs(ResourceFolder parent, ResourceItem addItem, bool isExpand = true)
 {
     this.Parent   = parent;
     this.AddItems = (IEnumerable <ResourceItem>) new List <ResourceItem>()
     {
         addItem
     };
     this.IsExpand = isExpand;
 }
示例#17
0
        public AdvancedModule(string aPath, string aAppRoot)
            : base("openhome.org.advanced")
        {
            iMimeTypes = new Dictionary<string, string>();
            iMimeTypes.Add(".css", "text/css");
            iMimeTypes.Add(".js", "text/javascript");

            var path = Path.Combine(aPath, "http");
            iResourceFolder = new ResourceFolder(path, iMimeTypes, aAppRoot);
        }
示例#18
0
        public CocoStudio.Core.Document NewDocument(ResourceFolder parentFolder, IList <ResourceItem> selectesResource = null)
        {
            Project project = Services.ProjectOperations.AddNewProject(parentFolder, selectesResource);

            if (project != null)
            {
                return(this.OpenDocument(project));
            }
            return((CocoStudio.Core.Document)null);
        }
示例#19
0
 private void SetExpandedResourceFolder(ResourceFolder folder, bool expand)
 {
     if (expand)
     {
         m_ExpandedResourceFolderNames.Add(folder.FromRootPath);
     }
     else
     {
         m_ExpandedResourceFolderNames.Remove(folder.FromRootPath);
     }
 }
        /// <summary>
        /// Processes the file part.
        /// This helps recursively create our directory structure.
        /// </summary>
        /// <param name="resourceName">Name of the file.</param>
        /// <param name="parts">The parts.</param>
        /// <param name="folder">The folder.</param>
        /// <exception cref="System.Collections.Generic.KeyNotFoundException"></exception>
        private void ProcessFilePart(string resourceName, IEnumerable <string> parts, ResourceFolder folder)
        {
            resourceName = resourceName.Replace("\\", "/");

            if (parts.Count() == 1)
            {
                IResourceFile item = null;

                this._embeddedResourceItems.TryGetValue(GetResourceItemKey(resourceName), out item);

                var embeddedResourceFile = item as ResourceFile;
                if (embeddedResourceFile == null && !resourceName.EndsWith(".resx", StringComparison.OrdinalIgnoreCase))
                {
                    System.Diagnostics.Trace.TraceWarning("Could not find an embedded file {0} yet it was defined in embedded project file.", resourceName);
                }

                if (item != null)
                {
                    folder.AddFile(item);

                    // we can only infer the virtual path once we know the file location.
                    embeddedResourceFile.VirtualPath = "~/" + resourceName;
                    embeddedResourceFile.FileName    = parts.First();
                }
            }
            else if (parts.Count() > 1)
            {
                var originalPart = parts.First();
                var firstPart    = originalPart
                                   .Replace("-", "_"); // this is a MSBuild convention, folder paths cannot contain a -, they are converted to _ at build time.
                // File names can contain dashes on the other hand... go figure.

                var nextParts = parts.Skip(1);

                var childFolder = folder.Folders
                                  .OfType <ResourceFolder>()
                                  .FirstOrDefault(x => x.Name.Equals(firstPart, StringComparison.OrdinalIgnoreCase));

                if (childFolder == null)
                {
                    var virtualPath = (folder.VirtualPath ?? "~") + "/" + originalPart;

                    childFolder = new ResourceFolder()
                    {
                        Name        = firstPart,
                        VirtualPath = virtualPath
                    };

                    folder.AddFolder(childFolder);
                }

                this.ProcessFilePart(resourceName, nextParts, childFolder);
            }
        }
示例#21
0
 public User GetFolderOwner(ResourceFolder folder, int teamId)
 {
     if (folder == null)
     {
         return
             (Ctx.TeamMembers
              .Include("Role")
              .First(m => m.TeamLead && m.Team.Id == teamId)
              .Member);
     }
     return(folder.Owner);
 }
        public Project AddNewProject(ResourceFolder parentResourceItem, ProjectCreateInformation info)
        {
            Project project = Services.ProjectsService.CreateProject(info.ContentType, info);

            parentResourceItem.Items.Add((ResourceItem)project);
            IProgressMonitor monitor = Services.ProgressMonitors.Default;

            project.Save(monitor);
            project.Initialize(monitor);
            this.CurrentSelectedSolution.Save(monitor);
            return(project);
        }
示例#23
0
 /// <summary>
 /// Initialize new instanse of class <see cref="ElFinder.Root"/>
 /// </summary>
 /// <param name="directory">Directory which will be root</param>
 /// <param name="url">Url to root</param>
 public Root(ResourceFolder directory, string url)
 {
     if (directory == null)
     {
         throw new ArgumentNullException("directory", "Root directory can not be null");
     }
     _alias           = directory.Name;
     _directory       = directory;
     _url             = url;
     _uploadOverwrite = true;
     _thumbnailsSize  = 48;
 }
示例#24
0
        public static IApplicationBuilder UseDatabaseMigration(this IApplicationBuilder app)
        {
            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                var db = serviceScope.ServiceProvider.GetService <ApplicationDbContext>();
                db.Database.Migrate();
                var userManager = serviceScope.ServiceProvider.GetService <UserManager <User> >();
                var roleManager = serviceScope.ServiceProvider.GetService <RoleManager <IdentityRole> >();

                Task
                .Run(async() =>
                {
                    var dummyuser = await userManager.Users.FirstOrDefaultAsync();

                    if (dummyuser == null)
                    {
                        dummyuser = new User
                        {
                            Email    = "*****@*****.**",
                            UserName = "******"
                        };

                        await userManager.CreateAsync(dummyuser, "test12");
                    }

                    if (!db.ResourceFolders.Any())
                    {
                        var folder = new ResourceFolder()
                        {
                            Name = "Everything", LastModified = DateTime.Now, Path = "/"
                        };
                        db.ResourceFolders.Add(folder);
                    }

                    if (!roleManager.Roles.Any())
                    {
                        var streamer = new IdentityRole(WebConstants.StreamerRole);
                        var admin    = new IdentityRole(WebConstants.AdministratorRole);
                        await roleManager.CreateAsync(streamer);
                        await roleManager.CreateAsync(admin);
                        await userManager.AddToRoleAsync(dummyuser, WebConstants.StreamerRole);
                    }

                    await db.SaveChangesAsync();
                })
                .Wait();
            }

            return(app);
        }
示例#25
0
    public MagitekResult AddFolder(ResourceFolderModel folderModel, string parentNodePath, string diskLocation)
    {
        var folder = new ResourceFolder(folderModel.Name);

        var folderNode = new ResourceFolderNode(folder.Name, folder)
        {
            DiskLocation = diskLocation
        };

        Tree.TryGetNode(parentNodePath, out var parentNode);
        parentNode.AttachChildNode(folderNode);

        return(MagitekResult.SuccessResult);
    }
示例#26
0
    /// <summary>
    /// Adds the specified resource to the parent resource node
    /// </summary>
    /// <param name="parentNode">ResourceNode that is contained by the project</param>
    /// <param name="resource">New resource to add</param>
    /// <returns>The added resource node result</returns>
    public virtual MagitekResult <ResourceNode> AddResource(ResourceNode parentNode, IProjectResource resource)
    {
        var tree = _projects.FirstOrDefault(x => x.ContainsNode(parentNode));

        if (tree is null)
        {
            return(new MagitekResult <ResourceNode> .Failed($"{parentNode.Item.Name} is not contained within any loaded project"));
        }

        if (parentNode.ContainsChildNode(resource.Name))
        {
            return(new MagitekResult <ResourceNode> .Failed($"'{parentNode.Name}' already contains a child named '{resource.Name}'"));
        }
        else if (parentNode.Item.CanContainChildResources == false)
        {
            return(new MagitekResult <ResourceNode> .Failed($"'{parentNode.Name}' cannot contain children"));
        }

        try
        {
            ResourceNode childNode = resource switch
            {
                DataSource df => new DataFileNode(df.Name, df),
                ScatteredArranger arranger => new ArrangerNode(arranger.Name, arranger),
                Palette pal => new PaletteNode(pal.Name, pal),
                ResourceFolder folder => new ResourceFolderNode(folder.Name, folder),
                _ => null
            };

            if (childNode is null)
            {
                return(new MagitekResult <ResourceNode> .Failed($"Cannot add a resource of type '{resource.GetType()}'"));
            }

            var contents = _serializerFactory.CreateWriter(tree).SerializeResource(childNode);
            var location = ResourceFileLocator.LocateByParent(tree, parentNode, childNode);
            File.WriteAllText(location, contents);

            parentNode.AttachChildNode(childNode);
            childNode.DiskLocation = location;
            UpdateNodeModel(tree, childNode);

            return(new MagitekResult <ResourceNode> .Success(childNode));
        }
        catch (Exception ex)
        {
            return(new MagitekResult <ResourceNode> .Failed(ex.Message));
        }
    }
        public List <ResourceItem> MessgeDialogImprotResource(ResourceFolder parent, IEnumerable <string> pathes)
        {
            MessageDialogProgressMonitor dialogProgreeMonitor = Services.ProgressMonitors.GetMessageDialogProgreeMonitor();
            ImportResourceResult         dic = FileOptionHelp.CopyToDic(parent, pathes, (IProgressMonitor)dialogProgreeMonitor, CancellationToken.None, (IEnumerable <string>)null);

            dialogProgreeMonitor.Dispose();
            if (dialogProgreeMonitor != null && dialogProgreeMonitor.Errors.Count == 0 && dialogProgreeMonitor.Warnings.Count == 0)
            {
                dialogProgreeMonitor.CloseDialogs();
            }
            IEnumerable <ResourceItem> addItems = dic.AddResourcePanelItems.Union <ResourceItem>((IEnumerable <ResourceItem>)dic.ImportResources);

            Services.EventsService.GetEvent <AddResourcesEvent>().Publish(new AddResourcesArgs(parent, addItems, true));
            return(dic.ImportResources);
        }
示例#28
0
        public static List <string> GetAllFilesByFolder(ResourceFolder folder)
        {
            List <string> stringList = new List <string>();
            IEnumerable <ResourceItem> resourceItems = folder.Items.Where <ResourceItem>((Func <ResourceItem, bool>)(n => n is ResourceFolder));
            IEnumerable <string>       collection    = folder.Items.Where <ResourceItem>((Func <ResourceItem, bool>)(n => n is ResourceFile)).Select <ResourceItem, string>((Func <ResourceItem, string>)(n => n.FullPath));

            stringList.AddRange(collection);
            foreach (ResourceItem resourceItem in resourceItems)
            {
                stringList.Add(resourceItem.FullPath);
                List <string> allFilesByFolder = FileOptionHelp.GetAllFilesByFolder((ResourceFolder)resourceItem);
                stringList.AddRange((IEnumerable <string>)allFilesByFolder);
            }
            return(stringList);
        }
        /// <summary>
        /// This class contains all our GUI Content labels that we use in Script Forge
        /// </summary>
        public override void WriteClassContent()
        {
            ResourceFolder rootFolder = new ResourceFolder(string.Empty);

            for (int i = 0; i < m_ResourcePaths.Length; i++)
            {
                rootFolder.Add(m_ResourcePaths[i]);
            }

            // We want to skip over the root since it's empty
            for (int i = 0; i < rootFolder.children.Count; i++)
            {
                WriteTree(rootFolder.children[i]);
            }
        }
示例#30
0
        private void OnEnable()
        {
            m_Controller = new ResourceEditorController();
            m_Controller.OnLoadingResource += OnLoadingResource;
            m_Controller.OnLoadingAsset    += OnLoadingAsset;
            m_Controller.OnLoadCompleted   += OnLoadCompleted;
            m_Controller.OnAssetAssigned   += OnAssetAssigned;
            m_Controller.OnAssetUnassigned += OnAssetUnassigned;

            m_MenuState                        = MenuState.Normal;
            m_SelectedResource                 = null;
            m_ResourceRoot                     = new ResourceFolder("Resources", null);
            m_ExpandedResourceFolderNames      = new HashSet <string>();
            m_SelectedAssetsInSelectedResource = new HashSet <Asset>();
            m_ExpandedSourceFolders            = new HashSet <SourceFolder>();
            m_SelectedSourceAssets             = new HashSet <SourceAsset>();
            m_MissingSourceAssetIcon           = EditorGUIUtility.IconContent("console.warnicon.sml").image;

            m_CachedSelectedSourceFolders   = new HashSet <SourceFolder>();
            m_CachedUnselectedSourceFolders = new HashSet <SourceFolder>();
            m_CachedAssignedSourceFolders   = new HashSet <SourceFolder>();
            m_CachedUnassignedSourceFolders = new HashSet <SourceFolder>();
            m_CachedAssignedSourceAssets    = new HashSet <SourceAsset>();
            m_CachedUnassignedSourceAssets  = new HashSet <SourceAsset>();

            m_ResourcesViewScroll         = Vector2.zero;
            m_ResourceViewScroll          = Vector2.zero;
            m_SourceAssetsViewScroll      = Vector2.zero;
            m_InputResourceName           = null;
            m_InputResourceVariant        = null;
            m_HideAssignedSourceAssets    = false;
            m_CurrentResourceContentCount = 0;
            m_CurrentResourceRowOnDraw    = 0;
            m_CurrentSourceRowOnDraw      = 0;

            if (m_Controller.Load())
            {
                Debug.Log("Load configuration success.");
            }
            else
            {
                Debug.LogWarning("Load configuration failure.");
            }

            EditorUtility.DisplayProgressBar("Prepare Resource Editor", "Processing...", 0f);
            RefreshResourceTree();
            EditorUtility.ClearProgressBar();
        }
示例#31
0
            public ResourceItem(string name, Resource resource, ResourceFolder folder)
            {
                if (resource == null)
                {
                    throw new GameFrameworkException("Resource is invalid.");
                }

                if (folder == null)
                {
                    throw new GameFrameworkException("Resource folder is invalid.");
                }

                Name     = name;
                Resource = resource;
                Folder   = folder;
            }
示例#32
0
        public ManualsXapp(IAppHandler aHandler)
        {
            iHandler = aHandler;

            iXappMimeTypes = new Dictionary<string, string>();
            iXappMimeTypes.Add(".css", "text/css");

            iGitMimeTypes = new Dictionary<string, string>();
            iGitMimeTypes.Add(".md", "text/md");
            iGitMimeTypes.Add(".html", "text/html");
            iGitMimeTypes.Add(".css", "text/css");
            iGitMimeTypes.Add(".js", "text/javascript");
            iGitMimeTypes.Add(".jpg", "image/jpg");
            iGitMimeTypes.Add(".png", "image/png");

            iResourceFolder = new ResourceFolder("http", iXappMimeTypes, iHandler.AppRoot);

            iGitPath = Path.Combine(iHandler.DataRoot, "GitManuals");

            iRepository = GitFactory.Open(iGitPath, "git://github.com/cropotkin/Documentation.git");

            iRepository.Fetch();

            iMarkdown = new Markdown();

            iAdvancedModule = new AdvancedModule("openhome.org.advanced", iHandler.AppRoot);

            iHandler.RegisterXapp(this, "xapp/main.css", iAdvancedModule);
        }