public override int GetHashCode() { int hash = 1; if (PlayerLevel != 0) { hash ^= PlayerLevel.GetHashCode(); } if (WarningSeverity.Length != 0) { hash ^= WarningSeverity.GetHashCode(); } if (WeatherTag.Length != 0) { hash ^= WeatherTag.GetHashCode(); } if (MoonTag.Length != 0) { hash ^= MoonTag.GetHashCode(); } if (TimeOfDayTag.Length != 0) { hash ^= TimeOfDayTag.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Function that loads the configuration from XML DataContract present in the class SettingsManager /// </summary> /// <param name="filename"></param> public static void LoadUserSettings(string filename) { try { FileStream fs = new FileStream(filename, FileMode.Open); XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(fs, new XmlDictionaryReaderQuotas()); DataContractSerializer ser = new DataContractSerializer(typeof(SettingsManager)); // Deserialize the data and read it from the instance. SettingsManager deserializedSettingsManager = (SettingsManager)ser.ReadObject(reader, true); reader.Close(); fs.Close(); language = deserializedSettingsManager.GetLanguage(); warningSeverity = deserializedSettingsManager.GetSeverity(); syntaxFilePath = deserializedSettingsManager.syntaxFilePath; defaultFontSize = deserializedSettingsManager.fontSize; } catch (Exception) { language = Language.French; warningSeverity = WarningSeverity.Light; syntaxFilePath = "resources/naturl_coloration.xshd"; defaultFontSize = 18d; } }
public static string ToStringRepresentation(this WarningSeverity warningSeverity) { switch (warningSeverity) { case WarningSeverity.Light: return("light"); case WarningSeverity.Medium: return("medium"); case WarningSeverity.Severe: return("severe"); default: throw new ArgumentOutOfRangeException(nameof(warningSeverity), warningSeverity, null); } }
//MyCompletionWindow myCompletionWindow; public MainWindow() { Instance = this; Environment.SetEnvironmentVariable("NATURLPATH", Path.GetFullPath("resources")); MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; //Loading Settings configuration from XML UserSettings.LoadUserSettings("resources/settings.xml"); language = UserSettings.language; _warningSeverity = UserSettings.warningSeverity; //Unused warning severity yet. InitializeComponent(); TextEditor textEditor = (TextEditor)((Grid)((TabItem)FindName("Tab_id_")).FindName( "grid_codebox")).Children[0]; XmlTextReader reader = new XmlTextReader(UserSettings.syntaxFilePath); _highlightingDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance); textEditor.SyntaxHighlighting = _highlightingDefinition; defaultSize = UserSettings.defaultFontSize; reader.Close(); string[] paths = File.ReadAllLines("resources/lastfiles.txt"); tabitem = XamlWriter.Save(FindName("Tab_id_")); ((TabablzControl)FindName("TabControl")).Items.RemoveAt(0); Process lspServer = new Process { StartInfo = { FileName = "resources/server.exe", //C:\\Users\\Adrian\\Desktop\\TCP Server\\TCP Server\\bin\\Debug\\netcoreapp3.1\\TCP Server.exe EnvironmentVariables = { ["NATURLPATH"] = Path.GetFullPath("resources") }, CreateNoWindow = true, RedirectStandardError = true }, }; //lspServer.OutputDataReceived += (sender, args) => Console.WriteLine("Server log:" + args.Data); //lspServer.ErrorDataReceived += (sender, args) => Console.WriteLine("Server log(err):" + args.Data); LspSender = new LspHandler(this, lspServer); LspSender.InitializeRequest(Process.GetCurrentProcess().Id, "file://" + Directory.GetCurrentDirectory(), new ClientCapabilities( new TextDocumentClientCapabilities( new CompletionClientCapabilities(), new DefinitionClientCapabilities(), new PublishDiagnosticsClientCapabilities()))); if (paths.Length == 0) { NewTabItems(++_tabInt, null); } else { foreach (string path in paths) { NewTabItems(++_tabInt, path); } } _lastFocusedTextEditor = (TextEditor)FindName("CodeBox" + _currenttabId); InitialiseLanguageComponents(language); }