Skip to content

Commit

Permalink
Update to latest dd
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandPheasant committed Mar 19, 2018
1 parent 481e75d commit 655fb3f
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 30 deletions.
57 changes: 57 additions & 0 deletions Source/TailBlazer.Domain/FileHandling/New/FileMonitor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.IO;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using TailBlazer.Domain.Ratings;


namespace TailBlazer.Domain.FileHandling.New
{


public class FileIndexer
{
/*
1. Get length - this gives extent.
2. Calculate average line length - gives position to scroll to
3. Segment files??
*/

/*
1. Grab segments and load observable list
2. [Clear segments when file is missing or size has reduced]
3. From segments, we require index - use transform function
4. Load details of last segment first
5. Load latest page on tail - max 1 Mb [always keep in memory]
*/

public FileIndexer()
{
}
}

public class FileMonitor
{


public FileMonitor(string fullPath, IRatingService ratingsMetrics, IScheduler scheduler = null)
{
if (fullPath == null) throw new ArgumentNullException(nameof(fullPath));
if (ratingsMetrics == null) throw new ArgumentNullException(nameof(ratingsMetrics));

scheduler = scheduler ?? Scheduler.Default;

var fileInfo = new FileInfo(fullPath);

var refreshRate = ratingsMetrics.Metrics.Take(1)
.Select(metrics => TimeSpan.FromMilliseconds(metrics.RefreshRate))
.Wait();

var fileChanged = fileInfo
.WatchFile(scheduler: scheduler, refreshPeriod: refreshRate);


}
}
}
4 changes: 0 additions & 4 deletions Source/TailBlazer.Domain/Infrastructure/DynamicDataEx.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using TailBlazer.Domain.Annotations;
using TailBlazer.Domain.Infrastructure;
Expand Down
5 changes: 3 additions & 2 deletions Source/TailBlazer.Domain/TailBlazer.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DynamicData, Version=6.0.4.2351, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.0.4.2351\lib\net45\DynamicData.dll</HintPath>
<Reference Include="DynamicData, Version=6.1.3.2378, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.1.3.2378\lib\net45\DynamicData.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
Expand Down Expand Up @@ -92,6 +92,7 @@
<Compile Include="FileHandling\IndexType.cs" />
<Compile Include="FileHandling\IProgressInfo.cs" />
<Compile Include="FileHandling\LineKey.cs" />
<Compile Include="FileHandling\New\FileMonitor.cs" />
<Compile Include="FileHandling\Search\CombinedSearchMetadataCollection.cs" />
<Compile Include="FileHandling\Search\GlobalSearchInfoCollection.cs" />
<Compile Include="FileHandling\Search\ICombinedSearchMetadataCollection.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Source/TailBlazer.Domain/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DynamicData" version="6.0.4.2351" targetFramework="net45" />
<package id="DynamicData" version="6.1.3.2378" targetFramework="net45" />
<package id="System.Reactive" version="3.1.1" targetFramework="net45" />
<package id="System.Reactive.Core" version="3.1.1" targetFramework="net45" />
<package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net45" />
Expand Down
4 changes: 2 additions & 2 deletions Source/TailBlazer.Fixtures/TailBlazer.Fixtures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DynamicData, Version=6.0.4.2351, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.0.4.2351\lib\net45\DynamicData.dll</HintPath>
<Reference Include="DynamicData, Version=6.1.3.2378, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.1.3.2378\lib\net45\DynamicData.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.5.0\lib\net45\FluentAssertions.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion Source/TailBlazer.Fixtures/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DynamicData" version="6.0.4.2351" targetFramework="net45" />
<package id="DynamicData" version="6.1.3.2378" targetFramework="net45" />
<package id="FluentAssertions" version="4.5.0" targetFramework="net45" />
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net45" />
<package id="MaterialDesignThemes" version="2.1.0.657" targetFramework="net45" />
Expand Down
4 changes: 2 additions & 2 deletions Source/TailBlazer/TailBlazer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dragablz.0.0.3.197\lib\net45\Dragablz.dll</HintPath>
</Reference>
<Reference Include="DynamicData, Version=6.0.4.2351, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.0.4.2351\lib\net45\DynamicData.dll</HintPath>
<Reference Include="DynamicData, Version=6.1.3.2378, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicData.6.1.3.2378\lib\net45\DynamicData.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
Expand Down
34 changes: 17 additions & 17 deletions Source/TailBlazer/Views/Tail/TailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ await Task.Run(() =>
firstIndexMonitor,
FileStatus,
Count,
CountText,
LatestCount,
FileSizeText,
CanViewInline,
Expand All @@ -237,7 +238,6 @@ await Task.Run(() =>
SearchCollection,
searchInfoCollection,
searchHints,
combinedSearchMetadataCollection,
SelectionMonitor,
closeOnDeselect,
Disposable.Create(dialogCoordinator.Close),
Expand All @@ -253,50 +253,50 @@ await Task.Run(() =>

public bool IsSelected
{
get { return _isSelected; }
set { SetAndRaise(ref _isSelected, value); }
get => _isSelected;
set => SetAndRaise(ref _isSelected, value);
}

public bool IsDialogOpen
{
get { return _isDialogOpen; }
set { SetAndRaise(ref _isDialogOpen, value); }
get => _isDialogOpen;
set => SetAndRaise(ref _isDialogOpen, value);
}

public object DialogContent
{
get { return _dialogContent; }
set { SetAndRaise(ref _dialogContent, value); }
get => _dialogContent;
set => SetAndRaise(ref _dialogContent, value);
}

public LineProxy SelectedItem
{
get { return _selectedLine; }
set { SetAndRaise(ref _selectedLine, value); }
get => _selectedLine;
set => SetAndRaise(ref _selectedLine, value);
}

public bool AutoTail
{
get { return _autoTail; }
set { SetAndRaise(ref _autoTail, value); }
get => _autoTail;
set => SetAndRaise(ref _autoTail, value);
}

public int PageSize
{
get { return _pageSize; }
set { SetAndRaise(ref _pageSize, value); }
get => _pageSize;
set => SetAndRaise(ref _pageSize, value);
}

public int FirstIndex
{
get { return _firstIndex; }
set { SetAndRaise(ref _firstIndex, value); }
get => _firstIndex;
set => SetAndRaise(ref _firstIndex, value);
}

public bool ShowInline
{
get { return _showInline; }
set { SetAndRaise(ref _showInline, value); }
get => _showInline;
set => SetAndRaise(ref _showInline, value);
}

#region Interact with scroll panel
Expand Down
2 changes: 1 addition & 1 deletion Source/TailBlazer/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net45" developmentDependency="true" />
<package id="Dragablz" version="0.0.3.197" targetFramework="net45" />
<package id="DynamicData" version="6.0.4.2351" targetFramework="net45" />
<package id="DynamicData" version="6.1.3.2378" targetFramework="net45" />
<package id="Fody" version="1.29.3" targetFramework="net45" developmentDependency="true" />
<package id="log4net" version="2.0.3" targetFramework="net46" />
<package id="MahApps.Metro" version="1.5.0" targetFramework="net45" />
Expand Down

0 comments on commit 655fb3f

Please sign in to comment.