예제 #1
0
파일: Form1.cs 프로젝트: John3/T3DConvoEdit
        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;
            }
        }
예제 #2
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;
            }
        }