ClaudiaIDE.Settings.Setting.Deserialize C# (CSharp) Method

Deserialize() public static method

public static Deserialize ( ) : Setting
return Setting
        public static Setting Deserialize()
        {
            var assemblylocation = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            var configpath = Path.Combine(string.IsNullOrEmpty(assemblylocation) ? "" : assemblylocation, CONFIGFILE);
            string config = "";

            using (var s = new StreamReader(configpath, Encoding.ASCII, false))
            {
                config = s.ReadToEnd();
                s.Close();
            }
            var ret = JsonSerializer<Setting>.DeSerialize(config);
            ret.BackgroundImageAbsolutePath = ToFullPath(ret.BackgroundImageAbsolutePath);
            ret.BackgroundImagesDirectoryAbsolutePath = ToFullPath(ret.BackgroundImagesDirectoryAbsolutePath);
            return ret;
        }

Usage Example

Example #1
0
        public static Setting Initialize(DTE serviceProvider)
        {
            var settings = Setting.Instance;

            if (settings.ServiceProvider == null || settings.ServiceProvider != serviceProvider)
            {
                settings.ServiceProvider = serviceProvider;
            }
            try
            {
                var solfile = VisualStudioUtility.GetSolutionSettingsFileFullPath();
                if (!string.IsNullOrWhiteSpace(solfile))
                {
                    var solconf = Deserialize(solfile);
                    settings.BackgroundImageAbsolutePath           = solconf.BackgroundImageAbsolutePath;
                    settings.BackgroundImagesDirectoryAbsolutePath = solconf.BackgroundImagesDirectoryAbsolutePath;
                    settings.ExpandToIDE                = solconf.ExpandToIDE;
                    settings.Extensions                 = solconf.Extensions;
                    settings.ImageBackgroundType        = solconf.ImageBackgroundType;
                    settings.ImageFadeAnimationInterval = solconf.ImageFadeAnimationInterval;
                    settings.ImageStretch               = solconf.ImageStretch;
                    settings.LoopSlideshow              = solconf.LoopSlideshow;
                    settings.MaxHeight                   = solconf.MaxHeight;
                    settings.MaxWidth                    = solconf.MaxWidth;
                    settings.Opacity                     = solconf.Opacity;
                    settings.PositionHorizon             = solconf.PositionHorizon;
                    settings.PositionVertical            = solconf.PositionVertical;
                    settings.ShuffleSlideshow            = solconf.ShuffleSlideshow;
                    settings.SoftEdgeX                   = solconf.SoftEdgeX;
                    settings.SoftEdgeY                   = solconf.SoftEdgeY;
                    settings.UpdateImageInterval         = solconf.UpdateImageInterval;
                    settings.ViewBoxPointX               = solconf.ViewBoxPointX;
                    settings.ViewBoxPointY               = solconf.ViewBoxPointY;
                    settings.SolutionConfigFilePath      = solfile;
                    settings.IsLimitToMainlyEditorWindow = solconf.IsLimitToMainlyEditorWindow;
                    settings.TileMode                    = solconf.TileMode;
                    settings.ViewPortHeight              = solconf.ViewPortHeight;
                    settings.ViewPortWidth               = solconf.ViewPortWidth;
                    settings.ViewPortPointX              = solconf.ViewPortPointX;
                    settings.ViewPortPointY              = solconf.ViewPortPointY;
                }
                else
                {
                    settings.Load();
                }
            }
            catch
            {
                return(Setting.Deserialize());
            }
            return(settings);
        }
All Usage Examples Of ClaudiaIDE.Settings.Setting::Deserialize