From 656669fa2066fd795aa4e8e31f9a9bad35f2d35f Mon Sep 17 00:00:00 2001 From: Dominik Herold Date: Tue, 21 Feb 2017 14:09:46 +0100 Subject: [PATCH 1/3] add solution for VS2012 --- .gitignore | 30 ++++++++++- ReadLine/ReadLine.sln | 20 ++++++++ ReadLine/ReadLine/Class1.cs | 12 +++++ ReadLine/ReadLine/Properties/AssemblyInfo.cs | 36 +++++++++++++ ReadLine/ReadLine/ReadLine.csproj | 53 ++++++++++++++++++++ 5 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 ReadLine/ReadLine.sln create mode 100644 ReadLine/ReadLine/Class1.cs create mode 100644 ReadLine/ReadLine/Properties/AssemblyInfo.cs create mode 100644 ReadLine/ReadLine/ReadLine.csproj diff --git a/.gitignore b/.gitignore index 68d27ef..7aacc9a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,32 @@ [Oo]bj/ .vscode .DS_Store -project.lock.json \ No newline at end of file +project.lock.json +#ignore thumbnails created by windows +Thumbs.db +#Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* diff --git a/ReadLine/ReadLine.sln b/ReadLine/ReadLine.sln new file mode 100644 index 0000000..d8131bb --- /dev/null +++ b/ReadLine/ReadLine.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadLine", "ReadLine\ReadLine.csproj", "{EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ReadLine/ReadLine/Class1.cs b/ReadLine/ReadLine/Class1.cs new file mode 100644 index 0000000..8148dd4 --- /dev/null +++ b/ReadLine/ReadLine/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ReadLine +{ + public class Class1 + { + } +} diff --git a/ReadLine/ReadLine/Properties/AssemblyInfo.cs b/ReadLine/ReadLine/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c245b6c --- /dev/null +++ b/ReadLine/ReadLine/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ReadLine")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ReadLine")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("56231b68-ed65-46bf-b959-c64b56fa22f9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ReadLine/ReadLine/ReadLine.csproj b/ReadLine/ReadLine/ReadLine.csproj new file mode 100644 index 0000000..cf84df6 --- /dev/null +++ b/ReadLine/ReadLine/ReadLine.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {EB5CCB00-7FBF-4ACE-AAF2-E994F518DAF7} + Library + Properties + ReadLine + ReadLine + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file From 8be801a672264edbb482b8ad3ac160cb34f9736b Mon Sep 17 00:00:00 2001 From: Dominik Herold Date: Tue, 21 Feb 2017 14:34:09 +0100 Subject: [PATCH 2/3] make proj compilable --- ReadLine/ReadLine/Class1.cs | 12 ---- ReadLine/ReadLine/Properties/AssemblyInfo.cs | 36 ----------- {ReadLine => src}/ReadLine.sln | 0 src/ReadLine/Abstractions/Console2.cs | 68 +++++++++++++++----- src/ReadLine/KeyHandler.cs | 30 +++++++-- src/ReadLine/Properties/AssemblyInfo.cs | 1 - src/ReadLine/ReadLine.cs | 17 ++++- {ReadLine => src}/ReadLine/ReadLine.csproj | 6 +- 8 files changed, 95 insertions(+), 75 deletions(-) delete mode 100644 ReadLine/ReadLine/Class1.cs delete mode 100644 ReadLine/ReadLine/Properties/AssemblyInfo.cs rename {ReadLine => src}/ReadLine.sln (100%) rename {ReadLine => src}/ReadLine/ReadLine.csproj (90%) diff --git a/ReadLine/ReadLine/Class1.cs b/ReadLine/ReadLine/Class1.cs deleted file mode 100644 index 8148dd4..0000000 --- a/ReadLine/ReadLine/Class1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ReadLine -{ - public class Class1 - { - } -} diff --git a/ReadLine/ReadLine/Properties/AssemblyInfo.cs b/ReadLine/ReadLine/Properties/AssemblyInfo.cs deleted file mode 100644 index c245b6c..0000000 --- a/ReadLine/ReadLine/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ReadLine")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ReadLine")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("56231b68-ed65-46bf-b959-c64b56fa22f9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ReadLine/ReadLine.sln b/src/ReadLine.sln similarity index 100% rename from ReadLine/ReadLine.sln rename to src/ReadLine.sln diff --git a/src/ReadLine/Abstractions/Console2.cs b/src/ReadLine/Abstractions/Console2.cs index 6dd292b..c7c0bdb 100644 --- a/src/ReadLine/Abstractions/Console2.cs +++ b/src/ReadLine/Abstractions/Console2.cs @@ -3,21 +3,57 @@ namespace Internal.ReadLine.Abstractions { internal class Console2 : IConsole - { - public int CursorLeft => Console.CursorLeft; - - public int CursorTop => Console.CursorTop; - - public int BufferWidth => Console.BufferWidth; - - public int BufferHeight => Console.BufferHeight; - - public void SetBufferSize(int width, int height) => Console.SetBufferSize(width, height); - - public void SetCursorPosition(int left, int top) => Console.SetCursorPosition(left, top); - - public void Write(string value) => Console.Write(value); - - public void WriteLine(string value) => Console.WriteLine(value); + { + public int CursorLeft + { + get + { + return Console.CursorLeft; + } + } + + public int CursorTop + { + get + { + return Console.CursorTop; + } + } + + public int BufferWidth + { + get + { + return Console.BufferWidth; + } + } + + public int BufferHeight + { + get + { + return Console.BufferHeight; + } + } + + public void SetBufferSize(int width, int height) + { + Console.SetBufferSize(width, height); + } + + public void SetCursorPosition(int left, int top) + { + Console.SetCursorPosition(left, top); + } + + public void Write(string value) + { + Console.Write(value); + } + + public void WriteLine(string value) + { + Console.WriteLine(value); + } } } \ No newline at end of file diff --git a/src/ReadLine/KeyHandler.cs b/src/ReadLine/KeyHandler.cs index 5c8fe56..6f85d6e 100644 --- a/src/ReadLine/KeyHandler.cs +++ b/src/ReadLine/KeyHandler.cs @@ -20,14 +20,29 @@ internal class KeyHandler private int _completionsIndex; private IConsole Console2; - private bool IsStartOfLine() => _cursorPos == 0; + private bool IsStartOfLine() + { + return _cursorPos == 0; + } - private bool IsEndOfLine() => _cursorPos == _cursorLimit; + private bool IsEndOfLine() + { + return _cursorPos == _cursorLimit; + } - private bool IsStartOfBuffer() => Console2.CursorLeft == 0; + private bool IsStartOfBuffer() + { + return Console2.CursorLeft == 0; + } - private bool IsEndOfBuffer() => Console2.CursorLeft == Console2.BufferWidth - 1; - private bool IsInAutoCompleteMode() => _completions != null; + private bool IsEndOfBuffer() + { + return Console2.CursorLeft == Console2.BufferWidth - 1; + } + private bool IsInAutoCompleteMode() + { + return _completions != null; + } private void MoveCursorLeft() { @@ -93,7 +108,10 @@ private void WriteString(string str) WriteChar(character); } - private void WriteChar() => WriteChar(_keyInfo.KeyChar); + private void WriteChar() + { + WriteChar(_keyInfo.KeyChar); + } private void WriteChar(char character) { diff --git a/src/ReadLine/Properties/AssemblyInfo.cs b/src/ReadLine/Properties/AssemblyInfo.cs index 8139536..5303f1b 100644 --- a/src/ReadLine/Properties/AssemblyInfo.cs +++ b/src/ReadLine/Properties/AssemblyInfo.cs @@ -3,5 +3,4 @@ [assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v1.3")] [assembly:System.Runtime.CompilerServices.InternalsVisibleTo("ReadLine.Tests")] \ No newline at end of file diff --git a/src/ReadLine/ReadLine.cs b/src/ReadLine/ReadLine.cs index 0cc85cd..a27acdc 100755 --- a/src/ReadLine/ReadLine.cs +++ b/src/ReadLine/ReadLine.cs @@ -17,9 +17,20 @@ static ReadLine() _history = new List(); } - public static void AddHistory(params string[] text) => _history.AddRange(text); - public static List GetHistory() => _history; - public static void ClearHistory() => _history = new List(); + public static void AddHistory(params string[] text) + { + _history.AddRange(text); + } + + public static List GetHistory() + { + return _history; + } + + public static void ClearHistory() + { + _history = new List(); + } public static string Read(string prompt = "") { diff --git a/ReadLine/ReadLine/ReadLine.csproj b/src/ReadLine/ReadLine.csproj similarity index 90% rename from ReadLine/ReadLine/ReadLine.csproj rename to src/ReadLine/ReadLine.csproj index cf84df6..de68e07 100644 --- a/ReadLine/ReadLine/ReadLine.csproj +++ b/src/ReadLine/ReadLine.csproj @@ -39,9 +39,13 @@ - + + + + +