Esempio n. 1
0
        public void SetChanges(string changesFileName)
        {
            try
            {
                var content = File.ReadAllBytes(changesFileName);
                var stream  = new MemoryStream(content);
                var changes = SerializableChanges.Deserialize(stream);                 //< We want to make sure that the file is legit..
                if (!changes.Changes.Any())
                {
                    Log.WarnFormat("The changelist file '{0}' doesn't contain any changes!", changesFileName);
                }

                stream.Position = 0;
                AddFile(PluginArchive.ChangesName, stream);
            }
            catch (Exception e)
            {
                throw new Exception($"Unable to read changelist: {e.Message}", e);
            }
        }
Esempio n. 2
0
        public IReadOnlyList <SerializableChange> LoadChanges()
        {
            var entry = _archive.GetEntry(PluginArchive.ChangesName);

            if (entry == null)
            {
                return(new SerializableChange[0]);
            }

            using (var stream = entry.Open())
            {
                try
                {
                    return(SerializableChanges.Deserialize(stream).Changes);
                }
                catch (Exception e)
                {
                    Log.ErrorFormat("Unable to load changes: {0}", e);
                    return(new SerializableChange[0]);
                }
            }
        }