void AddIconPaths(PArray icons, PArray iconFiles, string productsDir)
        {
            foreach (var icon in iconFiles.Cast <PString> ().Where(p => p.Value != null))
            {
                var  path       = string.Format("Applications/{0}/{1}", Path.GetFileName(AppBundleDir.ItemSpec), icon.Value);
                bool addDefault = true;

                if (path.EndsWith(".png", StringComparison.Ordinal))
                {
                    icons.Add(new PString(path));
                    continue;
                }

                if (File.Exists(Path.Combine(productsDir, path + "@3x.png")))
                {
                    icons.Add(new PString(path + "@3x.png"));
                    addDefault = false;
                }

                if (File.Exists(Path.Combine(productsDir, path + "@2x.png")))
                {
                    icons.Add(new PString(path + "@2x.png"));
                    addDefault = false;
                }

                if (addDefault || File.Exists(Path.Combine(productsDir, path + ".png")))
                {
                    icons.Add(new PString(path + ".png"));
                }
            }
        }
Example #2
0
        void AddIconPaths(PArray icons, PArray iconFiles, string productsDir)
        {
            foreach (var icon in iconFiles.Cast<PString> ().Where (p => p.Value != null)) {
                var path = string.Format ("Applications/{0}/{1}", Path.GetFileName (AppBundleDir.ItemSpec), icon.Value);
                bool addDefault = true;

                if (path.EndsWith (".png", StringComparison.Ordinal)) {
                    icons.Add (new PString (path));
                    continue;
                }

                if (File.Exists (Path.Combine (productsDir, path + "@3x.png"))) {
                    icons.Add (new PString (path + "@3x.png"));
                    addDefault = false;
                }

                if (File.Exists (Path.Combine (productsDir, path + "@2x.png"))) {
                    icons.Add (new PString (path + "@2x.png"));
                    addDefault = false;
                }

                if (addDefault || File.Exists (Path.Combine (productsDir, path + ".png")))
                    icons.Add (new PString (path + ".png"));
            }
        }