Ejemplo n.º 1
0
        public FPreferences(CSettings settings)
        {
            m_settings = settings;
            InitializeComponent();

            tbxDefaultNodeName.Text = m_settings.Attributes["[Default]"]["DEFAULTNODENAME"];
            tbxDefaultFilename.Text = m_settings.Attributes["[Default]"]["DEFAULTFILENAME"];
            tbxOutputFolder.Text = m_settings.Attributes["[Default]"]["OUTPUTFOLDER"];
        }
Ejemplo n.º 2
0
 public void Initialize(GraphControl ctrl, CLog log)
 {
     m_graphCtrl = ctrl;
     m_log = log;
     String homeFolder = @Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
     m_iniPath = homeFolder + @"\Roostertail Games\T3DConvoEditor\";
     String iniFile = m_iniPath + "TSWriterPlugin.ini";
     m_log.WriteLine("Attempting to load " + iniFile);
     if (File.Exists(iniFile))
         m_settings = new CSettings(m_iniPath + "TSWriterPlugin.ini");
     else
     {
         m_iniPath = Path.GetFullPath(".\\");
         iniFile = m_iniPath + @"Plugins\TSWriterPlugin.ini";
         m_log.WriteLine("Attempting to load " + iniFile);
         m_settings = new CSettings(iniFile);
     }
     if (!m_settings.LoadSettings())
         m_log.WriteLine("Failed to locate TSWriterPlugin.ini");
     else
         m_log.WriteLine("TSWriterPlugin settings loaded");
 }
Ejemplo n.º 3
0
 public CTorquescriptWriter(CLog log, CSettings settings)
 {
     m_log = log;
     m_settings = settings;
 }
Ejemplo n.º 4
0
 private void preferencesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     m_preferences.ShowDialog();
     String defFileName = m_settings.Attributes["[Default]"]["DEFAULTFILENAME"];
     tbxConvoName.Text = defFileName.Remove(defFileName.LastIndexOf('.'));
     m_settings = m_preferences.Settings;
 }
Ejemplo n.º 5
0
        public void Initialize()
        {
            String homeFolder = @Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            m_saveDefaultPath = homeFolder + @"\Roostertail Games\T3DConvoEditor\";
            m_dirty = false;
            m_log = new CLog();
            m_log.Filename = m_saveDefaultPath + "T3DConvoEditor.log";
            m_personalPath = Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.Personal)) + @"\Roostertail Games\T3DConvoEditor\"; ;
            m_log.WriteLine("Checking for settings file in " + m_personalPath);
            if (File.Exists(m_personalPath + "T3DConvoEditor.ini"))
            {
                m_log.WriteLine("Opening settings from " + m_personalPath);
                m_settings = new CSettings(m_personalPath + "T3DConvoEditor.ini");
            }
            else
            {
                m_log.WriteLine("Opening settings file from application path");
                m_settings = new CSettings("T3DConvoEditor.ini");
            }
            m_settings.LoadSettings();

            m_preferences = new FPreferences(m_settings);
            m_preferences.Settings = m_settings;

            m_nodeEdit = new FNodeEdit();
            m_nodeEdit.Text = "Edit Conversation Selection List";
            m_nodeEdit.MainForm = this;
            m_partEdit = new FConvPartEdit();
            m_plugins = new FPluginPage(m_log);
            m_log.WriteLine("T3D Conversation Editor started");

            if (!Directory.Exists(m_saveDefaultPath))
                Directory.CreateDirectory(m_saveDefaultPath);
            sfdSaveGraphFile.InitialDirectory = m_saveDefaultPath;
            ofdOpenFile.InitialDirectory = m_saveDefaultPath;

            String defFileName = m_settings.Attributes["[Default]"]["DEFAULTFILENAME"];
            tbxConvoName.Text = defFileName.Remove(defFileName.LastIndexOf('.'));

            graphCtrl.NodeAdded += new EventHandler<AcceptNodeEventArgs>(onNodeAdded);
            int width = pnlWork.Width - (2 * pnlWork.Margin.All);
            int height = pnlWork.Height - (2 * pnlWork.Margin.All);
            Rectangle graphBounds = new Rectangle(new Point(pnlWork.Margin.All, pnlWork.Margin.All), new Size(width, height));
            pnlGraph.Bounds = graphBounds;
            pnlGraph.Controls.Add(graphCtrl);

            _Plugins = m_plugins.Plugins;
            if (_Plugins.ContainsKey("TSWriterPlugin"))
            {
                IPlugin plugin = _Plugins["TSWriterPlugin"];
                plugin.Initialize(graphCtrl, m_log);
                m_currentPluginSettings = plugin.Settings;
            }
        }
Ejemplo n.º 6
0
        private void loadINI(String filename)
        {
            m_iniFile = new CSettings(filename);
            m_iniFile.LoadSettings();
            tctrlSettings.Controls.Clear();

            var list = m_iniFile.Attributes.Keys.ToList();
            list.Sort();
            foreach (String attrib in list)
            {
                Point topleft = new Point(4, 4);

                if (m_iniFile.Attributes[attrib].Count < 1)
                    continue;
                TabPage page = new TabPage(attrib);
                page.Name = attrib;
                tctrlSettings.TabPages.Add(page);

                Panel panel = new Panel();
                panel.Dock = DockStyle.Fill;
                panel.Name = "pnl" + attrib;
                page.Controls.Add(panel);

                ListBox listbox = new ListBox();
                listbox.Name = "lbx" + attrib;
                listbox.Width = 300;
                listbox.Height = panel.Height - 8;
                panel.Controls.Add(listbox);
                listbox.Location = topleft;
                List<String> boxItems = new List<String>();
                foreach (String setting in m_iniFile.Attributes[attrib].Keys)
                    boxItems.Add(setting);
                boxItems.Sort();
                foreach (String entry in boxItems)
                    listbox.Items.Add(entry);
                listbox.SelectedIndexChanged += listbox_SelectedIndexChanged;

                topleft = new Point(listbox.Right + 4, listbox.Top);

                // examine/edit
                Label lbl = new Label();
                lbl.Name = "lbl" + attrib;
                lbl.Text = "Field Value:";
                lbl.Width = 200;
                lbl.TextAlign = ContentAlignment.MiddleLeft;
                panel.Controls.Add(lbl);
                lbl.Location = topleft;

                topleft.Y += lbl.Height + 4;
                TextBox box = new TextBox();
                box.Width = 300;
                box.Name = "tbx" + attrib;
                panel.Controls.Add(box);
                box.Location = topleft;

                Button btn = new Button();
                topleft.Y = (box.Top - ((btn.Height - box.Height) / 2));
                topleft.X = box.Right + 4;
                btn.Name = "btn" + attrib;
                btn.Text = "Set";
                btn.Click += button_Click;
                panel.Controls.Add(btn);
                btn.Location = topleft;

                // add
                Label lblAdd = new Label();
                lblAdd.Name = "lblAdd" + attrib;
                lblAdd.Text = "Add";
                lblAdd.Width = 200;
                lblAdd.TextAlign = ContentAlignment.MiddleLeft;
                panel.Controls.Add(lblAdd);
                topleft.X = lbl.Left;
                topleft.Y = box.Top + box.Height + 4;
                lblAdd.Location = topleft;

                topleft.Y += lblAdd.Height + 4;
                TextBox boxAddName = new TextBox();
                boxAddName.Width = 200;
                boxAddName.Name = "tbxAdd" + attrib + "Name";
                panel.Controls.Add(boxAddName);
                boxAddName.Location = topleft;

                topleft.X += boxAddName.Width + 4;
                TextBox boxAddVal = new TextBox();
                boxAddVal.Width = 96;
                boxAddVal.Name = "tbxAdd" + attrib + "Value";
                panel.Controls.Add(boxAddVal);
                boxAddVal.Location = topleft;

                Button btnAdd = new Button();
                topleft.Y = (boxAddName.Top - ((btnAdd.Height - boxAddName.Height) / 2));
                topleft.X = boxAddVal.Right + 4;
                btnAdd.Name = "btnAdd" + attrib;
                btnAdd.Text = "Add";
                btnAdd.Click += button_AddClick;
                panel.Controls.Add(btnAdd);
                btnAdd.Location = topleft;

                m_selectedTabIndex = tctrlSettings.SelectedIndex;
            }
        }
Ejemplo n.º 7
0
 public bool Load()
 {
     bool success = true;
     if (File.Exists("Tables\\parentStatus.txt"))
     {
         m_parents = new CSettings("Tables\\parentStatus.txt");
         if (!m_parents.LoadSettings())
         {
             MessageBox.Show("Unable to load parent status tables.");
             success = false;
         }
     }
     if (File.Exists("Tables\\familyBackground.txt"))
     {
         m_family = new CSettings("Tables\\familyBackground.txt");
         if (!m_family.LoadSettings())
         {
             MessageBox.Show("Unable to load family background tables.");
             success = false;
         }
     }
     if (File.Exists("Tables\\friendsAndEnemies.txt"))
     {
         m_friends = new CSettings("Tables\\friendsAndEnemies.txt");
         if (!m_friends.LoadSettings())
         {
             MessageBox.Show("Unable to load friends and enemies tables.");
             success = false;
         }
     }
     if (File.Exists("Tables\\romanticLife.txt"))
     {
         m_romance = new CSettings("Tables\\romanticLife.txt");
         if (!m_romance.LoadSettings())
         {
             MessageBox.Show("Unable to load romance tables.");
             success = false;
         }
     }
     extractTables();
     return success;
 }