示例#1
0
        //Load settings from batch.xml
        private void ClientWindow_Initialized(object sender, EventArgs e)
        {
            using (var fstream = new FileStream("batch.xml", FileMode.Open, FileAccess.Read))
            {
                var xmlSettings = new XmlReaderSettings {IgnoreWhitespace = true};
                using (var reader = XmlReader.Create(fstream, xmlSettings))
                {
                    var xmlFile = new BatchConversionXml {ParentWindow = this};
                    xmlFile.ReadXml(reader);

                    _allFiles = xmlFile.FileDescs;

                    foreach (var file in _allFiles)
                        ListBoxAllFiles.Items.Add(file.Key);

                    TxtOutDir.Text = xmlFile.OutputDir;
                }
            }
        }
示例#2
0
        //Build batch.xml and launch the backend
        private void BtnConvert_Click(object sender, RoutedEventArgs e)
        {
            if (_allFiles.Count == 0)
            {
                MessageBox.Show(this, "Add .fbx files to serialize first.",
                                "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
            if (TxtOutDir.Text == "")
            {
                MessageBox.Show(this, "Please provide an output directory.",
                                "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
            //Save settings to batch.xml
            using (var fstream = new FileStream("batch.xml", FileMode.Create))
            {
                using (var writer = XmlWriter.Create(fstream))
                {
                    var xmlFile = new BatchConversionXml
                        {
                            FileDescs = _allFiles,
                            OutputDir = TxtOutDir.Text,
                            ParentWindow = this
                        };
                    xmlFile.WriteXml(writer);
                }
            }

            //Run the backend
            System.Diagnostics.Process.Start("TTconverterBackend.exe");
        }