Skip to content

Commit

Permalink
add net48
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 21, 2020
1 parent c45e33a commit 0c2ee77
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net471;net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net48;net471;net472;netcoreapp3.1</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -17,7 +17,7 @@
<PackageReleaseNotes>Aligh with latest API</PackageReleaseNotes>
<PackageIcon>Analogy.GitHistoryBanner.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.3.5.1</Version>
<Version>1.3.6</Version>
<Company>Analogy.LogViewer</Company>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
Expand All @@ -27,7 +27,6 @@
<ItemGroup>

<PackageReference Include="Analogy.LogViewer.Interfaces" Version="2.8.1.1" />

<PackageReference Include="Analogy.LogViewer.Template" Version="1.6.10.1" />
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
<PackageReference Include="Microsoft.Build.Tasks.Git" Version="1.0.0">
Expand Down
11 changes: 9 additions & 2 deletions Analogy.LogViewer.GitHistory/GitPullUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public GitPullUC(RepositorySetting repositorySetting)

private void BtnOperation_Click(object sender, EventArgs e)
{
if (RepositorySetting == null) return;
if (RepositorySetting == null)
{
return;
}

string logMessage = "";
using (var repo = new Repository(RepositorySetting.RepositoryPath))
Expand All @@ -52,7 +55,11 @@ private void BtnOperation_Click(object sender, EventArgs e)

private void GitPullUC_Load(object sender, EventArgs e)
{
if (DesignMode) return;
if (DesignMode)
{
return;
}

RefreshList();
}
private void RefreshList()
Expand Down
49 changes: 24 additions & 25 deletions Analogy.LogViewer.GitHistory/GitRepositoryLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@

namespace Analogy.LogViewer.GitHistory
{
public class GitRepositoryLoader : IAnalogyRealTimeDataProvider
public class GitRepositoryLoader : Template.OnlineDataProvider
{
public Guid Id { get; set; } = new Guid("3CD8B586-5AB0-4C84-A1F8-0F093F846A5D");
public Image ConnectedLargeImage { get; set; } = null;
public Image ConnectedSmallImage { get; set; } = null;
public Image DisconnectedLargeImage { get; set; } = null;
public Image DisconnectedSmallImage { get; set; } = null;
public string OptionalTitle { get; set; }
public Task<bool> CanStartReceiving() => Task.FromResult(true);
public IAnalogyOfflineDataProvider FileOperationsHandler { get; } = null;
public event EventHandler<AnalogyDataSourceDisconnectedArgs> OnDisconnected;
public event EventHandler<AnalogyLogMessageArgs> OnMessageReady;
public event EventHandler<AnalogyLogMessagesArgs> OnManyMessagesReady;
public override Guid Id { get; set; } = new Guid("3CD8B586-5AB0-4C84-A1F8-0F093F846A5D");
public override Image? ConnectedLargeImage { get; set; } = null;
public override Image? ConnectedSmallImage { get; set; } = null;
public override Image? DisconnectedLargeImage { get; set; } = null;
public override Image? DisconnectedSmallImage { get; set; } = null;
public override string OptionalTitle { get; set; }
public override Task<bool> CanStartReceiving() => Task.FromResult(true);
public override IAnalogyOfflineDataProvider FileOperationsHandler { get; set; } = null;

private RepositorySetting RepositorySetting { get; }
private GitOperationType Operation { get; }
public bool UseCustomColors { get; set; } = false;
Expand All @@ -38,18 +36,13 @@ public GitRepositoryLoader(RepositorySetting rs, GitOperationType operation)
OptionalTitle = RepositorySetting.RepositoryPath;
}

public Task InitializeDataProviderAsync(IAnalogyLogger logger)
public override async Task InitializeDataProviderAsync(IAnalogyLogger logger)
{
await base.InitializeDataProviderAsync(logger);
LogManager.Instance.SetLogger(logger);
return Task.CompletedTask;
}

public void MessageOpened(AnalogyLogMessage message)
{
//noop
}

public Task StartReceiving()
public override Task StartReceiving()
{
try
{
Expand Down Expand Up @@ -80,7 +73,7 @@ public Task StartReceiving()
Level = AnalogyLogLevel.Error,
Class = AnalogyLogClass.General
};
OnMessageReady?.Invoke(this, new AnalogyLogMessageArgs(m, "", "", Id));
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
return Task.CompletedTask;
Expand All @@ -93,11 +86,17 @@ private void GetGitHistory()
var RFC2822Format = "ddd dd MMM HH:mm:ss yyyy K";
IEnumerable<Commit> commits;
if (RepositorySetting.FetchType == FetchType.Count)
{
commits = repo.Commits.Take(RepositorySetting.NumberOfCommits);
}
else if (RepositorySetting.FetchType == FetchType.DateTime)
{
commits = repo.Commits.Where(c => c.Author.When >= RepositorySetting.HistoryDateTime);
}
else
{
commits = new List<Commit>(0);
}

foreach (Commit c in commits)
{
Expand All @@ -115,7 +114,7 @@ private void GetGitHistory()
Level = (c.Committer.Name == c.Author.Name) ? AnalogyLogLevel.Information : AnalogyLogLevel.Warning,
Class = AnalogyLogClass.General
};
OnMessageReady?.Invoke(this, new AnalogyLogMessageArgs(m, "", "", Id));
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
}
Expand Down Expand Up @@ -149,12 +148,12 @@ private void PerformGitFetch()
Level = AnalogyLogLevel.Information,
Class = AnalogyLogClass.General
};
OnMessageReady?.Invoke(this, new AnalogyLogMessageArgs(m, "", "", Id));
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
}
}
public Task StopReceiving() => Task.CompletedTask;
public override Task StopReceiving() => Task.CompletedTask;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DownloadInformation : Analogy.LogViewer.Template.AnalogyDownloadInf
protected override string RepositoryURL { get; set; } = "https://api.github.com/repos/Analogy-LogViewer/Analogy.LogViewer.GitHistory";
public override TargetFrameworkAttribute CurrentFrameworkAttribute { get; set; } = (TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttribute(typeof(TargetFrameworkAttribute));

public override Guid FactoryId { get; set; } = GitHistoryFactory.Id;
public override Guid FactoryId { get; set; } = GitHistoryPrimaryFactory.Id;
public override string Name { get; set; } = "Affirmations Data Provider";

private string? _installedVersionNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Analogy.LogViewer.GitHistory.IAnalogy
{
public class GitHistoryCustomActionsFactory
{
public Guid FactoryId { get; } = GitHistoryFactory.Id;
public Guid FactoryId { get; } = GitHistoryPrimaryFactory.Id;
public string Title { get; } = "Git Operations";
public IEnumerable<IAnalogyCustomAction> Actions { get; } = new List<IAnalogyCustomAction> { new GitFetchAction() };
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
using Analogy.Interfaces;
using Analogy.Interfaces.Factories;
using Analogy.LogViewer.GitHistory.Managers;
using System;
using System.Collections.Generic;
using System.Linq;
using Analogy.LogViewer.GitHistory.Data_Types;

namespace Analogy.LogViewer.GitHistory.IAnalogy
{
public class GitHistoryDataProviderFactory : IAnalogyDataProvidersFactory
public class GitHistoryDataProviderFactory : Template.DataProvidersFactory
{
public Guid FactoryId { get; set; } = GitHistoryFactory.Id;
public string Title { get; set; } = "Repositories History";
public override Guid FactoryId { get; set; } = GitHistoryPrimaryFactory.Id;
public override string Title { get; set; } = "Repositories History";

public IEnumerable<IAnalogyDataProvider> DataProviders
public override IEnumerable<IAnalogyDataProvider> DataProviders
{
get
{
foreach (RepositorySetting rs in UserSettingsManager.UserSettings.RepositoriesSetting.Repositories)
{
yield return new GitRepositoryLoader(rs, GitOperationType.History);
}
}
get => _dataProviders;
set => _dataProviders = value.ToList();
}


private List<IAnalogyDataProvider> _dataProviders;

public GitHistoryDataProviderFactory()
{
_dataProviders = UserSettingsManager.UserSettings.RepositoriesSetting.Repositories
.Select(rs => new GitRepositoryLoader(rs, GitOperationType.History)).Cast<IAnalogyDataProvider>()
.ToList();
}
}

public class GitFetchDataProviderFactory
{
public Guid FactoryId { get; } = GitHistoryFactory.Id;
public Guid FactoryId { get; } = GitHistoryPrimaryFactory.Id;
public string Title => "Repositories Fetches";

public IEnumerable<IAnalogyDataProvider> DataProviders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using Analogy.Interfaces;
using Analogy.LogViewer.GitHistory.Managers;

namespace Analogy.LogViewer.GitHistory.IAnalogy
{
public class GitHistoryDataProviderSettings : IAnalogyDataProviderSettings
public class GitHistoryDataProviderSettings : Template.UserSettingsFactory
{

public string Title { get; set; } = "Git History settings";
public UserControl DataProviderSettings { get; } = new GitRepositoriesSettings();
public Image SmallImage { get; set; }
public Image LargeImage { get; set; }
public Guid FactoryId { get; set; } = GitHistoryFactory.Id;
public Guid Id { get; set; } = new Guid("AEE6AA94-A0B6-4313-8C65-D81943B542DB");
public override string Title { get; set; } = "Git History settings";
public override UserControl DataProviderSettings { get; set; } = new GitRepositoriesSettings();
public override Image? SmallImage { get; set; }
public override Image? LargeImage { get; set; }
public override Guid FactoryId { get; set; } = GitHistoryPrimaryFactory.Id;
public override Guid Id { get; set; } = new Guid("AEE6AA94-A0B6-4313-8C65-D81943B542DB");

public Task SaveSettingsAsync()
public override Task SaveSettingsAsync()
{
UserSettingsManager.UserSettings.Save();
return Task.CompletedTask;
Expand Down
31 changes: 0 additions & 31 deletions Analogy.LogViewer.GitHistory/IAnalogy/GitHistoryFactory.cs

This file was deleted.

24 changes: 24 additions & 0 deletions Analogy.LogViewer.GitHistory/IAnalogy/GitHistoryPrimaryFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Analogy.Interfaces;
using Analogy.LogViewer.GitHistory.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;

namespace Analogy.LogViewer.GitHistory.IAnalogy
{
public class GitHistoryPrimaryFactory : Template.PrimaryFactory
{
internal static Guid Id = new Guid("B842CC0F-AD83-48FB-8394-3189F9A75024");
public override Guid FactoryId { get; set; } = Id;
public override string Title { get; set; } = "Git History";
public override Image? SmallImage { get; set; } = Resources.Git_icon_16x16;
public override Image? LargeImage { get; set; } = Resources.Git_icon_32x32;
public override IEnumerable<IAnalogyChangeLog> ChangeLog { get; set; } = new List<AnalogyChangeLog>
{
new AnalogyChangeLog("Initial version",AnalogChangeLogType.None, "Lior Banai",new DateTime(2020, 04, 02))
};
public override IEnumerable<string> Contributors { get; set; } = new List<string> { "Lior Banai" };
public override string About { get; set; } = "Analogy Git History";

}
}
Loading

0 comments on commit 0c2ee77

Please sign in to comment.