コード例 #1
0
        public void LoadGallery()
        {
            string currDirectory = System.AppDomain.CurrentDomain.BaseDirectory;

#if FINAL
            string fullPath = currDirectory + "\\galleries\\materials\\";
#else
            string fullPath = Path.Combine(currDirectory, "..\\..\\galleries\\materials\\");
#endif

            string[] paths = Directory.GetFiles(fullPath); // TODO poprawić ścieżkę w finalnej wersji

            foreach (string path in paths)
            {
                string file = Path.GetFileNameWithoutExtension(path);

                List <Material_> mat      = Material_.LoadMaterials(path);
                Material_        material = mat != null ? mat[0] : null;
                if (material != null)
                {
                    //bezier.Name = file;

#if FINAL
                    string ImageUri = currDirectory + "\\galleries\\materials\\" + material.Name + ".png";
#else
                    string ImageUri = AppDomain.CurrentDomain.BaseDirectory + "..\\..\\galleries\\materials\\" + material.Name + ".png";
#endif
                    Add(new Surface(material, ImageUri)); // TODO poprawić ścieżkę w finalnej wersji
                }
            }
        }
コード例 #2
0
        public void LoadGallery()
        {
            List <Material_> materials = Material_.LoadMaterials("../../galleries/MaterialsGallery.txt"); // TODO poprawić ścieżkę w finalnej wersji

            if (materials == null)
            {
                SaveGallery();
            }
            else
            {
                foreach (Material_ material in materials)
                {
                    Add(new Surface(material, "Ikony/Swiatla/" + material.name + ".png"));
                }
            }
        }