Esempio n. 1
0
        private void btnImportEagle_Click(object sender, EventArgs e)
        {
            //
            // GenTestData.GenerateData();

            //
            AppSettings.SourceFilename = textBoxSource.Text;
            AppSettings.DestFolder     = textBoxDest.Text;
            SaveAppSettings();

            if (Directory.Exists(AppSettings.DestFolder))
            {
                bool is_empty = false;

                string[] Files = Directory.GetFiles(AppSettings.DestFolder);

                if (Files.Length == 0)
                {
                    string[] folders = Directory.GetDirectories(AppSettings.DestFolder);
                    if (folders.Length == 0)
                    {
                        is_empty = true;
                    }
                }

                if (!is_empty)
                {
                    DialogResult res = MessageBox.Show("Warning - Destination folder is not empty, files will be overwritten!" + Environment.NewLine + Environment.NewLine +
                                                       "Continue ?",
                                                       "Overwrite check",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation
                                                       );

                    if (res != DialogResult.Yes)
                    {
                        return;
                    }
                }
            }
            else
            {
                AppSettingsBase.CreateDirectory(AppSettings.DestFolder);
            }

            ProjectConverter converter = new ProjectConverter();
            //if (converter.CheckValid(textBoxSource.Text))
            {
                converter.OnTrace += Trace;
                converter.ConvertProject(textBoxSource.Text, textBoxDest.Text);
            }
        }
Esempio n. 2
0
        private static bool ConvertToKicad()
        {
            AppSettings.SourceFilename = SourceFilename;
            AppSettings.DestFolder     = DestFolder;

            if (Directory.Exists(AppSettings.DestFolder))
            {
                if (!overwrite)
                {
                    bool is_empty = false;

                    string[] Files = Directory.GetFiles(AppSettings.DestFolder);

                    if (Files.Length == 0)
                    {
                        string[] folders = Directory.GetDirectories(AppSettings.DestFolder);
                        if (folders.Length == 0)
                        {
                            is_empty = true;
                        }
                    }

                    if (!is_empty)
                    {
                        Trace("error: Destination folder is not empty, specify -overwrite option");
                        Usage();
                        return(false);
                    }
                }
            }
            else
            {
                AppSettingsBase.CreateDirectory(AppSettings.DestFolder);
            }

            ProjectConverter converter = new ProjectConverter();

            //if (converter.CheckValid(textBoxSource.Text))
            {
                converter.OnTrace += Trace;
                converter.ConvertProject(SourceFilename, DestFolder);
            }

            return(true);
        }