Esempio n. 1
0
        public Result SaveNewChanges(string fileName, Stream fileStream)
        {
            try
            {
                byte[] fileData;
                using (var ms = new MemoryStream())
                {
                    fileStream.CopyTo(ms);
                    fileData = ms.ToArray();
                }

                var assemblyInfo = AssemblyChanges.GetAssemblyInfo(fileName, fileData);

                var historyList = _dataProvider.LoadChangesHistory(assemblyInfo.Assembly.Id);
                var newChanges  = assemblyInfo.Members
                                  .Except(historyList)
                                  .ForEach(o => o.CommitDate = DateTime.Now)
                                  .ToList();

                assemblyInfo.Members = historyList;
                assemblyInfo.Members.AddRange(newChanges);
                _dataProvider.AddAssembly(assemblyInfo);
                return(Result.Ok());
            }
            catch (Exception ex)
            {
                return(Result.Fail("Error: " + ex));
            }
        }