Ejemplo n.º 1
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.º 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;
            }
        }