Exemplo n.º 1
0
        public static FDImage GetImageForFile(string file)
        {
            if (file == null || file == string.Empty)
            {
                return(Icons.BlankFile);
            }
            string ext = Path.GetExtension(file).ToLower();

            if (FileInspector.IsActionScript(file, ext))
            {
                return(Icons.ActionScript);
            }
            else if (FileInspector.IsHaxeFile(file, ext))
            {
                return(Icons.HaxeFile);
            }
            else if (FileInspector.IsMxml(file, ext))
            {
                return(Icons.MxmlFile);
            }
            else if (FileInspector.IsFont(file, ext))
            {
                return(Icons.Font);
            }
            else if (FileInspector.IsImage(file, ext) || ext == ".ico")
            {
                return(Icons.ImageResource);
            }
            else if (FileInspector.IsSwf(file, ext))
            {
                return(Icons.SwfFile);
            }
            else if (FileInspector.IsSwc(file, ext))
            {
                return(Icons.SwcFile);
            }
            else if (FileInspector.IsHtml(file, ext))
            {
                return(Icons.HtmlFile);
            }
            else if (FileInspector.IsXml(file, ext))
            {
                return(Icons.XmlFile);
            }
            else if (FileInspector.IsText(file, ext))
            {
                return(Icons.TextFile);
            }
            else if (FileInspector.IsFLA(file, ext))
            {
                return(Icons.FlashCS3);
            }
            else
            {
                return(ExtractIconIfNecessary(file));
            }
        }
Exemplo n.º 2
0
        public override void Refresh(bool recursive)
        {
            base.Refresh(recursive);

            string path = BackingPath;
            string ext  = Path.GetExtension(path).ToLower();

            if (Project.IsPathHidden(path))
            {
                ImageIndex = Icons.HiddenFile.Index;
            }
            else if ((FileInspector.IsActionScript(path, ext) || FileInspector.IsHaxeFile(path, ext)) && Project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsMxml(path, ext) && Project.IsCompileTarget(path))
            {
                ImageIndex = Icons.MxmlFileCompile.Index;
            }
            else if (FileInspector.IsCss(path, ext) && Project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsSwc(path) && Parent == null) // external SWC library
            {
                ImageIndex = Icons.Classpath.Index;
            }
            else
            {
                ImageIndex = Icons.GetImageForFile(path).Index;
            }

            SelectedImageIndex = ImageIndex;

            Text = Path.GetFileName(path);

            if (Project.IsLibraryAsset(path))
            {
                ForeColorRequest = Color.Blue;
                LibraryAsset asset = Project.GetAsset(path);

                if (asset != null && asset.HasManualID)
                {
                    Text += " (" + asset.ManualID + ")";
                }
            }
            else
            {
                ForeColorRequest = Color.Black;
            }

            // hook for plugins
            if (OnFileNodeRefresh != null)
            {
                OnFileNodeRefresh(this);
            }
        }
Exemplo n.º 3
0
        public static FDImage GetImageForFile(string file)
        {
            if (string.IsNullOrEmpty(file))
            {
                return(BlankFile);
            }
            string ext = Path.GetExtension(file).ToLower();

            if (FileInspector.IsActionScript(file, ext))
            {
                return(ActionScript);
            }
            else if (FileInspector.IsHaxeFile(file, ext))
            {
                return(HaxeFile);
            }
            else if (FileInspector.IsMxml(file, ext))
            {
                return(MxmlFile);
            }
            else if (FileInspector.IsFont(file, ext))
            {
                return(Font);
            }
            else if (FileInspector.IsImage(file, ext) || ext == ".ico")
            {
                return(ImageResource);
            }
            else if (FileInspector.IsSwf(file, ext))
            {
                return(SwfFile);
            }
            else if (FileInspector.IsSwc(file, ext))
            {
                return(SwcFile);
            }
            else if (FileInspector.IsHtml(file, ext))
            {
                return(HtmlFile);
            }
            else if (FileInspector.IsXml(file, ext))
            {
                return(XmlFile);
            }
            else if (FileInspector.IsText(file, ext))
            {
                return(TextFile);
            }
            else if (FileInspector.IsFLA(file, ext))
            {
                return(FlashCS3);
            }
            else
            {
                return(ExtractIconIfNecessary(file));
            }
        }
Exemplo n.º 4
0
        public override string GetInsertFileText(string inFile, string path, string export, string nodeType)
        {
            bool isInjectionTarget = (UsesInjection && path == GetAbsolutePath(InputPath));

            if (export != null)
            {
                return(export);
            }
            if (IsLibraryAsset(path) && !isInjectionTarget)
            {
                return(GetAsset(path).ID);
            }
            else if (!NoOutput && FileInspector.IsActionScript(inFile, Path.GetExtension(inFile).ToLower()))
            {
                return(ProjectPaths.GetRelativePath(Path.GetDirectoryName(ProjectPath), path).Replace('\\', '/'));
            }
            else
            {
                return(ProjectPaths.GetRelativePath(Path.GetDirectoryName(inFile), path).Replace('\\', '/'));
            }
        }
Exemplo n.º 5
0
        private void AddItems(MergableMenu menu, GenericNode node)
        {
            string path = node.BackingPath;

            if (node.IsInvalid)
            {
                if (node is ClasspathNode)
                {
                    AddInvalidClassPathNodes(menu, path);
                }

                /*else if (node is FileNode)
                 * {
                 *  string ext = Path.GetExtension(path).ToLower();
                 *  if (FileInspector.IsSwc(path, ext)) AddInvalidSwcItems(menu, path);
                 * }*/
                return;
            }
            if (node is ProjectNode)
            {
                AddProjectItems(menu);
            }
            else if (node is ClasspathNode)
            {
                AddClasspathItems(menu, path);
            }
            else if (node is DirectoryNode)
            {
                AddFolderItems(menu, path);
            }
            else if (node is ProjectOutputNode)
            {
                AddProjectOutputItems(menu, node as ProjectOutputNode);
            }
            else if (node is ExportNode)
            {
                AddExportItems(menu, node as ExportNode);
            }
            else if (node is FileNode)
            {
                string ext = Path.GetExtension(path).ToLower();
                if (FileInspector.IsActionScript(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsHaxeFile(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsMxml(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsCss(path, ext))
                {
                    AddCssItems(menu, path);
                }
                else if (FileInspector.IsSwf(path, ext))
                {
                    AddSwfItems(menu, path);
                }
                else if (FileInspector.IsSwc(path, ext))
                {
                    AddSwcItems(menu, path);
                }
                else if (FileInspector.IsResource(path, ext))
                {
                    AddOtherResourceItems(menu, path);
                }
                else
                {
                    AddGenericFileItems(menu, path);
                }
            }
        }
Exemplo n.º 6
0
        public override void Refresh(bool recursive)
        {
            base.Refresh(recursive);

            Project project = MyProject;
            string  path    = BackingPath;
            string  ext     = Path.GetExtension(path).ToLower();

            if (project.IsPathHidden(path))
            {
                ImageIndex = Icons.HiddenFile.Index;
            }
            else if ((FileInspector.IsActionScript(path, ext) || FileInspector.IsHaxeFile(path, ext)) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsMxml(path, ext) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.MxmlFileCompile.Index;
            }
            else if (FileInspector.IsCss(path, ext) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsSwc(path) && Parent == null) // external SWC library
            {
                ImageIndex = Icons.Classpath.Index;
            }
            else
            {
                ImageIndex = Icons.GetImageForFile(path).Index;
            }

            SelectedImageIndex = ImageIndex;

            Text = Path.GetFileName(path);

            if (project.IsLibraryAsset(path))
            {
                ForeColorRequest = Color.Blue;
                LibraryAsset asset = project.GetAsset(path);

                if (asset != null && asset.HasManualID)
                {
                    Text += " (" + asset.ManualID + ")";
                }
            }
            else
            {
                Color color = PluginCore.PluginBase.MainForm.GetThemeColor("ProjectTreeView.ForeColor");
                if (color != Color.Empty)
                {
                    ForeColorRequest = color;
                }
                else
                {
                    ForeColorRequest = SystemColors.ControlText;
                }
            }

            // hook for plugins
            if (OnFileNodeRefresh != null)
            {
                OnFileNodeRefresh(this);
            }
        }
Exemplo n.º 7
0
        public override void Refresh(bool recursive)
        {
            base.Refresh(recursive);

            string path = BackingPath;
            string ext  = Path.GetExtension(path).ToLower();

            if (project != null && project.IsPathHidden(path))
            {
                ImageIndex = Icons.HiddenFile.Index;
            }
            else if ((FileInspector.IsActionScript(path, ext) || FileInspector.IsHaxeFile(path, ext)) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsMxml(path, ext) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.MxmlFileCompile.Index;
            }
            else if (FileInspector.IsCss(path, ext) && project.IsCompileTarget(path))
            {
                ImageIndex = Icons.ActionScriptCompile.Index;
            }
            else if (FileInspector.IsSwc(path) && Parent == null) // external SWC library
            {
                ImageIndex = Icons.Classpath.Index;
            }
            else
            {
                ImageIndex = Icons.GetImageForFile(path).Index;
            }
            SelectedImageIndex = ImageIndex;

            Text = Path.GetFileName(path);

            string colorId = "ProjectTreeView.ForeColor";

            if (project != null && project.IsLibraryAsset(path))
            {
                LibraryAsset asset = project.GetAsset(path);
                if (asset != null && asset.IsSwc)
                {
                    if (asset.SwfMode == SwfAssetMode.ExternalLibrary)
                    {
                        colorId = "ProjectTreeView.ExternalLibraryTextColor";
                    }
                    else if (asset.SwfMode == SwfAssetMode.Library)
                    {
                        colorId = "ProjectTreeView.LibraryTextColor";
                    }
                    else if (asset.SwfMode == SwfAssetMode.IncludedLibrary)
                    {
                        colorId = "ProjectTreeView.IncludedLibraryTextColor";
                    }
                }

                if (asset != null && asset.HasManualID)
                {
                    Text += " (" + asset.ManualID + ")";
                }
            }

            Color textColor = PluginBase.MainForm.GetThemeColor(colorId);

            if (colorId != "ProjectTreeView.ForeColor" && textColor == Color.Empty)
            {
                textColor = SystemColors.Highlight;
            }

            if (textColor != Color.Empty)
            {
                ForeColorRequest = textColor;
            }
            else
            {
                ForeColorRequest = SystemColors.ControlText;
            }

            // hook for plugins
            if (OnFileNodeRefresh != null)
            {
                OnFileNodeRefresh(this);
            }
        }