Ejemplo n.º 1
0
        public FormLST(ppxEditor editor, string lstParserVar)
        {
            try
            {
                InitializeComponent();

                lstParser parser = (lstParser)Gui.Scripting.Variables[lstParserVar];

                this.ShowHint    = DockState.Document;
                this.Text        = parser.Name;
                this.ToolTipText = editor.Archive.Filename + @"\" + parser.Name;

                ParserVar = lstParserVar;

                checkBoxWordWrap.Checked = syntaxHighlightingTextBoxLSTContents.WordWrap;
                syntaxHighlightingTextBoxLSTContents.ScrollBars = RichTextBoxScrollBars.Both & RichTextBoxScrollBars.ForcedBoth;

                syntaxHighlightingTextBoxLSTContents.Seperators.Add('\t');
                syntaxHighlightingTextBoxLSTContents.HighlightDescriptors.Add(new HighlightDescriptor("//", Color.DimGray, null, DescriptorType.ToEOL, DescriptorRecognition.StartsWith, false));

                syntaxHighlightingTextBoxLSTContents.InitText(parser.Text);
                syntaxHighlightingTextBoxLSTContents.TextChanged += new EventHandler(syntaxHighlightingTextBoxLSTContents_TextChanged);

                syntaxHighlightingTextBoxLSTContents.DragDrop          += new DragEventHandler(syntaxHighlightingTextBoxLSTContents_DragDrop);
                syntaxHighlightingTextBoxLSTContents.EnableAutoDragDrop = true;

                buttonApplyCheck.Enabled = false;

                Gui.Docking.ShowDockContent(this, Gui.Docking.DockEditors, ContentCategory.Others);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 2
0
        private void reopenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string opensFileVar = Gui.Scripting.GetNextVariable("opensPP");
                Gui.Scripting.RunScript(opensFileVar + " = FormPP(path=\"" + Editor.Parser.FilePath + "\", variable=\"" + opensFileVar + "\")", false);

                List <DockContent> formPPList;
                if (Gui.Docking.DockContents.TryGetValue(typeof(FormPP), out formPPList))
                {
                    var listCopy = new List <FormPP>(formPPList.Count);
                    for (int i = 0; i < formPPList.Count; i++)
                    {
                        listCopy.Add((FormPP)formPPList[i]);
                    }

                    foreach (var form in listCopy)
                    {
                        if (form.FormVariable == FormVariable)
                        {
                            form.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 3
0
        private void buttonRevert_Click(object sender, EventArgs e)
        {
            try
            {
                if (!edited)
                {
                    return;
                }

                lstParser parser = (lstParser)Gui.Scripting.Variables[ParserVar];

                syntaxHighlightingTextBoxLSTContents.TextChanged -= new EventHandler(syntaxHighlightingTextBoxLSTContents_TextChanged);
                syntaxHighlightingTextBoxLSTContents.Text         = String.Empty;
                syntaxHighlightingTextBoxLSTContents.AppendText(parser.Text);
                syntaxHighlightingTextBoxLSTContents.SelectionStart = 0;
                syntaxHighlightingTextBoxLSTContents.TextChanged   += new EventHandler(syntaxHighlightingTextBoxLSTContents_TextChanged);

                edited = false;
                buttonApplyCheck.Enabled = false;
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 4
0
        private void imageSubfilesList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            try
            {
                if (e.IsSelected)
                {
                    IReadFile       subfile = (IReadFile)e.Item.Tag;
                    ImportedTexture image;
                    string          stream = EditorVar + ".ReadSubfile(name=\"" + subfile.Name + "\")";

                    if (Path.GetExtension(subfile.Name).ToLowerInvariant() == ".ema")
                    {
                        image = (ImportedTexture)Gui.Scripting.RunScript(Gui.ImageControl.ImageScriptVariable + " = ImportEmaTexture(stream=" + stream + ", name=\"" + subfile.Name + "\")");
                    }
                    else
                    {
                        image = (ImportedTexture)Gui.Scripting.RunScript(Gui.ImageControl.ImageScriptVariable + " = ImportTexture(stream=" + stream + ", name=\"" + subfile.Name + "\")");
                    }

                    Gui.ImageControl.Image = image;
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 5
0
 private void soundSubfilesList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     try
     {
         if (!soundLib.isLoaded())
         {
             return;
         }
         if (e.IsSelected)
         {
             IReadFile subfile = (IReadFile)e.Item.Tag;
             Stream    stream  = (Stream)Gui.Scripting.RunScript(EditorVar + ".ReadSubfile(name=\"" + subfile.Name + "\")", false);
             byte[]    soundBuf;
             using (BinaryReader reader = new BinaryReader(stream))
             {
                 soundBuf = reader.ReadToEnd();
             }
             soundLib.Play(e.Item.Text, soundBuf);
         }
         else
         {
             soundLib.Stop(e.Item.Text);
         }
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 6
0
        void content_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                DockContent dock = (DockContent)sender;
                dock.FormClosing -= new FormClosingEventHandler(content_FormClosing);

                List <DockContent> typeList = DockContents[dock.GetType()];
                typeList.Remove(dock);

                var handler = DockContentRemoved;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(dock));
                }

                if (dock.Pane.Contents.Count == 2)
                {
                    if (viewFilesToolStripMenuItem.Checked && (dock.Pane == DockFiles.Pane))
                    {
                        DockFiles.Show();
                    }
                    else if (viewEditorsToolStripMenuItem.Checked && (dock.Pane == DockEditors.Pane))
                    {
                        DockEditors.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 7
0
        private void ChildForms_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                DockContent form = (DockContent)sender;
                form.FormClosing -= new FormClosingEventHandler(ChildForms_FormClosing);

                List <TreeNode> treeNodes = null;
                if (ChildForms.TryGetValue(form, out treeNodes))
                {
                    foreach (TreeNode node in treeNodes)
                    {
                        TreeNode parent = node.Parent;
                        node.Remove();
                        if (logMessagesToolStripMenuItem.Checked)
                        {
                            Report.ReportLog("Removed from Workspace: " + form.ToolTipText + " -> " + node.Text);
                        }
                        if (parent.Nodes.Count == 0)
                        {
                            parent.Remove();
                        }
                    }
                    ChildForms.Remove(form);
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 8
0
        private void FormPP_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                foreach (ListViewItem item in soundSubfilesList.SelectedItems)
                {
                    item.Selected = false;
                }

                foreach (var pair in ChildForms)
                {
                    if (pair.Value.IsHidden)
                    {
                        pair.Value.Show();
                    }

                    pair.Value.FormClosing -= new FormClosingEventHandler(ChildForms_FormClosing);
                    pair.Value.Close();
                }
                ChildForms.Clear();
                foreach (var parserVar in ChildParserVars.Values)
                {
                    Gui.Scripting.Variables.Remove(parserVar);
                }
                ChildParserVars.Clear();
                Gui.Scripting.Variables.Remove(FormVariable);
                Gui.Scripting.Variables.Remove(EditorVar);
                Gui.Scripting.Variables.Remove(ParserVar);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 9
0
 public void DockDragDrop(object sender, DragEventArgs e)
 {
     try
     {
         string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];
         if (files != null)
         {
             foreach (string path in files)
             {
                 if (File.Exists(path))
                 {
                     OpenFile(path);
                 }
                 else if (Directory.Exists(path))
                 {
                     OpenDirectory(path);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 10
0
        void InitAutosave()
        {
            try
            {
                string     path = null;
                FileStream fs   = null;
                for (int i = 0; i < 10 && fs == null; i++)
                {
                    path = Assembly.GetExecutingAssembly().Location;
                    path = Path.GetDirectoryName(path) + @"\" + Path.GetFileNameWithoutExtension(path)
                           + (i == 0 ? ".autosavescript.txt" : ".session" + i + ".txt");
                    try
                    {
                        fs = File.Open(path, FileMode.Append, FileAccess.Write, FileShare.Read);
                    }
                    catch {}
                }

                autosaveScriptWriter           = new StreamWriter(fs, Encoding.UTF8);
                autosaveScriptWriter.AutoFlush = true;
                autosaveScriptWriter.WriteLine("; start session" +
                                               " [" + DateTime.Today.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "] ");

                Report.ReportLog("Autosaving script to " + path);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 11
0
        private void treeView_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                TreeNode node = (TreeNode)e.Data.GetData(typeof(TreeNode));
                if (node == null)
                {
                    Gui.Docking.DockDragDrop(sender, e);
                }
                else
                {
                    if (node.TreeView != treeView)
                    {
                        if (FormVar == null && scriptingToolStripMenuItem.Checked)
                        {
                            FormVar = Gui.Scripting.GetNextVariable("workspace");
                            Gui.Scripting.RunScript(FormVar + " = SearchWorkspace(formVar=\"" + FormVar + "\")");
                        }

                        treeViewDragDrop(sender, e);
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 12
0
        public static void LoadPlugin(string path)
        {
            try
            {
                FileInfo file = new FileInfo(path);
                if (!file.Exists)
                {
                    Report.ReportLog("File doesn't exist: " + path);
                    return;
                }

                if (DoNotLoad.Contains(file.Name.ToLowerInvariant()))
                {
                    return;
                }

                var assembly = Assembly.LoadFrom(file.FullName);
                RegisterFunctions(assembly);
            }
            catch (Exception ex)
            {
                Report.ReportLog("Failed to load plugin " + path);
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 13
0
        private void treeView_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                TreeNode node = (TreeNode)e.Data.GetData(typeof(TreeNode));
                if (node == null)
                {
                    Gui.Docking.DockDragDrop(sender, e);
                }
                else
                {
                    if (node.TreeView != treeView)
                    {
                        DragSource?source = node.Tag as DragSource?;
                        if (source != null)
                        {
                            TreeNode clone = (TreeNode)node.Clone();
                            clone.Checked = true;

                            TreeNode type = null;
                            foreach (TreeNode root in treeView.Nodes)
                            {
                                if (root.Text == source.Value.Type.Name)
                                {
                                    type = root;
                                    break;
                                }
                            }

                            if (type == null)
                            {
                                type         = new TreeNode(source.Value.Type.Name);
                                type.Checked = true;
                                treeView.AddChild(type);
                            }

                            treeView.AddChild(type, clone);
                        }

                        foreach (TreeNode root in treeView.Nodes)
                        {
                            root.Expand();
                        }
                        if (treeView.Nodes.Count > 0)
                        {
                            treeView.Nodes[0].EnsureVisible();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 14
0
        public void ShowDockContent(DockContent content, DockContent defaultDock, ContentCategory category)
        {
            try
            {
                content.FormClosed += content_FormClosed;

                List <DockContent> typeList;
                Type type = content.GetType();
                if (!DockContents.TryGetValue(type, out typeList))
                {
                    typeList = new List <DockContent>();
                    DockContents.Add(type, typeList);
                }
                typeList.Add(content);

                var handler = DockContentAdded;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(content));
                }

                if (defaultDock == null)
                {
                    content.Show(this.dockPanel, DockState.Float);
                }
                else
                {
                    content.Show(defaultDock.Pane, null);

                    if (((defaultDock == DockFiles) || (defaultDock == DockEditors)) && !defaultDock.IsHidden)
                    {
                        defaultDock.Hide();
                    }
                }
                SetDocking(content, dockingToolStripMenuItem.Checked);

                if (category != ContentCategory.None)
                {
                    ((FormQuickAccess)DockQuickAccess).RegisterOpenFile(content, category);
                }

                foreach (Control c in content.Controls)
                {
                    if (c is MenuStrip)
                    {
                        MenuStrip ms = (MenuStrip)c;
                        InstallStatusLineHandler(ms.Items);
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 15
0
		static void Server(object commandLineArgs)
		{
			try
			{
				bool keepRunning = true;
				bool readyToServe = false;
				while (keepRunning)
				{
					using (serverStream = new NamedPipeServerStream(pipeName, PipeDirection.In, 1))
					{
						serverStream.WaitForConnection();

						using (StreamReader reader = new StreamReader(serverStream))
						{
							string command;
							while ((command = reader.ReadLine()) != null)
							{
								if (command == "Shutdown")
								{
									keepRunning = false;
									break;
								}
								else if (command == "Ready To Serve")
								{
									readyToServe = true;

									if (string.Compare(((string[])commandLineArgs)[0], "/OpenWithGUI", true) == 0)
									{
										string[] newArgs = new string[((string[])commandLineArgs).Length - 1];
										for (int i = 0; i < newArgs.Length; i++)
										{
											newArgs[i] = ((string[])commandLineArgs)[i + 1];
										}
										commandLineArgs = newArgs;

										keepRunning = false;
									}
									Gui.Docking.DockDragDrop((string[])commandLineArgs);
								}
								else if (readyToServe && command.StartsWith("Open "))
								{
									string[] args = new string[] { command.Substring(5) };
									Gui.Docking.DockDragDrop(args);
								}
							}
						}
					}
					serverStream = null;
				}
			}
			catch (Exception ex)
			{
				Utility.ReportException(ex);
			}
		}
Ejemplo n.º 16
0
 private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         this.Close();
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 17
0
 private void xaSubfilesList_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         OpenXASubfilesList();
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 18
0
 void MDIParent_Status(string s)
 {
     try
     {
         statusStrip.Text = s;
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 19
0
 private void toolStripEditTextBoxListViews_AfterEditTextChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["ListViewFontSize"] = Single.Parse(toolStripEditTextBoxListViews.Text);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 20
0
 private void toolStripEditTextBoxSwapThesholdMB_AfterEditTextChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["PrivateMemSwapThresholdMB"] = long.Parse(toolStripEditTextBoxSwapThesholdMB.Text);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 21
0
 void toolStripEditTextBoxMQOImportVertexScaling_AfterEditTextChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["MQOImportVertexScaling"] = Single.Parse(toolStripEditTextBoxMQOImportVertexScaling.Text);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 22
0
 private void comboBoxFormat_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Gui.Scripting.RunScript(EditorVar + ".SetFormat(" + (int)((ppFormat)comboBoxFormat.SelectedItem).ppFormatIdx + ")");
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 23
0
 private void negateQuaternionFlipsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["FbxImportAnimationNegateQuaternionFlips"] = negateQuaternionFlipsToolStripMenuItem.Checked;
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 24
0
 private void averageNormalsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["FbxImportAverageNormals"] = averageNormalsToolStripMenuItem.Checked;
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 25
0
 private void toolStripEditTextBoxFilterPrecision_AfterEditTextChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["FbxExportAnimationFilterPrecision"] = Single.Parse(toolStripEditTextBoxFilterPrecision.Text);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 26
0
 private void eulerFilterToolStripMenuItem_CheckChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["FbxExportAnimationEulerFilter"] = eulerFilterToolStripMenuItem.Checked;
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 27
0
 void panel1_Resize(object sender, EventArgs e)
 {
     try
     {
         ResizeImage();
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 28
0
 void forceTypeSampledToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         Properties.Settings.Default["FbxImportAnimationForceTypeSampled"] = forceTypeSampledToolStripMenuItem.Checked;
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 29
0
 void viewScriptToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         SetDockPaneVisible(DockScript, viewScriptToolStripMenuItem);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Ejemplo n.º 30
0
 private void treeView_DragOver(object sender, DragEventArgs e)
 {
     try
     {
         UpdateDragStatus(sender, e);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }