Example #1
0
        public void LoadAndApplyCompanionFileFor(string achxFile)
        {
            string fileToLoad = GetCompanionFileFor(achxFile);

            bool           succeeded      = false;
            AESettingsSave loadedInstance = null;

            if (System.IO.File.Exists(fileToLoad))
            {
                try
                {
                    loadedInstance =
                        FileManager.XmlDeserialize <AESettingsSave>(fileToLoad);

                    succeeded = true;
                }
                catch
                {
                    succeeded = false;
                }
            }

            if (succeeded)
            {
                ApplySettings(loadedInstance);
            }
        }
Example #2
0
        private void ApplySettings(AESettingsSave loadedInstance)
        {
            PreviewManager.Self.OffsetMultiplier = loadedInstance.OffsetMultiplier;

            PreviewManager.Self.HorizontalGuides = loadedInstance.HorizontalGuides;
            PreviewManager.Self.VerticalGuides   = loadedInstance.VerticalGuides;

            if (loadedInstance.ExpandedNodes != null)
            {
                TreeViewManager.Self.ExpandNodes(loadedInstance.ExpandedNodes);
            }
            ApplicationState.Self.UnitType = loadedInstance.UnitType;
        }
Example #3
0
        public void SaveCompanionFileFor(string fileName)
        {
            AESettingsSave settingsSave = new AESettingsSave();

            settingsSave.OffsetMultiplier = PreviewManager.Self.OffsetMultiplier;

            settingsSave.HorizontalGuides.AddRange(PreviewManager.Self.HorizontalGuides);
            settingsSave.VerticalGuides.AddRange(PreviewManager.Self.VerticalGuides);

            settingsSave.ExpandedNodes.Clear();
            settingsSave.ExpandedNodes.AddRange(TreeViewManager.Self.GetExpandedNodeAnimationChainNames());
            settingsSave.UnitType = ApplicationState.Self.UnitType;
            string locationToSave = GetCompanionFileFor(fileName);

            try
            {
                FileManager.XmlSerialize(settingsSave, locationToSave);
            }
            catch (Exception e)
            {
                MessageBox.Show("Could not save companion file " + locationToSave + "\n\n" + e.ToString());
            }
        }