예제 #1
0
        private void SetSourceDataInternal(
            SourceData newSd,
            SourceDataFileDescriptor newSdFileDescriptor,
            SourceDataChangesCache newSdChangesCache,
            bool newIsSdCorrect)
        {
            var newSdFileDescriptorDiffer = SetSourceDataFileDescriptor(newSdFileDescriptor);
            var newSdChangesCacheDiffer   = SetSourceDataChangesCache(newSdChangesCache);
            var newSdDiffer = true;

            if (newSd == null)
            {
                if (newSdFileDescriptor == null)
                {
                    if (SourceData == null)
                    {
                        newSdDiffer = false;
                    }
                }
                else if (newSdFileDescriptorDiffer)
                {
                    LoadSourceDataFromFile(_sourceDataFileDescriptor, false, out newSd);
                }
                else
                {
                    newSdDiffer = false;
                }
            }
            if (newSdDiffer || newSdChangesCacheDiffer)
            {
                if (SourceData != null)
                {
                    UnsubscribeFromSourceDataChanges();
                }
                if (newSdDiffer)
                {
                    SourceData = newSd;
                }
                if (SourceData != null)
                {
                    _sourceDataChangesCache.ApplyChanges(SourceData);
                    SubscribeToSourceDataChanges();
                }
            }
            _isSourceDataCorrect = newIsSdCorrect;
        }
예제 #2
0
 private bool SetSourceDataChangesCache(SourceDataChangesCache newSdChangesCache)
 {
     if (newSdChangesCache == null)
     {
         return(false);
     }
     if (_sourceDataChangesCache == null)
     {
         _sourceDataChangesCache = newSdChangesCache;
         return(true);
     }
     if (_sourceDataChangesCache.Equals(newSdChangesCache))
     {
         return(false);
     }
     _sourceDataChangesCache = newSdChangesCache;
     return(true);
 }
예제 #3
0
 private void SetSourceDataInternal( 
     SourceData newSd,  
     SourceDataFileDescriptor newSdFileDescriptor, 
     SourceDataChangesCache newSdChangesCache, 
     bool newIsSdCorrect)
 {
     var newSdFileDescriptorDiffer = SetSourceDataFileDescriptor(newSdFileDescriptor);
     var newSdChangesCacheDiffer = SetSourceDataChangesCache(newSdChangesCache);
     var newSdDiffer = true;
     if (newSd == null)
     {
         if (newSdFileDescriptor == null)
         {
             if (SourceData == null)
                 newSdDiffer = false;
         }
         else if (newSdFileDescriptorDiffer)
         {
             LoadSourceDataFromFile(_sourceDataFileDescriptor, false, out newSd);
         }
         else
         {
             newSdDiffer = false;
         }
     }
     if (newSdDiffer || newSdChangesCacheDiffer)
     {
         if (SourceData != null)
         {
             UnsubscribeFromSourceDataChanges();
         }
         if (newSdDiffer)
             SourceData = newSd;
         if (SourceData != null)
         {
             _sourceDataChangesCache.ApplyChanges(SourceData);
             SubscribeToSourceDataChanges();
         }
     }
     _isSourceDataCorrect = newIsSdCorrect;
 }
예제 #4
0
 private bool SetSourceDataChangesCache(SourceDataChangesCache newSdChangesCache)
 {
     if (newSdChangesCache == null)
         return false;
     if (_sourceDataChangesCache == null)
     {
         _sourceDataChangesCache = newSdChangesCache;
         return true;
     }
     if (_sourceDataChangesCache.Equals(newSdChangesCache))
         return false;
     _sourceDataChangesCache = newSdChangesCache;
     return true;
 }