コード例 #1
0
        private void UpgradeSettings()
        {
            try
            {
                string path = Environment.ExpandEnvironmentVariables(FractalsCollectionPath);
                if (!Directory.Exists(Path.GetDirectoryName(path)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(path));
                }
                using (var file = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    FractalsHelper.GetEmbeddedFractalsStream().CopyTo(file);
                }
            }
            catch (IOException) {}

            Upgrade();
        }
コード例 #2
0
        public ObservableCollection <Fractal> Load(string filePath)
        {
            ObservableCollection <Fractal> fractals = null;

            try
            {
                using (FileStream file = new FileStream(Environment.ExpandEnvironmentVariables(filePath), FileMode.Open, FileAccess.Read))
                {
                    fractals = Load(file);
                }
            }
            catch (IOException exc)
            {
                Trace.TraceError(exc.Message);
                fractals = Load(FractalsHelper.GetEmbeddedFractalsStream());
            }
            return(fractals);
        }