public override bool Run()
 {
     if (IsArg("--langserver"))
     {
         DeltintegerLanguageServer.Run();
         return(true);
     }
     return(false);
 }
Example #2
0
 public ClipboardListener(DeltintegerLanguageServer languageServer)
 {
     _languageServer = languageServer;
 }
Example #3
0
        static void Main(string[] args)
        {
            Program.args = args;

            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
            if (!args.Contains("--langserver"))
            {
                Log.Write(LogLevel.Normal, "Overwatch Script To Workshop " + VERSION);
            }

            Log.LogLevel = LogLevel.Normal;
            if (args.Contains("-verbose"))
            {
                Log.LogLevel = LogLevel.Verbose;
            }
            if (args.Contains("-quiet"))
            {
                Log.LogLevel = LogLevel.Quiet;
            }

            if (args.Contains("--langserver"))
            {
                Log.LogLevel = LogLevel.Quiet;
                DeltintegerLanguageServer.Run();
            }
            else if (args.Contains("--generatealphabet"))
            {
                Console.Write("Output folder: ");
                string folder = Console.ReadLine();
                Deltin.Deltinteger.Models.Letter.Generate(folder);
            }
            else if (args.Contains("--editor"))
            {
                string pathfindEditorScript = Extras.CombinePathWithDotNotation(null, "!PathfindEditor.del");

                if (!File.Exists(pathfindEditorScript))
                {
                    Log.Write(LogLevel.Normal, "The PathfindEditor.del module is missing!");
                }
                else
                {
                    Script(pathfindEditorScript);
                }
            }
            else if (args.ElementAtOrDefault(0) == "--i18n")
            {
                I18n.GenerateI18n.Generate(args);
            }
            else if (args.ElementAtOrDefault(0) == "--i18nlink")
            {
                I18n.GenerateI18n.GenerateKeyLink();
            }
            else
            {
                string script = args.ElementAtOrDefault(0);

                if (script != null && File.Exists(script))
                {
                    #if DEBUG == false
                    try
                    {
                    #endif

                    string ext = Path.GetExtension(script).ToLower();
                    if (ext == ".csv")
                    {
                        PathMap map    = PathMap.ImportFromCSV(script);
                        string  result = map.ExportAsXML();
                        string  output = Path.ChangeExtension(script, "pathmap");
                        using (FileStream fs = File.Create(output))
                        {
                            Byte[] info = Encoding.Unicode.GetBytes(result);
                            fs.Write(info, 0, info.Length);
                        }
                        Log.Write(LogLevel.Normal, "Created pathmap file at '" + output + "'.");
                    }
                    else if (ext == ".pathmap")
                    {
                        Editor.FromPathmapFile(script);
                    }
                    else
                    {
                        Script(script);
                    }

                    #if DEBUG == false
                }
                catch (Exception ex)
                {
                    Log.Write(LogLevel.Normal, "Internal exception.");
                    Log.Write(LogLevel.Normal, ex.ToString());
                }
                    #endif
                }
                else
                {
                    Log.Write(LogLevel.Normal, $"Could not find the file '{script}'.");
                    Log.Write(LogLevel.Normal, $"Drag and drop a script over the executable to parse.");
                }
            }

            Finished();
        }