예제 #1
0
        private void DownloadNativesBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                String url = "http://www.dev-c.com/nativedb/reference.zip";

                var natives = HTMLNativeParser.ParseZippedHtmlUrl(url); // TODO load this assync (proggress bar etc)

                var window = new MainWindow(natives);
                window.Show();

                this.Close();
            }
            catch (Exception ex)
            {
                this.ShowMessageAsync("Download/Parsing error", $"Reason: {ex.Message}");
            }
        }
예제 #2
0
        private void LoadNativesFromFileBtn_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = false;
            openFileDialog.Filter      = "NativeDB reference (reference.html)|reference.html|NativeDB zipped reference (reference.zip)|reference.zip|All files (*.*)|*.*";

            if (openFileDialog.ShowDialog() == true)
            {
                try
                {
                    var ext = System.IO.Path.GetExtension(openFileDialog.FileName);

                    List <GTAVNative> natives = null;

                    // TODO load this assync (proggress bar etc)
                    if (ext == ".html" || ext == ".htm")
                    {
                        natives = HTMLNativeParser.ParseLocalHtmlFile(openFileDialog.FileName);
                    }
                    else if (ext == ".zip")
                    {
                        natives = HTMLNativeParser.ParseZippedLocalHtmlFile(openFileDialog.FileName);
                    }
                    else
                    {
                        throw new ArgumentException($"Unknown file extension {ext}");
                    }


                    var window = new MainWindow(natives);
                    window.Show();

                    this.Close();
                }
                catch (Exception ex)
                {
                    this.ShowMessageAsync("Parsing error", $"Reason: {ex.Message}");
                }
            }
        }