Esempio n. 1
0
        bool LoadPresetFile(string fileName, ScreenshotHelper ssh)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(false);
            }

            if (!File.Exists(fileName))
            {
                return(false);
            }

            SSHPreset sshPreset = SSHPreset.Load(fileName);

            if (sshPreset != null)
            {
                if (sshPreset.sizes.Count > 0)
                {
                    ssh.shotInfo    = sshPreset.sizes;
                    ssh.savePath    = sshPreset.lastSavePath;
                    ssh.orientation = sshPreset.orientation;
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        void OnApplicationQuit()
        {
            ScreenshotHelper myTarget  = (ScreenshotHelper)target;
            SSHPreset        sshPreset = new SSHPreset();

            sshPreset.Save(myTarget);
        }
Esempio n. 3
0
        void PathChange(string newPath)
        {
            Debug.Log("PathChange to " + newPath);
            ScreenshotHelper myTarget = (ScreenshotHelper)target;

            myTarget.savePath = newPath;
            SSHPreset sshPreset = new SSHPreset();

            sshPreset.Save(myTarget);
        }
Esempio n. 4
0
        string SavePreset(ScreenshotHelper ssh)
        {
            string file = EditorUtility.SaveFilePanel("Save your presets",
                                                      Directory.GetCurrentDirectory(), "screenshot_helper_preset", "xml");

            SSHPreset preset = new SSHPreset();

            preset.Save(file, ssh);

            return(file);
        }
Esempio n. 5
0
        void OnEnable()
        {
            ScreenshotHelper ssHelper = (ScreenshotHelper)target;

            bool loadConfig = false;

            if (ssHelper.shotInfo.Count == 0 || !string.IsNullOrEmpty(ssHelper.configFile))
            {
                if (!string.IsNullOrEmpty(ssHelper.configFile))
                {
                    if (File.Exists(ssHelper.configFile))
                    {
                        loadConfig = true;
                    }
                }

                if (loadConfig)
                {
                    LoadPresetFile(ssHelper.configFile, ssHelper);
                }
                else
                {
                    ssHelper.SetDefaults();
                }
            }

            if (!loadConfig)
            {
                LoadPresetFile(SSHPreset.DefaultSavePath(), ssHelper);
                if (File.Exists(SSHPreset.DefaultSavePath()))
                {
                    File.Delete(SSHPreset.DefaultSavePath());
                }
            }

            ssHelper.PathChange = PathChange;
            //myTarget.DefaultsSet = SaveSettings;
        }