public static void LoadTextureData(StreamReader read)
        {
            //variables to initialize new TextureData when read in
            string filePath = null;
            string fileName = null;
            int textureID = -1;
            string spriteType = "";
            bool isTiled = false;
            bool isAnimated = false;
            int tileWidth = 0;
            int tileHeight = 0;

            string line = read.ReadLine();
            string elementName = null;

            do
            {
                string[] stringSeparators = new string[] { ":" };
                string[] result = line.Split(stringSeparators,
                StringSplitOptions.RemoveEmptyEntries);
                elementName = result[0];

                switch (elementName)
                {
                    case "FilePath":
                        {
                            filePath = result[1];
                            break;
                        }
                    case "FileName":
                        {
                            fileName = result[1];
                            break;
                        }
                    case "TextureID":
                        {
                            int value;
                            if (int.TryParse(result[1], out value)) textureID = value;
                            break;
                        }
                    case "SpriteType":
                        {
                            if (result.Length > 1) spriteType = result[1];
                            break;
                        }
                    case "IsTiled":
                        {
                            bool value;
                            if (bool.TryParse(result[1], out value)) isTiled = value;
                            break;
                        }
                    case "IsAnimated":
                        {
                            bool value;
                            if (bool.TryParse(result[1], out value)) isAnimated = value;
                            break;
                        }
                    case "TileWidth":
                        {
                            int value;
                            if (int.TryParse(result[1], out value)) tileWidth = value;
                            break;
                        }
                    case "TileHeight":
                        {
                            int value;
                            if (int.TryParse(result[1], out value)) tileHeight = value;
                            break;
                        }
                    default:
                        break;
                }
                line = read.ReadLine();
            } while (line != "<ENDTEXTUREDATA>");

            TextureData textureData = new TextureData(filePath, fileName, textureID, spriteType, isTiled, isAnimated, tileWidth, tileHeight);
            LevelDataManager.Load(textureData);

            return;
        }
 //pass initialized TextureData, for loading of levels in mapeditor and game
 public static void Load(TextureData newTexture)
 {
     if (newTexture.SpriteType == "EFFECT")
     {
         newTexture.Texture = effectsContent.Load<Texture2D>(newTexture.FilePath);
         LevelDataManager.effectTextures.Add(newTexture);
     }
     else
     {
         newTexture.Texture = levelContent.Load<Texture2D>(newTexture.FilePath);
         LevelDataManager.levelTextures.Add(newTexture);
     }
 }
 private static void CreateID(TextureData newTexture)
 {
     newTexture.TextureID += 1;
         foreach (TextureData loadedTextures in levelTextures)
         {
             if (loadedTextures.TextureID == newTexture.TextureID) CreateID(newTexture);
         }
     return;
 }
 //pass initialized TextureData, for loading of levels in mapeditor and game
 public static void Load(TextureData newTexture)
 {
     newTexture.Texture = content.Load<Texture2D>(newTexture.FilePath);
     LevelDataManager.levelTextures.Add(newTexture);
 }
        public static int Load(string filepath, bool isTiled, int tileWidth, int tileHeight)
        {
            int loadedTextureID = -1;
            TextureData newTexture = new TextureData();
            newTexture.FilePath = filepath;
            string[] seperators = new string[] { @"\" };
            string[] result2 = filepath.Split(seperators, StringSplitOptions.RemoveEmptyEntries);
            newTexture.FileName = result2[result2.Length - 1];

            //if the texture in the filepath is already loaded, return the ID
            loadedTextureID = IsTextureLoaded(newTexture.FileName);

            if (loadedTextureID != -1)
            {
                int loadedIndex = GetIndexByID(loadedTextureID);
                levelTextures[loadedIndex].IsTiled = isTiled;
                levelTextures[loadedIndex].TileWidth = tileWidth;
                levelTextures[loadedIndex].TileHeight = tileHeight;
                return loadedTextureID;
            }

            //if it wasnt already loaded, load it and generate an ID, and return the new ID
            else
            {
                newTexture.IsTiled = isTiled;
                newTexture.TileWidth = tileWidth;
                newTexture.TileHeight = tileHeight;
                newTexture.Texture = content.Load<Texture2D>(newTexture.FilePath);
                if (newTexture.TextureID < 0) CreateID(newTexture);
                LevelDataManager.levelTextures.Add(newTexture);
                return newTexture.TextureID;
            }
        }
        //asks the level manager to load a texture, returns Texture ID or -1 if the ID
        public static int Load(string filepath)
        {
            int loadedTextureID = -1;
            TextureData newTexture = new TextureData();
            newTexture.FilePath = filepath;
            string[] seperators = new string[] { @"\" };
            string[] result2 = filepath.Split(seperators, StringSplitOptions.RemoveEmptyEntries);
            newTexture.FileName = result2[result2.Length - 1];

            //if the texture in the filepath is already loaded, return the ID
            loadedTextureID = IsTextureLoaded(newTexture.FileName);
            if (loadedTextureID != -1) return loadedTextureID;

            //if it wasnt already loaded, load it and generate an ID, and return the new ID
            newTexture.IsTiled = false;
            newTexture.Texture = content.Load<Texture2D>(newTexture.FilePath);
            if (newTexture.TextureID < 0) CreateID(newTexture);
            LevelDataManager.levelTextures.Add(newTexture);
            return newTexture.TextureID;
        }