From: <du...@us...> - 2007-02-20 19:42:00
|
Revision: 127 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=127&view=rev Author: dukus Date: 2007-02-20 11:41:57 -0800 (Tue, 20 Feb 2007) Log Message: ----------- Wizard added Modified Paths: -------------- trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs trunk/plugins/mpinstaler/MPInstaler/MPpackageStruct.cs trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.Designer.cs trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs trunk/plugins/mpinstaler/MPInstaler.suo Modified: trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-02-19 16:06:40 UTC (rev 126) +++ trunk/plugins/mpinstaler/MPInstaler/MPinstalerStruct.cs 2007-02-20 19:41:57 UTC (rev 127) @@ -206,6 +206,7 @@ { XmlDocument doc = new XmlDocument(); doc.Load(fil); + FileList.Clear(); XmlNode ver = doc.DocumentElement.SelectSingleNode("/MPinstaler"); XmlNodeList fileList = ver.SelectNodes("FileList/File"); foreach (XmlNode nodefile in fileList) @@ -225,6 +226,19 @@ this.Version = nodeoption.SelectSingleNode("Version").InnerText; } + + public MPIFileList FindList(string typ, string stpy) + { + MPIFileList fs=new MPIFileList(); + for (int i = 0; i < FileList.Count; i++) + { + if ((((MPIFileList)FileList[i]).Type == typ) && (((MPIFileList)FileList[i]).SubType == stpy)) + { + fs = (MPIFileList)FileList[i]; + } + } + return fs; + } public string GetZipEntry(MPIFileList flst) { @@ -281,7 +295,16 @@ string _SubType = string.Empty; string _Id = string.Empty; string _Op = string.Empty; - + + public MPIFileList() + { + FileName = String.Empty;; + Type = String.Empty; + SubType = String.Empty; + ID = String.Empty; + Option = String.Empty; + } + public MPIFileList(string fn, string ty, string sty, string i) { FileName = fn; Modified: trunk/plugins/mpinstaler/MPInstaler/MPpackageStruct.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/MPpackageStruct.cs 2007-02-19 16:06:40 UTC (rev 126) +++ trunk/plugins/mpinstaler/MPInstaler/MPpackageStruct.cs 2007-02-20 19:41:57 UTC (rev 127) @@ -9,17 +9,74 @@ public class MPpackageStruct { public MPinstalerStruct _intalerStruct= new MPinstalerStruct(); + public string FileName = String.Empty; + public string txt_EULA = String.Empty; + public string txt_log = String.Empty; + public string txt_readme = String.Empty; public bool isValid = false; public MPpackageStruct() { + txt_EULA = String.Empty; + txt_log = String.Empty; + txt_readme = String.Empty; } + public void load() + { + if (isValid) + { + byte[] data = new byte[2048]; + int nb = data.Length; + ZipEntry entry; + try + { + if (File.Exists(FileName)) + { + ZipInputStream s = new ZipInputStream(File.OpenRead(FileName)); + while ((entry = s.GetNextEntry()) != null) + { + if (Path.GetFileName(entry.Name) == Path.GetFileName(_intalerStruct.FindList(MPinstalerStruct.TEXT_TYPE,MPinstalerStruct.TEXT_EULA_TYPE).FileName)) + { + txt_EULA = String.Empty; + while ((nb = s.Read(data, 0, data.Length)) > 0) + { + txt_EULA += new ASCIIEncoding().GetString(data, 0, data.Length); + } + } + if (Path.GetFileName(entry.Name) == Path.GetFileName(_intalerStruct.FindList(MPinstalerStruct.TEXT_TYPE, MPinstalerStruct.TEXT_LOG_TYPE).FileName)) + { + txt_log = String.Empty; + while ((nb = s.Read(data, 0, data.Length)) > 0) + { + txt_log += new ASCIIEncoding().GetString(data, 0, data.Length); + } + } + if (Path.GetFileName(entry.Name) == Path.GetFileName(_intalerStruct.FindList(MPinstalerStruct.TEXT_TYPE, MPinstalerStruct.TEXT_README_TYPE).FileName)) + { + txt_readme = String.Empty; + while ((nb = s.Read(data, 0, data.Length)) > 0) + { + txt_readme += new ASCIIEncoding().GetString(data, 0, data.Length); + } + } + + } + s.Close(); + } + } + catch (Exception) + { + } + } + } + + public void LoadFromFile(string fil) { + FileName = fil; byte[] data = new byte[2048]; int nb = data.Length; - ZipEntry entry; try { @@ -36,13 +93,13 @@ while ((nb = s.Read(data, 0, data.Length)) > 0) { fs.Write(data, 0, nb); - //progressBar.Value = +nb; } fs.Close(); _intalerStruct.LoadFromFile(tpf); } } s.Close(); + load(); } } catch (Exception) Modified: trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.Designer.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.Designer.cs 2007-02-19 16:06:40 UTC (rev 126) +++ trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.Designer.cs 2007-02-20 19:41:57 UTC (rev 127) @@ -35,6 +35,10 @@ this.button_back = new System.Windows.Forms.Button(); this.button_next = new System.Windows.Forms.Button(); this.button_cancel = new System.Windows.Forms.Button(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.title_label = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); @@ -42,6 +46,9 @@ // panel1 // this.panel1.BackColor = System.Drawing.Color.White; + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.title_label); + this.panel1.Controls.Add(this.richTextBox1); this.panel1.Location = new System.Drawing.Point(165, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(334, 298); @@ -83,6 +90,7 @@ this.button_next.TabIndex = 3; this.button_next.Text = "Next >"; this.button_next.UseVisualStyleBackColor = true; + this.button_next.Click += new System.EventHandler(this.button_next_Click); // // button_cancel // @@ -93,6 +101,35 @@ this.button_cancel.Text = "Cancel"; this.button_cancel.UseVisualStyleBackColor = true; // + // richTextBox1 + // + this.richTextBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText; + this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richTextBox1.Location = new System.Drawing.Point(3, 74); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.ReadOnly = true; + this.richTextBox1.Size = new System.Drawing.Size(331, 224); + this.richTextBox1.TabIndex = 0; + this.richTextBox1.Text = ""; + // + // title_label + // + this.title_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.title_label.Location = new System.Drawing.Point(9, 9); + this.title_label.Name = "title_label"; + this.title_label.Size = new System.Drawing.Size(313, 30); + this.title_label.TabIndex = 1; + this.title_label.Text = "label1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 49); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.TabIndex = 2; + this.label2.Text = "label2"; + // // wizard_1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -109,6 +146,8 @@ this.Name = "wizard_1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "wizard_1"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); @@ -123,5 +162,8 @@ private System.Windows.Forms.Button button_next; private System.Windows.Forms.Button button_cancel; private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label title_label; + private System.Windows.Forms.RichTextBox richTextBox1; } } \ No newline at end of file Modified: trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs =================================================================== --- trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs 2007-02-19 16:06:40 UTC (rev 126) +++ trunk/plugins/mpinstaler/MPInstaler/wizard/wizard_1.cs 2007-02-20 19:41:57 UTC (rev 127) @@ -17,16 +17,107 @@ package = new MPpackageStruct(); InitializeComponent(); } + public void nextStep() { + step++; + test_next_step(); switch (step) { - case 0: + case 1: { + this.Text = "MediaPortal extension instaler"; + button_back.Visible = false; + title_label.Text = package._intalerStruct.Name; + label2.Visible = false; + richTextBox1.Text = String.Format(" Name : {0} \n\n Author : {1} \n\n Version : {2}", package._intalerStruct.Name,package._intalerStruct.Author,package._intalerStruct.Version); this.ShowDialog(); break; } + case 2: + { + label2.Visible = true; + label2.Text = "License Agreement"; + button_next.Text = "I Agree"; + button_back.Visible = true; + richTextBox1.Text = package.txt_EULA; + break; + } + case 3: + { + label2.Visible = true; + label2.Text = "Change log"; + button_next.Text = "Next"; + button_back.Visible = true; + richTextBox1.Text = package.txt_log; + break; + } + case 4: + { + label2.Visible = true; + label2.Text = "Read me"; + button_back.Visible = true; + richTextBox1.Text = package.txt_readme; + break; + } + case 5: + { + label2.Visible = true; + label2.Text = "Instaling ..."; + button_next.Text = "Next"; + button_back.Visible = true; + richTextBox1.Text = ""; + break; + } + case 6: + { + label2.Visible = true; + label2.Text = "Instaling ..."; + button_next.Visible = false; + button_back.Visible = true; + richTextBox1.Text = ""; + richTextBox1.Visible = false; + break; + } + } } + + private void test_next_step() + { + switch (step) + { + case 1: + break; + case 2: + if (String.IsNullOrEmpty(package.txt_EULA)) + { + step++; + test_step(); + } + break; + case 3: + if (String.IsNullOrEmpty(package.txt_log)) + { + step++; + test_step(); + } + break; + case 4: + if (String.IsNullOrEmpty(package.txt_readme)) + { + step++; + test_step(); + } + break; + default: + break; + } + } + + private void button_next_Click(object sender, EventArgs e) + { + nextStep(); + } } } \ No newline at end of file Modified: trunk/plugins/mpinstaler/MPInstaler.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |