Exemple #1
0
        private void importIconDefinitions()
        {
            Console.Write("Reading icon definitions...");
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(getStringFromRessource("legacy-icon-mapping.xml"));

            // Retrieve all ContextType from the xml
            XmlNodeList entries = doc.SelectNodes("mapping/context");

            foreach (XmlNode context in entries)
            {
                string con = context.Attributes["dir"].Value;
                //Console.WriteLine(con);
                XmlNodeList fdoIconNodes = context.SelectNodes("icon");
                foreach (XmlNode icon in fdoIconNodes)
                {
                    CIcon iconObj = new CIcon();
                    iconObj.Context = strToContext(con);
                    iconObj.FdoName = icon.Attributes["name"].Value;
                    //Console.WriteLine(iconObj.NewName);
                    XmlNodeList links = icon.SelectNodes("link");
                    foreach (XmlNode link in links)
                    {
                        iconObj.LinkedNames.Add(link.InnerText);
                    }
                    fdoIcons.Add(iconObj);
                }
            }
            Console.WriteLine("finished");
        }
Exemple #2
0
        private void addThemeIcon(CIcon icon)
        {
            IconList list = getIconList(icon.Size);

            //Console.WriteLine("Icons: "+list.Icons.ToString());
            if (findThemeIcon(icon.FdoName, list) == null)
            {
                list.Icons.Add(icon);
                IconCount += 1;
            }
        }
Exemple #3
0
        public void ImportIcons(string Path)
        {
            int filecount = 0;

            Console.Write("Searching for icons...");
            //Find all icon files
            ArrayList filenameTypes = new ArrayList();

            filenameTypes.Add(getFiles(Path, "*.png", SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path, "*.jpeg", SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path, "*.jpg", SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path, "*.svg", SearchOption.AllDirectories));
            if (StatusWindow != null)
            {
                foreach (ArrayList files in filenameTypes)
                {
                    filecount += files.Count;
                }
                StatusWindow.SetDetailProgressStep(filecount + 1);
            }
            int stcount  = 0;
            int nstcount = 0;

            foreach (ArrayList filelist in filenameTypes)
            {
                foreach (string file in filelist)
                {
                    if (StatusWindow != null)
                    {
                        StatusWindow.SetDetailProgress(stcount.ToString() + " standard icons found, " + nstcount.ToString() + " non standard icons found");
                    }
                    try {
                        CIcon fdoIcon = getFdoIcon(file);
                        CIcon icon    = new CIcon();
                        icon.Filename = file;
                        icon.LoadImage(file);
                        if (fdoIcon != null)
                        {
                            icon.FdoName     = fdoIcon.FdoName;
                            icon.Context     = fdoIcon.Context;
                            icon.LinkedNames = fdoIcon.LinkedNames;                             //it's ok to pass a pointer...search names are not changing
                            stcount++;
                        }
                        else
                        {
                            icon.FdoName = System.IO.Path.GetFileNameWithoutExtension(file);
                            nstcount++;
                        }
                        addThemeIcon(icon);
                        //Console.WriteLine("Orig : "+file+", Now: "+fdoIcon.FdoName);
                        insertIntoDirectoryList(icon.GetSizeDir() + '/' + contextToStr(icon.Context));
                    }catch (Exception e) {
                        Console.WriteLine("ImportError: " + e.Message);
                    }
                }
            }
            Console.WriteLine(stcount.ToString() + " fd.o icons found");
            Console.WriteLine(nstcount.ToString() + " non fd.o icons found");

//			Console.WriteLine("Directory-Entries: "+getDirectoryEntries());
        }
        private void importIconDefinitions()
        {
            Console.Write("Reading icon definitions...");
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(getStringFromRessource("legacy-icon-mapping.xml"));

            // Retrieve all ContextType from the xml
            XmlNodeList entries = doc.SelectNodes("mapping/context");

            foreach(XmlNode context in entries){
                string con = context.Attributes["dir"].Value;
                //Console.WriteLine(con);
                XmlNodeList fdoIconNodes = context.SelectNodes("icon");
                foreach(XmlNode icon in fdoIconNodes){
                    CIcon iconObj = new CIcon();
                    iconObj.Context = strToContext(con);
                    iconObj.FdoName = icon.Attributes["name"].Value;
                    //Console.WriteLine(iconObj.NewName);
                    XmlNodeList links = icon.SelectNodes("link");
                    foreach(XmlNode link in links)
                        iconObj.LinkedNames.Add(link.InnerText);
                    fdoIcons.Add(iconObj);
                }
            }
            Console.WriteLine("finished");
        }
 private void addThemeIcon(CIcon icon)
 {
     IconList list = getIconList(icon.Size);
     //Console.WriteLine("Icons: "+list.Icons.ToString());
     if (findThemeIcon(icon.FdoName,list) == null){
         list.Icons.Add(icon);
         IconCount+=1;
     }
 }
        public void ImportIcons(string Path)
        {
            int filecount = 0;
            Console.Write("Searching for icons...");
            //Find all icon files
            ArrayList filenameTypes = new ArrayList();
            filenameTypes.Add(getFiles(Path,"*.png",SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path,"*.jpeg",SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path,"*.jpg",SearchOption.AllDirectories));
            filenameTypes.Add(getFiles(Path,"*.svg",SearchOption.AllDirectories));
            if (StatusWindow != null){
                foreach (ArrayList files in filenameTypes)
                    filecount+=files.Count;
                StatusWindow.SetDetailProgressStep(filecount+1);
            }
            int stcount=0;
            int nstcount=0;
            foreach(ArrayList filelist in filenameTypes){
                foreach(string file in filelist){
                    if (StatusWindow != null){
                        StatusWindow.SetDetailProgress(stcount.ToString()+" standard icons found, "+nstcount.ToString()+" non standard icons found");
                    }
                    try {
                        CIcon fdoIcon = getFdoIcon(file);
                        CIcon icon=new CIcon();
                        icon.Filename = file;
                        icon.LoadImage(file);
                        if (fdoIcon!=null) {
                            icon.FdoName = fdoIcon.FdoName;
                            icon.Context = fdoIcon.Context;
                            icon.LinkedNames = fdoIcon.LinkedNames; //it's ok to pass a pointer...search names are not changing
                            stcount++;
                        } else{
                            icon.FdoName = System.IO.Path.GetFileNameWithoutExtension(file);
                            nstcount++;
                        }
                        addThemeIcon(icon);
                        //Console.WriteLine("Orig : "+file+", Now: "+fdoIcon.FdoName);
                        insertIntoDirectoryList(icon.GetSizeDir()+'/'+contextToStr(icon.Context));
                    }catch (Exception e){
                        Console.WriteLine("ImportError: "+e.Message);
                    }
                }
            }
            Console.WriteLine(stcount.ToString()+" fd.o icons found");
            Console.WriteLine(nstcount.ToString()+" non fd.o icons found");

            //			Console.WriteLine("Directory-Entries: "+getDirectoryEntries());
        }