annotate Form1.cs @ 0:8439bec53421

Initial commit under the GPLv3
author IBBoard <dev@ibboard.co.uk>
date Sat, 06 Oct 2018 20:00:56 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 using System;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 using System.Drawing;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 using System.Collections;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using System.ComponentModel;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System.Windows.Forms;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using System.Data;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.Relic.RelicTools;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.Relic.RelicTools.Exceptions;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using System.Threading;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 using System.IO;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 namespace IBBoard.Relic.IChunkyViewer
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 /// <summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 /// Summary description for Form1.
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 /// </summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 public class Form1 : System.Windows.Forms.Form
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 private System.Windows.Forms.MainMenu mainMenu;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 private System.Windows.Forms.MenuItem menuItem1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 private System.Windows.Forms.MenuItem miFile_Open;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 private System.Windows.Forms.OpenFileDialog openFileDialog;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 private System.ComponentModel.IContainer components;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 private System.Windows.Forms.TreeView treeView;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 private System.Windows.Forms.TextBox txtDetails;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 private System.Windows.Forms.ImageList imageList;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 private System.Windows.Forms.ContextMenu contextMenu;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 private System.Windows.Forms.MenuItem miSaveChunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 private System.Windows.Forms.SaveFileDialog saveFileDialog;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 private System.Windows.Forms.MenuItem menuItem2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 private System.Windows.Forms.MenuItem menuItem3;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 private System.Windows.Forms.MenuItem menuItem4;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 private RelicChunkyFile chunkyFile;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 private string chunkyFilePath = "";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 private string chunkyFileNewPath = "";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 private System.Windows.Forms.MenuItem menuItem5;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 private System.Windows.Forms.StatusBar statusBar;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 private System.Windows.Forms.Timer timer;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 private System.Windows.Forms.MenuItem menuItem6;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 private System.Windows.Forms.MenuItem menuItem8;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 private System.Windows.Forms.MenuItem miExportChunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 private System.Windows.Forms.MenuItem miImportChunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 private System.Windows.Forms.SaveFileDialog exportFileDialog;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 private System.Windows.Forms.OpenFileDialog importFileDialog;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49 private System.Windows.Forms.MenuItem miImportSiblingChunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 private System.Windows.Forms.MenuItem menuItem9;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 private System.Windows.Forms.MenuItem miSave;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 private System.Windows.Forms.MenuItem menuItem11;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 private System.Windows.Forms.MenuItem menuItem10;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 private System.Windows.Forms.MenuItem miDeleteChunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 private System.Windows.Forms.MenuItem miOptions;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 private System.Windows.Forms.MenuItem menuItem7;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 private System.Windows.Forms.MenuItem miShowValidationString;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 private System.Windows.Forms.MenuItem menuItem16;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 private System.Windows.Forms.MenuItem miRefreshValidations;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 private ChunkyValidator[] chunkyValidators;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 private System.Windows.Forms.MenuItem miValidateAs;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 private System.Windows.Forms.MenuItem miNoValidators;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 private Preferences preferences;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 private Progress progress = null;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 private Form1()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 { //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 // Required for Windows Form Designer support
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 InitializeComponent();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73 preferences = new Preferences("IChunkyViewer");
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 openFileDialog.InitialDirectory = preferences["DoWPath"].ToString();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 public Form1(string path): this()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 if (path!=null && path.Trim()!="")
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 chunkyFileNewPath = path;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 Thread thr = new Thread(new ThreadStart(openChunkyFile));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 thr.Start();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88 private void Form1_Load(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 readInValidators();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 /// <summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 /// Clean up any resources being used.
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95 /// </summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 protected override void Dispose( bool disposing )
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98 if( disposing )
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100 if (components != null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 components.Dispose();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105 base.Dispose( disposing );
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108 #region Windows Form Designer generated code
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 /// <summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110 /// Required method for Designer support - do not modify
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 /// the contents of this method with the code editor.
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112 /// </summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 private void InitializeComponent()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115 this.components = new System.ComponentModel.Container();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 this.treeView = new System.Windows.Forms.TreeView();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 this.contextMenu = new System.Windows.Forms.ContextMenu();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119 this.miSaveChunk = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
120 this.miExportChunk = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121 this.menuItem8 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122 this.miImportChunk = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 this.miImportSiblingChunk = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 this.menuItem10 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125 this.miDeleteChunk = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126 this.imageList = new System.Windows.Forms.ImageList(this.components);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 this.mainMenu = new System.Windows.Forms.MainMenu();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 this.menuItem1 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 this.miFile_Open = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 this.menuItem5 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131 this.menuItem9 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
132 this.miSave = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
133 this.menuItem11 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 this.menuItem4 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
135 this.menuItem6 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 this.miOptions = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137 this.menuItem7 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138 this.miShowValidationString = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 this.miValidateAs = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140 this.miNoValidators = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 this.menuItem16 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142 this.miRefreshValidations = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 this.menuItem2 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144 this.menuItem3 = new System.Windows.Forms.MenuItem();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 this.txtDetails = new System.Windows.Forms.TextBox();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146 this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
147 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
148 this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 this.statusBar = new System.Windows.Forms.StatusBar();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
150 this.timer = new System.Windows.Forms.Timer(this.components);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
151 this.exportFileDialog = new System.Windows.Forms.SaveFileDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
152 this.importFileDialog = new System.Windows.Forms.OpenFileDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 this.SuspendLayout();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
154 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 // treeView
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
158 | System.Windows.Forms.AnchorStyles.Left)));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
159 this.treeView.ContextMenu = this.contextMenu;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
160 this.treeView.ImageList = this.imageList;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
161 this.treeView.Location = new System.Drawing.Point(0, 0);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
162 this.treeView.Name = "treeView";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
163 this.treeView.SelectedImageIndex = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
164 this.treeView.Size = new System.Drawing.Size(344, 520);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
165 this.treeView.TabIndex = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
166 this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
167 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
168 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
169 // contextMenu
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
170 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
171 this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
172 this.miSaveChunk,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
173 this.miExportChunk,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
174 this.menuItem8,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
175 this.miImportChunk,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
176 this.miImportSiblingChunk,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
177 this.menuItem10,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178 this.miDeleteChunk});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179 this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
181 // miSaveChunk
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
182 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
183 this.miSaveChunk.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
184 this.miSaveChunk.Text = "&Save chunk to location";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
185 this.miSaveChunk.Click += new System.EventHandler(this.miSaveChunk_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
186 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
187 // miExportChunk
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
188 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
189 this.miExportChunk.Index = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
190 this.miExportChunk.Text = "&Export chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
191 this.miExportChunk.Click += new System.EventHandler(this.miExportChunk_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
192 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
193 // menuItem8
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
194 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
195 this.menuItem8.Index = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
196 this.menuItem8.Text = "-";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
197 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
198 // miImportChunk
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
199 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
200 this.miImportChunk.Index = 3;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
201 this.miImportChunk.Text = "&Import child chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
202 this.miImportChunk.Click += new System.EventHandler(this.miImportChunk_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
203 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
204 // miImportSiblingChunk
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
205 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
206 this.miImportSiblingChunk.Index = 4;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
207 this.miImportSiblingChunk.Text = "I&mport sibling chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
208 this.miImportSiblingChunk.Click += new System.EventHandler(this.miImportSiblingChunk_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
209 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
210 // menuItem10
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
211 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
212 this.menuItem10.Index = 5;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
213 this.menuItem10.Text = "-";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
214 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
215 // miDeleteChunk
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
216 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
217 this.miDeleteChunk.Index = 6;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
218 this.miDeleteChunk.Text = "&Delete chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
219 this.miDeleteChunk.Click += new System.EventHandler(this.miDeleteChunk_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
220 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
221 // imageList
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
222 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
223 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
224 this.imageList.ImageSize = new System.Drawing.Size(16, 16);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
225 this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
226 this.imageList.TransparentColor = System.Drawing.Color.Transparent;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
227 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
228 // mainMenu
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
229 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
230 this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
231 this.menuItem1,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
232 this.menuItem6,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
233 this.menuItem7,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
234 this.menuItem2});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
235 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
236 // menuItem1
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
237 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
238 this.menuItem1.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
239 this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
240 this.miFile_Open,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
241 this.menuItem5,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
242 this.menuItem9,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
243 this.miSave,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
244 this.menuItem11,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
245 this.menuItem4});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
246 this.menuItem1.Text = "&File";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
247 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
248 // miFile_Open
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
249 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
250 this.miFile_Open.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
251 this.miFile_Open.Text = "&Open";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
252 this.miFile_Open.Click += new System.EventHandler(this.miFile_Open_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
253 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
254 // menuItem5
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
255 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
256 this.menuItem5.Index = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
257 this.menuItem5.Text = "O&pen in new window";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
258 this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
259 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
260 // menuItem9
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
261 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
262 this.menuItem9.Index = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
263 this.menuItem9.Text = "-";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
264 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
265 // miSave
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
266 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
267 this.miSave.Enabled = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
268 this.miSave.Index = 3;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
269 this.miSave.Text = "&Save";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
270 this.miSave.Click += new System.EventHandler(this.miSave_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
271 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
272 // menuItem11
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
273 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
274 this.menuItem11.Index = 4;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
275 this.menuItem11.Text = "-";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
276 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
277 // menuItem4
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
278 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
279 this.menuItem4.Index = 5;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
280 this.menuItem4.Text = "&Exit";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
281 this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
282 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
283 // menuItem6
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
284 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
285 this.menuItem6.Index = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
286 this.menuItem6.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
287 this.miOptions});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
288 this.menuItem6.Text = "&Edit";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
289 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
290 // miOptions
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
291 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
292 this.miOptions.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
293 this.miOptions.Text = "&Options";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
294 this.miOptions.Click += new System.EventHandler(this.miOptions_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
295 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
296 // menuItem7
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
297 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
298 this.menuItem7.Index = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
299 this.menuItem7.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
300 this.miShowValidationString,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
301 this.miValidateAs});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
302 this.menuItem7.Text = "&Tools";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
303 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
304 // miShowValidationString
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
305 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
306 this.miShowValidationString.Enabled = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
307 this.miShowValidationString.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
308 this.miShowValidationString.Text = "Vali&dation string";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
309 this.miShowValidationString.Click += new System.EventHandler(this.miShowValidationString_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
310 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
311 // miValidateAs
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
312 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
313 this.miValidateAs.Enabled = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
314 this.miValidateAs.Index = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
315 this.miValidateAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
316 this.miNoValidators,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
317 this.menuItem16,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
318 this.miRefreshValidations});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
319 this.miValidateAs.Text = "&Validate as...";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
320 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
321 // miNoValidators
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
322 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
323 this.miNoValidators.Enabled = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
324 this.miNoValidators.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
325 this.miNoValidators.Text = "No validators";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
326 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
327 // menuItem16
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
328 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
329 this.menuItem16.Index = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
330 this.menuItem16.Text = "-";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
331 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
332 // miRefreshValidations
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
333 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
334 this.miRefreshValidations.Index = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
335 this.miRefreshValidations.Text = "Refresh list";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
336 this.miRefreshValidations.Click += new System.EventHandler(this.miRefreshValidations_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
337 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
338 // menuItem2
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
339 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
340 this.menuItem2.Index = 3;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
341 this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
342 this.menuItem3});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
343 this.menuItem2.Text = "&Help";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
344 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
345 // menuItem3
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
346 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
347 this.menuItem3.Index = 0;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
348 this.menuItem3.Text = "&About";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
349 this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
350 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
351 // txtDetails
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
352 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
353 this.txtDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
354 | System.Windows.Forms.AnchorStyles.Left)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
355 | System.Windows.Forms.AnchorStyles.Right)));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
356 this.txtDetails.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
357 this.txtDetails.Location = new System.Drawing.Point(344, 0);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
358 this.txtDetails.Multiline = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
359 this.txtDetails.Name = "txtDetails";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
360 this.txtDetails.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
361 this.txtDetails.Size = new System.Drawing.Size(392, 520);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
362 this.txtDetails.TabIndex = 1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
363 this.txtDetails.Text = "";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
364 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
365 // statusBar
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
366 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
367 this.statusBar.Location = new System.Drawing.Point(0, 519);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
368 this.statusBar.Name = "statusBar";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
369 this.statusBar.Size = new System.Drawing.Size(736, 22);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
370 this.statusBar.TabIndex = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
371 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
372 // timer
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
373 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
374 this.timer.Interval = 2000;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
375 this.timer.Tick += new System.EventHandler(this.timer_Tick);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
376 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
377 // exportFileDialog
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
378 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
379 this.exportFileDialog.DefaultExt = "chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
380 this.exportFileDialog.Filter = "Relic Chunky Chunks (*.chunk)|*.chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
381 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
382 // importFileDialog
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
383 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
384 this.importFileDialog.Filter = "Relic Chunky Chunks (*.chunk)|*.chunk";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
385 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
386 // Form1
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
387 //
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
388 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
389 this.ClientSize = new System.Drawing.Size(736, 541);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
390 this.Controls.Add(this.statusBar);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
391 this.Controls.Add(this.txtDetails);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
392 this.Controls.Add(this.treeView);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
393 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
394 this.Menu = this.mainMenu;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
395 this.Name = "Form1";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
396 this.Text = "IChunky Viewer";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
397 this.Load += new System.EventHandler(this.Form1_Load);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
398 this.ResumeLayout(false);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
399
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
400 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
401 #endregion
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
402
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
403 /// <summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
404 /// The main entry point for the application.
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
405 /// </summary>
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
406 [STAThread]
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
407 static void Main(string[] args)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
408 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
409 if (args.Length==0)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
410 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
411 Application.EnableVisualStyles();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
412 Application.DoEvents();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
413 Application.Run(new Form1(""));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
414 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
415 else if (args.Length==1 && File.Exists(args[0]))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
416 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
417 Application.EnableVisualStyles();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
418 Application.DoEvents();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
419 Application.Run(new Form1(args[0]));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
420 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
421 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
422 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
423 MessageBox.Show(null, "The file path specified was invalid. Please try again with a correct path.", "Invalid path", MessageBoxButtons.OK, MessageBoxIcon.Error);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
424 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
425 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
426
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
427 private delegate void NoParamDelegate();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
428 private delegate int TreeNodeAddDelegate(TreeNode node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
429 private delegate void TreeNodeAddRangeDelegate(TreeNode[] nodes);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
430
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
431 private void openChunkyFile()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
432 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
433 if (chunkyFileNewPath=="")
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
434 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
435 return;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
436 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
437
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
438 Thread progressThread = null;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
439
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
440 //if (new FileInfo(chunkyFileNewPath).Length>102400)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
441 //{
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
442 // progressThread = new Thread(new ThreadStart(showProgress));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
443 // progressThread.Start();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
444 //}
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
445
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
446 Thread.Sleep(100);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
447
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
448 try{
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
449 RelicChunkyFile newChunkyFile = RelicChunkyReader.ReadChunkyFile(chunkyFileNewPath);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
450 chunkyFile = newChunkyFile; // make sure we don't trash the old value if it fails
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
451 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
452 catch(InvalidFileException)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
453 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
454 if (OnChunkyOpenFailed!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
455 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
456 OnChunkyOpenFailed();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
457 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
458
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
459 MessageBox.Show(this, "The file '"+chunkyFileNewPath+"' was not a valid Relic Chunky file", "Invalid Chunky File", MessageBoxButtons.OK, MessageBoxIcon.Error);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
460
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
461 if (!(progressThread.ThreadState==ThreadState.Aborted || progressThread.ThreadState==ThreadState.AbortRequested
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
462 || progressThread.ThreadState==ThreadState.Stopped || progressThread.ThreadState==ThreadState.StopRequested))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
463 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
464 try
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
465 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
466 progressThread.Abort();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
467 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
468 catch{}
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
469 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
470
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
471 return;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
472 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
473 catch(InvalidChunkException)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
474 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
475 if (OnChunkyOpenFailed!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
476 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
477 OnChunkyOpenFailed();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
478 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
479
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
480 MessageBox.Show(this, "The file '"+chunkyFileNewPath+"' was not a valid Relic Chunky file", "Invalid Chunky Chunk in file", MessageBoxButtons.OK, MessageBoxIcon.Error);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
481
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
482 if (!(progressThread.ThreadState==ThreadState.Aborted || progressThread.ThreadState==ThreadState.AbortRequested
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
483 || progressThread.ThreadState==ThreadState.Stopped || progressThread.ThreadState==ThreadState.StopRequested))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
484 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
485 try
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
486 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
487 progressThread.Abort();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
488 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
489 catch{}
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
490 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
491
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
492 return;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
493 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
494
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
495 chunkyFilePath = chunkyFileNewPath;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
496 chunkyFileNewPath = "";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
497
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
498 if (OnChunkyOpened!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
499 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
500 OnChunkyOpened(chunkyFilePath);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
501 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
502
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
503 treeView.Invoke(new NoParamDelegate(treeView.Nodes.Clear));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
504 txtDetails.Invoke(new NoParamDelegate(txtDetails.Clear));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
505
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
506 foreach (RelicChunkyStructure strct in chunkyFile.ChunkyStructures)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
507 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
508 int count = strct.RootChunks.Count;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
509 TreeNode node = null;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
510 ChunkyFolder fold;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
511 TreeNode[] nodes = new TreeNode[count];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
512
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
513 int children = strct.RootChunks.Count;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
514
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
515 for(int i = 0; i<count; i++)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
516 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
517 if (strct.RootChunks[i] is ChunkyData)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
518 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
519 children+=1;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
520 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
521 else if (strct.RootChunks[i] is ChunkyFolder)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
522 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
523 children += ((ChunkyFolder)strct.RootChunks[i]).Children.Count;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
524 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
525 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
526
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
527 if (OnChunkyNodesCounted!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
528 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
529 OnChunkyNodesCounted(children);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
530 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
531
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
532 for(int i = 0; i<count; i++)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
533 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
534 node = new TreeNode();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
535 setNodeName(node, strct.RootChunks[i]);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
536 node.Tag = strct.RootChunks[i];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
537
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
538 if (strct.RootChunks[i] is ChunkyFolder)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
539 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
540 fold = (ChunkyFolder)strct.RootChunks[i];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
541
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
542 foreach(ChunkyChunk chunk in fold.Children)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
543 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
544 addTreeNode(chunk, node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
545 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
546 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
547 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
548 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
549 node.ImageIndex = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
550 node.SelectedImageIndex = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
551 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
552
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
553 nodes[i] = node;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
554
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
555 if (OnChunkyNodeAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
556 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
557 OnChunkyNodeAdded(strct.RootChunks[i]);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
558 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
559 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
560
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
561 if (OnChunkyNodesAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
562 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
563 OnChunkyNodesAdded(false);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
564 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
565
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
566 treeView.Invoke(new TreeNodeAddRangeDelegate(treeView.Nodes.AddRange), new object[]{nodes});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
567
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
568 if (OnChunkyNodesAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
569 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
570 OnChunkyNodesAdded(true);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
571 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
572 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
573
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
574 this.Invoke(new SetStringDelegate(SetTitle), new object[]{"IChunky Viewer - "+chunkyFile.Name});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
575
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
576 System.Console.Write(chunkyFilePath.Substring(0, chunkyFilePath.LastIndexOf(Constants.DirectoryChar)));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
577 folderBrowserDialog.SelectedPath = chunkyFilePath.Substring(0, chunkyFilePath.LastIndexOf(Constants.DirectoryChar));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
578 openFileDialog.InitialDirectory = chunkyFilePath.Substring(0, chunkyFilePath.LastIndexOf(Constants.DirectoryChar));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
579 miSave.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
580 miShowValidationString.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
581 miValidateAs.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
582 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
583
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
584 private delegate void SetStringDelegate(string val);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
585
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
586 private void SetTitle(string title)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
587 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
588 this.Text = title;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
589 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
590
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
591 private void addTreeNode(ChunkyChunk chunk, TreeNode parent)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
592 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
593 if (chunk is ChunkyData)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
594 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
595 addTreeNode((ChunkyData)chunk, parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
596 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
597 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
598 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
599 addTreeNode((ChunkyFolder)chunk, parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
600 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
601 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
602
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
603 private void addTreeNode(ChunkyData chunk, TreeNode parent)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
604 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
605 TreeNode temp = new TreeNode("", 2, 2);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
606 setNodeName(temp, chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
607 temp.Tag = chunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
608 parent.Nodes.Add(temp);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
609
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
610 if (OnChunkyNodeAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
611 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
612 OnChunkyNodeAdded(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
613 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
614 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
615
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
616 private void addTreeNode(ChunkyFolder fld, TreeNode parent)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
617 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
618 TreeNode node = new TreeNode("", 0, 1);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
619 setNodeName(node, fld);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
620 node.Tag = fld;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
621
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
622 foreach(ChunkyChunk chunk in fld.Children)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
623 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
624 addTreeNode(chunk, node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
625 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
626
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
627 parent.Nodes.Add(node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
628
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
629 if (OnChunkyNodeAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
630 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
631 OnChunkyNodeAdded(fld);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
632 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
633 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
634
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
635 private void miFile_Open_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
636 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
637 DialogResult dr = openFileDialog.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
638
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
639 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
640 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
641 chunkyFileNewPath = openFileDialog.FileName;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
642 Thread thr = new Thread(new ThreadStart(openChunkyFile));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
643 thr.Start();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
644 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
645 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
646
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
647 private void treeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
648 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
649 txtDetails.Text = ((ChunkyChunk)e.Node.Tag).GetDisplayDetails();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
650 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
651
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
652 private void miSaveChunk_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
653 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
654 if (treeView.SelectedNode!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
655 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
656 DialogResult dr = folderBrowserDialog.ShowDialog();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
657
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
658 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
659 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
660 statusBar.Text = "Saving chunk...";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
661
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
662 if(treeView.SelectedNode.Tag is ChunkyData)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
663 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
664 if (((ChunkyData)treeView.SelectedNode.Tag).Save(folderBrowserDialog.SelectedPath))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
665 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
666 statusBar.Text+= "Saved";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
667 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
668 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
669 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
670 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
671 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
672 int saves = ((ChunkyFolder)treeView.SelectedNode.Tag).Save(folderBrowserDialog.SelectedPath);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
673
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
674 if (saves != 1)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
675 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
676 statusBar.Text+= saves+" items saved";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
677 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
678 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
679 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
680 statusBar.Text+= "1 item saved";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
681 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
682
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
683 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
684 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
685 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
686 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
687 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
688
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
689 private void treeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
690 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
691 if (e.Button == MouseButtons.Right)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
692 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
693 TreeNode tn = treeView.GetNodeAt(e.X, e.Y);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
694
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
695 if (tn!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
696 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
697 treeView.SelectedNode = tn;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
698 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
699 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
700 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
701 treeView.SelectedNode = null;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
702 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
703 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
704 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
705
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
706 private void contextMenu_Popup(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
707 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
708 if (treeView.SelectedNode!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
709 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
710 foreach(MenuItem item in contextMenu.MenuItems)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
711 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
712 item.Visible = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
713 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
714
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
715 ChunkyChunk chunk = ((ChunkyChunk)treeView.SelectedNode.Tag);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
716 miSaveChunk.Enabled = chunk.Savable;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
717
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
718 miDeleteChunk.Enabled = (treeView.SelectedNode!=treeView.Nodes[0] || treeView.Nodes.Count>1);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
719 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
720 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
721 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
722 foreach(MenuItem item in contextMenu.MenuItems)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
723 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
724 item.Visible = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
725 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
726 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
727 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
728
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
729 private void menuItem3_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
730 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
731 AboutChunkyViewer frm = new AboutChunkyViewer();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
732 frm.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
733 frm.Dispose();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
734 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
735
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
736 private void menuItem4_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
737 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
738 this.Close();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
739 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
740
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
741 private void showProgress()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
742 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
743 try
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
744 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
745 progress = new Progress(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
746 progress.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
747 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
748 catch{}
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
749 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
750
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
751 private void menuItem5_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
752 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
753 DialogResult dr = openFileDialog.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
754
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
755 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
756 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
757 System.Diagnostics.Process proc = new System.Diagnostics.Process();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
758 proc.EnableRaisingEvents = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
759 proc.StartInfo.FileName = Application.ExecutablePath;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
760 proc.StartInfo.Arguments = "\""+openFileDialog.FileName+"\"";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
761 proc.Start();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
762 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
763 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
764
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
765 private void timer_Tick(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
766 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
767 statusBar.Text = "";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
768 timer.Enabled = false;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
769 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
770
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
771 private void miExportChunk_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
772 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
773 if (treeView.SelectedNode!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
774 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
775 DialogResult dr = exportFileDialog.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
776
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
777 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
778 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
779 statusBar.Text = "Exporting...";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
780 if (((ChunkyChunk)treeView.SelectedNode.Tag).Export(exportFileDialog.FileName))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
781 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
782 statusBar.Text+= "Exported";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
783 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
784 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
785 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
786 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
787 statusBar.Text = "Export failed";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
788 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
789 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
790 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
791 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
792
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
793 private void miImportChunk_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
794 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
795 if (treeView.SelectedNode!=null && treeView.SelectedNode.Tag is ChunkyFolder)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
796 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
797 DialogResult dr = importFileDialog.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
798
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
799 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
800 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
801 FileStream str = new FileStream(importFileDialog.FileName, FileMode.Open);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
802 byte[] bytes = new byte[str.Length];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
803 str.Read(bytes, 0, (int)str.Length);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
804 str.Close();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
805 ChunkyChunk chunk = RelicChunkReader.ReadChunkyChunk(bytes);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
806 ChunkyFolder folder = (ChunkyFolder)treeView.SelectedNode.Tag;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
807 folder.Children.Add(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
808 addTreeNode(chunk, treeView.SelectedNode);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
809 cascadeRefreshUp(treeView.SelectedNode);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
810 txtDetails.Text = ((ChunkyChunk)treeView.SelectedNode.Tag).GetDisplayDetails();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
811 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
812 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
813 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
814
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
815 private void cascadeRefreshUp(TreeNode node)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
816 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
817 setNodeName(node, (ChunkyChunk)node.Tag);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
818
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
819 if (node.Parent!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
820 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
821 cascadeRefreshUp(node.Parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
822 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
823 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
824
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
825 private void cascadeRefreshDown(TreeNode node)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
826 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
827 setNodeName(node, (ChunkyChunk)node.Tag);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
828
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
829 foreach (TreeNode childNode in node.Nodes)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
830 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
831 cascadeRefreshDown(childNode);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
832 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
833 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
834
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
835 private void setNodeName(TreeNode node, ChunkyChunk chunk)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
836 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
837 int showSizes = (int)preferences["ShowChunkSizes"];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
838
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
839 if (showSizes == 1)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
840 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
841 node.Text = chunk.ID+" ("+chunk.DataLength+")";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
842 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
843 else if (showSizes == 2)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
844 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
845 node.Text = chunk.ID+" ("+chunk.Length+")";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
846 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
847 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
848 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
849 node.Text = chunk.ID;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
850 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
851 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
852
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
853 private void miImportSiblingChunk_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
854 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
855 if (treeView.SelectedNode!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
856 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
857 DialogResult dr = importFileDialog.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
858
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
859 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
860 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
861 FileStream str = new FileStream(importFileDialog.FileName, FileMode.Open);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
862 byte[] bytes = new byte[str.Length];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
863 str.Read(bytes, 0, (int)str.Length);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
864 str.Close();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
865 ChunkyChunk chunk = RelicChunkReader.ReadChunkyChunk(bytes);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
866
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
867 if (treeView.SelectedNode.Parent!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
868 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
869 ChunkyFolder folder = (ChunkyFolder)((ChunkyChunk)treeView.SelectedNode.Tag).Parent;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
870 folder.Children.Add(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
871 addTreeNode(chunk, treeView.SelectedNode.Parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
872 cascadeRefreshUp(treeView.SelectedNode.Parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
873 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
874 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
875 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
876 RelicChunkyFile file = ((ChunkyChunk)treeView.SelectedNode.Tag).ParentFile;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
877 file.ChunkyStructures[0].RootChunks.Add(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
878 TreeNode node = new TreeNode();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
879 setNodeName(node, chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
880 node.Tag = chunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
881
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
882 if (chunk is ChunkyFolder)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
883 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
884 ChunkyFolder fold = (ChunkyFolder)chunk;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
885
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
886 foreach(ChunkyChunk childChunk in fold.Children)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
887 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
888 addTreeNode(childChunk, node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
889 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
890 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
891 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
892 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
893 node.ImageIndex = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
894 node.SelectedImageIndex = 2;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
895 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
896
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
897 treeView.Nodes.Add(node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
898
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
899 if (OnChunkyNodeAdded!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
900 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
901 OnChunkyNodeAdded(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
902 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
903 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
904 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
905 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
906 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
907
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
908 private void miSave_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
909 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
910 if (chunkyFile!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
911 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
912 statusBar.Text = "Saving...";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
913 chunkyFile.Save(new DirectoryInfo(chunkyFilePath.Substring(0, chunkyFilePath.LastIndexOf(Constants.DirectoryChar))));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
914 statusBar.Text+= "Saved";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
915 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
916 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
917 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
918
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
919 private void miDeleteChunk_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
920 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
921 if (treeView.SelectedNode!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
922 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
923 TreeNode node = treeView.SelectedNode;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
924 ChunkyChunk chunk = (ChunkyChunk)node.Tag;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
925
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
926 if (chunk.Parent!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
927 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
928 chunk.Parent.Children.Remove(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
929 TreeNode parent = node.Parent;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
930 node.Parent.Nodes.Remove(node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
931 cascadeRefreshUp(parent);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
932 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
933 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
934 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
935 chunk.ParentFile.ChunkyStructures[0].RootChunks.Remove(chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
936 treeView.Nodes.Remove(node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
937 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
938 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
939 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
940
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
941 private void miOptions_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
942 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
943 FrmConfig frm = new FrmConfig(preferences);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
944 DialogResult dr = frm.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
945
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
946 if (dr == DialogResult.OK)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
947 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
948 foreach (TreeNode node in treeView.Nodes)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
949 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
950 cascadeRefreshDown(node);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
951 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
952 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
953 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
954
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
955 private void miShowValidationString_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
956 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
957 if (chunkyFile!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
958 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
959 FrmValidationString val = new FrmValidationString(chunkyFile);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
960 val.ShowDialog(this);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
961 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
962 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
963
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
964 private void readInValidators()
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
965 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
966 statusBar.Text = "Reading validators...";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
967 DirectoryInfo dir = new DirectoryInfo(preferences["DoWPath"].ToString() + Constants.DirectoryString + "IChunkyValidators");
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
968
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
969 miValidateAs.MenuItems.Clear();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
970
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
971 if (dir.Exists)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
972 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
973 FileInfo[] validators = dir.GetFiles("*.validator");
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
974
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
975 if (validators.Length>0)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
976 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
977 //chunkyValidators = new ChunkyValidator[validators.Length];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
978 //MenuItem[] items = new MenuItem[validators.Length];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
979 ArrayList chunkyValidatorsTemp = new ArrayList();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
980 ArrayList menuitems = new ArrayList();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
981 EventHandler handler = new EventHandler(miValidate_Click);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
982 ChunkyValidator validator;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
983
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
984 for (int i = 0; i<validators.Length; i++)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
985 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
986 try
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
987 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
988 validator = new ChunkyValidator(validators[i]);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
989 chunkyValidatorsTemp.Add(validator);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
990 menuitems.Add(new MenuItem(validator.FileType, handler));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
991 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
992 catch (InvalidOperationException){}//invalid validator file
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
993 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
994
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
995 chunkyValidators = (ChunkyValidator[])chunkyValidatorsTemp.ToArray(typeof(ChunkyValidator));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
996 miValidateAs.MenuItems.AddRange((MenuItem[])menuitems.ToArray(typeof(MenuItem)));
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
997 miValidateAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.menuItem16,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
998 this.miRefreshValidations});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
999
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1000 statusBar.Text = "Refreshed";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1001 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1002 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1003 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1004 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1005 statusBar.Text = "No validators found";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1006 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1007 miValidateAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.miNoValidators,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1008 this.menuItem16,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1009 this.miRefreshValidations});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1010 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1011 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1012 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1013 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1014 statusBar.Text = "ERROR: Could not find validators";
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1015 timer.Enabled = true;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1016 MessageBox.Show(this, "IChunkyViewer could not find a folder of Chunky file validators at "+dir.FullName, "Could not find validators", MessageBoxButtons.OK, MessageBoxIcon.Warning);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1017
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1018 miValidateAs.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.miNoValidators,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1019 this.menuItem16,
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1020 this.miRefreshValidations});
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1021 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1022 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1023
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1024 private void miValidate_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1025 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1026 if (sender is MenuItem && chunkyFile!=null)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1027 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1028 ChunkyValidator validator = chunkyValidators[((MenuItem)sender).Index];
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1029 if (validator.Validate(chunkyFile.GetValidationString()))
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1030 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1031 MessageBox.Show(this, chunkyFile.Name+" is a valid "+validator.FileType+" file", "Validation successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1032 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1033 else
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1034 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1035 MessageBox.Show(this, chunkyFile.Name+" is not a valid "+validator.FileType+" file", "Validation failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1036 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1037 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1038 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1039
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1040 private void miRefreshValidations_Click(object sender, System.EventArgs e)
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1041 {
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1042 readInValidators();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1043 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1044
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1045 public delegate void ChunkyOpenedDelegate(string path);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1046 public event ChunkyOpenedDelegate OnChunkyOpened;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1047 public delegate void ChunkyNodesCountedDelegate(int nodes);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1048 public event ChunkyNodesCountedDelegate OnChunkyNodesCounted;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1049 public delegate void ChunkyNodeAddedDelegate(ChunkyChunk chunk);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1050 public event ChunkyNodeAddedDelegate OnChunkyNodeAdded;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1051 public delegate void ChunkyNodesAddedDelegate(bool rendered);
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1052 public event ChunkyNodesAddedDelegate OnChunkyNodesAdded;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1053 public delegate void ChunkyOpenFailedDelegate();
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1054 public event ChunkyOpenFailedDelegate OnChunkyOpenFailed;
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1055 }
8439bec53421 Initial commit under the GPLv3
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1056 }