Esempio n. 1
0
        public MainWindow()
        {
            logInSuccess = false;

            client = new DiscordSocketClient(new DiscordSocketConfig {
                LogLevel = Discord.LogSeverity.Debug, MessageCacheSize = 0
            });
            client.LoggedIn        += OnDiscordLoggedIn;
            client.LoggedOut       += OnDiscordLoggedOut;
            client.Ready           += OnDiscordReady;
            client.MessageReceived += OnDiscordMessage;

            imagesScanner = new DiscordImagesScanner();
            storage       = new LocalArchiveStorage(System.IO.Directory.GetCurrentDirectory());

            InitializeComponent();
            logError.Tag       = LogLevel.Error;
            logInfo.Tag        = LogLevel.Info;
            logDebug.Tag       = LogLevel.Debug;
            logDebug.IsChecked = true;
            logsBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
        }
Esempio n. 2
0
		/// <summary>
		/// Begin updating to this <see cref="ZipFile"/> archive.
		/// </summary>
		/// <param name="archiveStorage">The storage to use during the update.</param>
		public void BeginUpdate(IArchiveStorage archiveStorage)
		{
			BeginUpdate(archiveStorage, new DynamicDiskDataSource());
		}
Esempio n. 3
0
//		TBD: Direct form of updating
// 
//		public void Update(IEntryMatcher deleteMatcher)
//		{
//		}
//
//		public void Update(IScanner addScanner)
//		{
//		}
		#endregion
		
		#region Deferred Updating
		/// <summary>
		/// Begin updating this <see cref="ZipFile"/> archive.
		/// </summary>
		/// <param name="archiveStorage">The <see cref="IArchiveStorage">archive storage</see> for use during the update.</param>
		/// <param name="dataSource">The <see cref="IDynamicDataSource">data source</see> to utilise during updating.</param>
		/// <exception cref="ObjectDisposedException">ZipFile has been closed.</exception>
		/// <exception cref="ArgumentNullException">One of the arguments provided is null</exception>
		/// <exception cref="ObjectDisposedException">ZipFile has been closed.</exception>
		public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
		{
			if ( archiveStorage == null ) {
				throw new ArgumentNullException("archiveStorage");
			}

			if ( dataSource == null ) {
				throw new ArgumentNullException("dataSource");
			}
			
			if ( isDisposed_ ) {
				throw new ObjectDisposedException("ZipFile");
			}

			if ( IsEmbeddedArchive ) {
				throw new ZipException ("Cannot update embedded/SFX archives");
			}

			archiveStorage_ = archiveStorage;
			updateDataSource_ = dataSource;

			// NOTE: the baseStream_ may not currently support writing or seeking.

			updateIndex_ = new Hashtable();

			updates_ = new ArrayList(entries_.Length);
			foreach(ZipEntry entry in entries_) {
				int index = updates_.Add(new ZipUpdate(entry));
				updateIndex_.Add(entry.Name, index);
			}

			// We must sort by offset before using offset's calculated sizes
			updates_.Sort(new UpdateComparer());

			int idx = 0;
			foreach (ZipUpdate update in updates_) {
				//If last entry, there is no next entry offset to use
				if (idx == updates_.Count - 1)
					break;

				update.OffsetBasedSize = ((ZipUpdate)updates_[idx + 1]).Entry.Offset - update.Entry.Offset;
				idx++;
			}
			updateCount_ = updates_.Count;

			contentsEdited_ = false;
			commentEdited_ = false;
			newComment_ = null;
		}
Esempio n. 4
0
		// Immediate updating
		//		TBD: Direct form of updating
		// 
		//		public void Update(IEntryMatcher deleteMatcher)
		//		{
		//		}
		//
		//		public void Update(IScanner addScanner)
		//		{
		//		}


		// Deferred Updating
		/// <summary>
		/// Begin updating this <see cref="BlubbFile"/> archive.
		/// </summary>
		/// <param name="archiveStorage">The <see cref="IArchiveStorage">archive storage</see> for use during the update.</param>
		/// <param name="dataSource">The <see cref="IDynamicDataSource">data source</see> to utilise during updating.</param>
		/// <exception cref="ObjectDisposedException">BlubbFile has been closed.</exception>
		/// <exception cref="ArgumentNullException">One of the arguments provided is null</exception>
		/// <exception cref="ObjectDisposedException">BlubbFile has been closed.</exception>
		public void BeginUpdate( IArchiveStorage archiveStorage, IDynamicDataSource dataSource ) {
			if( archiveStorage == null ) {
				throw new ArgumentNullException( "archiveStorage" );
			}

			if( dataSource == null ) {
				throw new ArgumentNullException( "dataSource" );
			}

			if( isDisposed_ ) {
				throw new ObjectDisposedException( "BlubbFile" );
			}

			if( IsEmbeddedArchive ) {
				throw new BlubbZipException( "Cannot update embedded/SFX archives" );
			}

			archiveStorage_ = archiveStorage;
			updateDataSource_ = dataSource;

			// NOTE: the baseStream_ may not currently support writing or seeking.

			updateIndex_ = new Hashtable();

			updates_ = new ArrayList( entries_.Length );
			foreach( BlubbZipEntry entry in entries_ ) {
				int index = updates_.Add( new BlubbUpdate( entry ) );
				updateIndex_.Add( entry.Name, index );
			}

			updateCount_ = updates_.Count;

			contentsEdited_ = false;
			commentEdited_ = false;
			newComment_ = null;
		}
Esempio n. 5
0
//		TBD: Direct form of updating
// 
//		public void Update(IEntryMatcher deleteMatcher)
//		{
//		}
//
//		public void Update(IScanner addScanner)
//		{
//		}
		#endregion
		#region Deferred Updating
		/// <summary>
		/// Begin updating this <see cref="ZipFile"/> archive.
		/// </summary>
		/// <param name="archiveStorage">The <see cref="IArchiveStorage">archive storage</see> for use during the update.</param>
		/// <param name="dataSource">The <see cref="IDynamicDataSource">data source</see> to utilise during updating.</param>
		public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
		{
			if ( IsEmbeddedArchive ) {
				throw new ZipException ("Cannot update embedded/SFX archives");
			}

			if ( archiveStorage == null ) {
				throw new ArgumentNullException("archiveStorage");
			}

			if ( dataSource == null ) {
				throw new ArgumentNullException("dataSource");
			}

			archiveStorage_ = archiveStorage;
			updateDataSource_ = dataSource;

			// NOTE: the baseStream_ may not currently support writing or seeking.

			if ( entries_ != null ) {
				updates_ = new ArrayList(entries_.Length);
				foreach(ZipEntry entry in entries_) {
					updates_.Add(new ZipUpdate(entry));
				}
			}
			else {
				updates_ = new ArrayList();
			}

			contentsEdited_ = false;
			commentEdited_ = false;
			newComment_ = null;
		}
Esempio n. 6
0
        void PostUpdateCleanup()
        {
            if( archiveStorage_!=null ) {
                archiveStorage_.Dispose();
                archiveStorage_=null;
            }

            updateDataSource_=null;
            updates_ = null;
            updateIndex_ = null;
        }
Esempio n. 7
0
//		TBD: Direct form of updating
// 
//		public void Update(IEntryMatcher deleteMatcher)
//		{
//		}
//
//		public void Update(IScanner addScanner)
//		{
//		}
		#endregion
		
		#region Deferred Updating
		/// <summary>
		/// Begin updating this <see cref="ZipFile"/> archive.
		/// </summary>
		/// <param name="archiveStorage">The <see cref="IArchiveStorage">archive storage</see> for use during the update.</param>
		/// <param name="dataSource">The <see cref="IDynamicDataSource">data source</see> to utilise during updating.</param>
		/// <exception cref="ObjectDisposedException">ZipFile has been closed.</exception>
		/// <exception cref="ArgumentNullException">One of the arguments provided is null</exception>
		/// <exception cref="ObjectDisposedException">ZipFile has been closed.</exception>
		public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
		{
			if ( archiveStorage == null ) {
				throw new ArgumentNullException("archiveStorage");
			}

			if ( dataSource == null ) {
				throw new ArgumentNullException("dataSource");
			}
			
			if ( _isDisposed ) {
				throw new ObjectDisposedException("ZipFile");
			}

			if ( IsEmbeddedArchive ) {
				throw new ZipException ("Cannot update embedded/SFX archives");
			}

			_archiveStorage = archiveStorage;
			_updateDataSource = dataSource;

			// NOTE: the baseStream_ may not currently support writing or seeking.

			_updateIndex = new Hashtable();

			_updates = new ArrayList(_entries.Length);
			foreach(ZipEntry entry in _entries) {
				int index = _updates.Add(new ZipUpdate(entry));
				_updateIndex.Add(entry.Name, index);
			}

			_updateCount = _updates.Count;

			_contentsEdited = false;
			_commentEdited = false;
			_newComment = null;
		}
Esempio n. 8
0
 public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
 {
     if (archiveStorage == null)
     {
         throw new ArgumentNullException("archiveStorage");
     }
     if (dataSource == null)
     {
         throw new ArgumentNullException("dataSource");
     }
     if (isDisposed_)
     {
         throw new ObjectDisposedException("ZipFile");
     }
     if (IsEmbeddedArchive)
     {
         throw new ZipException("Cannot update embedded/SFX archives");
     }
     archiveStorage_ = archiveStorage;
     updateDataSource_ = dataSource;
     updateIndex_ = new Hashtable();
     updates_ = new ArrayList(entries_.Length);
     foreach (ZipEntry entry in entries_)
     {
         int num = updates_.Add(new ZipUpdate(entry));
         updateIndex_.Add(entry.Name, num);
     }
     updates_.Sort(new UpdateComparer());
     int num2 = 0;
     foreach (ZipUpdate update in updates_)
     {
         if (num2 == (updates_.Count - 1))
         {
             break;
         }
         update.OffsetBasedSize = ((ZipUpdate)updates_[num2 + 1]).Entry.Offset - update.Entry.Offset;
         num2++;
     }
     updateCount_ = updates_.Count;
     contentsEdited_ = false;
     commentEdited_ = false;
     newComment_ = null;
 }
Esempio n. 9
0
 private void PostUpdateCleanup()
 {
     this.updateDataSource_ = null;
     this.updates_ = null;
     this.updateIndex_ = null;
     if (this.archiveStorage_ != null)
     {
         this.archiveStorage_.Dispose();
         this.archiveStorage_ = null;
     }
 }
Esempio n. 10
0
 public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
 {
     if (archiveStorage == null)
     {
         throw new ArgumentNullException(nameof(archiveStorage));
     }
     if (dataSource == null)
     {
         throw new ArgumentNullException(nameof(dataSource));
     }
     if (_isDisposed)
     {
         throw new ObjectDisposedException("ZipFile");
     }
     if (IsEmbeddedArchive)
     {
         throw new ZipException("Cannot update embedded/SFX archives");
     }
     _archiveStorage = archiveStorage;
     _updateDataSource = dataSource;
     _updateIndex = new Hashtable();
     _updates = new ArrayList(_entries.Length);
     foreach (var entry in _entries)
     {
         var num = _updates.Add(new ZipUpdate(entry));
         _updateIndex.Add(entry.Name, num);
     }
     _updates.Sort(new UpdateComparer());
     var num2 = 0;
     foreach (ZipUpdate update in _updates)
     {
         if (num2 == (_updates.Count - 1))
         {
             break;
         }
         update.OffsetBasedSize = ((ZipUpdate)_updates[num2 + 1]).Entry.Offset - update.Entry.Offset;
         num2++;
     }
     _updateCount = _updates.Count;
     _contentsEdited = false;
     _commentEdited = false;
     _newComment = null;
 }
Esempio n. 11
0
 private void PostUpdateCleanup()
 {
     _updateDataSource = null;
     _updates = null;
     _updateIndex = null;
     if (_archiveStorage != null)
     {
         _archiveStorage.Dispose();
         _archiveStorage = null;
     }
 }