├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── build-only.yml │ ├── build-site.yml │ └── build.yml ├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Crypt ├── Crypt.cpp ├── Crypt.def ├── Crypt.h ├── Crypt.rc ├── Crypt.vcxproj ├── Crypt.vcxproj.filters ├── LoginEncryption.cpp ├── LoginEncryption.h ├── MemFinder.cpp ├── MemFinder.h ├── OSIEncryption.cpp ├── OSIEncryption.h ├── OldStatusBar.cpp ├── PacketInfo.cpp ├── PacketInfo.h ├── UOArt.cpp ├── debug.h ├── platform.h ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── table.h ├── trees.cpp ├── twofish.c ├── twofish.h ├── uo_huffman.cpp └── uo_huffman.h ├── FastColoredTextBox ├── AutocompleteItem.cs ├── AutocompleteMenu.cs ├── Bookmarks.cs ├── Char.cs ├── CommandManager.cs ├── Commands.cs ├── DocumentMap.cs ├── EncodingDetector.cs ├── ExportToHTML.cs ├── ExportToRTF.cs ├── FCTB_key.snk ├── FastColoredTextBox.cs ├── FastColoredTextBox.csproj ├── FastColoredTextBox.resx ├── FastColoredTextBox.xml ├── FileTextSource.cs ├── FindForm.Designer.cs ├── FindForm.cs ├── FindForm.resx ├── GoToForm.Designer.cs ├── GoToForm.cs ├── GoToForm.resx ├── Hints.cs ├── Hotkeys.cs ├── HotkeysEditorForm.Designer.cs ├── HotkeysEditorForm.cs ├── HotkeysEditorForm.resx ├── LimitedStack.cs ├── Line.cs ├── LinesAccessor.cs ├── MacrosManager.cs ├── NativeMethods.cs ├── Place.cs ├── PlatformType.cs ├── Properties │ └── AssemblyInfo.cs ├── Range.cs ├── ReplaceForm.Designer.cs ├── ReplaceForm.cs ├── ReplaceForm.resx ├── Ruler.Designer.cs ├── Ruler.cs ├── Style.cs ├── SyntaxDescriptor.cs ├── SyntaxHighlighter.cs ├── TextSource.cs ├── TypeDescriptor.cs ├── UnfocusablePanel.cs └── VisualMarker.cs ├── INSTALL.md ├── LICENSE.md ├── Loader ├── Loader.cpp ├── Loader.def ├── Loader.h ├── Loader.rc ├── Loader.vcxproj ├── Loader.vcxproj.filters ├── resource.h ├── stdafx.cpp └── stdafx.h ├── Notepad++UDL.xml ├── Platform ├── Platform.cpp ├── Platform.def ├── Platform.h ├── Platform.vcxproj └── Platform.vcxproj.filters ├── README.md ├── Razor.sln ├── Razor ├── Agents │ ├── Agents.cs │ ├── BuyAgent.cs │ ├── IgnoreAgent.cs │ ├── OrganizerAgent.cs │ ├── RestockAgent.cs │ ├── ScavengerAgent.cs │ ├── SearchExemptionAgent.cs │ ├── SellAgent.cs │ └── UseOnceAgent.cs ├── Boat │ ├── BoatWindow.Designer.cs │ ├── BoatWindow.cs │ ├── BoatWindow.resx │ └── Images │ │ ├── anchor-left.png │ │ ├── anchor-right.png │ │ ├── boateast.png │ │ ├── boatnorth.png │ │ ├── boatsouth.png │ │ ├── boatwest.png │ │ ├── close.jpg │ │ ├── east.png │ │ ├── north.png │ │ ├── northeast.png │ │ ├── northwest.png │ │ ├── serpentspillar.png │ │ ├── south.png │ │ ├── southeast.png │ │ ├── southwest.png │ │ ├── stop.jpg │ │ ├── stop.png │ │ ├── stopboat.png │ │ ├── turnaround.png │ │ ├── turnleft.jpg │ │ ├── turnright.jpg │ │ ├── uo-frame.png │ │ └── west.png ├── Client │ ├── ClassicUO.cs │ ├── Client.cs │ ├── OSI.cs │ └── UOAssist.cs ├── Core │ ├── ActionQueue.cs │ ├── BandageTimer.cs │ ├── BodCapture.cs │ ├── BuffDebuffManager.cs │ ├── ClassicUOManager.cs │ ├── Commands.cs │ ├── ContainerLabels.cs │ ├── CooldownManager.cs │ ├── Counters.cs │ ├── DamageTracker.cs │ ├── Dress.cs │ ├── DressList.cs │ ├── EncodedSpeech.cs │ ├── FriendsManager.cs │ ├── GateTimer.cs │ ├── Geometry.cs │ ├── GoldPerHourTimer.cs │ ├── Item.cs │ ├── ItemID.cs │ ├── Main.cs │ ├── Map.cs │ ├── MemHelper.cs │ ├── MessageInBottleCapture.cs │ ├── MessageManager.cs │ ├── Mobile.cs │ ├── MsgQueue.cs │ ├── ObjectPropertyList.cs │ ├── OverheadManager.cs │ ├── Overrides.cs │ ├── PasswordMemory.cs │ ├── Ping.cs │ ├── Player.cs │ ├── ScreenCapture.cs │ ├── Serial.cs │ ├── SkillTimer.cs │ ├── Spells.cs │ ├── StaffToolsManager.cs │ ├── StealthSteps.cs │ ├── SystemMessages.cs │ ├── Targeting.cs │ ├── TargetingClosest.cs │ ├── TargetingNextPrevious.cs │ ├── TargetingRandom.cs │ ├── TextFilterManager.cs │ ├── Timer.cs │ ├── UOEntity.cs │ ├── Utility.cs │ ├── WaypointManager.cs │ ├── World.cs │ └── ZLib.cs ├── Filters │ ├── Death.cs │ ├── Filter.cs │ ├── Light.cs │ ├── MessageFilter.cs │ ├── MobileFilter.cs │ ├── SoundFilters.cs │ ├── SoundMusicManager.cs │ ├── StaffItems.cs │ ├── TargetFilterManager.cs │ ├── VetRewardGump.cs │ ├── WallStaticFilter.cs │ └── Weather.cs ├── Gumps │ ├── Gump.cs │ ├── GumpButtonType.cs │ ├── GumpCollection.cs │ ├── GumpElement.cs │ ├── GumpPage.cs │ ├── GumpType.cs │ └── Internal │ │ ├── AgentsGump.cs │ │ ├── BoatControlGump.cs │ │ ├── BuffGump.cs │ │ ├── CooldownGump.cs │ │ ├── DamageTrackerGump.cs │ │ ├── DamageTrackerListGump.cs │ │ ├── HotKeyGump.cs │ │ ├── InputDialogGump.cs │ │ ├── ItemInfoGump.cs │ │ ├── MobileInfoGump.cs │ │ ├── SystemMessagesGump.cs │ │ └── TestMessageGump.cs ├── HotKeys │ ├── Counters.cs │ ├── HotKeys.cs │ ├── Misc.cs │ ├── SkillHotKeys.cs │ ├── SpecialMoves.cs │ └── Undress.cs ├── Macros │ ├── Actions.cs │ ├── Actions.resx │ ├── Macro.cs │ ├── MacroManager.cs │ └── MacroVariables.cs ├── Map │ ├── MapWindow.cs │ ├── MapWindow.resx │ ├── Region.cs │ ├── UOMapControl.cs │ ├── UOMapControl.resx │ └── UOMapRuneButton.cs ├── Network │ ├── Handlers.cs │ ├── Loader.cs │ ├── Packet.cs │ ├── PacketHandler.cs │ ├── PacketTable.cs │ ├── PacketWriter.cs │ └── Packets.cs ├── Platform.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Razor.csproj ├── Razor.manifest ├── Scripts │ ├── AgentCommands.cs │ ├── Aliases.cs │ ├── Commands.cs │ ├── Engine │ │ ├── Interpreter.cs │ │ ├── Lexer.cs │ │ └── TextParser.cs │ ├── Expressions.cs │ ├── Helpers │ │ └── CommandHelper.cs │ ├── RazorScript.cs │ ├── ScriptManager.cs │ ├── ScriptVariables.cs │ ├── SpeechCommands.cs │ └── TargetCommands.cs ├── UI │ ├── AddCounter.cs │ ├── AddCounter.resx │ ├── App.ico │ ├── ArtViewer.Designer.cs │ ├── ArtViewer.cs │ ├── BuffDebuffOptions.Designer.cs │ ├── BuffDebuffOptions.cs │ ├── BuffDebuffOptions.resx │ ├── Config.cs │ ├── ContainerLabels.Designer.cs │ ├── ContainerLabels.cs │ ├── ContainerLabels.resx │ ├── Ext.cs │ ├── HueEntry.cs │ ├── HueEntry.resx │ ├── Images │ │ └── Doors │ │ │ ├── EastCCW.gif │ │ │ ├── EastCW.gif │ │ │ ├── NorthCCW.gif │ │ │ ├── NorthCW.gif │ │ │ ├── SouthCCW.gif │ │ │ ├── SouthCW.gif │ │ │ ├── WestCCW.gif │ │ │ └── WestCW.gif │ ├── InputBox.cs │ ├── InputBox.resx │ ├── InputDropdown.cs │ ├── InputDropdown.resx │ ├── Languages.cs │ ├── Lock.ico │ ├── MacroInsertDoWhile.cs │ ├── MacroInsertDoWhile.resx │ ├── MacroInsertIf.cs │ ├── MacroInsertIf.resx │ ├── MacroInsertWait.cs │ ├── MacroInsertWait.resx │ ├── MacroInsertWhile.cs │ ├── MacroInsertWhile.resx │ ├── MessageDialog.cs │ ├── MessageDialog.resx │ ├── Razor.Designer.cs │ ├── Razor.cs │ ├── Razor.resx │ ├── SoundEntry.cs │ ├── SoundEntry.resx │ ├── SplashScreen.cs │ ├── SplashScreen.resx │ ├── UOPS.ico │ ├── WelcomeForm.cs │ ├── WelcomeForm.resx │ ├── donate.gif │ ├── map.ico │ ├── old_splash.jpg │ ├── razor_new.bmp │ └── splash.png ├── UltimaSDK │ ├── ASCIIFont.cs │ ├── AnimationEdit.cs │ ├── Animations.cs │ ├── Animdata.cs │ ├── Art.cs │ ├── BwtDecompress.cs │ ├── CalibrationInfo.cs │ ├── Client.cs │ ├── ClientHandles.cs │ ├── FileIndex.cs │ ├── Files.cs │ ├── Gumps.cs │ ├── Hues.cs │ ├── Light.cs │ ├── LocationPointer.cs │ ├── Map.cs │ ├── MultiMap.cs │ ├── Multis.cs │ ├── NativeMethods.cs │ ├── ProcessStream.cs │ ├── RadarCol.cs │ ├── SkillGroups.cs │ ├── Skills.cs │ ├── Sound.cs │ ├── SpeechList.cs │ ├── StackDataReader.cs │ ├── StringEntry.cs │ ├── StringHelper.cs │ ├── StringList.cs │ ├── Textures.cs │ ├── TileData.cs │ ├── TileList.cs │ ├── TileMatrix.cs │ ├── TileMatrixPatch.cs │ ├── UnicodeFont.cs │ ├── ValueStringBuilder.cs │ ├── Verdata.cs │ └── WindowProcessStream.cs ├── app.config ├── cuoapi.dll └── packages.config ├── etc ├── Language │ ├── Razor_lang.CHS │ ├── Razor_lang.PTB │ ├── Razor_lang.bg │ ├── Razor_lang.cht │ ├── Razor_lang.deu │ ├── Razor_lang.enu │ ├── Razor_lang.esp │ ├── Razor_lang.ita │ ├── Razor_lang.pl │ ├── Razor_lang.rus │ ├── Razor_lang.swe │ └── Razor_lang.tur ├── Razor.nsi ├── animdata.csv ├── counters.xml ├── doors.xml ├── dotNet.nsh ├── guardlines.def ├── items.xml ├── license.txt ├── overrides.def ├── spells.def ├── unrar.dll ├── uorguardlines.def └── zlib.dll └── help ├── docs ├── download.md ├── faq.md ├── guide │ ├── commands.md │ ├── comments.md │ ├── expressions.md │ ├── index.md │ ├── keywords.md │ ├── layers.md │ └── variables.md ├── help │ ├── advanced.md │ ├── agents.md │ ├── armdress.md │ ├── displaycounters.md │ ├── filters.md │ ├── friends.md │ ├── general.md │ ├── hotkeys.md │ ├── index.md │ ├── macros.md │ ├── options.md │ ├── screenshots.md │ ├── scripts.md │ └── skills.md ├── history.md ├── images │ ├── advanced-deco.png │ ├── advanced-doors.png │ ├── advanced.png │ ├── agent-aliases.gif │ ├── agents.png │ ├── armdress-items.png │ ├── armdress-selection.png │ ├── armdress.png │ ├── bandagetimer.png │ ├── contextmenu.png │ ├── counters.png │ ├── cuolauncher-plugin.png │ ├── cuolauncher-profile.png │ ├── cuolauncher-update.png │ ├── displayscounters.png │ ├── filters.png │ ├── friends.png │ ├── general.png │ ├── hotkeys.png │ ├── infocommand.png │ ├── linuxsplash.png │ ├── macros-advanced-at.png │ ├── macros-advanced-at1.png │ ├── macros-advanced.png │ ├── macros-options.png │ ├── macros.png │ ├── map-boat.png │ ├── map-uops.png │ ├── map.png │ ├── moreoptions.png │ ├── old-splash.jpg │ ├── old-splash.png │ ├── options-additional.png │ ├── options-targetqueues.png │ ├── options.png │ ├── overhead.png │ ├── overheaddemo.gif │ ├── profiles.png │ ├── razor.ico │ ├── razor.png │ ├── razorinstaller.png │ ├── runebook-gump-numbers.png │ ├── screenshots.png │ ├── scripts-infogump.png │ ├── scripts-options.png │ ├── scripts.png │ ├── skills.png │ ├── soundmusic.png │ ├── targetfilters.png │ ├── titlebar.png │ ├── videocapture.png │ ├── waypoints.png │ └── welcome.png ├── index.md ├── install │ ├── linux.md │ └── windows.md ├── releasenotes.md ├── stylesheets │ └── extra.css └── uoaapi.md ├── mkdocs.yml ├── overrides └── main.html ├── pygments.lexers.razor ├── pygments.mapping.razor └── pygments.styles.razor /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help Razor improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Please include if you are using the standard OSI client or using ClassicUO.** 11 | 12 | Remember, **Great Bug Reports** tend to have: 13 | 14 | - A quick summary and/or background of the issue 15 | - Steps to reproduce 16 | - Be specific! This can be challenging at times in a game like UO, but the more specific you are, the easier it is to fix 17 | - Include screenshots, gifs, videos if possible. Free apps like ShareX and Greenshot make it easy. 18 | - What you expected would happen 19 | - What actually happens 20 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for Razor 4 | title: "[FEATURE]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | All feature requests will be considered, but not all will be implemented but please don't let that discourage you from submitting more. 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 14 | 15 | **Describe the solution you'd like** 16 | A clear and concise description of what you want to happen. 17 | 18 | **Describe alternatives you've considered** 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | **Additional context** 22 | Add any other context or screenshots about the feature request here. 23 | -------------------------------------------------------------------------------- /.github/workflows/build-only.yml: -------------------------------------------------------------------------------- 1 | name: Build Only 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - 'help/**' 9 | - '**/build-site.yml' 10 | 11 | jobs: 12 | 13 | build: 14 | 15 | strategy: 16 | matrix: 17 | configuration: [Release] 18 | 19 | runs-on: windows-2022 20 | 21 | env: 22 | Solution_Name: Razor.sln 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v2 27 | with: 28 | fetch-depth: 0 29 | 30 | - name: Install .NET 31 | uses: actions/setup-dotnet@v1 32 | with: 33 | dotnet-version: 6.0.x 34 | 35 | - name: Setup MSBuild.exe 36 | uses: microsoft/setup-msbuild@v1.1 37 | 38 | - name: Restore Razor 39 | run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration 40 | env: 41 | Configuration: ${{ matrix.configuration }} 42 | 43 | - name: Build Razor 44 | run: msbuild $env:Solution_Name /t:Build /p:Configuration=$env:Configuration 45 | env: 46 | Configuration: ${{ matrix.configuration }} 47 | 48 | 49 | -------------------------------------------------------------------------------- /.github/workflows/build-site.yml: -------------------------------------------------------------------------------- 1 | name: Build Site 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - 'help/**' 9 | - '**/build-site.yml' 10 | pull_request: 11 | branches: 12 | - master 13 | paths: 14 | - 'help/**' 15 | - '**/build-site.yml' 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-latest 20 | defaults: 21 | run: 22 | working-directory: ./help 23 | strategy: 24 | matrix: 25 | python-version: [3.10.9] 26 | 27 | steps: 28 | - uses: actions/checkout@v3 29 | - name: Set up Python ${{ matrix.python-version }} 30 | uses: actions/setup-python@v4 31 | with: 32 | python-version: ${{ matrix.python-version }} 33 | 34 | - name: Install dependencies 35 | run: | 36 | python -m pip install --upgrade pip 37 | pip install mkdocs 38 | pip install mkdocs-material 39 | pip install mkdocs-git-revision-date-localized-plugin 40 | pip install pillow 41 | pip install cairosvg 42 | sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev 43 | 44 | - name: Install and modify Pygments 45 | run: | 46 | 47 | git clone https://github.com/pygments/pygments.git 48 | 49 | # Replace with Razor files 50 | rm ./pygments/pygments/lexers/_mapping.py 51 | cp pygments.mapping.razor ./pygments/pygments/lexers/_mapping.py 52 | 53 | cp pygments.lexers.razor ./pygments/pygments/lexers/razor.py 54 | cp pygments.styles.razor ./pygments/pygments/styles/razor.py 55 | 56 | pip install -e ./pygments/ 57 | 58 | # Runs a single command using the runners shell 59 | - name: Build site 60 | run: mkdocs build 61 | 62 | - name: Generate robots.txt 63 | run: | 64 | cat > ./site/robots.txt <> 16) | (((~seed) ^ 0xabcdffff) & 0xffff0000); 40 | } 41 | 42 | void LoginEncryption::Encrypt( const BYTE *in, BYTE *out, int len ) 43 | { 44 | for (int i=0;i> 1) | (pt0 << 31)) ^ LOGIN_KEY_1) >> 1) | (pt0<<31)) ^ LOGIN_KEY_1; 57 | //m_Table[0] = ((pt0 >> 1) | (pt1 << 31)) ^ LOGIN_KEY_2; 58 | 59 | BYTE out = in ^ ((unsigned char)m_Table[0]); 60 | 61 | DWORD OldT1 = m_Table[1]; 62 | m_Table[1] = ((((m_Table[1] >> 1) | (m_Table[0] << 31)) ^ ((*Key1)-1)) >> 1 | (m_Table[0] << 31)) ^ (*Key1); 63 | m_Table[0] = ((m_Table[0]>>1) | (OldT1<<31)) ^ (*Key2); 64 | 65 | return out; 66 | } 67 | 68 | bool LoginEncryption::TestForLogin( BYTE encrypted ) 69 | { 70 | return IsLoginByte( (BYTE)( encrypted ^ ((BYTE)m_Table[0]) ) ); 71 | } 72 | 73 | bool LoginEncryption::IsLoginByte( BYTE unencrypted ) 74 | { 75 | return unencrypted == ((BYTE)0x80) || unencrypted == ((BYTE)0x48); 76 | } 77 | 78 | DWORD LoginEncryption::GenerateBadSeed( DWORD oldSeed ) 79 | { 80 | DWORD newSeed = (*Key1) ^ (*Key2); 81 | newSeed = ((newSeed >> 24) & 0xFF) | ((newSeed >> 8) & 0xFF00) | ((newSeed << 8) & 0xFF0000) | ((newSeed << 24) & 0xFF000000); 82 | return htonl( newSeed ^ htonl( oldSeed ) ); 83 | } 84 | -------------------------------------------------------------------------------- /Crypt/LoginEncryption.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LoginEncryption 4 | { 5 | public: 6 | LoginEncryption(); 7 | 8 | void Initialize( const BYTE *pSeed ); 9 | 10 | static void SetKeys( const DWORD *k1, const DWORD *k2 ); 11 | 12 | void Encrypt( const BYTE *in, BYTE *out, int len ); 13 | void Decrypt( const BYTE *in, BYTE *out, int len ); 14 | 15 | bool TestForLogin( BYTE encrypted ); 16 | 17 | static DWORD GenerateBadSeed( DWORD oldSeed ); 18 | 19 | static bool IsLoginByte( BYTE unencrypted ); 20 | 21 | private: 22 | static const DWORD *Key1, *Key2; 23 | 24 | BYTE Crypt( BYTE ); 25 | 26 | DWORD m_Table[2]; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /Crypt/MemFinder.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MemFinder.h" 3 | 4 | DWORD MemFinder::Find(const void *data, int length, DWORD addressHint, DWORD addressMax) 5 | { 6 | for (DWORD addr = addressHint; addr < addressMax; addr++) 7 | { 8 | if (IsBadReadPtr((void*)addr, length)) { 9 | continue; 10 | } 11 | 12 | __try 13 | { 14 | if (memcmp((const void*)addr, data, length) == 0) 15 | return addr; 16 | } 17 | __except (EXCEPTION_ACCESS_VIOLATION) 18 | { 19 | continue; 20 | } 21 | } 22 | 23 | return 0; 24 | } 25 | 26 | MemFinder::MemFinder() 27 | { 28 | Clear(); 29 | } 30 | 31 | MemFinder::~MemFinder() 32 | { 33 | Clear(); 34 | } 35 | 36 | void MemFinder::Clear() 37 | { 38 | _Executed = false; 39 | _StartPos = 0xFFFFFFFF; 40 | 41 | for (unsigned int i = 0; i<_Entries.size(); i++) 42 | delete[] _Entries[i].Data; 43 | 44 | _Entries.clear(); 45 | } 46 | 47 | 48 | void MemFinder::AddEntry(const void *data, int length, unsigned int maxResults, DWORD hint) 49 | { 50 | Entry ent; 51 | 52 | ent.Data = new char[length]; 53 | memcpy(ent.Data, data, length); 54 | 55 | ent.Length = length; 56 | ent.MaxResults = maxResults; 57 | ent.PositionHint = hint; 58 | 59 | if (hint < _StartPos) 60 | _StartPos = hint; 61 | 62 | _Entries.push_back(ent); 63 | } 64 | 65 | DWORD MemFinder::GetAddress(const void *data, int length, unsigned int idx) 66 | { 67 | if (!_Executed) 68 | return 0; 69 | 70 | for (unsigned int i = 0; i < _Entries.size(); i++) 71 | { 72 | if (_Entries[i].Length != length) 73 | continue; 74 | 75 | if (!memcmp(data, _Entries[i].Data, length)) 76 | { 77 | if (idx < _Entries[i].Results.size()) 78 | return _Entries[i].Results[idx]; 79 | else 80 | return 0; 81 | } 82 | } 83 | 84 | return 0; 85 | } 86 | 87 | void MemFinder::Execute() 88 | { 89 | bool allDone = false; 90 | for (DWORD pos = _StartPos; pos < 0x02000000 && !allDone; pos++) 91 | { 92 | __try 93 | { 94 | allDone = true; 95 | for (unsigned int i = 0; i < _Entries.size(); i++) 96 | { 97 | Entry &e = _Entries[i]; 98 | 99 | if (e.Results.size() >= e.MaxResults) { 100 | /* Already found this entry */ 101 | continue; 102 | } 103 | 104 | if (IsBadReadPtr((void*)pos, e.Length)) { 105 | continue; 106 | } 107 | 108 | allDone = false; 109 | 110 | if (e.PositionHint > pos) { 111 | /* This entry always appears in memory after this position */ 112 | continue; 113 | } 114 | 115 | if (!memcmp((void*)pos, e.Data, e.Length)) { 116 | e.Results.push_back(pos); 117 | } 118 | } 119 | } 120 | __except (EXCEPTION_ACCESS_VIOLATION) 121 | { 122 | break; 123 | } 124 | } 125 | 126 | _Executed = true; 127 | } 128 | 129 | -------------------------------------------------------------------------------- /Crypt/MemFinder.h: -------------------------------------------------------------------------------- 1 | #pragma pack(1) 2 | #pragma once 3 | 4 | #include 5 | using std::vector; 6 | 7 | class MemFinder 8 | { 9 | public: 10 | static DWORD Find( const void *data, int length, DWORD hint = 0x00400000, DWORD addressMax = 0x01000000 ); 11 | 12 | MemFinder(); 13 | ~MemFinder(); 14 | 15 | void AddEntry( const void *data, int length, unsigned int maxResults, DWORD hint ); 16 | void AddEntry( const void *data, int length, DWORD hint = 0x00400000 ) { AddEntry( data, length, 1, hint ); } 17 | 18 | DWORD GetAddress( const void *data, int length, unsigned int idx = 0 ); 19 | 20 | void Execute(); 21 | 22 | void Clear(); 23 | 24 | private: 25 | struct Entry 26 | { 27 | char *Data; 28 | int Length; 29 | DWORD PositionHint; 30 | unsigned int MaxResults; 31 | vector Results; 32 | }; 33 | 34 | vector _Entries; 35 | bool _Executed; 36 | DWORD _StartPos; 37 | }; 38 | -------------------------------------------------------------------------------- /Crypt/OSIEncryption.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TwoFish.h" 4 | 5 | class OSIEncryption 6 | { 7 | public: 8 | OSIEncryption(); 9 | 10 | void Initialize( DWORD dwSeed ); 11 | 12 | void DecryptFromServer( const BYTE *in, BYTE *out, int len ); 13 | void DecryptFromClient( const BYTE *in, BYTE *out, int len ); 14 | 15 | void EncryptForServer( const BYTE *in, BYTE *out, int len ); 16 | void EncryptForClient( const BYTE *in, BYTE *out, int len ); 17 | 18 | static void MD5( const BYTE *input, int inLen, BYTE *output ); 19 | 20 | private: 21 | void TwoFishCrypt( const BYTE *in, BYTE *out, int len ); 22 | void ReinitTFTable(); 23 | 24 | void XORCrypt( const BYTE *in, BYTE *out, int len ); 25 | void InitializeXORTable( const BYTE* data, int dataLen ); 26 | static void Hash( BYTE *field, const BYTE *param ); 27 | static void CallHash( BYTE *key, const BYTE *challenge, unsigned int len ); 28 | static void CalcResponse( BYTE *result, BYTE *field ); 29 | 30 | keyInstance m_Key; 31 | cipherInstance m_Cipher; 32 | unsigned int m_TFPos; 33 | unsigned char m_XORPos; 34 | BYTE m_TFTable[256]; 35 | BYTE m_XORTable[16]; 36 | }; 37 | 38 | -------------------------------------------------------------------------------- /Crypt/PacketInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Crypt.h" 3 | 4 | #include "PacketInfo.h" 5 | 6 | DLLFUNCTION int GetPacketLength( unsigned char *packet, int len ) 7 | { 8 | if ( pShared != NULL ) 9 | { 10 | int packetLen = pShared->PacketTable[(unsigned char)packet[0]]; 11 | 12 | if ( packetLen >= 0x4000 ) 13 | { 14 | if ( len < 3 ) 15 | return 0; 16 | else 17 | return packet[1]<<8 | packet[2]; 18 | } 19 | else 20 | { 21 | return packetLen; 22 | } 23 | } 24 | else if ( len >= 3 ) 25 | { 26 | //attempt to auto detect an undefined packet 27 | return packet[1]<<8 | packet[2]; 28 | } 29 | else 30 | { 31 | return -1; 32 | } 33 | } 34 | 35 | DLLFUNCTION bool IsDynLength( BYTE packet ) 36 | { 37 | if ( pShared != NULL ) 38 | return pShared->PacketTable[packet] >= 0x8000; 39 | else 40 | return true; 41 | } 42 | -------------------------------------------------------------------------------- /Crypt/debug.h: -------------------------------------------------------------------------------- 1 | #ifdef DEBUG /* keep these macros common so they are same for both versions */ 2 | CONST int debugCompile = 1; 3 | extern int debug; 4 | extern void DebugIO(CONST char *s); /* display the debug output */ 5 | 6 | #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) \ 7 | { if (debug) _Dump(x,s,R,XOR,doRot,showT,needBswap,t0,t1); } 8 | #define DebugDumpKey(key) { if (debug) _DumpKey(key); } 9 | #define IV_ROUND -100 10 | 11 | void _Dump(CONST void *p,CONST char *s,int R,int XOR,int doRot,int showT,int needBswap, 12 | DWORD t0,DWORD t1) 13 | { 14 | char line[512]; /* build output here */ 15 | int i,n; 16 | DWORD q[4]; 17 | 18 | if (R == IV_ROUND) 19 | sprintf(line,"%sIV: ",s); 20 | else 21 | sprintf(line,"%sR[%2d]: ",s,R); 22 | for (n=0;line[n];n++) ; 23 | 24 | for (i=0;i<4;i++) 25 | { 26 | q[i]=((CONST DWORD *)p)[i^(XOR)]; 27 | if (needBswap) q[i]=Bswap(q[i]); 28 | } 29 | 30 | sprintf(line+n,"x= %08lX %08lX %08lX %08lX.", 31 | ROR(q[0],doRot*(R )/2), 32 | ROL(q[1],doRot*(R )/2), 33 | ROR(q[2],doRot*(R+1)/2), 34 | ROL(q[3],doRot*(R+1)/2)); 35 | for (;line[n];n++) ; 36 | 37 | if (showT) 38 | sprintf(line+n," t0=%08lX. t1=%08lX.",t0,t1); 39 | for (;line[n];n++) ; 40 | 41 | sprintf(line+n,"\n"); 42 | DebugIO(line); 43 | } 44 | 45 | void _DumpKey(CONST keyInstance *key) 46 | { 47 | char line[512]; 48 | int i; 49 | int k64Cnt=(key->keyLen+63)/64; /* round up to next multiple of 64 bits */ 50 | int subkeyCnt = ROUND_SUBKEYS + 2*key->numRounds; 51 | 52 | sprintf(line,";\n;makeKey: Input key --> S-box key [%s]\n", 53 | (key->direction == DIR_ENCRYPT) ? "Encrypt" : "Decrypt"); 54 | DebugIO(line); 55 | for (i=0;i %08lX\n","", 58 | key->key32[2*i+1],key->key32[2*i],key->sboxKeys[k64Cnt-1-i]); 59 | DebugIO(line); 60 | } 61 | sprintf(line,";%11sSubkeys\n",""); 62 | DebugIO(line); 63 | for (i=0;isubKeys[2*i],key->subKeys[2*i+1], 66 | (2*i == INPUT_WHITEN) ? " Input whiten" : 67 | (2*i == OUTPUT_WHITEN) ? " Output whiten" : 68 | (2*i == ROUND_SUBKEYS) ? " Round subkeys" : ""); 69 | DebugIO(line); 70 | } 71 | DebugIO(";\n"); 72 | } 73 | #else 74 | CONST int debugCompile = 0; 75 | #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) 76 | #define DebugDumpKey(key) 77 | #endif 78 | -------------------------------------------------------------------------------- /Crypt/platform.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PLATFORM.H -- Platform-specific defines for TWOFISH code 3 | 4 | Submitters: 5 | Bruce Schneier, Counterpane Systems 6 | Doug Whiting, Hi/fn 7 | John Kelsey, Counterpane Systems 8 | Chris Hall, Counterpane Systems 9 | David Wagner, UC Berkeley 10 | 11 | Code Author: Doug Whiting, Hi/fn 12 | 13 | Version 1.00 April 1998 14 | 15 | Copyright 1998, Hi/fn and Counterpane Systems. All rights reserved. 16 | 17 | Notes: 18 | * Tab size is set to 4 characters in this file 19 | 20 | ***************************************************************************/ 21 | 22 | /* use intrinsic rotate if possible */ 23 | #ifndef ROL 24 | #define ROL(x,n) (((x) << ((n) & 0x1F)) | ((x) >> (32-((n) & 0x1F)))) 25 | #define ROR(x,n) (((x) >> ((n) & 0x1F)) | ((x) << (32-((n) & 0x1F)))) 26 | #endif 27 | 28 | #if (0) && defined(__BORLANDC__) && (__BORLANDC__ >= 0x462) 29 | #error "!!!This does not work for some reason!!!" 30 | #include /* get prototype for _lrotl() , _lrotr() */ 31 | #pragma inline __lrotl__ 32 | #pragma inline __lrotr__ 33 | #undef ROL /* get rid of inefficient definitions */ 34 | #undef ROR 35 | #define ROL(x,n) __lrotl__(x,n) /* use compiler intrinsic rotations */ 36 | #define ROR(x,n) __lrotr__(x,n) 37 | #endif 38 | 39 | #ifdef _MSC_VER 40 | #include /* get prototypes for rotation functions */ 41 | #undef ROL 42 | #undef ROR 43 | #pragma intrinsic(_lrotl,_lrotr) /* use intrinsic compiler rotations */ 44 | #define ROL(x,n) _lrotl(x,n) 45 | #define ROR(x,n) _lrotr(x,n) 46 | #endif 47 | 48 | #ifndef _M_IX86 49 | #ifdef __BORLANDC__ 50 | #define _M_IX86 300 /* make sure this is defined for Intel CPUs */ 51 | #endif 52 | #endif 53 | 54 | #ifdef _M_IX86 55 | #define LittleEndian 1 /* e.g., 1 for Pentium, 0 for 68K */ 56 | #define ALIGN32 0 /* need dword alignment? (no for Pentium) */ 57 | #else /* non-Intel platforms */ 58 | #define LittleEndian 0 /* (assume big endian */ 59 | #define ALIGN32 1 /* (assume need alignment for non-Intel) */ 60 | #endif 61 | 62 | #if LittleEndian 63 | #define Bswap(x) (x) /* NOP for little-endian machines */ 64 | #define ADDR_XOR 0 /* NOP for little-endian machines */ 65 | #else 66 | #define Bswap(x) ((ROR(x,8) & 0xFF00FF00) | (ROL(x,8) & 0x00FF00FF)) 67 | #define ADDR_XOR 3 /* convert byte address in dword */ 68 | #endif 69 | 70 | /* Macros for extracting bytes from dwords (correct for endianness) */ 71 | #define _b(x,N) (((BYTE *)&x)[((N) & 3) ^ ADDR_XOR]) /* pick bytes out of a dword */ 72 | 73 | #define b0(x) _b(x,0) /* extract LSB of DWORD */ 74 | #define b1(x) _b(x,1) 75 | #define b2(x) _b(x,2) 76 | #define b3(x) _b(x,3) /* extract MSB of DWORD */ 77 | 78 | -------------------------------------------------------------------------------- /Crypt/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Crypt.rc 4 | // 5 | #define IDI_ICON1 101 6 | #define IDI_RAZOR 101 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 102 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /Crypt/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Crypt.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /Crypt/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | #pragma warning(disable: 4309) 8 | #pragma warning(disable: 4311) 9 | #pragma warning(disable: 4312) 10 | #pragma warning(disable: 4800) 11 | #pragma warning(disable: 4530) 12 | #pragma warning(disable: 4996) 13 | #pragma comment(lib, "ws2_32.lib") 14 | 15 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 16 | // Windows Header Files: 17 | #include 18 | 19 | #pragma pack(1) 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | //#include 29 | //#include 30 | //using std::vector; 31 | //using std::string; 32 | -------------------------------------------------------------------------------- /Crypt/uo_huffman.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Compression 4 | { 5 | public: 6 | static int Compress( char *out, const char *in, int inlen ); 7 | static int Decompress( char *out, const char *in, int inlen ); 8 | 9 | static void Reset(); 10 | 11 | protected: 12 | static int bit_num, treepos; 13 | static int value, mask; 14 | 15 | static int CompressionTable[]; 16 | static int DecompressionTree[]; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /FastColoredTextBox/Char.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FastColoredTextBoxNS 4 | { 5 | /// 6 | /// Char and style 7 | /// 8 | public struct Char 9 | { 10 | /// 11 | /// Unicode character 12 | /// 13 | public char c; 14 | 15 | /// 16 | /// Style bit mask 17 | /// 18 | /// Bit 1 in position n means that this char will rendering by FastColoredTextBox.Styles[n] 19 | public StyleIndex style; 20 | 21 | public Char(char c) 22 | { 23 | this.c = c; 24 | style = StyleIndex.None; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /FastColoredTextBox/FCTB_key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markdwags/Razor/d1c7b2404da9c04184675c692c0a09c0035eacd8/FastColoredTextBox/FCTB_key.snk -------------------------------------------------------------------------------- /FastColoredTextBox/GoToForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace FastColoredTextBoxNS 5 | { 6 | public partial class GoToForm : Form 7 | { 8 | public int SelectedLineNumber { get; set; } 9 | public int TotalLineCount { get; set; } 10 | 11 | public GoToForm() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | protected override void OnLoad(EventArgs e) 17 | { 18 | base.OnLoad(e); 19 | 20 | this.tbLineNumber.Text = this.SelectedLineNumber.ToString(); 21 | 22 | this.label.Text = String.Format("Line number (1 - {0}):", this.TotalLineCount); 23 | } 24 | 25 | protected override void OnShown(EventArgs e) 26 | { 27 | base.OnShown(e); 28 | 29 | this.tbLineNumber.Focus(); 30 | } 31 | 32 | private void btnOk_Click(object sender, EventArgs e) 33 | { 34 | int enteredLine; 35 | if (int.TryParse(this.tbLineNumber.Text, out enteredLine)) 36 | { 37 | enteredLine = Math.Min(enteredLine, this.TotalLineCount); 38 | enteredLine = Math.Max(1, enteredLine); 39 | 40 | this.SelectedLineNumber = enteredLine; 41 | } 42 | 43 | this.DialogResult = DialogResult.OK; 44 | this.Close(); 45 | } 46 | 47 | private void btnCancel_Click(object sender, EventArgs e) 48 | { 49 | this.DialogResult = DialogResult.Cancel; 50 | this.Close(); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /FastColoredTextBox/LimitedStack.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FastColoredTextBoxNS 4 | { 5 | /// 6 | /// Limited stack 7 | /// 8 | public class LimitedStack 9 | { 10 | T[] items; 11 | int count; 12 | int start; 13 | 14 | /// 15 | /// Max stack length 16 | /// 17 | public int MaxItemCount 18 | { 19 | get { return items.Length; } 20 | } 21 | 22 | /// 23 | /// Current length of stack 24 | /// 25 | public int Count 26 | { 27 | get { return count; } 28 | } 29 | 30 | /// 31 | /// Constructor 32 | /// 33 | /// Maximum length of stack 34 | public LimitedStack(int maxItemCount) 35 | { 36 | items = new T[maxItemCount]; 37 | count = 0; 38 | start = 0; 39 | } 40 | 41 | /// 42 | /// Pop item 43 | /// 44 | public T Pop() 45 | { 46 | if (count == 0) 47 | throw new Exception("Stack is empty"); 48 | 49 | int i = LastIndex; 50 | T item = items[i]; 51 | items[i] = default(T); 52 | 53 | count--; 54 | 55 | return item; 56 | } 57 | 58 | int LastIndex 59 | { 60 | get { return (start + count - 1) % items.Length; } 61 | } 62 | 63 | /// 64 | /// Peek item 65 | /// 66 | public T Peek() 67 | { 68 | if (count == 0) 69 | return default(T); 70 | 71 | return items[LastIndex]; 72 | } 73 | 74 | /// 75 | /// Push item 76 | /// 77 | public void Push(T item) 78 | { 79 | if (count == items.Length) 80 | start = (start + 1) % items.Length; 81 | else 82 | count++; 83 | 84 | items[LastIndex] = item; 85 | } 86 | 87 | /// 88 | /// Clear stack 89 | /// 90 | public void Clear() 91 | { 92 | items = new T[items.Length]; 93 | count = 0; 94 | start = 0; 95 | } 96 | 97 | public T[] ToArray() 98 | { 99 | T[] result = new T[count]; 100 | for (int i = 0; i < count; i++) 101 | result[i] = items[(start + i) % items.Length]; 102 | return result; 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /FastColoredTextBox/LinesAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FastColoredTextBoxNS 6 | { 7 | public class LinesAccessor : IList 8 | { 9 | IList ts; 10 | 11 | public LinesAccessor(IList ts) 12 | { 13 | this.ts = ts; 14 | } 15 | 16 | public int IndexOf(string item) 17 | { 18 | for (int i = 0; i < ts.Count; i++) 19 | if (ts[i].Text == item) 20 | return i; 21 | 22 | return -1; 23 | } 24 | 25 | public void Insert(int index, string item) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | 30 | public void RemoveAt(int index) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | 35 | public string this[int index] 36 | { 37 | get { return ts[index].Text; } 38 | set { throw new NotImplementedException(); } 39 | } 40 | 41 | public void Add(string item) 42 | { 43 | throw new NotImplementedException(); 44 | } 45 | 46 | public void Clear() 47 | { 48 | throw new NotImplementedException(); 49 | } 50 | 51 | public bool Contains(string item) 52 | { 53 | for (int i = 0; i < ts.Count; i++) 54 | if (ts[i].Text == item) 55 | return true; 56 | 57 | return false; 58 | } 59 | 60 | public void CopyTo(string[] array, int arrayIndex) 61 | { 62 | for (int i = 0; i < ts.Count; i++) 63 | array[i + arrayIndex] = ts[i].Text; 64 | } 65 | 66 | public int Count 67 | { 68 | get { return ts.Count; } 69 | } 70 | 71 | public bool IsReadOnly 72 | { 73 | get { return true; } 74 | } 75 | 76 | public bool Remove(string item) 77 | { 78 | throw new NotImplementedException(); 79 | } 80 | 81 | public IEnumerator GetEnumerator() 82 | { 83 | for (int i = 0; i < ts.Count; i++) 84 | yield return ts[i].Text; 85 | } 86 | 87 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 88 | { 89 | return GetEnumerator(); 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /FastColoredTextBox/Place.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FastColoredTextBoxNS 4 | { 5 | /// 6 | /// Line index and char index 7 | /// 8 | public struct Place : IEquatable 9 | { 10 | public int iChar; 11 | public int iLine; 12 | 13 | public Place(int iChar, int iLine) 14 | { 15 | this.iChar = iChar; 16 | this.iLine = iLine; 17 | } 18 | 19 | public void Offset(int dx, int dy) 20 | { 21 | iChar += dx; 22 | iLine += dy; 23 | } 24 | 25 | public bool Equals(Place other) 26 | { 27 | return iChar == other.iChar && iLine == other.iLine; 28 | } 29 | 30 | public override bool Equals(object obj) 31 | { 32 | return (obj is Place) && Equals((Place) obj); 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return iChar.GetHashCode() ^ iLine.GetHashCode(); 38 | } 39 | 40 | public static bool operator !=(Place p1, Place p2) 41 | { 42 | return !p1.Equals(p2); 43 | } 44 | 45 | public static bool operator ==(Place p1, Place p2) 46 | { 47 | return p1.Equals(p2); 48 | } 49 | 50 | public static bool operator <(Place p1, Place p2) 51 | { 52 | if (p1.iLine < p2.iLine) return true; 53 | if (p1.iLine > p2.iLine) return false; 54 | if (p1.iChar < p2.iChar) return true; 55 | return false; 56 | } 57 | 58 | public static bool operator <=(Place p1, Place p2) 59 | { 60 | if (p1.Equals(p2)) return true; 61 | if (p1.iLine < p2.iLine) return true; 62 | if (p1.iLine > p2.iLine) return false; 63 | if (p1.iChar < p2.iChar) return true; 64 | return false; 65 | } 66 | 67 | public static bool operator >(Place p1, Place p2) 68 | { 69 | if (p1.iLine > p2.iLine) return true; 70 | if (p1.iLine < p2.iLine) return false; 71 | if (p1.iChar > p2.iChar) return true; 72 | return false; 73 | } 74 | 75 | public static bool operator >=(Place p1, Place p2) 76 | { 77 | if (p1.Equals(p2)) return true; 78 | if (p1.iLine > p2.iLine) return true; 79 | if (p1.iLine < p2.iLine) return false; 80 | if (p1.iChar > p2.iChar) return true; 81 | return false; 82 | } 83 | 84 | public static Place operator +(Place p1, Place p2) 85 | { 86 | return new Place(p1.iChar + p2.iChar, p1.iLine + p2.iLine); 87 | } 88 | 89 | public static Place Empty 90 | { 91 | get { return new Place(); } 92 | } 93 | 94 | public override string ToString() 95 | { 96 | return "(" + iChar + "," + iLine + ")"; 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /FastColoredTextBox/PlatformType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace FastColoredTextBoxNS 7 | { 8 | public static class PlatformType 9 | { 10 | const ushort PROCESSOR_ARCHITECTURE_INTEL = 0; 11 | const ushort PROCESSOR_ARCHITECTURE_IA64 = 6; 12 | const ushort PROCESSOR_ARCHITECTURE_AMD64 = 9; 13 | const ushort PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF; 14 | 15 | 16 | public static Platform GetOperationSystemPlatform() 17 | { 18 | if (Environment.OSVersion.Platform == PlatformID.Unix) 19 | return Environment.Is64BitOperatingSystem ? Platform.X64 : Platform.X86; 20 | var sysInfo = new Win32NativeMethods.SYSTEM_INFO(); 21 | 22 | // WinXP and older - use GetNativeSystemInfo 23 | if (Environment.OSVersion.Version.Major > 5 || 24 | (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1)) 25 | { 26 | NativeMethodWrapper.GetNativeSystemInfo(ref sysInfo); 27 | } 28 | // else use GetSystemInfo 29 | else 30 | { 31 | NativeMethodWrapper.GetSystemInfo(ref sysInfo); 32 | } 33 | 34 | switch (sysInfo.wProcessorArchitecture) 35 | { 36 | case PROCESSOR_ARCHITECTURE_IA64: 37 | case PROCESSOR_ARCHITECTURE_AMD64: 38 | return Platform.X64; 39 | 40 | case PROCESSOR_ARCHITECTURE_INTEL: 41 | return Platform.X86; 42 | 43 | default: 44 | return Platform.Unknown; 45 | } 46 | } 47 | } 48 | 49 | public enum Platform 50 | { 51 | X86, 52 | X64, 53 | Unknown 54 | } 55 | } -------------------------------------------------------------------------------- /FastColoredTextBox/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FastColoredTextBox")] 9 | [assembly: AssemblyDescription("Fast сolored textbox control")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Pavel Torgashov")] 12 | [assembly: AssemblyProduct("FastColoredTextBox")] 13 | [assembly: AssemblyCopyright("© Pavel Torgashov, 2011-2016, pavel_torgashov@ukr.net.")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("95be11b3-45bc-4512-be26-a860a78bd1f1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.16.23.0")] 36 | [assembly: AssemblyFileVersion("2.16.23.0")] -------------------------------------------------------------------------------- /FastColoredTextBox/Ruler.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace FastColoredTextBoxNS 2 | { 3 | partial class Ruler 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | } 34 | 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /FastColoredTextBox/SyntaxDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.RegularExpressions; 3 | using System; 4 | 5 | namespace FastColoredTextBoxNS 6 | { 7 | public class SyntaxDescriptor : IDisposable 8 | { 9 | public char leftBracket = '('; 10 | public char rightBracket = ')'; 11 | public char leftBracket2 = '{'; 12 | public char rightBracket2 = '}'; 13 | public BracketsHighlightStrategy bracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2; 14 | public readonly List