diff --git a/.gitignore b/.gitignore index dfcfd56..0dff1c9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,14 +19,19 @@ mono_crash.* # Build results [Dd]ebug/ [Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ +#[Rr]elease/ +#[Rr]eleases/ x64/ x86/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ -[Bb]in/ +#[Bb]in/ +bin/Debug +bin/ +obj/ +.vs/ +Plugin/ [Oo]bj/ [Ll]og/ [Ll]ogs/ @@ -348,3 +353,9 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +.vs/Genie3/v17/.suo +obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +obj/Debug/Genie3.csproj.AssemblyReference.cache +.vs/Genie3/v17/.suo +*.cache +bin/Plugins.dll diff --git a/.gitignore.bak b/.gitignore.bak new file mode 100644 index 0000000..18e421c --- /dev/null +++ b/.gitignore.bak @@ -0,0 +1,359 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +#[Rr]elease/ +#[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +#[Bb]in/ +bin/Debug +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ +.vs/Genie3/v17/.suo +obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +obj/Debug/Genie3.csproj.AssemblyReference.cache +.vs/Genie3/v17/.suo +*.cache +.vs/Genie3/v17/.suo +bin/Plugins.dll +obj/Debug/Genie3.csproj.AssemblyReference.cache diff --git a/.vs/Genie3/project-colors.json b/.vs/Genie3/project-colors.json deleted file mode 100644 index 487db96..0000000 --- a/.vs/Genie3/project-colors.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Version": 1, - "ProjectMap": { - "da666ffd-3be5-06e4-3978-5ec08f4edbb3": { - "ProjectGuid": "da666ffd-3be5-06e4-3978-5ec08f4edbb3", - "DisplayName": "Genie3", - "ColorIndex": 0 - }, - "b0882700-5eaf-4712-ade5-69dafe473a01": { - "ProjectGuid": "b0882700-5eaf-4712-ade5-69dafe473a01", - "DisplayName": "Interfaces", - "ColorIndex": 1 - } - }, - "NextColorIndex": 2 -} \ No newline at end of file diff --git a/.vs/Genie3/v16/.suo b/.vs/Genie3/v16/.suo deleted file mode 100644 index 5a9cbbd..0000000 Binary files a/.vs/Genie3/v16/.suo and /dev/null differ diff --git a/.vs/Genie3/v17/.suo b/.vs/Genie3/v17/.suo deleted file mode 100644 index f68ac5d..0000000 Binary files a/.vs/Genie3/v17/.suo and /dev/null differ diff --git a/.vs/Genie3/v17/TestStore/0/000.testlog b/.vs/Genie3/v17/TestStore/0/000.testlog deleted file mode 100644 index 0c2ba7e..0000000 Binary files a/.vs/Genie3/v17/TestStore/0/000.testlog and /dev/null differ diff --git a/.vs/Genie3/v17/TestStore/0/testlog.manifest b/.vs/Genie3/v17/TestStore/0/testlog.manifest deleted file mode 100644 index e92ede2..0000000 Binary files a/.vs/Genie3/v17/TestStore/0/testlog.manifest and /dev/null differ diff --git a/Core/Command.cs b/Core/Command.cs index 49345f9..545f68e 100644 --- a/Core/Command.cs +++ b/Core/Command.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.IO; using System.Runtime.InteropServices; +using System.Threading; using System.Windows.Forms; using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; @@ -14,11 +15,11 @@ public class Command { public event EventReconnectEventHandler EventReconnect; - public delegate void EventReconnectEventHandler(); + public delegate void EventReconnectEventHandler(bool isLich); public event EventConnectEventHandler EventConnect; - public delegate void EventConnectEventHandler(string sAccountName, string sPassword, string sCharacter, string sGame); + public delegate void EventConnectEventHandler(string sAccountName, string sPassword, string sCharacter, string sGame, bool isLich); public event EventDisconnectEventHandler EventDisconnect; @@ -60,7 +61,7 @@ public class Command public delegate void EventStatusBarEventHandler(string sText, int iIndex); - public event EventCopyDataEventHandler EventCopyData; + // public event EventCopyDataEventHandler EventCopyData; public delegate void EventCopyDataEventHandler(string sDestination, string sData); @@ -233,7 +234,7 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp if (sRow.Trim().StartsWith(Conversions.ToString(oGlobals.Config.cCommandChar))) { // Get result from function then send result to game - var oArgs = new ArrayList(); + var oArgs = new Genie.Collections.ArrayList(); oArgs = Utility.ParseArgs(sRow); if (oArgs.Count > 0) { @@ -366,35 +367,42 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp case "connect": { - if (oArgs.Count == 1) - { - // EchoText("Reconnect Command Received" & vbNewLine) - EventReconnect?.Invoke(); - } - else if (oArgs.Count == 5) - { - // EchoText("Connect Command Received" & vbNewLine); - var arg1 = oGlobals.ParseGlobalVars(oArgs[1].ToString()); - var arg2 = oGlobals.ParseGlobalVars(oArgs[2].ToString()); - var arg3 = oGlobals.ParseGlobalVars(oArgs[3].ToString()); - var arg4 = oGlobals.ParseGlobalVars(oArgs[4].ToString()); + Connect(oArgs); + break; + } - EventConnect?.Invoke(arg1, arg2, arg3, arg4); - } - else if (oArgs.Count == 2) - { - var arg1 = oGlobals.ParseGlobalVars(oArgs[1].ToString()); - var argEmpty = ""; - EventConnect?.Invoke(arg1, argEmpty, argEmpty, argEmpty); - } - else + case "lc": + case "lconnect": + case "lichconnect": + { + EchoText("Starting Lich Server\n"); + string lichLaunch = $"/C {oGlobals.Config.RubyPath} {oGlobals.Config.LichPath} {oGlobals.Config.LichArguments}"; + + Utility.ExecuteProcess(oGlobals.Config.CmdPath, lichLaunch, false); + int count = 0; + while (count < oGlobals.Config.LichStartPause) { - EchoText("Invalid number of arguments in #connect command. Syntax: #connect account password character game" + Constants.vbNewLine); + Thread.Sleep(1000); + count++; } - + Connect(oArgs, true); break; } + case "ls": + case "lichsettings": + { + EchoText($"\nLich Settings\n"); + EchoText($"----------------------------------------------------\n"); + EchoText($"Cmd Path:\t\t {oGlobals.Config.CmdPath}\n"); + EchoText($"Ruby Path:\t\t {oGlobals.Config.RubyPath}\n"); + EchoText($"Lich Path:\t\t {oGlobals.Config.LichPath}\n"); + EchoText($"Lich Arguments:\t {oGlobals.Config.LichArguments}\n"); + EchoText($"Lich Start Pause:\t {oGlobals.Config.LichStartPause}\n"); + EchoText($"Lich Server:\t\t {oGlobals.Config.LichServer}\n"); + EchoText($"Lich Port:\t\t {oGlobals.Config.LichPort}\n\n"); + break; + } case "disconnect": { EventDisconnect?.Invoke(); @@ -992,7 +1000,9 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp string argsVariable3 = "$" + oArgs[1].ToString(); VariableChanged(argsVariable3); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { EchoText("Invalid #math expression: " + Utility.ArrayToString(oArgs, 1)); } @@ -2314,7 +2324,11 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp } case "goto": + case "go": + case "g": case "walk": + case "walkto": + case "path": { EventMapperCommand?.Invoke(sRow.Replace("#", "#mapper ")); break; @@ -2322,6 +2336,7 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp case "mapper": case "map": + case "m": { EventMapperCommand?.Invoke(sRow); break; @@ -2428,6 +2443,37 @@ public string ParseCommand(string sText, bool bSendToGame = false, bool bUserInp return sResult; } + + private void Connect(ArrayList args, bool isLich = false) + { + if (args.Count == 1) + { + // EchoText("Reconnect Command Received" & vbNewLine) + EventReconnect?.Invoke(isLich); + } + else if (args.Count == 5) + { + // EchoText("Connect Command Received" & vbNewLine); + var arg1 = oGlobals.ParseGlobalVars(args[1].ToString()); + var arg2 = oGlobals.ParseGlobalVars(args[2].ToString()); + var arg3 = oGlobals.ParseGlobalVars(args[3].ToString()); + var arg4 = oGlobals.ParseGlobalVars(args[4].ToString()); + + EventConnect?.Invoke(arg1, arg2, arg3, arg4, isLich); + } + else if (args.Count == 2) + { + var arg1 = oGlobals.ParseGlobalVars(args[1].ToString()); + var argEmpty = ""; + EventConnect?.Invoke(arg1, argEmpty, argEmpty, argEmpty,isLich); + } + else + { + EchoText("Invalid number of arguments in #connect command. Syntax: #connect account password character game" + Constants.vbNewLine); + } + + } + public string Eval(string sText) { string s = m_oEval.EvalString(sText, oGlobals); @@ -2503,7 +2549,7 @@ private string GetArgumentString(string strRow) private string ParseAlias(string sText) { string sResult = ""; - var oArgs = new ArrayList(); + var oArgs = new Genie.Collections.ArrayList(); oArgs = Utility.ParseArgs(sText); string sKey = GetKeywordString(sText); if (oGlobals.AliasList.ContainsKey(sKey) == true) @@ -2568,7 +2614,9 @@ private void ShowHelp(string sFile = "index.txt") objFile.Close(); } } + #pragma warning disable CS0168 catch (FileNotFoundException ex) + #pragma warning restore CS0168 { EchoText("Topic does not exist."); } @@ -2593,7 +2641,7 @@ private void SendTextToGame(string sText, [Optional, DefaultParameterValue(false SendText(sText, bUserInput, sOrigin); } - // Private Function ParseAllArgs(ByoList As ArrayList, Optional ByVal iStartIndex As Integer = 1) As String + // Private Function ParseAllArgs(ByoList As Genie.Collections.ArrayList, Optional ByVal iStartIndex As Integer = 1) As String // Dim sResult As String = String.Empty // For i As Integer = iStartIndex To oList.Count - 1 @@ -2794,10 +2842,10 @@ private void ListVariables(string sPattern) private void ListSubstitutes(string sPattern) { EchoText(Constants.vbNewLine + "Active substitutes: " + Constants.vbNewLine); - bool bUsePattern = false; + // bool bUsePattern = false; if (sPattern.Length > 0) { - bUsePattern = true; + // bUsePattern = true; EchoText("Filter: " + sPattern + Constants.vbNewLine); } @@ -2833,10 +2881,10 @@ private void ListSubstitutes(string sPattern) private void ListGags(string sPattern) { EchoText(Constants.vbNewLine + "Active gags: " + Constants.vbNewLine); - bool bUsePattern = false; + // bool bUsePattern = false; if (sPattern.Length > 0) { - bUsePattern = true; + // bUsePattern = true; EchoText("Filter: " + sPattern + Constants.vbNewLine); } diff --git a/Core/Connection.cs b/Core/Connection.cs index 60785de..57afa78 100644 --- a/Core/Connection.cs +++ b/Core/Connection.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; @@ -143,7 +144,8 @@ public void Connect(string sHostname, int iPort) m_sHostname = sHostname; m_SocketClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - m_IPEndPoint = new IPEndPoint(Dns.GetHostEntry(sHostname).AddressList[0], iPort); + var hostEntryList = Dns.GetHostEntry(sHostname); + m_IPEndPoint = new IPEndPoint(hostEntryList.AddressList.Where(i => i.AddressFamily == AddressFamily.InterNetwork).FirstOrDefault(), iPort); m_SocketClient.BeginConnect(m_IPEndPoint, new AsyncCallback(ConnectCallback), m_SocketClient); } catch (SocketException ex) diff --git a/Core/Game.cs b/Core/Game.cs index 0f3eb75..b7199a6 100644 --- a/Core/Game.cs +++ b/Core/Game.cs @@ -24,9 +24,6 @@ public Game(ref Globals cl) { m_oSocket = new Connection(); m_oGlobals = cl; - // m_oBanned.Add("A92A093E4352F6B0B9FDAAF23B1E600CC1C4546A6206E1F8CF0EA59DFF324AB9", True) - // m_oBanned.Add("DB7D3A74709A222515C6B8FAFEA9A6EE9E7593BA91733D0776AFD87A4B14B4E8", True) - // m_oBanned.Add("D9198B4AB9EC86B4E2EC55596881A07AF8FCAC57C6BB6086463A6990E3015EFC", True) } public event EventPrintTextEventHandler EventPrintText; @@ -193,7 +190,7 @@ private Globals m_oGlobals private bool m_bUpdatingRoom = false; private bool m_bUpdateRoomOnStreamEnd = false; private string m_sRoomTitle = string.Empty; - private Match m_oRegMatch; + // private Match m_oRegMatch; private Hashtable m_oIndicatorHash = new Hashtable(); private Hashtable m_oCompassHash = new Hashtable(); private WindowTarget m_oTargetWindow = WindowTarget.Main; @@ -202,11 +199,13 @@ private Globals m_oGlobals private ConnectStates m_oConnectState; private object m_oThreadLock = new object(); // Thread safety private bool m_bFamiliarLineParse = false; + public bool IsLich = false; /* TODO ERROR: Skipped RegionDirectiveTrivia */ public enum WindowTarget { Unknown, + Combat, Main, Inv, Familiar, @@ -397,6 +396,8 @@ public void Disconnect() } } + + public void SendText(string sText, bool bUserInput = false, string sOrigin = "") { string sShowText = sText; @@ -450,6 +451,10 @@ public void SendText(string sText, bool bUserInput = false, string sOrigin = "") sShowText = "[" + sOrigin + "]: " + sShowText; } + // Maybe not needed + if (sOrigin.Equals("") && sShowText.Equals("")) + sShowText = sText; + if (bHideOutput == false) { Color color; @@ -764,7 +769,9 @@ public string ProcessXML(string sXML) { oDocument.LoadXml("" + sXML + ""); } +#pragma warning disable CS0168 catch (XmlException ex) +#pragma warning restore CS0168 { /* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ return sReturn; @@ -900,15 +907,16 @@ private void ParseRow(string sText) case ConnectStates.ConnectedGameHandshake: { m_oConnectState = ConnectStates.ConnectedGame; + Thread.Sleep(1000); m_oSocket.Send(Constants.vbLf + Constants.vbLf); break; } } } - private ArrayList _CharacterList = new ArrayList(); + private Genie.Collections.ArrayList _CharacterList = new Genie.Collections.ArrayList(); - public ArrayList CharacterList + public Genie.Collections.ArrayList CharacterList { get { @@ -925,7 +933,7 @@ private void ParseKeyRow(string sText) } else { - var oData = new ArrayList(); + var oData = new Genie.Collections.ArrayList(); foreach (string strLine in sText.Split(Conversions.ToChar(Constants.vbTab))) oData.Add(strLine); if (oData.Count > 0) @@ -995,7 +1003,7 @@ private void ParseKeyRow(string sText) string argtext4 = "Listing characters:"; PrintError(argtext4); string strUserKey = string.Empty; - bool blnFoundMatch = false; + // bool blnFoundMatch = false; for (int i = 5, loopTo = oData.Count - 1; i <= loopTo; i++) { if (i % 2 == 0) @@ -1079,11 +1087,11 @@ private void ParseKeyRow(string sText) { if (strRow.IndexOf("GAMEHOST=") > -1) { - m_sConnectHost = strRow.Substring(9); + m_sConnectHost = IsLich ? m_oGlobals.Config.LichServer : strRow.Substring(9); } else if (strRow.IndexOf("GAMEPORT=") > -1) { - m_sConnectPort = int.Parse(strRow.Substring(9)); + m_sConnectPort = IsLich ? m_oGlobals.Config.LichPort : int.Parse(strRow.Substring(9)); } else if (strRow.IndexOf("KEY=") > -1) { @@ -1091,6 +1099,8 @@ private void ParseKeyRow(string sText) } } + + if (m_sConnectKey.Length > 0) { m_oSocket.Disconnect(); @@ -1318,6 +1328,11 @@ private string ProcessXMLNodeElement(XmlNode oXmlNode) var switchExpr3 = GetAttributeData(oXmlNode, argstrAttributeName13); switch (switchExpr3) { + case "combat": + { + m_oTargetWindow = WindowTarget.Combat; + break; + } case "main": { m_oTargetWindow = WindowTarget.Main; @@ -2647,6 +2662,12 @@ private void PrintTextToWindow(string text, Color color, Color bgcolor, WindowTa break; } + case WindowTarget.Combat: + { + sTargetWindowString = "combat"; + break; + } + case WindowTarget.Familiar: { sTargetWindowString = "familiar"; @@ -2791,29 +2812,39 @@ private void PrintTextToWindow(string text, Color color, Color bgcolor, WindowTa { if (text.Trim().Length == 0) { - if (m_bLastRowWasBlank == true | m_bLastRowWasPrompt == true) + if (m_bLastRowWasBlank == true || m_bLastRowWasPrompt == true) { return; } m_bLastRowWasBlank = true; } + else if (Regex.IsMatch(text, @"^\w*\> ?$")) + { + if (m_bLastRowWasBlank) + { + return; + } + m_bLastRowWasPrompt = true; + } else { + m_bLastRowWasPrompt = false; m_bLastRowWasBlank = false; } } - if (targetwindow == WindowTarget.Main | targetwindow == WindowTarget.Thoughts) + if (targetwindow == WindowTarget.Main | targetwindow == WindowTarget.Thoughts | targetwindow == WindowTarget.Combat) { if (m_oGlobals.Config.bAutoLog == true) { - if (m_bLastRowWasPrompt == true) - { - m_oGlobals.Log?.LogText(Constants.vbNewLine, Conversions.ToString(m_oGlobals.VariableList["charactername"]), Conversions.ToString(m_oGlobals.VariableList["game"])); - } + m_oGlobals.Log?.LogText(text, Conversions.ToString(m_oGlobals.VariableList["charactername"]), Conversions.ToString(m_oGlobals.VariableList["game"])); + //if (m_bLastRowWasPrompt == true) + //{ + // m_oGlobals.Log?.LogText(text + System.Environment.NewLine, Conversions.ToString(m_oGlobals.VariableList["charactername"]), Conversions.ToString(m_oGlobals.VariableList["game"])); + //} - //m_oGlobals.Log.LogText(text, Conversions.ToString(m_oGlobals.VariableList["charactername"]), Conversions.ToString(m_oGlobals.VariableList["game"])); + // m_oGlobals.Log.LogText(text, Conversions.ToString(m_oGlobals.VariableList["charactername"]), Conversions.ToString(m_oGlobals.VariableList["game"])); } } diff --git a/Core/PluginHost.cs b/Core/PluginHost.cs index edde1e7..5ddd87a 100644 --- a/Core/PluginHost.cs +++ b/Core/PluginHost.cs @@ -34,7 +34,6 @@ public void SendText(string Text) public string get_Variable(string Var) { - string PluginKey = ""; if ((Var ?? "") == "GenieKey") { return m_oGlobals.GenieKey; diff --git a/Forms/Components/ComponentIconBar.cs b/Forms/Components/ComponentIconBar.cs index e225073..fc289df 100644 --- a/Forms/Components/ComponentIconBar.cs +++ b/Forms/Components/ComponentIconBar.cs @@ -112,7 +112,7 @@ private void AddImage(string sName) private Bitmap ImageToGrayScale(Bitmap b) { - int iColor = 0; + // int iColor = 0; var oOutput = new Bitmap(b.Width, b.Height); for (int X = 0, loopTo = b.Width - 1; X <= loopTo; X++) { diff --git a/Forms/Components/ComponentPluginItem.Designer.cs b/Forms/Components/ComponentPluginItem.Designer.cs index 8794f11..eb89cd7 100644 --- a/Forms/Components/ComponentPluginItem.Designer.cs +++ b/Forms/Components/ComponentPluginItem.Designer.cs @@ -29,7 +29,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/Components/ComponentRichTextBox.cs b/Forms/Components/ComponentRichTextBox.cs index edbc73e..6613ebe 100644 --- a/Forms/Components/ComponentRichTextBox.cs +++ b/Forms/Components/ComponentRichTextBox.cs @@ -126,7 +126,7 @@ private struct CHARFORMAT2_STRUCT /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ private Win32Utility Win32Utility = new Win32Utility(); - private int m_iMaxScroll = int.MinValue; + // private int m_iMaxScroll = int.MinValue; private int m_iEndLine = int.MinValue; private FormSkin m_oParentForm; private RichTextBox m_oRichTextBuffer = new RichTextBox(); @@ -388,7 +388,7 @@ private void AddToBuffer(string sText, Color oColor, Color oBgColor, bool bMono if (sText.Length > 0) { - m_oRichTextBuffer.SelectedText = sText; + m_oRichTextBuffer.SelectedText = sText; ParseLineHighlight(iStart, sText); } } @@ -673,7 +673,10 @@ private void InvokeAddRTF(string text) SelectionStart = int.MaxValue; SelectionLength = 0; - SelectedRtf = text; + + if (text != "") + SelectedRtf = text; + bool bScroll = true; if (iFirstLineVisible + 2 >= m_iEndLine) // +2 extra lines { @@ -776,7 +779,7 @@ private void InvokeClearWindow() m_bPendingNewLine = false; } - private void ComponentRichTextBox_GotFocus(object sender, EventArgs e) + public void ComponentRichTextBox_GotFocus(object sender, EventArgs e) { m_oParentForm.Focus(); } @@ -785,7 +788,7 @@ private void ComponentRichTextBox_GotFocus(object sender, EventArgs e) public delegate void EventKeyDownEventHandler(KeyEventArgs e); - private void ComponentRichTextBox_KeyDown(object sender, KeyEventArgs e) + public void ComponentRichTextBox_KeyDown(object sender, KeyEventArgs e) { if (!(e.KeyData == Keys.PageUp | e.KeyData == Keys.PageDown)) { @@ -798,7 +801,7 @@ private void ComponentRichTextBox_KeyDown(object sender, KeyEventArgs e) public delegate void EventKeyPressEventHandler(KeyPressEventArgs e); - private void ComponentRichTextBox_KeyPress(object sender, KeyPressEventArgs e) + public void ComponentRichTextBox_KeyPress(object sender, KeyPressEventArgs e) { EventKeyPress?.Invoke(e); e.Handled = true; @@ -806,12 +809,12 @@ private void ComponentRichTextBox_KeyPress(object sender, KeyPressEventArgs e) private bool m_bMouseDown = false; - private void ComponentRichTextBox_MouseDown(object sender, MouseEventArgs e) + public void ComponentRichTextBox_MouseDown(object sender, MouseEventArgs e) { m_bMouseDown = true; } - private void ComponentRichTextBox_MouseUp(object sender, MouseEventArgs e) + public void ComponentRichTextBox_MouseUp(object sender, MouseEventArgs e) { try { @@ -828,7 +831,9 @@ private void ComponentRichTextBox_MouseUp(object sender, MouseEventArgs e) FlushBuffer(); } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { } // Ignore diff --git a/Forms/Components/ComponentTextBox.cs b/Forms/Components/ComponentTextBox.cs index 96ed2b3..ad6c75d 100644 --- a/Forms/Components/ComponentTextBox.cs +++ b/Forms/Components/ComponentTextBox.cs @@ -25,7 +25,7 @@ public ComponentTextBox() public delegate void PageDownEventHandler(); - private ArrayList HistoryArray = new ArrayList(); + private Genie.Collections.ArrayList HistoryArray = new Genie.Collections.ArrayList(); private int HistoryPos = -1; private int HistorySize = 20; private int HistoryMinLenght = 3; diff --git a/Forms/ConfigPanels/UCAliases.cs b/Forms/ConfigPanels/UCAliases.cs index 0ddc385..fcec190 100644 --- a/Forms/ConfigPanels/UCAliases.cs +++ b/Forms/ConfigPanels/UCAliases.cs @@ -122,7 +122,7 @@ private void UpdateGroupBox() TextBoxAction.Enabled = true; TextBoxAction.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -132,7 +132,7 @@ private void UpdateGroupBox() TextBoxAlias.Text = ""; TextBoxAction.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -230,7 +230,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCClasses.cs b/Forms/ConfigPanels/UCClasses.cs index 861746a..1231134 100644 --- a/Forms/ConfigPanels/UCClasses.cs +++ b/Forms/ConfigPanels/UCClasses.cs @@ -122,7 +122,7 @@ private void UpdateGroupBox() TextBoxAction.Enabled = true; TextBoxAction.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -132,7 +132,7 @@ private void UpdateGroupBox() TextBoxClass.Text = ""; TextBoxAction.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -230,7 +230,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCHighlightStrings.cs b/Forms/ConfigPanels/UCHighlightStrings.cs index 356fb9d..6b88a8d 100644 --- a/Forms/ConfigPanels/UCHighlightStrings.cs +++ b/Forms/ConfigPanels/UCHighlightStrings.cs @@ -359,7 +359,7 @@ private void UpdateGroupBox() TextBoxColor.Text = ListViewBase.SelectedItems[0].SubItems[2].Text; TextBoxColor.Tag = ListViewBase.SelectedItems[0].SubItems[2].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); LabelExampleColor.ForeColor = ListViewBase.SelectedItems[0].ForeColor; LabelExampleColor.BackColor = ListViewBase.SelectedItems[0].BackColor; RadioButtonString.Enabled = true; @@ -418,7 +418,7 @@ private void UpdateGroupBox() TextBoxHighlight.Text = ""; TextBoxColor.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); RadioButtonString.Enabled = false; RadioButtonLine.Enabled = false; RadioButtonBeginsWith.Enabled = false; @@ -721,7 +721,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } m_HighlightList.RebuildLineIndex(); diff --git a/Forms/ConfigPanels/UCIgnore.cs b/Forms/ConfigPanels/UCIgnore.cs index 591d2ef..4cf24e0 100644 --- a/Forms/ConfigPanels/UCIgnore.cs +++ b/Forms/ConfigPanels/UCIgnore.cs @@ -181,7 +181,7 @@ private void UpdateGroupBox() CheckBoxIgnoreCase.Enabled = true; CheckBoxIgnoreCase.Checked = GetBoolean(ListViewBase.SelectedItems[0].SubItems[1].Text); GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; if (ListViewBase.SelectedItems[0].SubItems[2].Text.Length > 0) @@ -199,7 +199,7 @@ private void UpdateGroupBox() CheckBoxIgnoreCase.Checked = false; CheckBoxIgnoreCase.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -318,7 +318,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCMacros.cs b/Forms/ConfigPanels/UCMacros.cs index 9b0b923..898fb47 100644 --- a/Forms/ConfigPanels/UCMacros.cs +++ b/Forms/ConfigPanels/UCMacros.cs @@ -122,7 +122,7 @@ private void UpdateGroupBox() TextBoxAction.Enabled = true; TextBoxAction.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -132,7 +132,7 @@ private void UpdateGroupBox() TextBoxMacro.Text = ""; TextBoxAction.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -235,7 +235,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCNames.cs b/Forms/ConfigPanels/UCNames.cs index 39e0fcd..b3ce60e 100644 --- a/Forms/ConfigPanels/UCNames.cs +++ b/Forms/ConfigPanels/UCNames.cs @@ -224,7 +224,7 @@ private void UpdateGroupBox() TextBoxColor.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; TextBoxColor.Tag = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); LabelExampleColor.ForeColor = ListViewBase.SelectedItems[0].ForeColor; LabelExampleColor.BackColor = ListViewBase.SelectedItems[0].BackColor; ToolStripButtonRemove.Enabled = true; @@ -236,7 +236,7 @@ private void UpdateGroupBox() TextBoxName.Text = ""; TextBoxColor.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -336,7 +336,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } m_NameList.RebuildIndex(); diff --git a/Forms/ConfigPanels/UCPreset.Designer.cs b/Forms/ConfigPanels/UCPreset.Designer.cs index 8c40bf7..1a687c7 100644 --- a/Forms/ConfigPanels/UCPreset.Designer.cs +++ b/Forms/ConfigPanels/UCPreset.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/ConfigPanels/UCPreset.cs b/Forms/ConfigPanels/UCPreset.cs index e91df75..522f387 100644 --- a/Forms/ConfigPanels/UCPreset.cs +++ b/Forms/ConfigPanels/UCPreset.cs @@ -241,7 +241,7 @@ private void UpdateGroupBox() TextBoxColor.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; TextBoxColor.Tag = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); LabelExampleColor.ForeColor = ListViewBase.SelectedItems[0].ForeColor; LabelExampleColor.BackColor = ListViewBase.SelectedItems[0].BackColor; } @@ -251,7 +251,7 @@ private void UpdateGroupBox() TextBoxPreset.Text = ""; TextBoxColor.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } else { diff --git a/Forms/ConfigPanels/UCSettings.Designer.cs b/Forms/ConfigPanels/UCSettings.Designer.cs index ea69f29..8e3cae7 100644 --- a/Forms/ConfigPanels/UCSettings.Designer.cs +++ b/Forms/ConfigPanels/UCSettings.Designer.cs @@ -23,7 +23,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/ConfigPanels/UCSubs.cs b/Forms/ConfigPanels/UCSubs.cs index 7a6aa91..50a35e4 100644 --- a/Forms/ConfigPanels/UCSubs.cs +++ b/Forms/ConfigPanels/UCSubs.cs @@ -163,7 +163,7 @@ private void UpdateGroupBox() TextBoxReplaceWith.Enabled = true; TextBoxReplaceWith.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; if (ListViewBase.SelectedItems[0].SubItems[2].Text.Length > 0) @@ -181,7 +181,7 @@ private void UpdateGroupBox() TextBoxReplace.Text = ""; TextBoxReplaceWith.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -309,7 +309,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCTriggers.cs b/Forms/ConfigPanels/UCTriggers.cs index c591f50..5986ad2 100644 --- a/Forms/ConfigPanels/UCTriggers.cs +++ b/Forms/ConfigPanels/UCTriggers.cs @@ -170,7 +170,7 @@ private void UpdateGroupBox() string argsValue = ListViewBase.SelectedItems[0].SubItems[2].Text; CheckBoxEval.Checked = Utility.StringToBoolean(argsValue); GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); if (ListViewBase.SelectedItems[0].SubItems[3].Text.Length > 0) { ComboBoxClass.Text = ListViewBase.SelectedItems[0].SubItems[3].Text; @@ -191,7 +191,7 @@ private void UpdateGroupBox() CheckBoxEval.Checked = false; TextBoxAction.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -326,7 +326,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCVariables.cs b/Forms/ConfigPanels/UCVariables.cs index db26ee2..222fe67 100644 --- a/Forms/ConfigPanels/UCVariables.cs +++ b/Forms/ConfigPanels/UCVariables.cs @@ -123,7 +123,7 @@ private void UpdateGroupBox() TextBoxAction.Enabled = true; TextBoxAction.Text = ListViewBase.SelectedItems[0].SubItems[1].Text; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -133,7 +133,7 @@ private void UpdateGroupBox() TextBoxVariable.Text = ""; TextBoxAction.Enabled = true; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -230,7 +230,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); } return true; diff --git a/Forms/ConfigPanels/UCWindowSettings.Designer.cs b/Forms/ConfigPanels/UCWindowSettings.Designer.cs index ba3bbc8..c5bf4e1 100644 --- a/Forms/ConfigPanels/UCWindowSettings.Designer.cs +++ b/Forms/ConfigPanels/UCWindowSettings.Designer.cs @@ -23,7 +23,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/ConfigPanels/UCWindowSettings.cs b/Forms/ConfigPanels/UCWindowSettings.cs index 456b56b..76a9335 100644 --- a/Forms/ConfigPanels/UCWindowSettings.cs +++ b/Forms/ConfigPanels/UCWindowSettings.cs @@ -63,8 +63,11 @@ private void ButtonMonoFont_Click(object sender, EventArgs e) m_ItemChanged = true; } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { + TextBoxMonoFont.Text = ""; TextBoxMonoFont.Tag = null; Interaction.MsgBox("Invalid font selected. Please select a TrueType font.", MsgBoxStyle.Critical); @@ -87,7 +90,9 @@ private void ButtonInputFont_Click(object sender, EventArgs e) m_ItemChanged = true; } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { TextBoxInputFont.Text = ""; TextBoxInputFont.Tag = null; diff --git a/Forms/ConfigPanels/UCWindows.cs b/Forms/ConfigPanels/UCWindows.cs index 09ef13f..a21f0d9 100644 --- a/Forms/ConfigPanels/UCWindows.cs +++ b/Forms/ConfigPanels/UCWindows.cs @@ -201,7 +201,7 @@ private void UpdateGroupBox() CheckBoxTimeStamp.Checked = fo.TimeStamp; CheckBoxNameListOnly.Checked = fo.NameListOnly; GroupBoxBase.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -215,7 +215,7 @@ private void UpdateGroupBox() CheckBoxNameListOnly.Checked = false; CheckBoxTimeStamp.Enabled = false; CheckBoxNameListOnly.Enabled = false; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; } @@ -339,7 +339,7 @@ public bool ApplyChanges() li.Selected = true; ToolStripButtonRemove.Enabled = true; RemoveToolStripMenuItem.Enabled = true; - GroupBoxBase.Tag = new ArrayList(ListViewBase.SelectedItems); + GroupBoxBase.Tag = new Genie.Collections.ArrayList(ListViewBase.SelectedItems); m_FormMain.UpdateWindowMenuList(); fo.Visible = true; } @@ -372,7 +372,9 @@ private void ButtonFont_Click(object sender, EventArgs e) m_ItemChanged = true; } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { TextBoxFont.Text = ""; TextBoxFont.Tag = null; diff --git a/Forms/DialogChangelog.Designer.cs b/Forms/DialogChangelog.Designer.cs index 70eeb50..0674975 100644 --- a/Forms/DialogChangelog.Designer.cs +++ b/Forms/DialogChangelog.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogConnect.Designer.cs b/Forms/DialogConnect.Designer.cs index f152cfc..cf66dbd 100644 --- a/Forms/DialogConnect.Designer.cs +++ b/Forms/DialogConnect.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogDownload.Designer.cs b/Forms/DialogDownload.Designer.cs index cb92387..1da97b9 100644 --- a/Forms/DialogDownload.Designer.cs +++ b/Forms/DialogDownload.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogEdit.Designer.cs b/Forms/DialogEdit.Designer.cs index 4a01ced..3fbaa40 100644 --- a/Forms/DialogEdit.Designer.cs +++ b/Forms/DialogEdit.Designer.cs @@ -29,7 +29,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogException.Designer.cs b/Forms/DialogException.Designer.cs index e71dd69..1a1ae35 100644 --- a/Forms/DialogException.Designer.cs +++ b/Forms/DialogException.Designer.cs @@ -29,7 +29,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogKey.Designer.cs b/Forms/DialogKey.Designer.cs index 6618618..d3f71ea 100644 --- a/Forms/DialogKey.Designer.cs +++ b/Forms/DialogKey.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogProfileConnect.Designer.cs b/Forms/DialogProfileConnect.Designer.cs index fcb2bf2..7a0db3f 100644 --- a/Forms/DialogProfileConnect.Designer.cs +++ b/Forms/DialogProfileConnect.Designer.cs @@ -29,7 +29,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogReconnect.Designer.cs b/Forms/DialogReconnect.Designer.cs index 6fe15f2..8ccaf69 100644 --- a/Forms/DialogReconnect.Designer.cs +++ b/Forms/DialogReconnect.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/DialogScriptName.Designer.cs b/Forms/DialogScriptName.Designer.cs index 8c718f1..9be071f 100644 --- a/Forms/DialogScriptName.Designer.cs +++ b/Forms/DialogScriptName.Designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/FormConfig.designer.cs b/Forms/FormConfig.designer.cs index 9048275..fb168a3 100644 --- a/Forms/FormConfig.designer.cs +++ b/Forms/FormConfig.designer.cs @@ -24,7 +24,9 @@ protected override void Dispose(bool disposing) } // Required by the Windows Form Designer + #pragma warning disable 0649 private System.ComponentModel.IContainer components; + #pragma warning restore 0649 // NOTE: The following procedure is required by the Windows Form Designer // It can be modified using the Windows Form Designer. diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index cd52cbe..c275d0e 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -34,7 +34,7 @@ public FormMain() // Add any initialization after the InitializeComponent() call. LocalDirectory.CheckUserDirectory(); bool bCustomConfigFile = false; - var al = new ArrayList(); + var al = new Genie.Collections.ArrayList(); al = Utility.ParseArgs(Interaction.Command()); foreach (string cmd in al) { @@ -103,7 +103,9 @@ public FormMain() { File.Move(m_oGlobals.Config.ConfigDir + @"\config.xml", m_sConfigFile); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { Interaction.MsgBox("Error: Unable to move config.xml to default.layout"); } @@ -140,6 +142,7 @@ public Genie.Globals m_oGlobals if (_m_oGlobals != null) { GenieError.EventGenieError -= HandleGenieException; + _m_oGlobals.Config.ConfigChanged -= Config_ConfigChanged; _m_oGlobals.ConfigChanged -= Config_ConfigChanged; } @@ -147,7 +150,9 @@ public Genie.Globals m_oGlobals if (_m_oGlobals != null) { GenieError.EventGenieError += HandleGenieException; + _m_oGlobals.Config.ConfigChanged += Config_ConfigChanged; _m_oGlobals.ConfigChanged += Config_ConfigChanged; + } } } @@ -420,17 +425,17 @@ private FormSkin m_oOutputMain private FormSkin m_oOutputDeath; private FormSkin m_oOutputRoom; private FormSkin m_oOutputLog; - private ArrayList m_oFormList = new ArrayList(); + private Genie.Collections.ArrayList m_oFormList = new Genie.Collections.ArrayList(); private string m_sConfigFile = string.Empty; - private string m_sUpdateVersion = string.Empty; - private bool m_bIsUpdateMajor = false; + // private string m_sUpdateVersion = string.Empty; + // private bool m_bIsUpdateMajor = false; private string m_sGenieKey = string.Empty; private System.Text.RegularExpressions.Match m_oRegMatch; // Private WithEvents m_oWorker As New System.ComponentModel.BackgroundWorker // Private m_bRunWorker As Boolean = True - public ArrayList FormList + public Genie.Collections.ArrayList FormList { get { @@ -552,7 +557,9 @@ private void LoadPlugin(string filename) { filename = Path.Combine(sPluginPath, filename); } + #pragma warning disable CS0168 catch (ArgumentException ex) + #pragma warning restore CS0168 { AppendText("Plugin not found: " + filename + Constants.vbNewLine); return; @@ -1528,13 +1535,6 @@ private void FormMain_Load(object sender, EventArgs e) AppendText("Using Encoding: " + Encoding.Default.EncodingName + Constants.vbNewLine); AppendText("Genie User Data Path: " + LocalDirectory.Path + Constants.vbNewLine + Constants.vbNewLine); - // AppendText(vbNewLine & _ - // "THIS SOFTWARE AND THE ACCOMPANYING FILES ARE SENT ""AS IS"" AND WITHOUT WARRANTY AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED." & vbNewLine & _ - // "The software authors will not be held liable for any damage to your computer system, data files, gaming environment, or for any actions brought against you for using this software. The user must assume the entire risk of running this software." & vbNewLine & _ - // "You may not redistribute this software in any way shape or form without the written permission from the author." & vbNewLine & _ - // vbNewLine & _ - // "BY USING THIS SOFTWARE YOU AGREE TO THE ABOVE STATED TERMS " & vbNewLine & vbNewLine) - Application.DoEvents(); AppendText("Loading Settings..."); m_oGlobals.Config.Load(m_oGlobals.Config.ConfigDir + @"\settings.cfg"); @@ -2393,7 +2393,9 @@ private void SafeRemoveExitedScripts() RemoveExitedScripts(); } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { } // Don't care. Close } @@ -2588,7 +2590,7 @@ private void AddScriptToToolStrip(Script oScript) } } - private Script LoadScript(string sScriptName, ArrayList oArgList) + private Script LoadScript(string sScriptName, Genie.Collections.ArrayList oArgList) { if (m_oGlobals.Config.bAbortDupeScript == true) { @@ -2968,7 +2970,9 @@ private void SafeAddScripts() AddScripts(); } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { } // Don't care } @@ -3329,13 +3333,15 @@ private void TextBoxInput_SendText(string sText) try { m_CommandSent = true; - m_oCommand.ParseCommand(sText, true, true); string argsText = ""; - var argoColor = Color.Transparent; + var argoColor = Color.Transparent; var argoBgColor = Color.Transparent; Genie.Game.WindowTarget argoTargetWindow = Genie.Game.WindowTarget.Main; string argsTargetWindow = ""; - AddText(argsText, argoColor, argoBgColor, oTargetWindow: argoTargetWindow, sTargetWindow: argsTargetWindow); // For some stupid reason we need this. Probably because EndUpdate is fired before we are ready in the other thread. + m_oCommand.ParseCommand(sText, true, true); + AddText(argsText, argoColor, argoBgColor, oTargetWindow: argoTargetWindow, sTargetWindow: argsTargetWindow); + + EndUpdate(); } /* TODO ERROR: Skipped IfDirectiveTrivia */ @@ -3562,7 +3568,7 @@ private void ParseTriggers(string sText, bool bBufferWait = true) m_oRegMatch = oTrigger.oRegexTrigger.Match(sText); if (m_oRegMatch.Success == true) { - var RegExpArg = new ArrayList(); + var RegExpArg = new Genie.Collections.ArrayList(); if (m_oRegMatch.Groups.Count > 0) { int J; @@ -3716,7 +3722,7 @@ private void Command_EventListScripts(string sFilter) } } - private void TriggerAction(string sAction, ArrayList oArgs) + private void TriggerAction(string sAction, Genie.Collections.ArrayList oArgs) { if (m_bTriggersEnabled == true) { @@ -3750,7 +3756,9 @@ private void TriggerAction(string sAction, ArrayList oArgs) { m_oCommand.ParseCommand(sAction, true, false, "Trigger"); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { string argsText = "Trigger action failed: " + sAction; PrintError(argsText); @@ -3781,7 +3789,7 @@ private void ClassCommand_RunScript(string sText) { try { - var al = new ArrayList(); + var al = new Genie.Collections.ArrayList(); al = Utility.ParseArgs(sText, true); string ScriptName = Conversions.ToString(al[0].ToString().ToLower().Trim().Substring(1)); if (ScriptName.EndsWith(".cmd") == false) @@ -4012,7 +4020,7 @@ public void TriggerVariableChanged(string sVariableName) // When variables chang if (s.Length > 0 & (s ?? "") != "0") { - TriggerAction(oTrigger.sAction, new ArrayList()); + TriggerAction(oTrigger.sAction, new Genie.Collections.ArrayList()); } } } @@ -4143,6 +4151,8 @@ private void AddText(string sText, [Optional, DefaultParameterValue(Genie.Game.W private void AddText(string sText, Color oColor, Color oBgColor, FormSkin oTargetWindow, bool bNoCache = true, bool bMono = false, bool bPrompt = false, bool bInput = false) { + bPrompt = false; + if (IsDisposed) { return; @@ -4254,6 +4264,12 @@ private void AddText(string sText, Color oColor, Color oBgColor, [Optional, Defa break; } + case Genie.Game.WindowTarget.Combat: + { + oFormTarget = FindSkinFormByName("Combat"); + break; + } + default: { oFormTarget = m_oOutputMain; @@ -5104,8 +5120,9 @@ public void CheckReconnect() } } - private void ReconnectToGame() + private void ReconnectToGame(bool isLich = false) { + m_oGame.IsLich = isLich; try { if (m_oGame.AccountName.Length > 0) @@ -5127,8 +5144,9 @@ private void ReconnectToGame() } } - private void ConnectToGame(string sAccountName, string sPassword, string sCharacter, string sGame) + private void ConnectToGame(string sAccountName, string sPassword, string sCharacter, string sGame, bool isLich = false) { + m_oGame.IsLich = isLich; try { if (sPassword.Length > 0) @@ -5395,8 +5413,7 @@ private void Game_EventRoundtime(int iTime) { if (InvokeRequired == true) { - var parameters = new[] { iTime }; - Invoke(new SetRoundtimeDelegate(SetRoundTime), parameters); + Invoke(new SetRoundtimeDelegate(SetRoundTime), iTime); } else { @@ -6055,7 +6072,7 @@ private void Config_ConfigChanged(Genie.Config.ConfigFieldUpdated oField) private void Command_EventClassChange() { - var al = new ArrayList(); + var al = new Genie.Collections.ArrayList(); if (m_oGlobals.ClassList.AcquireReaderLock()) { try @@ -6886,7 +6903,7 @@ private void LoadProfile(string FileName, bool DoConnect = false) { if (sAccount.Length > 0 & sPassword.Length > 0) { - ConnectToGame(sAccount, sPassword, sCharacter, sGame); + ConnectToGame(sAccount, sPassword, sCharacter, sGame, m_oGame.IsLich); } else { diff --git a/Forms/FormPlugins.cs b/Forms/FormPlugins.cs index f94776e..fe9edfd 100644 --- a/Forms/FormPlugins.cs +++ b/Forms/FormPlugins.cs @@ -13,7 +13,7 @@ public FormPlugins() InitializeComponent(); } - public FormPlugins(ref ArrayList pluginList) + public FormPlugins(ref Genie.Collections.ArrayList pluginList) { // This call is required by the designer. InitializeComponent(); @@ -54,7 +54,7 @@ public void ReloadList() } } - private ArrayList m_PluginList; + private Genie.Collections.ArrayList m_PluginList; private void PopulatePluginList() { diff --git a/Forms/FormSkin.Designer.cs b/Forms/FormSkin.Designer.cs index 40fcb14..fe8207d 100644 --- a/Forms/FormSkin.Designer.cs +++ b/Forms/FormSkin.Designer.cs @@ -32,123 +32,144 @@ protected override void Dispose(bool disposing) [DebuggerStepThrough()] private void InitializeComponent() { - components = new System.ComponentModel.Container(); - _PanelContents = new Panel(); - _PanelContents.MouseEnter += new EventHandler(PanelContents_MouseEnter); - _ContextMenuStripOutput = new ContextMenuStrip(components); - _ClearToolStripMenuItem = new ToolStripMenuItem(); - _ClearToolStripMenuItem.Click += new EventHandler(ClearToolStripMenuItem_Click); - _TimeStampToolStripMenuItem = new ToolStripMenuItem(); - _TimeStampToolStripMenuItem.Click += new EventHandler(TimeStampToolStripMenuItem_Click); - _NameListOnlyToolStripMenuItem = new ToolStripMenuItem(); - _NameListOnlyToolStripMenuItem.Click += new EventHandler(NameListOnlyToolStripMenuItem_Click); - _ToolStripSeparator1 = new ToolStripSeparator(); - _CloseWindowToolStripMenuItem = new ToolStripMenuItem(); - _CloseWindowToolStripMenuItem.Click += new EventHandler(CloseWindowToolStripMenuItem_Click); - _RichTextBoxOutput = new ComponentRichTextBox(); - _RichTextBoxOutput.EventKeyDown += new ComponentRichTextBox.EventKeyDownEventHandler(MyKeyDown); - _RichTextBoxOutput.EventKeyPress += new ComponentRichTextBox.EventKeyPressEventHandler(MyKeyPress); - _RichTextBoxOutput.LinkClicked += new LinkClickedEventHandler(RichTextBoxOutput_LinkClicked); - _PanelContents.SuspendLayout(); - _ContextMenuStripOutput.SuspendLayout(); - SuspendLayout(); + this.components = new System.ComponentModel.Container(); + this._PanelContents = new System.Windows.Forms.Panel(); + this._RichTextBoxOutput = new GenieClient.ComponentRichTextBox(); + this._ContextMenuStripOutput = new System.Windows.Forms.ContextMenuStrip(this.components); + this._ClearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._TimeStampToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._NameListOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this._CloseWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._PanelContents.SuspendLayout(); + this._ContextMenuStripOutput.SuspendLayout(); + this.SuspendLayout(); // - // PanelContents + // _PanelContents // - _PanelContents.BackColor = Color.Black; - _PanelContents.Controls.Add(_RichTextBoxOutput); - _PanelContents.Dock = DockStyle.Fill; - _PanelContents.Location = new Point(0, 0); - _PanelContents.Name = "PanelContents"; - _PanelContents.Size = new Size(300, 200); - _PanelContents.TabIndex = 2; - _PanelContents.Visible = false; + this._PanelContents.BackColor = System.Drawing.Color.Black; + this._PanelContents.Controls.Add(this._RichTextBoxOutput); + this._PanelContents.Dock = System.Windows.Forms.DockStyle.Fill; + this._PanelContents.Location = new System.Drawing.Point(0, 0); + this._PanelContents.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this._PanelContents.Name = "_PanelContents"; + this._PanelContents.Size = new System.Drawing.Size(500, 385); + this._PanelContents.TabIndex = 2; + this._PanelContents.Visible = false; + this._PanelContents.MouseEnter += new System.EventHandler(this.PanelContents_MouseEnter); // - // ContextMenuStripOutput + // _RichTextBoxOutput // - _ContextMenuStripOutput.Items.AddRange(new ToolStripItem[] { _ClearToolStripMenuItem, _TimeStampToolStripMenuItem, _NameListOnlyToolStripMenuItem, _ToolStripSeparator1, _CloseWindowToolStripMenuItem }); - _ContextMenuStripOutput.Name = "ContextMenuStripOutput"; - _ContextMenuStripOutput.Size = new Size(156, 98); + this._RichTextBoxOutput.BackColor = System.Drawing.Color.Black; + this._RichTextBoxOutput.BorderStyle = System.Windows.Forms.BorderStyle.None; + this._RichTextBoxOutput.ContextMenuStrip = this._ContextMenuStripOutput; + this._RichTextBoxOutput.DetectUrls = false; + this._RichTextBoxOutput.Dock = System.Windows.Forms.DockStyle.Fill; + this._RichTextBoxOutput.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this._RichTextBoxOutput.ForeColor = System.Drawing.Color.WhiteSmoke; + this._RichTextBoxOutput.FormParent = null; + this._RichTextBoxOutput.HideSelection = false; + this._RichTextBoxOutput.IsMainWindow = false; + this._RichTextBoxOutput.Location = new System.Drawing.Point(0, 0); + this._RichTextBoxOutput.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this._RichTextBoxOutput.MaxBufferSize = 500000; + this._RichTextBoxOutput.MonoFont = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this._RichTextBoxOutput.Name = "_RichTextBoxOutput"; + this._RichTextBoxOutput.NameListOnly = false; + this._RichTextBoxOutput.ReadOnly = true; + this._RichTextBoxOutput.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical; + this._RichTextBoxOutput.ShowSelectionMargin = true; + this._RichTextBoxOutput.Size = new System.Drawing.Size(500, 385); + this._RichTextBoxOutput.TabIndex = 7; + this._RichTextBoxOutput.Text = ""; + this._RichTextBoxOutput.TimeStamp = false; + this._RichTextBoxOutput.Visible = false; + this._RichTextBoxOutput.EventKeyDown += new GenieClient.ComponentRichTextBox.EventKeyDownEventHandler(this.MyKeyDown); + this._RichTextBoxOutput.EventKeyPress += new GenieClient.ComponentRichTextBox.EventKeyPressEventHandler(this.MyKeyPress); + this._RichTextBoxOutput.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RichTextBoxOutput_LinkClicked); + this._RichTextBoxOutput.KeyDown += new System.Windows.Forms.KeyEventHandler(this._RichTextBoxOutput_KeyDown); + this._RichTextBoxOutput.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this._RichTextBoxOutput_KeyPress); + this._RichTextBoxOutput.MouseUp += new System.Windows.Forms.MouseEventHandler(this._RichTextBoxOutput_MouseUp); + this._RichTextBoxOutput.MouseDown += new System.Windows.Forms.MouseEventHandler(_RichTextBoxOutput_MouseDown); + // - // ClearToolStripMenuItem + // _ContextMenuStripOutput // - _ClearToolStripMenuItem.Name = "ClearToolStripMenuItem"; - _ClearToolStripMenuItem.Size = new Size(155, 22); - _ClearToolStripMenuItem.Text = "Clear"; + this._ContextMenuStripOutput.ImageScalingSize = new System.Drawing.Size(24, 24); + this._ContextMenuStripOutput.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this._ClearToolStripMenuItem, + this._TimeStampToolStripMenuItem, + this._NameListOnlyToolStripMenuItem, + this._ToolStripSeparator1, + this._CloseWindowToolStripMenuItem}); + this._ContextMenuStripOutput.Name = "ContextMenuStripOutput"; + this._ContextMenuStripOutput.Size = new System.Drawing.Size(205, 138); // - // TimeStampToolStripMenuItem + // _ClearToolStripMenuItem // - _TimeStampToolStripMenuItem.Name = "TimeStampToolStripMenuItem"; - _TimeStampToolStripMenuItem.Size = new Size(155, 22); - _TimeStampToolStripMenuItem.Text = "Time Stamp"; + this._ClearToolStripMenuItem.Name = "_ClearToolStripMenuItem"; + this._ClearToolStripMenuItem.Size = new System.Drawing.Size(204, 32); + this._ClearToolStripMenuItem.Text = "Clear"; + this._ClearToolStripMenuItem.Click += new System.EventHandler(this.ClearToolStripMenuItem_Click); // - // NameListOnlyToolStripMenuItem + // _TimeStampToolStripMenuItem // - _NameListOnlyToolStripMenuItem.Name = "NameListOnlyToolStripMenuItem"; - _NameListOnlyToolStripMenuItem.Size = new Size(155, 22); - _NameListOnlyToolStripMenuItem.Text = "Name List Only"; + this._TimeStampToolStripMenuItem.Name = "_TimeStampToolStripMenuItem"; + this._TimeStampToolStripMenuItem.Size = new System.Drawing.Size(204, 32); + this._TimeStampToolStripMenuItem.Text = "Time Stamp"; + this._TimeStampToolStripMenuItem.Click += new System.EventHandler(this.TimeStampToolStripMenuItem_Click); // - // ToolStripSeparator1 + // _NameListOnlyToolStripMenuItem // - _ToolStripSeparator1.Name = "ToolStripSeparator1"; - _ToolStripSeparator1.Size = new Size(152, 6); + this._NameListOnlyToolStripMenuItem.Name = "_NameListOnlyToolStripMenuItem"; + this._NameListOnlyToolStripMenuItem.Size = new System.Drawing.Size(204, 32); + this._NameListOnlyToolStripMenuItem.Text = "Name List Only"; + this._NameListOnlyToolStripMenuItem.Click += new System.EventHandler(this.NameListOnlyToolStripMenuItem_Click); // - // CloseWindowToolStripMenuItem + // _ToolStripSeparator1 // - _CloseWindowToolStripMenuItem.Name = "CloseWindowToolStripMenuItem"; - _CloseWindowToolStripMenuItem.Size = new Size(155, 22); - _CloseWindowToolStripMenuItem.Text = "Close Window"; + this._ToolStripSeparator1.Name = "_ToolStripSeparator1"; + this._ToolStripSeparator1.Size = new System.Drawing.Size(201, 6); // - // RichTextBoxOutput + // _CloseWindowToolStripMenuItem // - _RichTextBoxOutput.BackColor = Color.Black; - _RichTextBoxOutput.BorderStyle = BorderStyle.None; - _RichTextBoxOutput.ContextMenuStrip = _ContextMenuStripOutput; - _RichTextBoxOutput.DetectUrls = false; - _RichTextBoxOutput.Dock = DockStyle.Fill; - _RichTextBoxOutput.Font = new Font("Verdana", 9.0F, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); - _RichTextBoxOutput.ForeColor = Color.WhiteSmoke; - _RichTextBoxOutput.FormParent = null; - _RichTextBoxOutput.HideSelection = false; - _RichTextBoxOutput.IsMainWindow = false; - _RichTextBoxOutput.Location = new Point(0, 0); - _RichTextBoxOutput.MaxBufferSize = 500000; - _RichTextBoxOutput.MonoFont = new Font("Courier New", 9.0F); - _RichTextBoxOutput.Name = "RichTextBoxOutput"; - _RichTextBoxOutput.NameListOnly = false; - _RichTextBoxOutput.ReadOnly = true; - _RichTextBoxOutput.ScrollBars = RichTextBoxScrollBars.ForcedVertical; - _RichTextBoxOutput.ShowSelectionMargin = true; - _RichTextBoxOutput.Size = new Size(300, 200); - _RichTextBoxOutput.TabIndex = 7; - _RichTextBoxOutput.Text = ""; - _RichTextBoxOutput.TimeStamp = false; - _RichTextBoxOutput.Visible = false; + this._CloseWindowToolStripMenuItem.Name = "_CloseWindowToolStripMenuItem"; + this._CloseWindowToolStripMenuItem.Size = new System.Drawing.Size(204, 32); + this._CloseWindowToolStripMenuItem.Text = "Close Window"; + this._CloseWindowToolStripMenuItem.Click += new System.EventHandler(this.CloseWindowToolStripMenuItem_Click); // // FormSkin // - AutoScaleDimensions = new SizeF(6.0F, 13.0F); - AutoScaleMode = AutoScaleMode.Font; - BackColor = Color.Black; - ClientSize = new Size(300, 200); - Controls.Add(_PanelContents); - DoubleBuffered = true; - FormBorderStyle = FormBorderStyle.None; - MinimumSize = new Size(50, 50); - Name = "FormSkin"; - StartPosition = FormStartPosition.Manual; - _PanelContents.ResumeLayout(false); - _ContextMenuStripOutput.ResumeLayout(false); - DoubleClick += new EventHandler(FormSkin_DoubleClick); - Load += new EventHandler(FormSkin_Load); - Paint += new PaintEventHandler(FormSkin_Paint); - MouseDown += new MouseEventHandler(FormSkin_MouseDown); - MouseMove += new MouseEventHandler(FormSkin_MouseMove); - Resize += new EventHandler(FormSkin_Resize); - Enter += new EventHandler(FormSkin_Enter); - VisibleChanged += new EventHandler(FormSkin_VisibleChanged); - Shown += new EventHandler(FormSkin_Shown); - ResumeLayout(false); + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.ClientSize = new System.Drawing.Size(500, 385); + this.Controls.Add(this._PanelContents); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.MinimumSize = new System.Drawing.Size(83, 96); + this.Name = "FormSkin"; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Load += new System.EventHandler(this.FormSkin_Load); + this.Shown += new System.EventHandler(this.FormSkin_Shown); + this.VisibleChanged += new System.EventHandler(this.FormSkin_VisibleChanged); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormSkin_Paint); + this.DoubleClick += new System.EventHandler(this.FormSkin_DoubleClick); + this.Enter += new System.EventHandler(this.FormSkin_Enter); + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormSkin_MouseDown); + this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FormSkin_MouseMove); + this.GotFocus += FormSkin_GotFocus; + this.Resize += new System.EventHandler(this.FormSkin_Resize); + this._PanelContents.ResumeLayout(false); + this._ContextMenuStripOutput.ResumeLayout(false); + this.ResumeLayout(false); + + } + + private void FormSkin_GotFocus(object sender, EventArgs e) + { + this._RichTextBoxOutput.ComponentRichTextBox_GotFocus(sender, e); } private Panel _PanelContents; diff --git a/Forms/FormSkin.cs b/Forms/FormSkin.cs index 21bf3e6..ca6a115 100644 --- a/Forms/FormSkin.cs +++ b/Forms/FormSkin.cs @@ -793,5 +793,25 @@ private void RichTextBoxOutput_LinkClicked(object sender, LinkClickedEventArgs e { EventLinkClicked?.Invoke(e.LinkText); } + + private void _RichTextBoxOutput_KeyDown(object sender, KeyEventArgs e) + { + this._RichTextBoxOutput.ComponentRichTextBox_KeyDown(sender, e); + } + + private void _RichTextBoxOutput_KeyPress(object sender, KeyPressEventArgs e) + { + this._RichTextBoxOutput.ComponentRichTextBox_KeyPress(sender,e); + } + + private void _RichTextBoxOutput_MouseUp(object sender, MouseEventArgs e) + { + this._RichTextBoxOutput.ComponentRichTextBox_MouseUp(sender, e); + } + + private void _RichTextBoxOutput_MouseDown(object sender, MouseEventArgs e) + { + this._RichTextBoxOutput.ComponentRichTextBox_MouseDown(sender, e); + } } } \ No newline at end of file diff --git a/Forms/FormSkin.resx b/Forms/FormSkin.resx index ff8aaf4..5a9610c 100644 --- a/Forms/FormSkin.resx +++ b/Forms/FormSkin.resx @@ -1,64 +1,4 @@ - - @@ -117,7 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 \ No newline at end of file diff --git a/Forms/ScriptExplorer.cs b/Forms/ScriptExplorer.cs index d192ab1..d56a21b 100644 --- a/Forms/ScriptExplorer.cs +++ b/Forms/ScriptExplorer.cs @@ -83,7 +83,9 @@ private void AddDirectories(TreeNode tn, string sScriptDir) // Get an array of all sub-directories as DirectoryInfo objects adiDirectories = diDirectory.GetDirectories(); } + #pragma warning disable CS0168 catch (Exception exp) + #pragma warning restore CS0168 { return; } @@ -112,7 +114,9 @@ private void AddFiles(TreeNode tn, string sScriptDir) // Get an array of all files as FileInfo objects adiFiles = diDirectory.GetFiles(); } + #pragma warning disable CS0168 catch (Exception exp) + #pragma warning restore CS0168 { return; } diff --git a/Genie3.csproj b/Genie3.csproj index 62b73b1..2ced58a 100644 --- a/Genie3.csproj +++ b/Genie3.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -24,8 +24,9 @@ 3.5 - Plugin\GenieStrongKey2020.pfx - v4.0 + + + v4.8 $(DefaultItemExcludes);$(ProjectDir)**\*.vb latest @@ -59,6 +60,8 @@ AllRules.ruleset + false + preview None @@ -71,13 +74,26 @@ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355 AnyCPU AllRules.ruleset + false + preview - + + False + Libs\Antlr3.Runtime.dll + False + + + False + Libs\Interfaces.dll + False + False Libs\Jint.dll + False + @@ -301,17 +317,13 @@ - - True - True - Settings.settings - + @@ -509,7 +521,6 @@ ScriptExplorer.cs - SettingsSingleFileGenerator @@ -594,12 +605,6 @@ - - - {B0882700-5EAF-4712-ADE5-69DAFE473A01} - Interfaces - - UCWindowSettings.cs @@ -653,6 +658,20 @@ + + + {b0882700-5eaf-4712-ade5-69dafe473a01} + Plugins + + + + + + + + + + -Official source code for Genie3 - https://genieclient.com -Download executable here: -https://github.com/walcon/genie3/releases/download/compiled/Genie3Release.zip -Please note, this version is untested and may contain bugs. Use at your own risk! -More notes will be added later. If you make any improvements please contact me and I will add you as a contributor. + + +[![Contributors][contributors-shield]][contributors-url] +[![Forks][forks-shield]][forks-url] +[![Stargazers][stars-shield]][stars-url] +[![Issues][issues-shield]][issues-url] +[![GPU License][license-shield]][license-url] -// Conny + + + + +
+
+ + Logo + + +

Genie Client

+ +

+ Genie is an alternative front-end for use with the Simutronics Corporation’s library of games, including Dragonrealms and Gemstone. +
+ Genie3 boasts a large list of features that will help you survive and thrive in Elanthia like never before. +
+ Explore the docs » +
+
+ Report Bug or Request Feature +

+
+ + + + +
+ Table of Contents +
    +
  1. + About The Project + +
  2. +
  3. + Getting Started + +
  4. +
  5. Features
  6. +
  7. Roadmap
  8. +
  9. Contributing
  10. +
  11. License
  12. +
  13. Contact
  14. +
  15. Acknowledgments
  16. +
+
+ + + + +## About The Project + + +![Genie Client!](https://i.postimg.cc/0jBm69Ww/Game-Startup.png "Genie Client") + + +

(back to top)

+ + + +### Built With + +* [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) +* [Visual Basic](https://docs.microsoft.com/en-us/dotnet/visual-basic/) + + +

(back to top)

+ + + + +## Getting Started + + +### Prerequisites + + +Genie Client utilizes Microsoft .NET Framework and may require you to install. +Most newer model computers will already have this installed, but if your system is a few years old or was custom built, it may be necessary to download and install this programs prior to installing our software. These programs can be downloaded directly from the Microsoft website using the links below. + +Microsoft .NET Framework 4.8 Runtime [https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48] + +### Installation + +1. Download the installer from here: + ***todo-CreateNewBuild*** + + +2. Get the latest Active Testing version of the Client from here: + [https://github.com/GenieClient/genie3/raw/main/bin/Release/Genie.exe](https://github.com/GenieClient/genie3/raw/main/bin/Release/Genie.exe) + +3. Copy the client into your install Location from Step 2 above. + "Default install Directory" + ```sh + C:\Program Files (x86)\Genie Client 3 + ``` +4. Get Maps Updates from the Team at + [https://github.com/GenieClient/Maps] + + +

(back to top)

+ + + + +## Features + +### AutoMapper +Never get lost again! Auto Mapper lets you create, edit, and share maps of the world. With one click, you can breeze from place to place, and see the worlds of Elanthia in a whole new way. +A Helpful Video can be found here: [https://player.vimeo.com/video/44971762] + +_For more discussion, join the discord group [DiscordGroup](https://discord.gg/MtmzE2w) + +

(back to top)

+ + + +## Roadmap + +- [https://github.com/GenieClient/genie3/issues/15] Explore Cross Platform Options +- [https://github.com/GenieClient/genie3/issues/9] Bugfix - Game AutoScroll +- [https://github.com/GenieClient/genie3/issues/5] Bugfix - Automapper Display + +See the [open issues](https://github.com/GenieClient/genie3/issues) for a full list of proposed features (and known issues). + +

(back to top)

+ + + + +## Contributing + +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make is **greatly appreciated**. + +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". +Don't forget to give the project a star! Thanks again! + +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + +

(back to top)

+ + + + +## License + +Distributed under the GPL 3.0 License. See `LICENSE` for more information. + +

(back to top)

+ + + + +## Contact + + +Project Link: [https://github.com/GenieClient/genie3](https://github.com/GenieClient/genie3) + +

(back to top)

+ + + + +## Acknowledgments + +* [https://github.com/walcon] Conny - Origional Developer) + + +

(back to top)

+ + + + + +[contributors-shield]: https://img.shields.io/github/contributors/GenieClient/genie3.svg?style=for-the-badge +[contributors-url]: https://github.com/GenieClient/genie3/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/GenieClient/genie3.svg?style=for-the-badge +[forks-url]: https://github.com/GenieClient/genie3/network/members +[stars-shield]: https://img.shields.io/github/stars/GenieClient/genie3.svg?style=for-the-badge +[stars-url]: https://github.com/GenieClient/genie3/stargazers +[issues-shield]: https://img.shields.io/github/issues/GenieClient/genie3.svg?style=for-the-badge +[issues-url]: https://github.com/GenieClient/genie3/issues +[license-shield]: https://img.shields.io/github/license/GenieClient/genie3.svg?style=for-the-badge +[license-url]: https://github.com/GenieClient/genie3/blob/master/LICENSE.txt +[product-screenshot]: images/screenshot.png diff --git a/Resources.Designer.cs b/Resources.Designer.cs index c3214a3..cc10c2f 100644 --- a/Resources.Designer.cs +++ b/Resources.Designer.cs @@ -1,277 +1,293 @@ -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.225 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // -// ------------------------------------------------------------------------------ - -using System.Diagnostics; -using System.Drawing; -using Microsoft.VisualBasic; - -namespace GenieClient.My.Resources -{ +//------------------------------------------------------------------------------ +namespace GenieClient.My.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - [System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [DebuggerNonUserCode()] - [System.Runtime.CompilerServices.CompilerGenerated()] - [HideModuleName()] - internal static class Resources - { - private static System.Resources.ResourceManager resourceMan; - private static System.Globalization.CultureInfo resourceCulture; - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + /// - /// Returns the cached ResourceManager instance used by this class. + /// Returns the cached ResourceManager instance used by this class. /// - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Resources.ResourceManager ResourceManager - { - get - { - if (ReferenceEquals(resourceMan, null)) - { - var temp = new System.Resources.ResourceManager("GenieClient.Resources", typeof(Resources).Assembly); + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GenieClient.Resources", typeof(Resources).Assembly); resourceMan = temp; } - return resourceMan; } } - + /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Globalization.CultureInfo Culture - { - get - { + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - - set - { + set { resourceCulture = value; } } - - internal static Bitmap accessories_text_editor - { - get - { - var obj = ResourceManager.GetObject("accessories_text_editor", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap accessories_text_editor { + get { + object obj = ResourceManager.GetObject("accessories_text_editor", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap applications_graphics - { - get - { - var obj = ResourceManager.GetObject("applications_graphics", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap applications_graphics { + get { + object obj = ResourceManager.GetObject("applications_graphics", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap control_edit - { - get - { - var obj = ResourceManager.GetObject("control_edit", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_edit { + get { + object obj = ResourceManager.GetObject("control_edit", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap control_pause - { - get - { - var obj = ResourceManager.GetObject("control_pause", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_pause { + get { + object obj = ResourceManager.GetObject("control_pause", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap control_play - { - get - { - var obj = ResourceManager.GetObject("control_play", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_play { + get { + object obj = ResourceManager.GetObject("control_play", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap control_stop - { - get - { - var obj = ResourceManager.GetObject("control_stop", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_stop { + get { + object obj = ResourceManager.GetObject("control_stop", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap dialog_warning - { - get - { - var obj = ResourceManager.GetObject("dialog_warning", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap dialog_warning { + get { + object obj = ResourceManager.GetObject("dialog_warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap document_new - { - get - { - var obj = ResourceManager.GetObject("document_new", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_new { + get { + object obj = ResourceManager.GetObject("document_new", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap document_open - { - get - { - var obj = ResourceManager.GetObject("document_open", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_open { + get { + object obj = ResourceManager.GetObject("document_open", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap document_save - { - get - { - var obj = ResourceManager.GetObject("document_save", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_save { + get { + object obj = ResourceManager.GetObject("document_save", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap document_save_as - { - get - { - var obj = ResourceManager.GetObject("document_save_as", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_save_as { + get { + object obj = ResourceManager.GetObject("document_save_as", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap edit_clear - { - get - { - var obj = ResourceManager.GetObject("edit_clear", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap edit_clear { + get { + object obj = ResourceManager.GetObject("edit_clear", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap edit_find - { - get - { - var obj = ResourceManager.GetObject("edit_find", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap edit_find { + get { + object obj = ResourceManager.GetObject("edit_find", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap folder_open - { - get - { - var obj = ResourceManager.GetObject("folder_open", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_open { + get { + object obj = ResourceManager.GetObject("folder_open", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap font_x_generic - { - get - { - var obj = ResourceManager.GetObject("font_x_generic", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap font_x_generic { + get { + object obj = ResourceManager.GetObject("font_x_generic", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap list_add - { - get - { - var obj = ResourceManager.GetObject("list_add", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap list_add { + get { + object obj = ResourceManager.GetObject("list_add", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap list_remove - { - get - { - var obj = ResourceManager.GetObject("list_remove", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap list_remove { + get { + object obj = ResourceManager.GetObject("list_remove", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap network_offline - { - get - { - var obj = ResourceManager.GetObject("network_offline", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap network_offline { + get { + object obj = ResourceManager.GetObject("network_offline", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap network_transmit - { - get - { - var obj = ResourceManager.GetObject("network_transmit", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap network_transmit { + get { + object obj = ResourceManager.GetObject("network_transmit", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap preferences_desktop_locale - { - get - { - var obj = ResourceManager.GetObject("preferences_desktop_locale", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap preferences_desktop_locale { + get { + object obj = ResourceManager.GetObject("preferences_desktop_locale", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap text_x_script - { - get - { - var obj = ResourceManager.GetObject("text_x_script", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap text_x_script { + get { + object obj = ResourceManager.GetObject("text_x_script", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap user_trash - { - get - { - var obj = ResourceManager.GetObject("user_trash", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap user_trash { + get { + object obj = ResourceManager.GetObject("user_trash", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } - - internal static Bitmap view_refresh - { - get - { - var obj = ResourceManager.GetObject("view_refresh", resourceCulture); - return (Bitmap)obj; + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap view_refresh { + get { + object obj = ResourceManager.GetObject("view_refresh", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } } -} \ No newline at end of file +} diff --git a/Script/Eval.cs b/Script/Eval.cs index 299b364..db23b70 100644 --- a/Script/Eval.cs +++ b/Script/Eval.cs @@ -25,7 +25,7 @@ public enum ParseType NegateType // NOT } - private ArrayList oSections = new ArrayList(); + private Genie.Collections.ArrayList oSections = new Genie.Collections.ArrayList(); private class Sections { @@ -457,7 +457,6 @@ private void ParseSection(int iStart, int iEnd) if (iEnd >= oSections.Count | iStart < 0) { throw new Exception("Invalid argument to ParseSection()"); - return; } if (iStart >= 2 && ((Sections)oSections[iStart - 2]).BlockType == ParseType.FunctionType) @@ -823,7 +822,7 @@ private bool ParseCompare(int iArgLeft, int iArgRight, int iComparer, bool bSkip return false; } - private ArrayList m_RegExpResultList = new ArrayList(); + private Genie.Collections.ArrayList m_RegExpResultList = new Genie.Collections.ArrayList(); public bool DoEval(string sText, Globals oGlobals) { @@ -834,7 +833,7 @@ public bool DoEval(string sText, Globals oGlobals) return GetBooleanResult(); } - public ArrayList ResultList + public Genie.Collections.ArrayList ResultList { get { @@ -848,10 +847,9 @@ private void ParseFunction(int iStart, int iEnd) if (iEnd >= oSections.Count | iStart < 0) { throw new Exception("Invalid argument to ParseFunction()"); - return; } - ArrayList args; + Genie.Collections.ArrayList args; args = BuildArgs(iStart, iEnd); var switchExpr = ((Sections)oSections[iStart]).sBlock.ToLower(); switch (switchExpr) @@ -1186,7 +1184,6 @@ private void ParseFunction(int iStart, int iEnd) default: { throw new Exception("Invalid function name."); - break; } } } @@ -1219,7 +1216,9 @@ private bool IsSectionTrue(Sections oSection) return false; } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { return false; } @@ -1242,10 +1241,10 @@ private int Count(string text, string match) return c; } - // Builds the argument arraylist for ParseFunction() - private ArrayList BuildArgs(int iStart, int iEnd) + // Builds the argument Genie.Collections.ArrayList for ParseFunction() + private Genie.Collections.ArrayList BuildArgs(int iStart, int iEnd) { - var ar = new ArrayList(); + var ar = new Genie.Collections.ArrayList(); for (int j = iStart, loopTo = iEnd; j <= loopTo; j++) { if (((Sections)oSections[j]).bParsed == false) diff --git a/Script/MathEval.cs b/Script/MathEval.cs index a820b6c..ff27bdd 100644 --- a/Script/MathEval.cs +++ b/Script/MathEval.cs @@ -56,20 +56,20 @@ private enum TOKENCLASS private Collection m_tokens; private int[,] m_State; - private string[] m_KeyWords; + // private string[] m_KeyWords; private string m_colstring; private const string ALPHA = "_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private const string DIGITS = "#0123456789"; private string[] m_funcs = new[] { "sin", "cos", "tan", "arcsin", "arccos", "arctan", "sqrt", "max", "min", "floor", "ceiling", "log", "log10", "ln", "round", "abs", "neg", "pos" }; - private ArrayList m_operators; + private Genie.Collections.ArrayList m_operators; private Stack m_stack = new Stack(); private void init_operators() { ClassSymbol op; - m_operators = new ArrayList(); + m_operators = new Genie.Collections.ArrayList(); op = new ClassSymbol(); op.Token = "-"; op.Cls = TOKENCLASS.OPERATORTOKEN; @@ -324,8 +324,6 @@ private double calc_function(string func, Collection args) { return Math.Round(Conversions.ToDouble(args[1])); } - - break; } case "ln": @@ -702,7 +700,6 @@ private double level6(ref Queue tokens) else { throw new Exception("Invalid expression."); - return 0; } double val; @@ -745,7 +742,6 @@ private double level6(ref Queue tokens) default: { throw new Exception("Invalid expression."); - break; } } } @@ -762,7 +758,6 @@ private Collection arguments(Queue tokens) else { throw new Exception("Invalid expression."); - return null; } if ((symbol.Token ?? "") == "(") @@ -779,7 +774,6 @@ private Collection arguments(Queue tokens) else { throw new Exception("Invalid expression."); - return null; } symbol = (ClassSymbol)tokens.Dequeue(); @@ -790,7 +784,6 @@ private Collection arguments(Queue tokens) else { throw new Exception("Invalid expression."); - return null; } } /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ diff --git a/Script/Script.cs b/Script/Script.cs index 08f7fdf..4f07ba2 100644 --- a/Script/Script.cs +++ b/Script/Script.cs @@ -31,12 +31,12 @@ private class Line public int iIndex = 0; public bool bSkipBlock = false; public int iBlockDepth = 0; - public ArrayList oBlockList = new ArrayList(); - public ArrayList oArgList = new ArrayList(); + public Genie.Collections.ArrayList oBlockList = new Genie.Collections.ArrayList(); + public Genie.Collections.ArrayList oArgList = new Genie.Collections.ArrayList(); public bool bLastRowWasEvaluation = false; } - private ArrayList oLineList = new ArrayList(); + private Genie.Collections.ArrayList oLineList = new Genie.Collections.ArrayList(); public enum BlockState { @@ -75,7 +75,7 @@ public bool RemoveBlock() } } - public ArrayList ArgList + public Genie.Collections.ArrayList ArgList { get { @@ -359,7 +359,7 @@ public Action(string sTrigger, string sAction, int iFileId, int iFileRow, bool b } } - public new bool Add(string sTrigger, string sAction, int iFileId, int iFileRow, bool bIgnoreCase = false, bool bIsEvalAction = false, bool bIsInstant = false) + public bool Add(string sTrigger, string sAction, int iFileId, int iFileRow, bool bIgnoreCase = false, bool bIsEvalAction = false, bool bIsInstant = false) { if (sTrigger.StartsWith("e/") == true) { @@ -429,7 +429,7 @@ public Action(string sTrigger, string sAction, int iFileId, int iFileRow, bool b return true; } - public new void Remove(string sText) + public void Remove(string sText) { if (sText.StartsWith("e/") == true) { @@ -477,7 +477,7 @@ public void SetClass(string name, bool status) } } - public class ClassMatchList : ArrayList + public class ClassMatchList : Genie.Collections.ArrayList { public class Match { @@ -507,7 +507,7 @@ public Match(string sText, string sLabel, bool bIsRegExp, bool bIgnoreCase) } } - public new int Add(string sText, string sLabel, bool bIsRegExp = false, bool bIgnoreCase = false) + public int Add(string sText, string sLabel, bool bIsRegExp = false, bool bIgnoreCase = false) { if (bIsRegExp) { @@ -533,7 +533,7 @@ public Match(string sText, string sLabel, bool bIsRegExp, bool bIgnoreCase) public class ClassVariableList : SortedList { - public new void Add(string key, string value) + public void Add(string key, string value) { if (base.ContainsKey(key) == true) { @@ -636,8 +636,8 @@ public enum ScriptState private Genie.Script.Eval m_oEval = new Genie.Script.Eval(); private Genie.Script.MathEval m_oEvalMath = new Genie.Script.MathEval(); - private ArrayList m_oScript = new ArrayList(); - private ArrayList m_oScriptFiles = new ArrayList(); + private Genie.Collections.ArrayList m_oScript = new Genie.Collections.ArrayList(); + private Genie.Collections.ArrayList m_oScriptFiles = new Genie.Collections.ArrayList(); private Hashtable m_oScriptLabels = new Hashtable(); private CurrentLine m_oCurrentLine = new CurrentLine(); private ClassVariableList m_oLocalVarList = new ClassVariableList(); @@ -648,7 +648,7 @@ public enum ScriptState private DateTime m_oPauseEnd; private bool m_bWaitForStringResume = true; private bool m_bWaitForStringIsRegExp = false; - private bool m_bWaitForStringIgnoreCase = false; + // private bool m_bWaitForStringIgnoreCase = false; private string m_sWaitForStringText = string.Empty; private Regex m_oWaitForRegex = null; private bool m_bWaitForMove = true; @@ -1267,7 +1267,7 @@ public void TriggerParse(string text, bool bBufferWait = true) m_oRegMatch = ((ClassActionList.Action)de.Value).oRegExp.Match(text); if (m_oRegMatch.Success == true) { - var ActionRegExpArg = new ArrayList(); + var ActionRegExpArg = new Genie.Collections.ArrayList(); if (m_oRegMatch.Groups.Count > 0) { int J; @@ -1365,7 +1365,7 @@ public void TriggerVariableChanged(string sVariableName) // When variables chang if (s.Length > 0 & (s ?? "") != "0") { - ParseAction(de.Key.ToString(), new ArrayList(), sVariableName); + ParseAction(de.Key.ToString(), new Genie.Collections.ArrayList(), sVariableName); if (m_oActions.Count == 0) // Script Aborted { return; @@ -1914,7 +1914,7 @@ public bool LoadFile(string sFile, bool bClear = true) return default; } - public bool LoadFile(string strFile, ArrayList al) + public bool LoadFile(string strFile, Genie.Collections.ArrayList al) { if (Monitor.TryEnter(m_oThreadLock, m_iDefaultTimeout)) { @@ -1969,12 +1969,11 @@ private string GetFileName(int index = 0) return string.Empty; } - private void ParseAction(string sKey, ArrayList oArgs, string sTriggerText) + private void ParseAction(string sKey, Genie.Collections.ArrayList oArgs, string sTriggerText) { if (m_oActions.ContainsKey(sKey) == false) { throw new Exception("Invalid Key in ParseAction()"); - return; } int iFileId = ((ClassActionList.Action)m_oActions[sKey]).iFileId; @@ -2834,7 +2833,9 @@ private void EvalTimer(string sText, int iFileId, int iFileRow) m_oTimerStart = DateTime.Parse(Utility.GetArgumentString(sText)); m_oLocalVarList.Add("t", "@timer@"); // set automatically "start" timer } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { PrintError("Invalid datetime format in TIMER SETSTART command: " + Utility.GetArgumentString(sText), iFileId, iFileRow); AbortOnScriptError(); @@ -3059,7 +3060,9 @@ private double DoMathCalc(double dValue, string sExpression, int iFileId, int iF { return Utility.MathCalc(dValue, sExpression); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { PrintError("Invalid MATH expression: " + sExpression, iFileId, iFileRow); AbortOnScriptError(); @@ -3131,7 +3134,7 @@ private bool EvalWaitString(string sText, bool bIsRegExp = false) if (sText.Trim().Length > 0) { m_bWaitForStringIsRegExp = bIsRegExp; - m_bWaitForStringIgnoreCase = false; + // m_bWaitForStringIgnoreCase = false; if (m_bWaitForStringIsRegExp == true) { if (sText.StartsWith("/") == true) @@ -3141,7 +3144,7 @@ private bool EvalWaitString(string sText, bool bIsRegExp = false) if (sText.EndsWith("/i") == true) { - m_bWaitForStringIgnoreCase = true; + // m_bWaitForStringIgnoreCase = true; sText = sText.Substring(0, sText.Length - 2); } else if (sText.EndsWith("/") == true) @@ -3338,13 +3341,17 @@ private bool RunJSFile(string sFile) return false; } } + #pragma warning disable CS0168 catch (FileNotFoundException ex) + #pragma warning restore CS0168 { PrintError("File not found: " + sFriendlyName, iFileId: argiFileId, iFileRow: argiFileRow); AbortScript(); return false; } + #pragma warning disable CS0168 catch (FileLoadException ex) + #pragma warning restore CS0168 { PrintError("File load exception: " + sFriendlyName, iFileId: argiFileId, iFileRow: argiFileRow); AbortScript(); @@ -3451,13 +3458,17 @@ private bool AppendFile(string sFile, bool bJSBlock = false) return false; } } + #pragma warning disable CS0168 catch (FileNotFoundException ex) + #pragma warning restore CS0168 { PrintError("File not found: " + sFriendlyName, iFileId: argiFileId, iFileRow: argiFileRow); AbortScript(); return false; } + #pragma warning disable CS0168 catch (FileLoadException ex) + #pragma warning restore CS0168 { PrintError("File load exception: " + sFriendlyName, iFileId: argiFileId, iFileRow: argiFileRow); AbortScript(); @@ -3554,6 +3565,14 @@ private bool AddLine(int iFileRow, string sText, int iFileId, bool bJSBlock = fa { case ScriptFunctions.include: { + if (m_oScriptFiles.Contains(strArgument)) + { + continue; + } + else + { + m_oScriptFiles.Add(strArgument); + } if (strArgument.ToLower().EndsWith(".js")) { if (AppendFile(strArgument, true) == false) @@ -3565,9 +3584,7 @@ private bool AddLine(int iFileRow, string sText, int iFileId, bool bJSBlock = fa { return false; } - continue; - break; } case ScriptFunctions.pluginscript: @@ -3577,9 +3594,7 @@ private bool AddLine(int iFileRow, string sText, int iFileId, bool bJSBlock = fa { AppendString(strScript); } - continue; - break; } case ScriptFunctions.iffunc: @@ -3731,7 +3746,6 @@ private bool AddLine(int iFileRow, string sText, int iFileId, bool bJSBlock = fa continue; } - break; } @@ -3742,9 +3756,7 @@ private bool AddLine(int iFileRow, string sText, int iFileId, bool bJSBlock = fa PrintError("Unknown script command: " + sRow, iFileId, iFileRow); return false; } - continue; - break; } } } diff --git a/Utility/ColorCode.cs b/Utility/ColorCode.cs index bb22f3e..c712225 100644 --- a/Utility/ColorCode.cs +++ b/Utility/ColorCode.cs @@ -39,7 +39,9 @@ public static Color StringToColor(string sColor) return (Color)new ColorConverter().ConvertFromString(sColor); } } + #pragma warning disable CS0168 catch (Exception ex) // Unfortunately there is no specific error for convert errors. + #pragma warning restore CS0168 { return default; } @@ -99,7 +101,9 @@ public static Color HexToColor(string sColor) { return ColorTranslator.FromHtml(sColor); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { return default; } @@ -119,7 +123,6 @@ public static bool IsHexString(string sText) if (ValidHexChars.IndexOf(c) == -1) { return false; - return default; } } diff --git a/Utility/Crypto.cs b/Utility/Crypto.cs index 44970fb..5d9b3ef 100644 --- a/Utility/Crypto.cs +++ b/Utility/Crypto.cs @@ -200,7 +200,7 @@ public static bool EncryptString(string Content) public static bool DecryptString() { - byte[] encText = null; + // byte[] encText = null; byte[] clearText = null; try { @@ -232,7 +232,9 @@ public static bool EncryptFile(string Filename, string Target) fs.Dispose(); File.Delete(Target); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { _exception = new CryptographicException(ERR_FILE_WRITE); return false; @@ -244,7 +246,9 @@ public static bool EncryptFile(string Filename, string Target) { inStream = File.ReadAllBytes(Filename); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { _exception = new CryptographicException(ERR_FILE_READ); return false; @@ -296,7 +300,9 @@ public static bool DecryptFile(string Filename, string Target) fs.Dispose(); File.Delete(Target); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { _exception = new CryptographicException(ERR_FILE_WRITE); return false; @@ -308,7 +314,9 @@ public static bool DecryptFile(string Filename, string Target) { inStream = File.ReadAllBytes(Filename); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { _exception = new CryptographicException(ERR_FILE_READ); return false; @@ -492,7 +500,6 @@ private static byte[] _Encrypt(byte[] Content) default: { throw new CryptographicException(ERR_INVALID_PROVIDER); - break; } } @@ -594,7 +601,6 @@ private static byte[] _Decrypt(byte[] Content) default: { throw new CryptographicException(ERR_INVALID_PROVIDER); - break; } } @@ -838,7 +844,6 @@ private static byte[] RSADecrypt(string encText) if (!(maxBytes % RSA_DECRYPTBLOCKSIZE).Equals(0)) { throw new CryptographicException("Encrypted text is an invalid length"); - return null; } // Calculate the number of blocks we will have to work on @@ -985,7 +990,6 @@ private static string GetTextFromFile(string fileName) else { throw new IOException("Specified file does not exist"); - return null; } } /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ diff --git a/Utility/EmbeddedAssembly.cs b/Utility/EmbeddedAssembly.cs new file mode 100644 index 0000000..d19b2b1 --- /dev/null +++ b/Utility/EmbeddedAssembly.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Reflection; +using System.Security.Cryptography; + +namespace GenieClient +{ + public class EmbeddedAssembly + { + // Version 1.3 + + static Dictionary dic = null; + + public static void Load(string embeddedResource, string fileName) + { + if (dic == null) + dic = new Dictionary(); + + byte[] ba = null; + Assembly asm = null; + Assembly curAsm = Assembly.GetExecutingAssembly(); + + using (Stream stm = curAsm.GetManifestResourceStream(embeddedResource)) + { + // Either the file is not existed or it is not mark as embedded resource + if (stm == null) + throw new Exception(embeddedResource + " is not found in Embedded Resources."); + + // Get byte[] from the file from embedded resource + ba = new byte[(int)stm.Length]; + stm.Read(ba, 0, (int)stm.Length); + try + { + asm = Assembly.Load(ba); + + // Add the assembly/dll into dictionary + dic.Add(asm.FullName, asm); + return; + } + catch + { + // Purposely do nothing + // Unmanaged dll or assembly cannot be loaded directly from byte[] + // Let the process fall through for next part + } + } + + bool fileOk = false; + string tempFile = ""; + + using (SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider()) + { + string fileHash = BitConverter.ToString(sha1.ComputeHash(ba)).Replace("-", string.Empty); ; + + tempFile = Path.GetTempPath() + fileName; + + if (File.Exists(tempFile)) + { + byte[] bb = File.ReadAllBytes(tempFile); + string fileHash2 = BitConverter.ToString(sha1.ComputeHash(bb)).Replace("-", string.Empty); + + if (fileHash == fileHash2) + { + fileOk = true; + } + else + { + fileOk = false; + } + } + else + { + fileOk = false; + } + } + + if (!fileOk) + { + System.IO.File.WriteAllBytes(tempFile, ba); + } + + asm = Assembly.LoadFile(tempFile); + + dic.Add(asm.FullName, asm); + } + + public static Assembly Get(string assemblyFullName) + { + if (dic == null || dic.Count == 0) + return null; + + if (dic.ContainsKey(assemblyFullName)) + return dic[assemblyFullName]; + + return null; + } + } +} \ No newline at end of file diff --git a/Utility/KeyCode.cs b/Utility/KeyCode.cs index 0a03e69..ae9c628 100644 --- a/Utility/KeyCode.cs +++ b/Utility/KeyCode.cs @@ -178,7 +178,9 @@ public static System.Windows.Forms.Keys StringToKey(string sHotkey) { return (System.Windows.Forms.Keys)Conversions.ToInteger(new KeysConverter().ConvertFromString(sHotkey)); } + #pragma warning disable CS0168 catch (Exception ex) // Unfortunately there is no specific error for convert errors. + #pragma warning restore CS0168 { return default; } diff --git a/Utility/PluginServices.cs b/Utility/PluginServices.cs index e46b24f..1acd079 100644 --- a/Utility/PluginServices.cs +++ b/Utility/PluginServices.cs @@ -19,7 +19,7 @@ public struct AvailablePlugin public static AvailablePlugin[] FindPlugins(string strPath, string strInterface) { - var Plugins = new ArrayList(); + var Plugins = new Genie.Collections.ArrayList(); string[] strDLLs; int intIndex; Assembly objDLL; @@ -37,7 +37,9 @@ public static AvailablePlugin[] FindPlugins(string strPath, string strInterface) objDLL = Assembly.Load(readAllBytes); ExamineAssembly(objDLL, strDLLs[intIndex], strInterface, Conversions.ToString(strKey), Plugins); } + #pragma warning disable CS0168 catch (Exception e) + #pragma warning restore CS0168 { // Error loading DLL, we don't need to do anything special } @@ -68,7 +70,7 @@ public static AvailablePlugin FindPlugin(string strFile, string strInterface) object strKey = Utility.GenerateKeyHash(argsText); var readAllBytes = File.ReadAllBytes(strFile); objDLL = Assembly.Load(readAllBytes); - var Plugins = new ArrayList(); + var Plugins = new Genie.Collections.ArrayList(); ExamineAssembly(objDLL, strFile, strInterface, Conversions.ToString(strKey), Plugins); if (Plugins.Count != 0) { @@ -92,7 +94,7 @@ public static string GetMD5HashFromFile(string fileName) return sb.ToString(); } - private static void ExamineAssembly(Assembly objDLL, string AssemblyPath, string strInterface, string strKey, ArrayList Plugins) + private static void ExamineAssembly(Assembly objDLL, string AssemblyPath, string strInterface, string strKey, Genie.Collections.ArrayList Plugins) { Type objInterface; AvailablePlugin Plugin; @@ -137,7 +139,9 @@ public static object CreateInstance(AvailablePlugin Plugin) // Create and return class instance objPlugin = objDLL.CreateInstance(Plugin.ClassName); } + #pragma warning disable CS0168 catch (Exception e) + #pragma warning restore CS0168 { return null; } diff --git a/Utility/Utility.cs b/Utility/Utility.cs index 7c71b65..a2cbc23 100644 --- a/Utility/Utility.cs +++ b/Utility/Utility.cs @@ -16,7 +16,7 @@ public static string GetTimeStamp() return "[" + Strings.FormatDateTime(DateAndTime.Now, DateFormat.ShortTime) + "]"; } - public static bool ExecuteProcess(string sFileName, string sArguments) + public static bool ExecuteProcess(string sFileName, string sArguments, bool closeProcess = true) { var myProcess = new Process(); var myProcessStartInfo = new ProcessStartInfo(sFileName); @@ -29,12 +29,13 @@ public static bool ExecuteProcess(string sFileName, string sArguments) myProcess.Start(); var myStreamReader = myProcess.StandardOutput; // Read the standard output of the spawned process. - while (myProcess.HasExited == false) - // If myStreamReader.Peek() > -1 Then - // RTBOutput.AppendText(myStreamReader.ReadToEnd() & vbCrLf) - // End If - Thread.Sleep(10); - myProcess.Close(); + if (closeProcess) + { + while (myProcess.HasExited == false) + Thread.Sleep(10); + myProcess.Close(); + } + return default; } @@ -45,7 +46,9 @@ public static bool ValidateRegExp(string sRegExp) var re = new Regex(sRegExp); return true; } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { return false; } @@ -65,12 +68,20 @@ public static string EncryptText(string sKey, string sText) z = (x ^ y) + 32; Debug.WriteLine(z + ":" + ((Strings.Asc(Strings.Mid(sKey, i, 1)) ^ Strings.Asc(Strings.Mid(sText, i, 1)) - 32) + 32)); var midTmp = Conversions.ToString(Strings.Chr((Strings.Asc(Strings.Mid(sKey, i, 1)) ^ Strings.Asc(Strings.Mid(sText, i, 1)) - 32) + 32)); + // var midTmp = Conversions.ToString(Chr((Strings.Asc(Strings.Mid(sKey, i, 1)) ^ Strings.Asc(Strings.Mid(sText, i, 1)) - 32) + 32)); StringType.MidStmtStr(ref sText, i, 1, midTmp); } return sText; } + public static string Chr(int p_intByte) + { + byte[] bytBuffer = BitConverter.GetBytes(p_intByte); + + return System.Text.Encoding.Unicode.GetString(bytBuffer); + } + // Nya keyserver rutiner: // 1. Generera Hash av Nyckel // 2. Hämta fil från webserver som heter .key @@ -104,8 +115,7 @@ public static string GenerateHashSHA512(string sText) { throw new Exception(Crypto.CryptoException.Message); } - - Crypto.Clear(); + // Crypto.Clear(); } public static string GenerateHashSHA256(string sText) @@ -123,7 +133,7 @@ public static string GenerateHashSHA256(string sText) throw new Exception(Crypto.CryptoException.Message); } - Crypto.Clear(); + // Crypto.Clear(); } public static string EncryptString(string sPassword, string sText) @@ -142,7 +152,7 @@ public static string EncryptString(string sPassword, string sText) throw new Exception(Crypto.CryptoException.Message); } - Crypto.Clear(); + // Crypto.Clear(); } public static string DecryptString(string sPassword, string sText) @@ -162,7 +172,7 @@ public static string DecryptString(string sPassword, string sText) throw new Exception(Crypto.CryptoException.Message); } - Crypto.Clear(); + // Crypto.Clear(); } public static int RandomNumber(int min, int max) @@ -213,7 +223,6 @@ public static int GetTimeDiffInSeconds(DateTime oDateStart, DateTime oDateEnd) if (Information.IsNothing(oDateStart) | Information.IsNothing(oDateEnd)) { return 0; - return default; } var span = oDateEnd - oDateStart; @@ -225,15 +234,14 @@ public static double GetTimeDiffInMilliseconds(DateTime oDateStart, DateTime oDa if (Information.IsNothing(oDateStart) | Information.IsNothing(oDateEnd)) { return 0; - return default; } var span = oDateEnd - oDateStart; return span.TotalMilliseconds; } - // Public Shared Function SafeSplit(BysInput As String, BycSplitChar As Char) As ArrayList - // Dim oList As New ArrayList() + // Public Shared Function SafeSplit(BysInput As String, BycSplitChar As Char) As Genie.Collections.ArrayList + // Dim oList As New Genie.Collections.ArrayList() // Dim bInsideString As Boolean = False // Dim cInsideStringChar As Char @@ -306,9 +314,9 @@ public static string GenerateAccountHashSecond(string sText) return GenerateHashSHA512(argsText); } - public static ArrayList ParseArgs(string sText, bool bTreatUnderscoreAsSpace = false) + public static Genie.Collections.ArrayList ParseArgs(string sText, bool bTreatUnderscoreAsSpace = false) { - var oList = new ArrayList(); + var oList = new Genie.Collections.ArrayList(); try { bool bInsideString = false; @@ -400,7 +408,9 @@ public static ArrayList ParseArgs(string sText, bool bTreatUnderscoreAsSpace = f AddArrayItem(oList, argsText3, Conversions.ToBoolean(Interaction.IIf(oList.Count > 0, bTreatUnderscoreAsSpace, false))); } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { throw new Exception("Invalid string in Parse Arguments: " + sText); } @@ -440,12 +450,16 @@ public static bool MoveFile(string sSourceFileName, string sDestFileName) { File.Move(sSourceFileName, sDestFileName); } + #pragma warning disable CS0168 catch (IOException ex) + #pragma warning restore CS0168 { // The destination file already exists. return false; } + #pragma warning disable CS0168 catch (UnauthorizedAccessException ex) + #pragma warning restore CS0168 { // The caller does not have the required permission. return false; @@ -460,11 +474,15 @@ public static bool DeleteFile(string sourceFileName) { File.Delete(sourceFileName); } + #pragma warning disable CS0168 catch (IOException ex) + #pragma warning restore CS0168 { return false; } + #pragma warning disable CS0168 catch (UnauthorizedAccessException ex) + #pragma warning restore CS0168 { // The caller does not have the required permission. return false; @@ -482,11 +500,15 @@ public static bool CreateDirectory(string sourceDirectoryName) Directory.CreateDirectory(sourceDirectoryName); } } + #pragma warning disable CS0168 catch (IOException ex) + #pragma warning restore CS0168 { return false; } + #pragma warning disable CS0168 catch (UnauthorizedAccessException ex) + #pragma warning restore CS0168 { // The caller does not have the required permission. return false; @@ -523,15 +545,21 @@ public static double StringToDouble(string sValue) double d = double.Parse(sValue, new System.Globalization.CultureInfo("en-US")); return d; } + #pragma warning disable CS0168 catch (FormatException ex) + #pragma warning restore CS0168 { return -1; } + #pragma warning disable CS0168 catch (OverflowException ex) + #pragma warning restore CS0168 { return -1; } + #pragma warning disable CS0168 catch (InvalidCastException ex) + #pragma warning restore CS0168 { return -1; } @@ -556,15 +584,21 @@ public static int StringToInteger(string sValue) return -1; } } + #pragma warning disable CS0168 catch (FormatException ex) + #pragma warning restore CS0168 { return -1; } + #pragma warning disable CS0168 catch (OverflowException ex) + #pragma warning restore CS0168 { return -1; } + #pragma warning disable CS0168 catch (InvalidCastException ex) + #pragma warning restore CS0168 { return -1; } @@ -600,7 +634,9 @@ private static DateTime AssemblyLastWriteTime(System.Reflection.Assembly a) { return File.GetLastWriteTime(a.Location); } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { return DateTime.MaxValue; } @@ -643,9 +679,9 @@ public static string ArrayToString(ArrayList oList, int iStartIndex) return sReturnText.Trim(); } - public static ArrayList SafeSplit(string sInput, char cSplitChar) + public static Genie.Collections.ArrayList SafeSplit(string sInput, char cSplitChar) { - var oList = new ArrayList(); + var oList = new Genie.Collections.ArrayList(); bool bInsideString = false; var cInsideStringChar = default(char); int iBracketDepth = 0; @@ -737,7 +773,9 @@ public static void MoveLayoutFiles() sFile = FileSystem.Dir(); } } + #pragma warning disable CS0168 catch (Exception ex) + #pragma warning restore CS0168 { } } @@ -810,7 +848,6 @@ public static double MathCalc(double dValue, string sExpression) default: { throw new Exception("Invalid #MATH expression: " + sExpression); - break; } } diff --git a/Utility/Win32Utility.cs b/Utility/Win32Utility.cs index d587db0..f2c92c8 100644 --- a/Utility/Win32Utility.cs +++ b/Utility/Win32Utility.cs @@ -19,7 +19,7 @@ public class Win32Utility private const int WM_SETREDRAW = 0xB; private const int EM_GETFIRSTVISIBLELINE = 0xCE; private const int EM_LINESCROLL = 0xB6; - private const int EM_GETLINECOUNT = 0xBA; + // private const int EM_GETLINECOUNT = 0xBA; private struct SCROLLINFO { diff --git a/Utility/XMLConfig.cs b/Utility/XMLConfig.cs index 59d34c7..0ee9295 100644 --- a/Utility/XMLConfig.cs +++ b/Utility/XMLConfig.cs @@ -102,128 +102,83 @@ public void CloseFile() public string GetValue(string path, string attribute, string DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (!Information.IsNothing(ro)) { - if (!Information.IsNothing(ro)) + try { + // can this throw? return Convert.ToString(ro); } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + catch { } } + return DefaultValue; } public bool GetValue(string path, string attribute, bool DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (ro != null && ro.Length > 0 && (ro.Equals("True") || ro.Equals("False"))) { - if (ro.Length > 0) - { - if (ro.Equals("True") || ro.Equals("False")) - { - return Convert.ToBoolean(ro); - } - else - { - return false; - } - } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + return Convert.ToBoolean(ro); } + return DefaultValue; } public int GetValue(string path, string attribute, int DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (ro != null && ro.Length > 0) { - if (ro.Length > 0) + try { return Convert.ToInt32(ro); } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + catch { } } + // If value doesn't exist or is invalid, return default: + return DefaultValue; } public double GetValue(string path, string attribute, double DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (ro != null && ro.Length > 0) { - if (ro.Length > 0) + try { return Convert.ToDouble(ro); } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + catch { } } + return DefaultValue; } public float GetValueSingle(string path, string attribute, float DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (ro != null && ro.Length > 0) { - if (ro.Length > 0) + try { return Convert.ToSingle(ro); } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + catch { } } + return DefaultValue; } public DateTime GetValue(string path, string attribute, DateTime DefaultValue) { string ro = GetValueObject(path, attribute); - try + if (ro != null && ro.Length > 0) { - if (ro.Length > 0) + try { return Convert.ToDateTime(ro); } - else - { - return DefaultValue; - } - } - catch - { - return DefaultValue; + catch { } } + return DefaultValue; } private string GetValueObject(string path, string attribute) @@ -250,20 +205,13 @@ private string GetValueObject(string path, string attribute) if (!(xmlNode is null)) { XmlElement targetElem = (XmlElement)xmlNode.SelectSingleNode(key); - if (!(targetElem is null)) - { - if (targetElem.HasAttribute(attribute) == false) - return null; + if (!(targetElem is null) && targetElem.HasAttribute(attribute) != false) return targetElem.GetAttribute(attribute); - } } - - return null; } catch - { - return null; - } + { } + return null; } public bool SetValue(string path, string attribute, string val) diff --git a/app.config b/app.config index 506bf6e..a99e1ab 100644 --- a/app.config +++ b/app.config @@ -20,4 +20,4 @@ - + diff --git a/genie3 b/genie3 deleted file mode 160000 index d504ed9..0000000 --- a/genie3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d504ed9ec82abe7797fe79be5ff0efb00e10ce60 diff --git a/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs b/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs deleted file mode 100644 index 5d01041..0000000 --- a/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index 0cb2c6a..0000000 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/obj/Debug/Genie3.csproj.AssemblyReference.cache b/obj/Debug/Genie3.csproj.AssemblyReference.cache deleted file mode 100644 index b9bbb13..0000000 Binary files a/obj/Debug/Genie3.csproj.AssemblyReference.cache and /dev/null differ