Skip to content

Commit e1d5562

Browse files
committed
feedbacks addressed
1 parent 6aa7a97 commit e1d5562

File tree

5 files changed

+2
-209
lines changed

5 files changed

+2
-209
lines changed

Signature/AddDigitalSignature/.editorconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

Signature/AddDigitalSignature/AddDigitalSignature.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<WarningLevel>4</WarningLevel>
3737
</PropertyGroup>
3838
<ItemGroup>
39-
<PackageReference Include="Portable.BouncyCastle" Version="*" />
39+
<PackageReference Include = "Portable.BouncyCastle" Version = "*" />
4040
<PackageReference Include="Syncfusion.PdfViewer.WPF" Version="*" />
4141
<Reference Include="System" />
4242
<Reference Include="System.Data" />
@@ -91,7 +91,6 @@
9191
<Generator>ResXFileCodeGenerator</Generator>
9292
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
9393
</EmbeddedResource>
94-
<None Include=".editorconfig" />
9594
<None Include="packages.config" />
9695
<None Include="Properties\Settings.settings">
9796
<Generator>SettingsSingleFileGenerator</Generator>

Signature/AddDigitalSignature/ExtensionMethods.cs

Lines changed: 0 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -10,195 +10,6 @@ namespace AddDigitalSignature
1010
{
1111
public static class ExtensionMethods
1212
{
13-
14-
public static void Clear(this BlockingCollection<string> blockingCollection)
15-
{
16-
try
17-
{
18-
if (blockingCollection == null)
19-
{
20-
return;
21-
}
22-
23-
while (blockingCollection.Count > 0)
24-
{
25-
string item;
26-
blockingCollection.TryTake(out item);
27-
item = null;
28-
}
29-
30-
blockingCollection.Dispose();
31-
}
32-
catch (System.Exception ex)
33-
{
34-
//cGlobalSettings.oLogger.WriteLogException("Clear", ex);
35-
}
36-
37-
}
38-
39-
40-
public static void Clear(this BlockingCollection<int> blockingCollection)
41-
{
42-
try
43-
{
44-
if (blockingCollection == null)
45-
{
46-
return;
47-
}
48-
49-
while (blockingCollection.Count > 0)
50-
{
51-
int item;
52-
blockingCollection.TryTake(out item);
53-
}
54-
55-
blockingCollection.Dispose();
56-
}
57-
catch (System.Exception ex)
58-
{
59-
//cGlobalSettings.oLogger.WriteLogException("Clear", ex);
60-
}
61-
62-
}
63-
64-
public static IEnumerable<T> Distinct<T, TKey>(this IEnumerable<T> @this, Func<T, TKey> keySelector)
65-
{
66-
return @this.GroupBy(keySelector).Select(grps => grps).Select(e => e.First());
67-
}
68-
69-
70-
public static Dictionary<TKey, TValue>
71-
Merge<TKey, TValue>(Dictionary<TKey, TValue>[] dicts,
72-
Func<IGrouping<TKey, TValue>, TValue> resolveDuplicates)
73-
{
74-
if (resolveDuplicates == null)
75-
resolveDuplicates = new Func<IGrouping<TKey, TValue>, TValue>(group => group.First());
76-
77-
return dicts.SelectMany<Dictionary<TKey, TValue>, KeyValuePair<TKey, TValue>>(dict => dict)
78-
.ToLookup(pair => pair.Key, pair => pair.Value)
79-
.ToDictionary(group => group.Key, group => resolveDuplicates(group));
80-
}
81-
82-
83-
84-
85-
86-
87-
88-
89-
public static Dictionary<TKey, TValue> Merge<TKey, TValue>(this IEnumerable<Dictionary<TKey, TValue>> dicts,
90-
Func<IGrouping<TKey, TValue>, TValue> resolveDuplicates)
91-
{
92-
if (resolveDuplicates == null)
93-
resolveDuplicates = new Func<IGrouping<TKey, TValue>, TValue>(group => group.First());
94-
95-
return dicts.SelectMany<Dictionary<TKey, TValue>, KeyValuePair<TKey, TValue>>(dict => dict)
96-
.ToLookup(pair => pair.Key, pair => pair.Value)
97-
.ToDictionary(group => group.Key, group => resolveDuplicates(group));
98-
}
99-
100-
public static long ToLong(long nFileSizeHigh, long nFileSizeLow)
101-
{
102-
return (long)((nFileSizeHigh << 0x20) | (nFileSizeLow & 0xffffffffL));
103-
104-
}
105-
106-
public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME filetime)
107-
{
108-
long highBits = filetime.dwHighDateTime;
109-
highBits = highBits << 32;
110-
return DateTime.FromFileTimeUtc(highBits + (long)filetime.dwLowDateTime);
111-
}
112-
113-
114-
public static long ToLong(this System.Runtime.InteropServices.ComTypes.FILETIME filetime)
115-
{
116-
long highBits = filetime.dwHighDateTime;
117-
highBits = highBits << 32;
118-
return DateTime.FromFileTimeUtc(highBits + (long)filetime.dwLowDateTime).Ticks;
119-
}
120-
121-
/// <summary>
122-
/// http://stackoverflow.com/questions/419019/split-list-into-sublists-with-linq
123-
///
124-
/// </summary>
125-
/// <typeparam name="T"></typeparam>
126-
/// <param name="source"></param>
127-
/// <param name="groupSize"></param>
128-
/// <returns></returns>
129-
public static List<List<T>> Split<T>(this List<T> source, int groupSize)
130-
{
131-
return source
132-
.Select((x, i) => new { Index = i, Value = x })
133-
.GroupBy(x => x.Index / groupSize/*3*/)
134-
.Select(x => x.Select(v => v.Value).ToList())
135-
.ToList();
136-
}
137-
138-
139-
// public static string SafeGetString(this SQLiteDataReader reader, int colIndex)
140-
// {
141-
// if (!reader.IsDBNull(colIndex))
142-
// return reader.GetString(colIndex);
143-
// else
144-
// return string.Empty;
145-
// }
146-
147-
// public static Int32 SafeGetInt32(this SQLiteDataReader reader, int colIndex, Int32 defaultReturnValue)
148-
// {
149-
// if (!reader.IsDBNull(colIndex))
150-
// return reader.GetInt32(colIndex);
151-
// else
152-
// return defaultReturnValue;
153-
// }
154-
155-
// public static Int64 SafeGetInt64(this SQLiteDataReader reader, int colIndex, Int64 defaultReturnValue)
156-
// {
157-
// if (!reader.IsDBNull(colIndex))
158-
// return reader.GetInt64(colIndex);
159-
// else
160-
// return defaultReturnValue;
161-
// }
162-
163-
// public static T SafeGetValue<T>(this SQLiteDataReader reader, int colIndex, T defaultReturnValue)
164-
// {
165-
// if (!reader.IsDBNull(colIndex))
166-
// {
167-
// if (typeof(T) == typeof(int))
168-
// {
169-
// return (T)Convert.ChangeType(reader.GetInt32(colIndex), typeof(T));
170-
// }
171-
// else if (typeof(T) == typeof(long))
172-
// {
173-
// return (T)Convert.ChangeType(reader.GetInt64(colIndex), typeof(T));
174-
// }
175-
// else if (typeof(T) == typeof(string))
176-
// {
177-
// return (T)Convert.ChangeType(reader.GetString(colIndex), typeof(T));
178-
// }
179-
// else
180-
// {
181-
////#error "not defined"
182-
// Debug.Assert(false);
183-
// }
184-
185-
186-
// }
187-
188-
// return defaultReturnValue;
189-
// }
190-
191-
public static List<Dictionary<T1, T2>> Split<T1, T2>(this Dictionary<T1, T2> source, int groupSize)
192-
{
193-
return source
194-
.Select((x, i) => new { Index = i, Value = x })
195-
.GroupBy(x => x.Index / groupSize/*3*/)
196-
.Select(x => x.Select(v => v.Value).ToDictionary(z => z.Key, z => z.Value))
197-
.ToList();
198-
}
199-
200-
201-
20213
public static IEnumerable<string> Split(this string str, int n)
20314
{
20415
if (String.IsNullOrEmpty(str) || n < 1)
@@ -212,12 +23,4 @@ public static IEnumerable<string> Split(this string str, int n)
21223
}
21324
}
21425
}
215-
216-
static class DataRowExtensions
217-
{
218-
public static object GetValueWithContainsCheck(this DataRow row, string column)
219-
{
220-
return row.Table.Columns.Contains(column) ? row?[column] : null;
221-
}
222-
}
22326
}

Signature/AddDigitalSignature/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
77
xmlns:local="clr-namespace:AddDigitalSignature"
88
mc:Ignorable="d"
9-
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
9+
Title="MainWindow" WindowState="Maximized" Loaded="Window_Loaded">
1010
<Grid>
1111
<Grid.RowDefinitions>
1212
<RowDefinition Height="50"></RowDefinition>
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Portable.BouncyCastle" version="* targetFramework="net48" />
4-
<package id="Syncfusion.Compression.Base" version="*" targetFramework="net48" />
5-
<package id="Syncfusion.Licensing" version="*" targetFramework="net48" />
6-
<package id="Syncfusion.Pdf.Wpf" version="*" targetFramework="net48" />
7-
<package id="Syncfusion.PdfToImageConverter.WPF" version="*" targetFramework="net48" />
84
<package id="Syncfusion.PdfViewer.WPF" version="*" targetFramework="net48" />
9-
<package id="Syncfusion.Shared.WPF" version="*" targetFramework="net48" />
105
</packages>

0 commit comments

Comments
 (0)