Exemple #1
0
        public static TpsFileSave Load(string filename, out TpsLoadResult result)
        {
            result = new TpsLoadResult();

            if (string.IsNullOrEmpty(filename))
            {
                result.ErrorMessage = "Passed null file name, could not load TpsFileSave";
                return(null);
            }

            TpsFileSave tps = null;

            try
            {
                tps = FileManager.XmlDeserialize <TpsFileSave>(filename);

                tps.Filename = filename.Replace("/", "\\");
                tps.SetupFile();
            }
            catch (FileNotFoundException)
            {
                result.ErrorMessage = "The Texture Packer Settings file does not exist";
                return(null);
            }
            catch (IOException ex)
            {
                result.ErrorMessage = ex.Message;
                return(null);
            }

            tps.SetupFile();

            return(tps);
        }
Exemple #2
0
        public static TpsFileSave Load(string filename, out TpsLoadResult result)
        {
            result = new TpsLoadResult();

            if (string.IsNullOrEmpty(filename))
            {
                result.ErrorMessage = "Passed null file name, could not load TpsFileSave";
                return null;
            }

            TpsFileSave tps = null;

            try
            {
                tps = FileManager.XmlDeserialize<TpsFileSave>(filename);

                tps.Filename = filename.Replace("/", "\\");
                tps.SetupFile();
            }
            catch (FileNotFoundException)
            {
                result.ErrorMessage = "The Texture Packer Settings file does not exist";
                return null;
            }
            catch (IOException ex)
            {
                result.ErrorMessage = ex.Message;
                return null;
            }

            tps.SetupFile();

            return tps;
        }