Пример #1
0
        private static void Load(string filePath)
        {
            Log.Editor.Write("Loading designtime object data data...");
            Log.Editor.PushIndent();

            manager = null;
            if (File.Exists(filePath))
            {
                try
                {
                    using (FileStream str = File.OpenRead(filePath))
                    {
                        using (var formatter = Formatter.Create(str, FormattingMethod.Binary))
                        {
                            formatter.SerializationLog = Log.Editor;
                            manager = formatter.ReadObject <DesignTimeObjectDataManager>();
                        }
                    }
                }
                catch (Exception e) { Log.Editor.WriteError(Log.Exception(e)); }
            }

            if (manager == null)
            {
                manager = new DesignTimeObjectDataManager();
            }

            Log.Editor.PopIndent();
        }
Пример #2
0
 private static void Load(string filePath)
 {
     manager = Formatter.TryReadObject <DesignTimeObjectDataManager>(filePath) ?? new DesignTimeObjectDataManager();
 }