ImportExportSettingDialog.cs 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099
  1. using PaintDotNet;
  2. using PaintDotNet.Base.CommTool;
  3. using PaintDotNet.Base.SettingModel;
  4. using PaintDotNet.DbOpreate.DbBll;
  5. using PaintDotNet.DbOpreate.DbModel;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. namespace Metis.Setting
  17. {
  18. internal partial class ImportExportSettingDialog : PdnBaseForm
  19. {
  20. private GroupBox groupBox1;
  21. private Button button6;
  22. private Button button5;
  23. private Button button3;
  24. private Button button2;
  25. private GroupBox groupBox2;
  26. private Button button8;
  27. private GroupBox groupBox3;
  28. private RadioButton radioButton2;
  29. private RadioButton radioButton1;
  30. private TextBox textBox4;
  31. private Button button4;
  32. private GroupBox groupBox4;
  33. private GroupBox groupBox5;
  34. private Label label1;
  35. private TextBox textBox1;
  36. private CheckBox checkBox1;
  37. private GroupBox groupBox6;
  38. private TextBox textBox2;
  39. private Label label2;
  40. private Button button7;
  41. private Button button1;
  42. private Button button10;
  43. private Button button9;
  44. private Button button11;
  45. /// <summary>
  46. /// 选择的步
  47. /// </summary>
  48. private int chooseStep = 1;
  49. private ImportExportModel importExportModel;
  50. /// <summary>
  51. /// 工具栏组成的结构数据
  52. /// </summary>
  53. private List<ProjectData> toolbarModelList = new List<ProjectData>();
  54. /// <summary>
  55. /// 工作流程组成的结构数据
  56. /// </summary>
  57. private List<ProjectData> workFlowModelList = new List<ProjectData>();
  58. private PaintDotNet.CustomControl.TreeViewEnhanced treeView1;
  59. /// <summary>
  60. /// 脚本组成的结构数据
  61. /// </summary>
  62. private List<ProjectData> stepModelList = new List<ProjectData>();
  63. /// <summary>
  64. /// 压缩中间数据目录
  65. /// </summary>
  66. private string temporaryFilePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Temp\\";
  67. /// <summary>
  68. /// 解压中间数据目录
  69. /// </summary>
  70. private string unZipTemporaryFilePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\UnZipTemp\\";
  71. private Dictionary<string, string> originalPathDict = new Dictionary<string, string>();
  72. private Dictionary<string, string> newPathDict = new Dictionary<string, string>();
  73. private Dictionary<string, string> importPathDict = new Dictionary<string, string>();
  74. /// <summary>
  75. /// (导出)选择的树状信息
  76. /// </summary>
  77. private List<string> checkDataList = new List<string>();
  78. /// <summary>
  79. /// (导出)二级结构选择
  80. /// </summary>
  81. private Dictionary<string, List<string>> checkSecondData = new Dictionary<string, List<string>>();
  82. /// <summary>
  83. /// (导入)选择的树状信息
  84. /// </summary>
  85. private List<string> importCheckDataList = new List<string>();
  86. /// <summary>
  87. /// (导入)二级结构选择
  88. /// </summary>
  89. private Dictionary<string, List<string>> importCheckSecondData = new Dictionary<string, List<string>>();
  90. public ImportExportSettingDialog()
  91. {
  92. InitializeComponent();
  93. #region [默认展示第一步]
  94. button1_Click(null, null);
  95. #endregion
  96. #region [获取二级结构数据]
  97. this.getSonData();
  98. #endregion
  99. #region [读取树状图结构]
  100. this.getTreeData();
  101. #endregion
  102. #region [组织树状图]
  103. this.treeView1.CheckBoxes = true;
  104. this.treeView1.ItemHeight = 18;
  105. this.createTreeView();
  106. #endregion
  107. #region [生成中间文件夹]
  108. this.createDefaultDirectory();
  109. #endregion
  110. }
  111. private void InitializeComponent()
  112. {
  113. this.groupBox1 = new System.Windows.Forms.GroupBox();
  114. this.button6 = new System.Windows.Forms.Button();
  115. this.button5 = new System.Windows.Forms.Button();
  116. this.button3 = new System.Windows.Forms.Button();
  117. this.button2 = new System.Windows.Forms.Button();
  118. this.button1 = new System.Windows.Forms.Button();
  119. this.groupBox2 = new System.Windows.Forms.GroupBox();
  120. this.button11 = new System.Windows.Forms.Button();
  121. this.button10 = new System.Windows.Forms.Button();
  122. this.button9 = new System.Windows.Forms.Button();
  123. this.button8 = new System.Windows.Forms.Button();
  124. this.groupBox3 = new System.Windows.Forms.GroupBox();
  125. this.button4 = new System.Windows.Forms.Button();
  126. this.textBox4 = new System.Windows.Forms.TextBox();
  127. this.radioButton2 = new System.Windows.Forms.RadioButton();
  128. this.radioButton1 = new System.Windows.Forms.RadioButton();
  129. this.groupBox4 = new System.Windows.Forms.GroupBox();
  130. this.treeView1 = new PaintDotNet.CustomControl.TreeViewEnhanced();
  131. this.groupBox5 = new System.Windows.Forms.GroupBox();
  132. this.checkBox1 = new System.Windows.Forms.CheckBox();
  133. this.textBox1 = new System.Windows.Forms.TextBox();
  134. this.label1 = new System.Windows.Forms.Label();
  135. this.groupBox6 = new System.Windows.Forms.GroupBox();
  136. this.button7 = new System.Windows.Forms.Button();
  137. this.textBox2 = new System.Windows.Forms.TextBox();
  138. this.label2 = new System.Windows.Forms.Label();
  139. this.groupBox1.SuspendLayout();
  140. this.groupBox2.SuspendLayout();
  141. this.groupBox3.SuspendLayout();
  142. this.groupBox4.SuspendLayout();
  143. this.groupBox5.SuspendLayout();
  144. this.groupBox6.SuspendLayout();
  145. this.SuspendLayout();
  146. //
  147. // groupBox1
  148. //
  149. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  150. | System.Windows.Forms.AnchorStyles.Left)));
  151. this.groupBox1.Controls.Add(this.button6);
  152. this.groupBox1.Controls.Add(this.button5);
  153. this.groupBox1.Controls.Add(this.button3);
  154. this.groupBox1.Controls.Add(this.button2);
  155. this.groupBox1.Controls.Add(this.button1);
  156. this.groupBox1.Location = new System.Drawing.Point(12, 10);
  157. this.groupBox1.Name = "groupBox1";
  158. this.groupBox1.Size = new System.Drawing.Size(115, 445);
  159. this.groupBox1.TabIndex = 2;
  160. this.groupBox1.TabStop = false;
  161. //
  162. // button6
  163. //
  164. this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  165. | System.Windows.Forms.AnchorStyles.Right)));
  166. this.button6.Location = new System.Drawing.Point(20, 383);
  167. this.button6.Name = "button6";
  168. this.button6.Size = new System.Drawing.Size(75, 23);
  169. this.button6.TabIndex = 4;
  170. this.button6.Text = "上一步";
  171. this.button6.UseVisualStyleBackColor = true;
  172. this.button6.Click += new System.EventHandler(this.button6_Click);
  173. //
  174. // button5
  175. //
  176. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  177. | System.Windows.Forms.AnchorStyles.Right)));
  178. this.button5.Location = new System.Drawing.Point(20, 412);
  179. this.button5.Name = "button5";
  180. this.button5.Size = new System.Drawing.Size(75, 23);
  181. this.button5.TabIndex = 3;
  182. this.button5.Text = "下一步";
  183. this.button5.UseVisualStyleBackColor = true;
  184. this.button5.Click += new System.EventHandler(this.button5_Click);
  185. //
  186. // button3
  187. //
  188. this.button3.Location = new System.Drawing.Point(20, 89);
  189. this.button3.Name = "button3";
  190. this.button3.Size = new System.Drawing.Size(75, 23);
  191. this.button3.TabIndex = 2;
  192. this.button3.Text = "第三步";
  193. this.button3.UseVisualStyleBackColor = true;
  194. this.button3.Click += new System.EventHandler(this.button3_Click);
  195. //
  196. // button2
  197. //
  198. this.button2.Location = new System.Drawing.Point(20, 59);
  199. this.button2.Name = "button2";
  200. this.button2.Size = new System.Drawing.Size(75, 23);
  201. this.button2.TabIndex = 1;
  202. this.button2.Text = "第二步";
  203. this.button2.UseVisualStyleBackColor = true;
  204. this.button2.Click += new System.EventHandler(this.button2_Click);
  205. //
  206. // button1
  207. //
  208. this.button1.Location = new System.Drawing.Point(20, 29);
  209. this.button1.Name = "button1";
  210. this.button1.Size = new System.Drawing.Size(75, 23);
  211. this.button1.TabIndex = 0;
  212. this.button1.Text = "第一步";
  213. this.button1.UseVisualStyleBackColor = true;
  214. this.button1.Click += new System.EventHandler(this.button1_Click);
  215. //
  216. // groupBox2
  217. //
  218. this.groupBox2.Controls.Add(this.button11);
  219. this.groupBox2.Controls.Add(this.button10);
  220. this.groupBox2.Controls.Add(this.button9);
  221. this.groupBox2.Controls.Add(this.button8);
  222. this.groupBox2.Location = new System.Drawing.Point(133, 12);
  223. this.groupBox2.Name = "groupBox2";
  224. this.groupBox2.Size = new System.Drawing.Size(604, 58);
  225. this.groupBox2.TabIndex = 3;
  226. this.groupBox2.TabStop = false;
  227. this.groupBox2.Text = "操作";
  228. //
  229. // button11
  230. //
  231. this.button11.Location = new System.Drawing.Point(512, 20);
  232. this.button11.Name = "button11";
  233. this.button11.Size = new System.Drawing.Size(75, 23);
  234. this.button11.TabIndex = 4;
  235. this.button11.Text = "完成";
  236. this.button11.UseVisualStyleBackColor = true;
  237. this.button11.Click += new System.EventHandler(this.button11_Click);
  238. //
  239. // button10
  240. //
  241. this.button10.Location = new System.Drawing.Point(431, 20);
  242. this.button10.Name = "button10";
  243. this.button10.Size = new System.Drawing.Size(75, 23);
  244. this.button10.TabIndex = 3;
  245. this.button10.Text = "全不选";
  246. this.button10.UseVisualStyleBackColor = true;
  247. this.button10.Click += new System.EventHandler(this.button10_Click);
  248. //
  249. // button9
  250. //
  251. this.button9.Location = new System.Drawing.Point(350, 20);
  252. this.button9.Name = "button9";
  253. this.button9.Size = new System.Drawing.Size(75, 23);
  254. this.button9.TabIndex = 2;
  255. this.button9.Text = "全选";
  256. this.button9.UseVisualStyleBackColor = true;
  257. this.button9.Click += new System.EventHandler(this.button9_Click);
  258. //
  259. // button8
  260. //
  261. this.button8.Location = new System.Drawing.Point(512, 20);
  262. this.button8.Name = "button8";
  263. this.button8.Size = new System.Drawing.Size(75, 23);
  264. this.button8.TabIndex = 1;
  265. this.button8.Text = "关闭";
  266. this.button8.UseVisualStyleBackColor = true;
  267. this.button8.Click += new System.EventHandler(this.button8_Click);
  268. //
  269. // groupBox3
  270. //
  271. this.groupBox3.Controls.Add(this.button4);
  272. this.groupBox3.Controls.Add(this.textBox4);
  273. this.groupBox3.Controls.Add(this.radioButton2);
  274. this.groupBox3.Controls.Add(this.radioButton1);
  275. this.groupBox3.Location = new System.Drawing.Point(133, 76);
  276. this.groupBox3.Name = "groupBox3";
  277. this.groupBox3.Size = new System.Drawing.Size(604, 379);
  278. this.groupBox3.TabIndex = 4;
  279. this.groupBox3.TabStop = false;
  280. this.groupBox3.Text = "设置";
  281. //
  282. // button4
  283. //
  284. this.button4.Location = new System.Drawing.Point(512, 64);
  285. this.button4.Name = "button4";
  286. this.button4.Size = new System.Drawing.Size(75, 21);
  287. this.button4.TabIndex = 13;
  288. this.button4.Text = "选择";
  289. this.button4.UseVisualStyleBackColor = true;
  290. this.button4.Click += new System.EventHandler(this.button4_Click);
  291. //
  292. // textBox4
  293. //
  294. this.textBox4.Location = new System.Drawing.Point(24, 65);
  295. this.textBox4.Name = "textBox4";
  296. this.textBox4.ReadOnly = true;
  297. this.textBox4.Size = new System.Drawing.Size(482, 21);
  298. this.textBox4.TabIndex = 12;
  299. //
  300. // radioButton2
  301. //
  302. this.radioButton2.AutoSize = true;
  303. this.radioButton2.Location = new System.Drawing.Point(24, 109);
  304. this.radioButton2.Name = "radioButton2";
  305. this.radioButton2.Size = new System.Drawing.Size(47, 16);
  306. this.radioButton2.TabIndex = 1;
  307. this.radioButton2.TabStop = true;
  308. this.radioButton2.Text = "导出";
  309. this.radioButton2.UseVisualStyleBackColor = true;
  310. this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_Check);
  311. //
  312. // radioButton1
  313. //
  314. this.radioButton1.AutoSize = true;
  315. this.radioButton1.Checked = true;
  316. this.radioButton1.Location = new System.Drawing.Point(24, 30);
  317. this.radioButton1.Name = "radioButton1";
  318. this.radioButton1.Size = new System.Drawing.Size(47, 16);
  319. this.radioButton1.TabIndex = 0;
  320. this.radioButton1.TabStop = true;
  321. this.radioButton1.Text = "导入";
  322. this.radioButton1.UseVisualStyleBackColor = true;
  323. this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_Check);
  324. //
  325. // groupBox4
  326. //
  327. this.groupBox4.Controls.Add(this.treeView1);
  328. this.groupBox4.Location = new System.Drawing.Point(133, 76);
  329. this.groupBox4.Name = "groupBox4";
  330. this.groupBox4.Size = new System.Drawing.Size(604, 379);
  331. this.groupBox4.TabIndex = 14;
  332. this.groupBox4.TabStop = false;
  333. this.groupBox4.Text = "设置";
  334. //
  335. // treeView1
  336. //
  337. this.treeView1.Location = new System.Drawing.Point(189, 13);
  338. this.treeView1.Name = "treeView1";
  339. this.treeView1.Size = new System.Drawing.Size(227, 360);
  340. this.treeView1.TabIndex = 16;
  341. this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  342. //
  343. // groupBox5
  344. //
  345. this.groupBox5.Controls.Add(this.checkBox1);
  346. this.groupBox5.Controls.Add(this.textBox1);
  347. this.groupBox5.Controls.Add(this.label1);
  348. this.groupBox5.Location = new System.Drawing.Point(133, 76);
  349. this.groupBox5.Name = "groupBox5";
  350. this.groupBox5.Size = new System.Drawing.Size(604, 379);
  351. this.groupBox5.TabIndex = 15;
  352. this.groupBox5.TabStop = false;
  353. this.groupBox5.Text = "设置";
  354. //
  355. // checkBox1
  356. //
  357. this.checkBox1.AutoSize = true;
  358. this.checkBox1.Location = new System.Drawing.Point(24, 110);
  359. this.checkBox1.Name = "checkBox1";
  360. this.checkBox1.Size = new System.Drawing.Size(96, 16);
  361. this.checkBox1.TabIndex = 2;
  362. this.checkBox1.Text = "覆盖当前数据";
  363. this.checkBox1.UseVisualStyleBackColor = true;
  364. //
  365. // textBox1
  366. //
  367. this.textBox1.Location = new System.Drawing.Point(24, 65);
  368. this.textBox1.Name = "textBox1";
  369. this.textBox1.ReadOnly = true;
  370. this.textBox1.Size = new System.Drawing.Size(462, 21);
  371. this.textBox1.TabIndex = 1;
  372. //
  373. // label1
  374. //
  375. this.label1.AutoSize = true;
  376. this.label1.Location = new System.Drawing.Point(22, 34);
  377. this.label1.Name = "label1";
  378. this.label1.Size = new System.Drawing.Size(77, 12);
  379. this.label1.TabIndex = 0;
  380. this.label1.Text = "从......导入";
  381. //
  382. // groupBox6
  383. //
  384. this.groupBox6.Controls.Add(this.button7);
  385. this.groupBox6.Controls.Add(this.textBox2);
  386. this.groupBox6.Controls.Add(this.label2);
  387. this.groupBox6.Location = new System.Drawing.Point(133, 76);
  388. this.groupBox6.Name = "groupBox6";
  389. this.groupBox6.Size = new System.Drawing.Size(604, 379);
  390. this.groupBox6.TabIndex = 16;
  391. this.groupBox6.TabStop = false;
  392. this.groupBox6.Text = "设置";
  393. //
  394. // button7
  395. //
  396. this.button7.Location = new System.Drawing.Point(512, 62);
  397. this.button7.Name = "button7";
  398. this.button7.Size = new System.Drawing.Size(75, 23);
  399. this.button7.TabIndex = 2;
  400. this.button7.Text = "选择";
  401. this.button7.UseVisualStyleBackColor = true;
  402. this.button7.Click += new System.EventHandler(this.button7_Click);
  403. //
  404. // textBox2
  405. //
  406. this.textBox2.Location = new System.Drawing.Point(24, 65);
  407. this.textBox2.Name = "textBox2";
  408. this.textBox2.ReadOnly = true;
  409. this.textBox2.Size = new System.Drawing.Size(471, 21);
  410. this.textBox2.TabIndex = 1;
  411. //
  412. // label2
  413. //
  414. this.label2.AutoSize = true;
  415. this.label2.Location = new System.Drawing.Point(22, 34);
  416. this.label2.Name = "label2";
  417. this.label2.Size = new System.Drawing.Size(125, 12);
  418. this.label2.TabIndex = 0;
  419. this.label2.Text = "选择配置文件存放位置";
  420. //
  421. // ImportExportSettingDialog
  422. //
  423. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  424. this.ClientSize = new System.Drawing.Size(749, 467);
  425. this.Controls.Add(this.groupBox4);
  426. this.Controls.Add(this.groupBox5);
  427. this.Controls.Add(this.groupBox3);
  428. this.Controls.Add(this.groupBox2);
  429. this.Controls.Add(this.groupBox1);
  430. this.Controls.Add(this.groupBox6);
  431. this.MaximizeBox = false;
  432. this.MinimizeBox = false;
  433. this.Name = "ImportExportSettingDialog";
  434. this.Text = "导入导出向导";
  435. this.Controls.SetChildIndex(this.groupBox6, 0);
  436. this.Controls.SetChildIndex(this.groupBox1, 0);
  437. this.Controls.SetChildIndex(this.groupBox2, 0);
  438. this.Controls.SetChildIndex(this.groupBox3, 0);
  439. this.Controls.SetChildIndex(this.groupBox5, 0);
  440. this.Controls.SetChildIndex(this.groupBox4, 0);
  441. this.groupBox1.ResumeLayout(false);
  442. this.groupBox2.ResumeLayout(false);
  443. this.groupBox3.ResumeLayout(false);
  444. this.groupBox3.PerformLayout();
  445. this.groupBox4.ResumeLayout(false);
  446. this.groupBox5.ResumeLayout(false);
  447. this.groupBox5.PerformLayout();
  448. this.groupBox6.ResumeLayout(false);
  449. this.groupBox6.PerformLayout();
  450. this.ResumeLayout(false);
  451. }
  452. /// <summary>
  453. /// 初始化UI
  454. /// </summary>
  455. private void InitializeUI() {
  456. switch (this.chooseStep) {
  457. case 1:
  458. this.groupBox3.Visible = true;
  459. this.groupBox4.Visible = false;
  460. this.groupBox5.Visible = false;
  461. this.groupBox6.Visible = false;
  462. this.button1.BackColor = Color.Black;
  463. this.button1.ForeColor = Color.White;
  464. this.button2.BackColor = Color.White;
  465. this.button2.ForeColor = Color.Black;
  466. this.button3.BackColor = Color.White;
  467. this.button3.ForeColor = Color.Black;
  468. this.button6.Enabled = false;
  469. this.button5.Enabled = true;
  470. this.button8.Visible = true;
  471. this.button9.Visible = false;
  472. this.button10.Visible = false;
  473. this.button11.Visible = false;
  474. break;
  475. case 2:
  476. this.groupBox3.Visible = false;
  477. this.groupBox4.Visible = true;
  478. this.groupBox5.Visible = false;
  479. this.groupBox6.Visible = false;
  480. this.button1.BackColor = Color.White;
  481. this.button1.ForeColor = Color.Black;
  482. this.button2.BackColor = Color.Black;
  483. this.button2.ForeColor = Color.White;
  484. this.button3.BackColor = Color.White;
  485. this.button3.ForeColor = Color.Black;
  486. this.button6.Enabled = true;
  487. this.button5.Enabled = true;
  488. this.button8.Visible = true;
  489. this.button9.Visible = true;
  490. this.button10.Visible = true;
  491. this.button11.Visible = false;
  492. break;
  493. case 3:
  494. this.groupBox3.Visible = false;
  495. this.groupBox4.Visible = false;
  496. if (this.radioButton1.Checked)
  497. {
  498. this.groupBox5.Visible = true;
  499. this.groupBox6.Visible = false;
  500. }
  501. else if (this.radioButton2.Checked)
  502. {
  503. this.groupBox5.Visible = false;
  504. this.groupBox6.Visible = true;
  505. }
  506. this.button1.BackColor = Color.White;
  507. this.button1.ForeColor = Color.Black;
  508. this.button2.BackColor = Color.White;
  509. this.button2.ForeColor = Color.Black;
  510. this.button3.BackColor = Color.Black;
  511. this.button3.ForeColor = Color.White;
  512. this.button5.Enabled = false;
  513. this.button6.Enabled = true;
  514. this.button8.Visible = false;
  515. this.button9.Visible = false;
  516. this.button10.Visible = false;
  517. this.button11.Visible = true;
  518. break;
  519. }
  520. }
  521. /// <summary>
  522. /// 关闭
  523. /// </summary>
  524. /// <param name="sender"></param>
  525. /// <param name="e"></param>
  526. private void button8_Click(object sender, EventArgs e)
  527. {
  528. this.Close();
  529. }
  530. /// <summary>
  531. /// 导入按钮选择
  532. /// </summary>
  533. /// <param name="sender"></param>
  534. /// <param name="e"></param>
  535. private void radioButton2_Check(object sender, EventArgs e)
  536. {
  537. clearData();
  538. }
  539. /// <summary>
  540. /// 导入按钮选择
  541. /// </summary>
  542. /// <param name="sender"></param>
  543. /// <param name="e"></param>
  544. private void radioButton1_Check(object sender, EventArgs e)
  545. {
  546. clearData();
  547. }
  548. /// <summary>
  549. /// 清理之前的数据
  550. /// </summary>
  551. private void clearData()
  552. {
  553. checkDataList.Clear();
  554. checkSecondData.Clear();
  555. importCheckDataList.Clear();
  556. importCheckSecondData.Clear();
  557. }
  558. /// <summary>
  559. /// 导入选择
  560. /// </summary>
  561. /// <param name="sender"></param>
  562. /// <param name="e"></param>
  563. private void button4_Click(object sender, EventArgs e)
  564. {
  565. if (!radioButton1.Checked) {
  566. MessageBox.Show("请选择导入后再选择需要导入的文件!");
  567. return;
  568. }
  569. OpenFileDialog dialog = new OpenFileDialog();
  570. dialog.Multiselect = false; //该值确定是否可以选择多个文件
  571. dialog.Filter = "压缩包(*.zip)|*.zip";
  572. if (dialog.ShowDialog() != DialogResult.OK)
  573. {
  574. return;
  575. }
  576. string file = dialog.FileName;
  577. this.textBox4.Text = file;
  578. this.textBox1.Text = file;
  579. if (!file.EndsWith(".zip")) {
  580. MessageBox.Show("请选择ZIP类型的压缩包文件!");
  581. return;
  582. }
  583. clearData();
  584. #region [将文件解压到中间文件]
  585. if (ZipHandleHelper.decompressionZip(file, unZipTemporaryFilePath))
  586. {
  587. List<string> allFileList = FileOperationHelper.GetAllDirectoryList(unZipTemporaryFilePath);
  588. #region [校验应勾选的树状信息]
  589. if (allFileList.Contains("CameraParam"))
  590. {
  591. this.importCheckDataList.Add("camera");
  592. }
  593. if (allFileList.Contains("Config"))
  594. {
  595. this.importCheckDataList.Add("generalSetting");
  596. }
  597. if (allFileList.Contains("Hotkey"))
  598. {
  599. this.importCheckDataList.Add("hotkey");
  600. }
  601. if (allFileList.Contains("Label"))
  602. {
  603. this.importCheckDataList.Add("label");
  604. }
  605. if (allFileList.Contains("Measure"))
  606. {
  607. this.importCheckDataList.Add("measure");
  608. }
  609. if (allFileList.Contains("ModuleManage"))
  610. {
  611. this.importCheckDataList.Add("reportModel");
  612. }
  613. if (allFileList.Contains("ParameterSaving"))
  614. {
  615. this.importCheckDataList.Add("parameter");
  616. }
  617. if (allFileList.Contains("Ruler"))
  618. {
  619. this.importCheckDataList.Add("ruler");
  620. }
  621. if (allFileList.Contains("Shortcutbar"))
  622. {
  623. this.importCheckDataList.Add("shortcutbar");
  624. }
  625. if (allFileList.Contains("Toolbar"))
  626. {
  627. this.importCheckDataList.Add("toolbar");
  628. string filePath = unZipTemporaryFilePath + "Toolbar\\Toolbar.xml";
  629. var importToolBar = XmlSerializeHelper.DESerializer<ToolbarModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  630. List<string> secondDataList = new List<string>();
  631. foreach (var item in importToolBar.Flows)
  632. {
  633. secondDataList.Add(item.Name);
  634. }
  635. importCheckSecondData.Add("toolbar", secondDataList);
  636. addTreeView(4,secondDataList);
  637. }
  638. if (allFileList.Contains("WorkFlow"))
  639. {
  640. this.importCheckDataList.Add("workFlow");
  641. string filePath = unZipTemporaryFilePath + "WorkFlow\\WorkFlow.xml";
  642. var importWorkFlow = XmlSerializeHelper.DESerializer<WorkFlowModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  643. List<string> secondDataList = new List<string>();
  644. foreach (var item in importWorkFlow.Flows)
  645. {
  646. secondDataList.Add(item.Name);
  647. }
  648. addTreeView(12, secondDataList);
  649. importCheckSecondData.Add("workFlow", secondDataList);
  650. }
  651. //脚本
  652. if (allFileList.Contains("ScriptStep"))
  653. {
  654. this.importCheckDataList.Add("scriptStep");
  655. string filePath = unZipTemporaryFilePath + "ScriptStep\\ScriptStep.xml";
  656. List<mic_script> importMicScriptList = XmlSerializeHelper.DESerializer<List<mic_script>>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  657. List<string> secondDataList = new List<string>();
  658. foreach (var item in importMicScriptList)
  659. {
  660. secondDataList.Add(item.name);
  661. }
  662. addTreeView(10, secondDataList);
  663. importCheckSecondData.Add("scriptStep", secondDataList);
  664. }
  665. #endregion
  666. }
  667. else {
  668. MessageBox.Show("解压文件失败,请稍后再试!");
  669. return;
  670. }
  671. #endregion
  672. }
  673. /// <summary>
  674. ///
  675. /// </summary>
  676. /// <param name="type"></param>
  677. /// <param name="secondDataList"></param>
  678. private void addTreeView(int type,List<string> secondDataList)
  679. {
  680. this.treeView1.Nodes[type - 1].Nodes.Clear();
  681. foreach (var item in secondDataList) {
  682. TreeNode node = new TreeNode();
  683. node.Text = item;
  684. node.Name = item;
  685. this.treeView1.Nodes[type - 1].Nodes.Add(node);
  686. }
  687. }
  688. /// <summary>
  689. /// 导出选择
  690. /// </summary>
  691. /// <param name="sender"></param>
  692. /// <param name="e"></param>
  693. private void button7_Click(object sender, EventArgs e)
  694. {
  695. SaveFileDialog exe = new SaveFileDialog();
  696. exe.Filter = "Compressed Package(*.zip)|*.zip";
  697. exe.FilterIndex = 0;
  698. exe.RestoreDirectory = true;
  699. //exe.CreatePrompt = true;
  700. exe.Title = "Export Compressed Package";
  701. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  702. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + "参数导出";
  703. DialogResult dr = exe.ShowDialog();
  704. if (dr != DialogResult.OK)
  705. {
  706. return;
  707. }
  708. this.textBox2.Text = exe.FileName;
  709. }
  710. /// <summary>
  711. /// 点击第一步
  712. /// </summary>
  713. /// <param name="sender"></param>
  714. /// <param name="e"></param>
  715. private void button1_Click(object sender, EventArgs e)
  716. {
  717. this.chooseStep = 1;
  718. InitializeUI();
  719. }
  720. /// <summary>
  721. /// 点击第二步
  722. /// </summary>
  723. /// <param name="sender"></param>
  724. /// <param name="e"></param>
  725. private void button2_Click(object sender, EventArgs e)
  726. {
  727. // 导出默认全部选中 导入则根据导入时拥有的情况来选择
  728. if (radioButton2.Checked)
  729. {
  730. AllChecked();
  731. }
  732. else if (radioButton1.Checked) {
  733. CancelAllChecked();
  734. if (string.IsNullOrEmpty(textBox4.Text))
  735. {
  736. MessageBox.Show("请先选择要导入的ZIP文件!");
  737. return;
  738. }
  739. this.treeView1.AfterCheck -= new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  740. foreach (TreeNode node in treeView1.Nodes) {
  741. switch (node.Name) {
  742. case "1":
  743. if (importCheckDataList.Contains("camera")) {
  744. node.Checked = true;
  745. }
  746. break;
  747. case "2":
  748. if (importCheckDataList.Contains("measure"))
  749. {
  750. node.Checked = true;
  751. }
  752. break;
  753. case "3":
  754. if (importCheckDataList.Contains("label"))
  755. {
  756. node.Checked = true;
  757. }
  758. break;
  759. case "4":
  760. if (importCheckDataList.Contains("toolbar"))
  761. {
  762. node.Checked = true;
  763. RecursiveNodeCheck(node, 4);
  764. }
  765. break;
  766. case "5":
  767. if (importCheckDataList.Contains("shortcutbar"))
  768. {
  769. node.Checked = true;
  770. }
  771. break;
  772. case "6":
  773. if (importCheckDataList.Contains("hotkey"))
  774. {
  775. node.Checked = true;
  776. }
  777. break;
  778. case "7":
  779. if (importCheckDataList.Contains("reportModel"))
  780. {
  781. node.Checked = true;
  782. }
  783. break;
  784. case "8":
  785. if (importCheckDataList.Contains("ruler"))
  786. {
  787. node.Checked = true;
  788. }
  789. break;
  790. case "9":
  791. if (importCheckDataList.Contains("parameter"))
  792. {
  793. node.Checked = true;
  794. }
  795. break;
  796. case "10":
  797. if (importCheckDataList.Contains("scriptStep"))
  798. {
  799. node.Checked = true;
  800. RecursiveNodeCheck(node, 10);
  801. }
  802. break;
  803. case "11":
  804. if (importCheckDataList.Contains("generalSetting"))
  805. {
  806. node.Checked = true;
  807. }
  808. break;
  809. case "12":
  810. if (importCheckDataList.Contains("workFlow"))
  811. {
  812. node.Checked = true;
  813. RecursiveNodeCheck(node, 12);
  814. }
  815. break;
  816. }
  817. }
  818. this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  819. }
  820. this.chooseStep = 2;
  821. InitializeUI();
  822. }
  823. /// <summary>
  824. /// 点击第三步
  825. /// </summary>
  826. /// <param name="sender"></param>
  827. /// <param name="e"></param>
  828. private void button3_Click(object sender, EventArgs e)
  829. {
  830. //假如不按套路出牌 直接跳到第三步 模拟第二步点击
  831. if (this.chooseStep == 1)
  832. {
  833. button2_Click(sender, e);
  834. }
  835. foreach (TreeNode item in this.treeView1.Nodes)
  836. {
  837. if (!item.Checked) {
  838. continue;
  839. }
  840. switch (item.Name) {
  841. case "1":
  842. this.checkDataList.Add("camera");
  843. break;
  844. case "2":
  845. this.checkDataList.Add("measure");
  846. break;
  847. case "3":
  848. this.checkDataList.Add("label");
  849. break;
  850. case "4":
  851. this.checkDataList.Add("toolbar");
  852. break;
  853. case "5":
  854. this.checkDataList.Add("shortcutbar");
  855. break;
  856. case "6":
  857. this.checkDataList.Add("hotkey");
  858. break;
  859. case "7":
  860. this.checkDataList.Add("reportModel");
  861. break;
  862. case "8":
  863. this.checkDataList.Add("ruler");
  864. break;
  865. case "9":
  866. this.checkDataList.Add("parameter");
  867. break;
  868. case "10":
  869. this.checkDataList.Add("scriptStep");
  870. break;
  871. case "11":
  872. this.checkDataList.Add("generalSetting");
  873. break;
  874. case "12":
  875. this.checkDataList.Add("workFlow");
  876. break;
  877. }
  878. if (item.Nodes.Count > 0)
  879. {
  880. RecursiveDataCheck(item);
  881. }
  882. }
  883. this.chooseStep = 3;
  884. InitializeUI();
  885. }
  886. /// <summary>
  887. /// 递归将所需子集选中
  888. /// </summary>
  889. /// <param name="node"></param>
  890. private void RecursiveNodeCheck(TreeNode node,int type)
  891. {
  892. switch (type) {
  893. case 4:
  894. foreach (TreeNode treeNode in node.Nodes)
  895. {
  896. if (importCheckSecondData["toolbar"].Contains(treeNode.Text)) {
  897. treeNode.Checked = true;
  898. }
  899. }
  900. break;
  901. case 10:
  902. foreach (TreeNode treeNode in node.Nodes)
  903. {
  904. if (importCheckSecondData["scriptStep"].Contains(treeNode.Text))
  905. {
  906. treeNode.Checked = true;
  907. }
  908. }
  909. break;
  910. case 12:
  911. foreach (TreeNode treeNode in node.Nodes)
  912. {
  913. if (importCheckSecondData["workFlow"].Contains(treeNode.Text))
  914. {
  915. treeNode.Checked = true;
  916. }
  917. }
  918. break;
  919. }
  920. }
  921. /// <summary>
  922. /// 递归查询子集点击
  923. /// </summary>
  924. /// <param name="node"></param>
  925. private void RecursiveDataCheck(TreeNode node)
  926. {
  927. List<string> list = new List<string>();
  928. foreach (TreeNode item in node.Nodes)
  929. {
  930. if (!item.Checked) {
  931. continue;
  932. }
  933. list.Add(item.Text);
  934. }
  935. if (list.Count > 0)
  936. {
  937. if (checkSecondData.ContainsKey(node.Name))
  938. {
  939. checkSecondData[node.Name] = list;
  940. }
  941. else {
  942. checkSecondData.Add(node.Name, list);
  943. }
  944. }
  945. }
  946. /// <summary>
  947. /// 点击上一步
  948. /// </summary>
  949. /// <param name="sender"></param>
  950. /// <param name="e"></param>
  951. private void button6_Click(object sender, EventArgs e)
  952. {
  953. switch (this.chooseStep)
  954. {
  955. case 1:
  956. break;
  957. case 2:
  958. button1.Focus();
  959. button1_Click(sender, e);
  960. break;
  961. case 3:
  962. button2.Focus();
  963. button2_Click(sender, e);
  964. break;
  965. }
  966. }
  967. /// <summary>
  968. /// 点击下一步
  969. /// </summary>
  970. /// <param name="sender"></param>
  971. /// <param name="e"></param>
  972. private void button5_Click(object sender, EventArgs e)
  973. {
  974. switch (this.chooseStep)
  975. {
  976. case 1:
  977. button2.Focus();
  978. button2_Click(sender, e);
  979. break;
  980. case 2:
  981. button3.Focus();
  982. button3_Click(sender, e);
  983. break;
  984. case 3:
  985. break;
  986. }
  987. }
  988. /// <summary>
  989. /// 获取二级数据
  990. /// </summary>
  991. private void getSonData() {
  992. #region [工具栏]
  993. ToolbarModel toolbarModel = Startup.instance.toolbarModel;
  994. foreach (var item in toolbarModel.Flows)
  995. {
  996. ProjectData sonData = new ProjectData();
  997. sonData.ProjectID = Guid.NewGuid().ToString();
  998. sonData.ProjectName = item.Name;
  999. sonData.ProjectParentID = "4";
  1000. sonData.isCheck = true;
  1001. this.toolbarModelList.Add(sonData);
  1002. }
  1003. #endregion
  1004. #region [工作流程]
  1005. WorkFlowModel workFlowModel = Startup.instance.workFlowModel;
  1006. foreach (var item in workFlowModel.Flows)
  1007. {
  1008. ProjectData sonData = new ProjectData();
  1009. sonData.ProjectID = Guid.NewGuid().ToString();
  1010. sonData.ProjectName = item.Name;
  1011. sonData.ProjectParentID = "12";
  1012. sonData.isCheck = true;
  1013. this.workFlowModelList.Add(sonData);
  1014. }
  1015. #endregion
  1016. #region [脚本]
  1017. List<mic_script> list = mic_script_BLL.FindAll();
  1018. foreach (var item in list)
  1019. {
  1020. ProjectData sonData = new ProjectData();
  1021. sonData.ProjectID = Guid.NewGuid().ToString();
  1022. sonData.ProjectName = item.name;
  1023. sonData.ProjectParentID = "10";
  1024. sonData.isCheck = true;
  1025. this.stepModelList.Add(sonData);
  1026. }
  1027. #endregion
  1028. }
  1029. /// <summary>
  1030. /// 读取树状图结构
  1031. /// </summary>
  1032. private void getTreeData()
  1033. {
  1034. string filePath = Application.StartupPath + "\\Config\\"+ Startup.instance.SettingPrefix + "\\ImportExportModel.xml";
  1035. //文件不在 生成默认文件
  1036. if (!File.Exists(filePath))
  1037. {
  1038. importExportModel = new ImportExportModel();
  1039. #region [生成实体类结构]
  1040. for (int i = 1; i <= 12; i++) {
  1041. ProjectData data = new ProjectData();
  1042. data.ProjectID = i.ToString();
  1043. #region [分别处理]
  1044. switch (i)
  1045. {
  1046. case 1:
  1047. data.ProjectName = "预览属性";
  1048. break;
  1049. case 2:
  1050. data.ProjectName = "测量属性";
  1051. break;
  1052. case 3:
  1053. data.ProjectName = "标注属性";
  1054. break;
  1055. case 4:
  1056. data.ProjectName = "工具栏";
  1057. data.sonDataList = this.toolbarModelList;
  1058. break;
  1059. case 5:
  1060. data.ProjectName = "快捷栏";
  1061. break;
  1062. case 6:
  1063. data.ProjectName = "快捷键";
  1064. break;
  1065. case 7:
  1066. data.ProjectName = "报告模板";
  1067. break;
  1068. case 8:
  1069. data.ProjectName = "比例尺";
  1070. break;
  1071. case 9:
  1072. data.ProjectName = "功能参数";
  1073. break;
  1074. case 10:
  1075. data.ProjectName = "脚本信息";
  1076. data.sonDataList = this.stepModelList;
  1077. break;
  1078. case 11:
  1079. data.ProjectName = "常规设置";
  1080. break;
  1081. case 12:
  1082. data.ProjectName = "工作流程";
  1083. data.sonDataList = this.workFlowModelList;
  1084. break;
  1085. }
  1086. #endregion
  1087. importExportModel.AllProjectList.Add(data);
  1088. }
  1089. #endregion
  1090. string importExportXml = XmlSerializeHelper.XmlSerialize(importExportModel);
  1091. FileOperationHelper.WriteStringToFile(importExportXml, filePath, FileMode.Create);
  1092. }
  1093. else {
  1094. importExportModel = XmlSerializeHelper.DESerializer<ImportExportModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  1095. //替换最新的工具栏 工作流程 脚本
  1096. foreach (var item in importExportModel.AllProjectList) {
  1097. switch (item.ProjectID) {
  1098. case "4":
  1099. item.sonDataList = toolbarModelList;
  1100. break;
  1101. case "10":
  1102. item.sonDataList = stepModelList;
  1103. break;
  1104. case "12":
  1105. item.sonDataList = workFlowModelList;
  1106. break;
  1107. }
  1108. }
  1109. }
  1110. }
  1111. /// <summary>
  1112. /// 组织树状图
  1113. /// </summary>
  1114. private void createTreeView() {
  1115. foreach (var item in importExportModel.AllProjectList)
  1116. {
  1117. TreeNode treeNode = new TreeNode();
  1118. treeNode.Text = item.ProjectName;
  1119. treeNode.Name = item.ProjectID;
  1120. #region [如果含有子集 开始递归搞起]
  1121. if (item.sonDataList != null && item.sonDataList.Count > 0) {
  1122. RecursiveDataView(treeNode, item);
  1123. }
  1124. #endregion
  1125. treeNode.Expand();
  1126. treeView1.Nodes.Add(treeNode);
  1127. }
  1128. }
  1129. private void RecursiveDataView(TreeNode node, ProjectData data) {
  1130. foreach (var item in data.sonDataList) {
  1131. TreeNode treeNode = new TreeNode();
  1132. treeNode.Text = item.ProjectName;
  1133. treeNode.Name = item.ProjectID;
  1134. if (item.sonDataList != null && item.sonDataList.Count > 0)
  1135. {
  1136. RecursiveDataView(treeNode, item);
  1137. }
  1138. node.Nodes.Add(treeNode);
  1139. }
  1140. }
  1141. /// <summary>
  1142. /// 全选
  1143. /// </summary>
  1144. /// <param name="sender"></param>
  1145. /// <param name="e"></param>
  1146. private void button9_Click(object sender, EventArgs e)
  1147. {
  1148. this.treeView1.AfterCheck -= new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1149. AllChecked();
  1150. this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1151. }
  1152. /// <summary>
  1153. /// 全不选
  1154. /// </summary>
  1155. /// <param name="sender"></param>
  1156. /// <param name="e"></param>
  1157. private void button10_Click(object sender, EventArgs e)
  1158. {
  1159. this.treeView1.AfterCheck -= new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1160. CancelAllChecked();
  1161. this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1162. }
  1163. /// <summary>
  1164. /// 节点选中
  1165. /// </summary>
  1166. /// <param name="sender"></param>
  1167. /// <param name="e"></param>
  1168. private void treeViewChecked(object sender, TreeViewEventArgs e)
  1169. {
  1170. this.treeView1.AfterCheck -= new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1171. CheckParentNode(e.Node);
  1172. if (e.Node.Nodes.Count > 0)
  1173. {
  1174. CheckAllChildNodes(e.Node, e.Node.Checked);
  1175. }
  1176. this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewChecked);
  1177. }
  1178. #region [节点选中相关方法]
  1179. /// <summary>
  1180. /// 全选
  1181. /// </summary>
  1182. private void AllChecked()
  1183. {
  1184. foreach (TreeNode e in this.treeView1.Nodes) {
  1185. e.Checked = true;
  1186. if (e.Nodes.Count > 0)
  1187. {
  1188. CheckAllChildNodes(e, true);
  1189. }
  1190. }
  1191. }
  1192. /// <summary>
  1193. /// 取消全选
  1194. /// </summary>
  1195. private void CancelAllChecked()
  1196. {
  1197. foreach (TreeNode e in this.treeView1.Nodes)
  1198. {
  1199. e.Checked = false;
  1200. if (e.Nodes.Count > 0)
  1201. {
  1202. CheckAllChildNodes(e, false);
  1203. }
  1204. }
  1205. }
  1206. /// <summary>
  1207. /// 改变所有子节点的状态
  1208. /// </summary>
  1209. /// <param name="pn"></param>
  1210. /// <param name="IsChecked"></param>
  1211. private void CheckAllChildNodes(TreeNode pn, bool IsChecked)
  1212. {
  1213. foreach (TreeNode tn in pn.Nodes)
  1214. {
  1215. tn.Checked = IsChecked;
  1216. if (tn.Nodes.Count > 0)
  1217. {
  1218. CheckAllChildNodes(tn, IsChecked);
  1219. }
  1220. }
  1221. }
  1222. /// <summary>
  1223. /// 改变父节点的选中状态,此处为所有子节点不选中时才取消父节点选中,可以根据需要修改
  1224. /// </summary>
  1225. /// <param name="curNode"></param>
  1226. private void CheckParentNode(TreeNode curNode)
  1227. {
  1228. bool bChecked = false;
  1229. if (curNode.Parent != null)
  1230. {
  1231. foreach (TreeNode node in curNode.Parent.Nodes)
  1232. {
  1233. if (node.Checked)
  1234. {
  1235. bChecked = true;
  1236. break;
  1237. }
  1238. }
  1239. if (bChecked)
  1240. {
  1241. curNode.Parent.Checked = true;
  1242. CheckParentNode(curNode.Parent);
  1243. }
  1244. else
  1245. {
  1246. curNode.Parent.Checked = false;
  1247. CheckParentNode(curNode.Parent);
  1248. }
  1249. }
  1250. }
  1251. #endregion
  1252. /// <summary>
  1253. /// 完成
  1254. /// </summary>
  1255. /// <param name="sender"></param>
  1256. /// <param name="e"></param>
  1257. private void button11_Click(object sender, EventArgs e)
  1258. {
  1259. if (radioButton1.Checked)
  1260. {
  1261. #region [开始导入]
  1262. ProgressThreadProcClass procClass = new ProgressThreadProcClass();
  1263. int itemCount = 100;
  1264. ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
  1265. System.Threading.ThreadStart copyThreadProc =
  1266. delegate ()
  1267. {
  1268. try
  1269. {
  1270. foreach (var item in originalPathDict)
  1271. {
  1272. if (!checkDataList.Contains(item.Key) || item.Key.Equals("toolbar") || item.Key.Equals("shortcutbar") || item.Key.Equals("ruler") || item.Key.Equals("scriptStep") || item.Key.Equals("workFlow"))
  1273. {
  1274. continue;
  1275. }
  1276. FileOperationHelper.CopyDirectory(importPathDict[item.Key], item.Value, true);
  1277. }
  1278. #region [快捷键特殊处理下]
  1279. if (checkDataList.Contains("hotkey"))
  1280. {
  1281. string toolBarPath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\";
  1282. string importBarPath = importPathDict["hotkey"] + "Hotkey.xml";
  1283. FileOperationHelper.CopyDirectory(importBarPath, toolBarPath, true);
  1284. }
  1285. #endregion
  1286. #region [常规设置特殊处理下]
  1287. if (checkDataList.Contains("generalSetting"))
  1288. {
  1289. string toolBarPath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\";
  1290. string importBarPath = importPathDict["generalSetting"] + "Config.xml";
  1291. FileOperationHelper.CopyDirectory(importBarPath, toolBarPath, true);
  1292. }
  1293. #endregion
  1294. #region [测量特殊处理下]
  1295. if (checkDataList.Contains("measure"))
  1296. {
  1297. string toolBarPath = originalPathDict["generalSetting"];
  1298. string importSettingPath = importPathDict["measure"] + "Config.xml";
  1299. var importNowSetting = XmlSerializeHelper.DESerializer<ConfigModel>(FileOperationHelper.ReadStringFromFile(importSettingPath, FileMode.Open));
  1300. Startup.instance.configModel.MarkpointWidth = importNowSetting.MarkpointWidth;
  1301. string toolXml = XmlSerializeHelper.XmlSerialize(Startup.instance.configModel);
  1302. FileOperationHelper.WriteStringToFile(toolXml, toolBarPath, FileMode.Create);
  1303. FileOperationHelper.DeleteFolder(originalPathDict["measure"] + "Config.xml");
  1304. }
  1305. #endregion
  1306. #region [脚本信息特殊处理下]
  1307. if (checkDataList.Contains("scriptStep")) {
  1308. string filePath = unZipTemporaryFilePath + "ScriptStep\\ScriptStep.xml";
  1309. List<mic_script> importMicScriptList = XmlSerializeHelper.DESerializer<List<mic_script>>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  1310. List<string> needImportDataList = new List<string>();
  1311. if (checkSecondData.ContainsKey("10"))
  1312. {
  1313. needImportDataList = checkSecondData["10"];
  1314. }
  1315. #region [如果覆盖 则清除数据]
  1316. if (checkBox1.Checked)
  1317. {
  1318. List<mic_script> mainList = mic_script_BLL.FindAll();
  1319. List<mic_script_step> secondList = mic_script_step_BLL.FindAll();
  1320. List<mic_script_step_param> thirdList = mic_script_step_param_BLL.FindAll();
  1321. foreach (var item in mainList)
  1322. {
  1323. mic_script_BLL.Del(item.id);
  1324. }
  1325. foreach (var item in secondList)
  1326. {
  1327. mic_script_step_BLL.Del(item.id);
  1328. }
  1329. foreach (var item in thirdList)
  1330. {
  1331. mic_script_step_param_BLL.Del(item.id);
  1332. }
  1333. }
  1334. #endregion
  1335. foreach (var item in importMicScriptList)
  1336. {
  1337. if (!needImportDataList.Contains(item.name)) {
  1338. continue;
  1339. }
  1340. mic_script script = new mic_script();
  1341. script.name = item.name;
  1342. mic_script_BLL.Add(script);
  1343. foreach (var s in item.sonList) {
  1344. mic_script_step mic_Script_Step = new mic_script_step();
  1345. mic_Script_Step.automatic = s.automatic;
  1346. mic_Script_Step.menu_id = s.menu_id;
  1347. mic_Script_Step.script_id = script.id;
  1348. mic_Script_Step.step_name = s.step_name;
  1349. mic_Script_Step.step_sort = s.step_sort;
  1350. mic_script_step_BLL.Add(mic_Script_Step);
  1351. foreach (var m in s.sonList) {
  1352. mic_script_step_param param = new mic_script_step_param();
  1353. param.param_key = m.param_key;
  1354. param.param_type = m.param_type;
  1355. param.param_value = m.param_value;
  1356. param.script_id = script.id;
  1357. param.step_id = mic_Script_Step.script_id;
  1358. param.value = m.value;
  1359. mic_script_step_param_BLL.Add(param);
  1360. }
  1361. }
  1362. }
  1363. }
  1364. #endregion
  1365. #region [快捷栏特殊处理下]
  1366. if (checkDataList.Contains("shortcutbar"))
  1367. {
  1368. string toolBarPath = originalPathDict["shortcutbar"];
  1369. var nowToolBar = XmlSerializeHelper.DESerializer<ShortcutbarModel>(FileOperationHelper.ReadStringFromFile(toolBarPath, FileMode.Open));
  1370. string importBarPath = importPathDict["shortcutbar"] + "Shortcutbar.xml";
  1371. var importToolBar = XmlSerializeHelper.DESerializer<ShortcutbarModel>(FileOperationHelper.ReadStringFromFile(importBarPath, FileMode.Open));
  1372. if (checkBox1.Checked)
  1373. {
  1374. nowToolBar = importToolBar;
  1375. }
  1376. else
  1377. {
  1378. foreach (var item in importToolBar.Menus)
  1379. {
  1380. nowToolBar.Menus.Add(item);
  1381. }
  1382. }
  1383. Startup.instance.shortcutbarModel = nowToolBar;
  1384. string toolXml = XmlSerializeHelper.XmlSerialize(nowToolBar);
  1385. FileOperationHelper.WriteStringToFile(toolXml, toolBarPath, FileMode.Create);
  1386. }
  1387. #endregion
  1388. #region [标尺特殊处理下]
  1389. if (checkDataList.Contains("ruler"))
  1390. {
  1391. string filePath = unZipTemporaryFilePath + "Ruler\\Ruler.xml";
  1392. List<mic_rulers> importRulerList = XmlSerializeHelper.DESerializer<List<mic_rulers>>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  1393. List<mic_rulers> allRulerList = mic_rulers_BLL.FindAll();
  1394. if (checkBox1.Checked) {
  1395. foreach (var item in allRulerList) {
  1396. mic_rulers_BLL.Del(item.id);
  1397. }
  1398. }
  1399. foreach (var item in importRulerList)
  1400. {
  1401. mic_rulers rulers = new mic_rulers();
  1402. rulers.gain_multiple = item.gain_multiple;
  1403. rulers.microscope = item.objective_lens;
  1404. rulers.physical_length = item.physical_length;
  1405. rulers.objective_lens = item.objective_lens;
  1406. rulers.pixel_length = item.pixel_length;
  1407. rulers.ruler_camera = item.ruler_camera;
  1408. rulers.ruler_connector = item.ruler_connector;
  1409. rulers.ruler_eyepiece = item.ruler_eyepiece;
  1410. rulers.ruler_height = item.ruler_height;
  1411. rulers.ruler_name = item.ruler_name;
  1412. rulers.ruler_type = item.ruler_type;
  1413. rulers.ruler_units = item.ruler_units;
  1414. rulers.ruler_width = item.ruler_width;
  1415. rulers.ruler_zoom = item.ruler_zoom;
  1416. mic_rulers_BLL.Add(rulers);
  1417. }
  1418. }
  1419. #endregion
  1420. #region [工具栏特殊处理下]
  1421. if (checkDataList.Contains("toolbar")) {
  1422. string toolBarPath = originalPathDict["toolbar"];
  1423. var nowToolBar = XmlSerializeHelper.DESerializer<ToolbarModel>(FileOperationHelper.ReadStringFromFile(toolBarPath, FileMode.Open));
  1424. string importBarPath = importPathDict["toolbar"] + "Toolbar.xml";
  1425. var importToolBar = XmlSerializeHelper.DESerializer<ToolbarModel>(FileOperationHelper.ReadStringFromFile(importBarPath, FileMode.Open));
  1426. #region [如果覆盖 则清除数据]
  1427. List<ToolbarModel.Flow> list = new List<ToolbarModel.Flow>();
  1428. foreach (var item in importToolBar.Flows)
  1429. {
  1430. if (checkSecondData["4"].Contains(item.Name))
  1431. {
  1432. continue;
  1433. }
  1434. list.Add(item);
  1435. }
  1436. foreach (var item in list)
  1437. {
  1438. importToolBar.Flows.Remove(item);
  1439. }
  1440. if (checkBox1.Checked)
  1441. {
  1442. nowToolBar = importToolBar;
  1443. }
  1444. else {
  1445. foreach (var item in importToolBar.Flows)
  1446. {
  1447. nowToolBar.Flows.Add(item);
  1448. }
  1449. }
  1450. #endregion
  1451. Startup.instance.toolbarModel = nowToolBar;
  1452. string toolXml = XmlSerializeHelper.XmlSerialize(nowToolBar);
  1453. FileOperationHelper.WriteStringToFile(toolXml, toolBarPath, FileMode.Create);
  1454. }
  1455. #endregion
  1456. #region [工作流程特殊处理下]
  1457. if (checkDataList.Contains("workFlow"))
  1458. {
  1459. string filePath = originalPathDict["workFlow"];
  1460. var workFlowModel = XmlSerializeHelper.DESerializer<WorkFlowModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  1461. string importWorkFlowPath = importPathDict["workFlow"] + "WorkFlow.xml";
  1462. var importWorkFlow = XmlSerializeHelper.DESerializer<WorkFlowModel>(FileOperationHelper.ReadStringFromFile(importWorkFlowPath, FileMode.Open));
  1463. #region [[如果覆盖 则清除数据]
  1464. List<WorkFlowModel.Flow> list = new List<WorkFlowModel.Flow>();
  1465. foreach (var item in importWorkFlow.Flows)
  1466. {
  1467. if (checkSecondData["12"].Contains(item.Name))
  1468. {
  1469. continue;
  1470. }
  1471. list.Add(item);
  1472. }
  1473. foreach (var item in list)
  1474. {
  1475. importWorkFlow.Flows.Remove(item);
  1476. }
  1477. if (checkBox1.Checked)
  1478. {
  1479. workFlowModel = importWorkFlow;
  1480. }
  1481. else {
  1482. foreach (var item in importWorkFlow.Flows)
  1483. {
  1484. workFlowModel.Flows.Add(item);
  1485. }
  1486. }
  1487. #endregion
  1488. string workFlowModelXml = XmlSerializeHelper.XmlSerialize(workFlowModel);
  1489. FileOperationHelper.WriteStringToFile(workFlowModelXml, filePath, FileMode.Create);
  1490. }
  1491. #endregion
  1492. if (checkDataList.Contains("parameter"))
  1493. {
  1494. //晶粒度单独处理下
  1495. string GrainSizePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\";
  1496. FileOperationHelper.CopyDirectory(importPathDict["parameter"] + "\\GrainSizeAnalysisModel.xml", GrainSizePath, true);
  1497. }
  1498. if (checkDataList.Contains("generalSetting"))
  1499. {
  1500. //常规设置需要单独处理下
  1501. string userInfoFilePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\";
  1502. FileOperationHelper.CopyDirectory(importPathDict["generalSetting"] + "\\UserInfo.xml", userInfoFilePath, true);
  1503. string setUpFilePath = Application.StartupPath + @"\Config\" + Startup.instance.SettingPrefix + @"\SetUp\";
  1504. FileOperationHelper.CopyDirectory(importPathDict["generalSetting"] + "\\GuideStyle.xml", setUpFilePath, true);
  1505. }
  1506. }
  1507. catch (Exception ex)
  1508. {
  1509. }
  1510. finally
  1511. {
  1512. progressEvents.EndOperation(OperationResult.Finished);
  1513. }
  1514. };
  1515. procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
  1516. MessageBox.Show("导入成功,请重启软件!");
  1517. #endregion
  1518. }
  1519. else if (radioButton2.Checked) {
  1520. #region [开始导出]
  1521. if (string.IsNullOrEmpty(textBox2.Text))
  1522. {
  1523. MessageBox.Show("请先选择要导出文件的路径!");
  1524. return;
  1525. }
  1526. ProgressThreadProcClass procClass = new ProgressThreadProcClass();
  1527. int itemCount = 100;
  1528. ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
  1529. System.Threading.ThreadStart copyThreadProc =
  1530. delegate ()
  1531. {
  1532. try
  1533. {
  1534. string choosePath = this.textBox2.Text;
  1535. foreach (var item in originalPathDict)
  1536. {
  1537. if (!checkDataList.Contains(item.Key))
  1538. {
  1539. continue;
  1540. }
  1541. FileOperationHelper.CopyDirectory(item.Value, newPathDict[item.Key], false);
  1542. }
  1543. #region [脚本信息特殊处理]
  1544. if (checkDataList.Contains("scriptStep"))
  1545. {
  1546. List<mic_script> mainList = mic_script_BLL.FindAll();
  1547. List<mic_script_step> secondList = mic_script_step_BLL.FindAll();
  1548. List<mic_script_step_param> thirdList = mic_script_step_param_BLL.FindAll();
  1549. if (checkSecondData.ContainsKey("10")) {
  1550. List<string> hasDataList = checkSecondData["10"];
  1551. List<mic_script> shouldExportDataList = new List<mic_script>();
  1552. foreach (var item in mainList)
  1553. {
  1554. if (!hasDataList.Contains(item.name)) {
  1555. continue;
  1556. }
  1557. var mic = item;
  1558. mic.sonList = secondList.Where(m => m.script_id == mic.id).ToList();
  1559. foreach (var s in mic.sonList) {
  1560. s.sonList = thirdList.Where(m => m.script_id == mic.id && m.step_id == s.id).ToList();
  1561. }
  1562. shouldExportDataList.Add(mic);
  1563. }
  1564. string scriptExportXml = XmlSerializeHelper.XmlSerialize(shouldExportDataList);
  1565. FileOperationHelper.WriteStringToFile(scriptExportXml, newPathDict["scriptStep"] + "ScriptStep.xml", FileMode.Create);
  1566. }
  1567. }
  1568. #endregion
  1569. #region [标尺信息特殊处理]
  1570. if (checkDataList.Contains("ruler"))
  1571. {
  1572. List<mic_rulers> mainList = mic_rulers_BLL.FindAll();
  1573. string scriptExportXml = XmlSerializeHelper.XmlSerialize(mainList);
  1574. FileOperationHelper.WriteStringToFile(scriptExportXml, newPathDict["ruler"] + "Ruler.xml", FileMode.Create);
  1575. }
  1576. #endregion
  1577. #region [获取二级数据]
  1578. if (checkSecondData.ContainsKey("4"))
  1579. {
  1580. var toolbarModel = XmlSerializeHelper.DESerializer<ToolbarModel>(FileOperationHelper.ReadStringFromFile(newPathDict["toolbar"] + "\\Toolbar.xml", FileMode.Open));
  1581. List<ToolbarModel.Flow> list = new List<ToolbarModel.Flow>();
  1582. foreach (var item in toolbarModel.Flows)
  1583. {
  1584. if (checkSecondData["4"].Contains(item.Name))
  1585. {
  1586. continue;
  1587. }
  1588. list.Add(item);
  1589. }
  1590. foreach (var item in list)
  1591. {
  1592. toolbarModel.Flows.Remove(item);
  1593. }
  1594. string toolbarModelXml = XmlSerializeHelper.XmlSerialize(toolbarModel);
  1595. FileOperationHelper.WriteStringToFile(toolbarModelXml, newPathDict["toolbar"] + "\\Toolbar.xml", FileMode.Create);
  1596. }
  1597. if (checkSecondData.ContainsKey("12"))
  1598. {
  1599. var workFlowModel = XmlSerializeHelper.DESerializer<WorkFlowModel>(FileOperationHelper.ReadStringFromFile(newPathDict["workFlow"] + "\\WorkFlow.xml", FileMode.Open));
  1600. List<WorkFlowModel.Flow> list = new List<WorkFlowModel.Flow>();
  1601. foreach (var item in workFlowModel.Flows)
  1602. {
  1603. if (checkSecondData["12"].Contains(item.Name))
  1604. {
  1605. continue;
  1606. }
  1607. list.Add(item);
  1608. }
  1609. foreach (var item in list)
  1610. {
  1611. workFlowModel.Flows.Remove(item);
  1612. }
  1613. string workFlowModelXml = XmlSerializeHelper.XmlSerialize(workFlowModel);
  1614. FileOperationHelper.WriteStringToFile(workFlowModelXml, newPathDict["workFlow"] + "\\WorkFlow.xml", FileMode.Create);
  1615. }
  1616. #endregion
  1617. if (checkDataList.Contains("measure"))
  1618. {
  1619. //测量标记点单独处理下
  1620. string pointPath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml";
  1621. FileOperationHelper.CopyDirectory(pointPath, newPathDict["measure"], false);
  1622. }
  1623. if (checkDataList.Contains("parameter"))
  1624. {
  1625. //晶粒度单独处理下
  1626. string GrainSizePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  1627. FileOperationHelper.CopyDirectory(GrainSizePath, newPathDict["parameter"], true);
  1628. }
  1629. if (checkDataList.Contains("generalSetting"))
  1630. {
  1631. //常规设置需要单独处理下
  1632. string userInfoFilePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\UserInfo.xml";
  1633. FileOperationHelper.CopyDirectory(userInfoFilePath, newPathDict["generalSetting"], true);
  1634. string setUpFilePath = Application.StartupPath + @"\Config\" + Startup.instance.SettingPrefix + @"\SetUp\GuideStyle.xml";
  1635. FileOperationHelper.CopyDirectory(setUpFilePath, newPathDict["generalSetting"], true);
  1636. }
  1637. ZipHandleHelper.createZip(temporaryFilePath, choosePath);
  1638. }
  1639. catch (Exception)
  1640. {
  1641. }
  1642. finally
  1643. {
  1644. progressEvents.EndOperation(OperationResult.Finished);
  1645. }
  1646. };
  1647. procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
  1648. MessageBox.Show("导出成功!");
  1649. #endregion
  1650. }
  1651. this.Close();
  1652. }
  1653. /// <summary>
  1654. /// 生成默认的中间数据文件夹
  1655. /// </summary>
  1656. private void createDefaultDirectory() {
  1657. //生成一个临时文件夹 用于存放各种xml
  1658. //先删除之前的
  1659. FileOperationHelper.DeleteFolder(unZipTemporaryFilePath);
  1660. FileOperationHelper.DeleteFolder(temporaryFilePath);
  1661. //生成新的
  1662. Directory.CreateDirectory(temporaryFilePath);
  1663. #region [相机设置]
  1664. string cameraFilePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\CameraParam\\";
  1665. string temporaryCameraFilePath = $"{temporaryFilePath}\\CameraParam\\";
  1666. Directory.CreateDirectory(temporaryCameraFilePath);
  1667. originalPathDict.Add("camera", cameraFilePath);
  1668. newPathDict.Add("camera", temporaryCameraFilePath);
  1669. string importTemporaryCameraFilePath = $"{unZipTemporaryFilePath}\\CameraParam\\";
  1670. importPathDict.Add("camera", importTemporaryCameraFilePath);
  1671. #endregion
  1672. #region [测量参数]
  1673. string measure = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Measure\\";
  1674. string temporaryMeasureFilePath = $"{temporaryFilePath}\\Measure\\";
  1675. Directory.CreateDirectory(temporaryMeasureFilePath);
  1676. originalPathDict.Add("measure", measure);
  1677. newPathDict.Add("measure", temporaryMeasureFilePath);
  1678. string importTemporaryMeasureFilePath = $"{unZipTemporaryFilePath}\\Measure\\";
  1679. importPathDict.Add("measure", importTemporaryMeasureFilePath);
  1680. #endregion
  1681. #region [标注参数]
  1682. string label = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\";
  1683. string temporaryLabelFilePath = $"{temporaryFilePath}\\Label\\";
  1684. Directory.CreateDirectory(temporaryLabelFilePath);
  1685. originalPathDict.Add("label", label);
  1686. newPathDict.Add("label", temporaryLabelFilePath);
  1687. string importTemporaryLabelFilePath = $"{unZipTemporaryFilePath}\\Label\\";
  1688. importPathDict.Add("label", importTemporaryLabelFilePath);
  1689. #endregion
  1690. #region [工具栏]
  1691. string toolbar = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Toolbar.xml";
  1692. string temporaryToolbarFilePath = $"{temporaryFilePath}\\Toolbar\\";
  1693. Directory.CreateDirectory(temporaryToolbarFilePath);
  1694. originalPathDict.Add("toolbar", toolbar);
  1695. newPathDict.Add("toolbar", temporaryToolbarFilePath);
  1696. string importTemporaryToolbarFilePath = $"{unZipTemporaryFilePath}\\Toolbar\\";
  1697. importPathDict.Add("toolbar", importTemporaryToolbarFilePath);
  1698. #endregion
  1699. #region [快捷栏]
  1700. string shortcutbar = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Shortcutbar.xml";
  1701. string temporaryShortcutbarFilePath = $"{temporaryFilePath}\\Shortcutbar\\";
  1702. Directory.CreateDirectory(temporaryShortcutbarFilePath);
  1703. originalPathDict.Add("shortcutbar", shortcutbar);
  1704. newPathDict.Add("shortcutbar", temporaryShortcutbarFilePath);
  1705. string importTemporaryShortcutbarFilePath = $"{unZipTemporaryFilePath}\\Shortcutbar\\";
  1706. importPathDict.Add("shortcutbar", importTemporaryShortcutbarFilePath);
  1707. #endregion
  1708. #region [快捷键]
  1709. string hotkey = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Hotkey.xml";
  1710. string temporaryHotkeyFilePath = $"{temporaryFilePath}\\Hotkey\\";
  1711. Directory.CreateDirectory(temporaryHotkeyFilePath);
  1712. originalPathDict.Add("hotkey", hotkey);
  1713. newPathDict.Add("hotkey", temporaryHotkeyFilePath);
  1714. string importTemporaryHotkeyFilePath = $"{unZipTemporaryFilePath}\\Hotkey\\";
  1715. importPathDict.Add("hotkey", importTemporaryHotkeyFilePath);
  1716. #endregion
  1717. #region [报告模板]
  1718. string reportModel = Application.StartupPath + "\\ModuleManage\\";
  1719. string temporaryReportModelPath = $"{temporaryFilePath}\\ModuleManage\\";
  1720. Directory.CreateDirectory(temporaryReportModelPath);
  1721. originalPathDict.Add("reportModel", reportModel);
  1722. newPathDict.Add("reportModel", temporaryReportModelPath);
  1723. string importTemporaryReportModelPath = $"{unZipTemporaryFilePath}\\ModuleManage\\";
  1724. importPathDict.Add("reportModel", importTemporaryReportModelPath);
  1725. #endregion
  1726. #region [比例尺]
  1727. string temporaryRulerFilePath = $"{temporaryFilePath}\\Ruler\\";
  1728. Directory.CreateDirectory(temporaryRulerFilePath);
  1729. newPathDict.Add("ruler", temporaryRulerFilePath);
  1730. string importTemporaryRulerFilePath = $"{unZipTemporaryFilePath}\\Ruler\\";
  1731. importPathDict.Add("ruler", importTemporaryRulerFilePath);
  1732. #endregion
  1733. #region [功能参数]
  1734. string parameter = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\";
  1735. string temporaryParameterFilePath = $"{temporaryFilePath}\\ParameterSaving\\";
  1736. Directory.CreateDirectory(temporaryParameterFilePath);
  1737. originalPathDict.Add("parameter", parameter);
  1738. newPathDict.Add("parameter", temporaryParameterFilePath);
  1739. string importTemporaryParameterFilePath = $"{unZipTemporaryFilePath}\\ParameterSaving\\";
  1740. importPathDict.Add("parameter", importTemporaryParameterFilePath);
  1741. #endregion
  1742. #region [脚本信息]
  1743. string temporaryScriptStepPath = $"{temporaryFilePath}\\ScriptStep\\";
  1744. Directory.CreateDirectory(temporaryScriptStepPath);
  1745. newPathDict.Add("scriptStep", temporaryScriptStepPath);
  1746. string importTemporaryScriptStepPath = $"{temporaryScriptStepPath}\\ScriptStep\\";
  1747. importPathDict.Add("scriptStep", importTemporaryScriptStepPath);
  1748. #endregion
  1749. #region [常规设置]
  1750. string generalSetting = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml";
  1751. string temporaryGeneralSettingPath = $"{temporaryFilePath}\\Config\\";
  1752. Directory.CreateDirectory(temporaryGeneralSettingPath);
  1753. originalPathDict.Add("generalSetting", generalSetting);
  1754. newPathDict.Add("generalSetting", temporaryGeneralSettingPath);
  1755. string importTemporaryGeneralSettingPath = $"{unZipTemporaryFilePath}\\Config\\";
  1756. importPathDict.Add("generalSetting", importTemporaryGeneralSettingPath);
  1757. #endregion
  1758. #region [工作流程]
  1759. string workFlow = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkFlow.xml";
  1760. string temporaryWorkFlowPath = $"{temporaryFilePath}\\WorkFlow\\";
  1761. Directory.CreateDirectory(temporaryWorkFlowPath);
  1762. originalPathDict.Add("workFlow", workFlow);
  1763. newPathDict.Add("workFlow", temporaryWorkFlowPath);
  1764. string importTemporaryWorkFlowPath = $"{unZipTemporaryFilePath}\\WorkFlow\\";
  1765. importPathDict.Add("workFlow", importTemporaryWorkFlowPath);
  1766. #endregion
  1767. }
  1768. }
  1769. }