Пример #1
0
        public static string ApplyCustomData(CustomTileData tData, int index, CustomType type)
        {
            string key = tData.path + "@" + (object)tData.checksum + ".png";

            if (tData.texture != null)
            {
                string str = DuckFile.GetCustomDownloadDirectory(type) + key;
                if (!File.Exists(str))
                {
                    DuckFile.CreatePath(str);
                    FileStream fileStream = File.Create(str);
                    tData.texture.SaveAsPng((Stream)fileStream, tData.texture.Width, tData.texture.Height);
                    fileStream.Close();
                }
            }
            else if (tData.path == null)
            {
                return("");
            }
            Custom._customTilesetData[type][key] = tData;
            Custom.data[type][index]             = key;
            return(key);
        }