Skip to content

Commit 406eb63

Browse files
committed
Nit.
1 parent ea43e15 commit 406eb63

File tree

3 files changed

+4
-81
lines changed

3 files changed

+4
-81
lines changed

src/Berrysoft.Data/BinaryTree.cs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -198,58 +198,6 @@ private static IEnumerable<IBinaryTree<T>> AsLevelOrderEnumerableIterator<T>(IBi
198198
/// Represents a binary node of a <see cref="BinaryTree{T}"/>.
199199
/// </summary>
200200
/// <typeparam name="T">The type of value the node contains.</typeparam>
201-
/// <example>
202-
/// This is an example to instantiatea binary tree with its pre and in order.
203-
/// <code language="C#"><![CDATA[
204-
/// static BinaryTree<int> tree;
205-
/// static BinaryTree<int> current;
206-
/// static void Main(string[] args)
207-
/// {
208-
/// tree = new BinaryTree<int>();
209-
/// Console.WriteLine("Please enter the values by pre order, splited by space:");
210-
/// int[] front = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
211-
/// Console.WriteLine("Please enter the values by in order, splited by space:");
212-
/// int[] mid = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
213-
/// if (front.Length != mid.Length)
214-
/// {
215-
/// Console.WriteLine("The length of the two arrays should be equal.");
216-
/// return;
217-
/// }
218-
/// tree.LeftChild = null;
219-
/// tree.RightChild = null;
220-
/// current = tree;
221-
/// Create(front, mid);
222-
/// Console.WriteLine("The post order of this tree is:");
223-
/// Console.WriteLine(String.Join(" ", tree.AsPostOrderEnumerable().Select(node => node.ToString()).ToArray()));
224-
/// Console.WriteLine("The level order of this tree is:");
225-
/// Console.WriteLine(string.Join(" ", tree.AsLevelOrderEnumerable().Select(node => node.ToString()).ToArray()));
226-
/// }
227-
/// static void Create(in Span<int> front, in Span<int> mid)
228-
/// {
229-
/// int n = front.Length;
230-
/// BinaryNode<int> tr = current;
231-
/// tr.Value = front[0];
232-
/// int i;
233-
/// for (i = 0; i < n; i++)
234-
/// {
235-
/// if (mid[i] == front[0])
236-
/// {
237-
/// break;
238-
/// }
239-
/// }
240-
/// if (i > 0)
241-
/// {
242-
/// current = (tr.LeftChild = new BinaryTree<int>());
243-
/// Create(front.Slice(1, i), mid);
244-
/// }
245-
/// if (n - 1 - i > 0)
246-
/// {
247-
/// current = (tr.RightChild = new BinaryTree<int>());
248-
/// Create(front.Slice(i + 1, n - 1 - i), mid.Slice(i + 1, n - 1 - i));
249-
/// }
250-
/// }
251-
/// ]]></code>
252-
/// </example>
253201
public class BinaryTree<T> : IBinaryTree<T>
254202
{
255203
private T _value;

src/Berrysoft.Tsinghua.Net/AuthHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ private async Task<Dictionary<string, string>> GetLoginDataAsync()
127127
["password"] = "{MD5}" + passwordMD5
128128
};
129129
}
130-
string loginInfo = string.Format(LoginInfoJson, Username, Password);
131-
loginDataDictionary["info"] = "{SRBX1}" + Base64Encode(XEncode(loginInfo, token));
130+
loginDataDictionary["info"] = "{SRBX1}" + Base64Encode(XEncode(string.Format(LoginInfoJson, Username, Password), token));
132131
loginDataDictionary["username"] = Username;
133132
loginDataDictionary["chksum"] = CryptographyHelper.GetSHA1(string.Format(ChkSumData, token, Username, passwordMD5, loginDataDictionary["info"]));
134133
return loginDataDictionary;
@@ -320,6 +319,8 @@ private static string XEncode(string str, string key)
320319
}
321320
return L(v, false);
322321
}
322+
323+
private static readonly string Base64N = "LVoJPiCN2R8G90yg+hmFHuacZ1OWMnrsSTXkYpUq/3dlbfKwv6xztjI7DeBE45QA";
323324
/// <summary>
324325
/// Encode a string to base64 in a special way.
325326
/// </summary>
@@ -358,7 +359,6 @@ private static string XEncode(string str, string key)
358359
/// </remarks>
359360
private unsafe static string Base64Encode(string t)
360361
{
361-
string n = "LVoJPiCN2R8G90yg+hmFHuacZ1OWMnrsSTXkYpUq/3dlbfKwv6xztjI7DeBE45QA";
362362
int a = t.Length;
363363
int len = a / 3 * 4;
364364
len += a % 3 != 0 ? 4 : 0;
@@ -381,7 +381,7 @@ private unsafe static string Base64Encode(string t)
381381
}
382382
else
383383
{
384-
u[ui++] = n[h >> 6 * (3 - i) & 0x3F];
384+
u[ui++] = Base64N[h >> 6 * (3 - i) & 0x3F];
385385
}
386386
}
387387
}

src/Berrysoft.Unsafe/Pointer.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,6 @@ namespace Berrysoft.Unsafe
99
/// Represents a .NET CLR pointer.
1010
/// </summary>
1111
/// <typeparam name="T">Type of the pointer targets to.</typeparam>
12-
/// <example>
13-
/// This example shows how to use pointer in Visual Basic.
14-
/// <code language="VB"><![CDATA[
15-
/// Imports Berrysoft.Unsafe.UnsafeMethods
16-
/// Module Program
17-
/// Sub Main(args As String())
18-
/// Dim int1 As Integer = 111
19-
/// Console.WriteLine("Init an Int32: {0}", int1)
20-
/// Dim ptr1 As Pointer(Of Integer) = PointerOf(int1)
21-
/// Console.WriteLine("The address of the Int32: 0x{0}", ptr1.ToString("x16"))
22-
/// TargetOf(ptr1) = 222
23-
/// Console.WriteLine("Now the Int32 is: {0}", int1)
24-
/// StackAlloc(Of Integer)(2,
25-
/// Sub(ptr2)
26-
/// Console.WriteLine("Allocated two Int32: {0}, {1}", ptr2(0), ptr2(1))
27-
/// MemorySet(ptr2, &H33, 4)
28-
/// MemorySet(ptr2 + 1, &H22, 4)
29-
/// Console.WriteLine("Now they are: 0x{0}, 0x{1}", ptr2(0).ToString("x8"), ptr2(1).ToString("x8"))
30-
/// MemoryCopy(ptr1, ptr2, 4)
31-
/// End Sub)
32-
/// Console.WriteLine("Now the first Int32 is: 0x{0}", int1.ToString("x8"))
33-
/// End Sub
34-
/// End Module
35-
/// ]]></code>
36-
/// </example>
3712
[DebuggerDisplay("{Ptr}")]
3813
[DebuggerTypeProxy(typeof(PointerDebugView<>))]
3914
public readonly unsafe struct Pointer<T> : IEquatable<Pointer<T>>

0 commit comments

Comments
 (0)