Example #1
0
        protected virtual bool LoadTarget()
        {
            var result = false;
            var path   = file.FullPath;

            try {
                result = (!string.IsNullOrEmpty(path) &&
                          File.Exists(path) &&
                          (target == null
                                        ? (target = format.CreateTexture(2, 2))
                                        : target).LoadImage(File.ReadAllBytes(path), markNonReadable));

                if (result)
                {
                    Debug.LogFormat("Load Image : {0}", path);
                    target.name      = path;
                    target.hideFlags = HideFlags.DontSave;
                }
                else
                {
                    target.Destroy();
                    target = null;
                }
            } catch (System.Exception e) {
                Debug.LogErrorFormat("Exception at loading : {0}\n{1}", path, e);
            }
            return(result);
        }
Example #2
0
        protected virtual bool LoadTarget()
        {
            var result = false;

            try {
                var path = file.FullPath;
                result = (!string.IsNullOrEmpty(path) &&
                          File.Exists(path) &&
                          (target == null
                                        ? (target = format.CreateTexture(2, 2))
                                        : target).LoadImage(File.ReadAllBytes(path)));

                if (result)
                {
                    Debug.LogFormat("Load Image : {0}", path);
                    target.name = path;
                }
                else
                {
                    target.Destroy();
                    target = null;
                }
            } catch { }
            return(result);
        }