コード例 #1
0
        /// <summary>
        /// If "Go!" is pressed, start processing the input to the output.
        /// </summary>
        /// <param name="sender">The invoker object.</param>
        /// <param name="e">Event parameters.</param>
        private void gobutton_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            XmlDocument partsxml = new XmlDocument();

            progress(0, "");
            try
            {
                progress(10, "Started...");

                Unzip  z     = new Unzip(lxfName.Text);
                String lxfml = z.GetLXFML();

                progress(10, "LXFML unzipped. ");

                PartsReader pr = new PartsReader(lxfml);

                progress(20, "LXFML loaded. ");

                SortedDictionary <int, Brick> partslist = pr.Extract();

                progress(20, "LXFML extracted. ");

                XMLCreator xc = new XMLCreator(partslist);
                partsxml = xc.GetXML();

                progress(20, "XML generated. ");

                z = null;
                if (!FileTypes.Save(partsxml, saveName.Text, outputType.SelectedIndex))
                {
                    progress(20, "Can't save the output. Sorry. Maybe I can't write there? ");
                }
                else
                {
                    progress(20, "Output formatted and saved. Done. ");
                }
            }
            catch (Exception ex)
            {
                progressText.Text += ex.Message;
            }
            Cursor.Current = Cursors.Arrow;
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender">The invoker object.</param>
        /// <param name="e">Event parameters.</param>
        private void savebutton_Click(object sender, EventArgs e)
        {
            if (saveName.Text.Trim().Length == 0)
            {
                saveDialog.FileName = Path.GetFileNameWithoutExtension(lxfName.Text).Trim();
            }

            saveDialog.Filter = FileTypes.GetByID(outputType.SelectedIndex).GetDescription() + "|*." + FileTypes.GetByID(outputType.SelectedIndex).GetExtension();

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                saveName.Text    = saveDialog.FileName;
                goButton.Enabled = true;
            }
        }
コード例 #3
0
        /// <summary>
        /// If the output type is changed, change the savename's extension.
        /// </summary>
        /// <param name="sender">The invoker object.</param>
        /// <param name="e">Event parameters.</param>
        private void outputtype_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (outputType.SelectedIndex != -1)
            {
                saveButton.Enabled = true;
                saveName.Enabled   = true;

                if (saveName.Text.Length > 4)
                {
                    saveName.Text = saveName.Text.Remove(saveName.Text.LastIndexOf('.') + 1) + FileTypes.GetByID(outputType.SelectedIndex).GetExtension();
                }
            }
        }
コード例 #4
0
ファイル: FileTypes.cs プロジェクト: Jeremy1980/LDDPartList
 /// <summary>
 /// Returns if the given Filetype can work from XML.
 /// </summary>
 /// <param name="ft">The filetype under questioning</param>
 /// <returns>Can you transform to this by XSL from XML? If yes, then true.</returns>
 public static bool IsXSLTEnabled(FileTypes ft)
 {
     return(false);
 }
コード例 #5
0
ファイル: FileTypes.cs プロジェクト: Jeremy1980/LDDPartList
 /// <summary>
 /// Call the Save method for the specified handler.
 /// </summary>
 /// <param name="xml">The XmlDocument to save by the handler.</param>
 /// <param name="filename">Absolute path of a file.</param>
 /// <param name="typeID">The filetype reference ID.</param>
 /// <returns>Success?</returns>
 public static bool Save(XmlDocument xml, string filename, int typeID)
 {
     return(FileTypes.GetByID(typeID).Save(xml, filename));
 }