public static String ZipFile(String sourcePath, String destinationPath, String zippedFilename, String rawFilename_Ext, String password) { String ZIP_File_Created_Successfully = "True"; try { ZipForge ZipForge1 = new ZipForge(); ZipForge1.FileName = destinationPath + @"\" + zippedFilename + ".zip"; // Create a new archive file ZipForge1.OpenArchive(FileMode.Create); if (password != "") { ZipForge1.Password = password; } // Set path to folder with the files to archive ZipForge1.BaseDir = sourcePath; // Add all files and directories from the source folder to the archive ZipForge1.AddFiles(rawFilename_Ext); ZipForge1.CloseArchive(); } catch (Exception zipEx) { ZIP_File_Created_Successfully = zipEx.Message.ToString(); } return(ZIP_File_Created_Successfully); }
public static Boolean UnZipFile(string fileName_Ext, string filesDestination) { Boolean unZipStatus = true; ZipForge archiver = new ZipForge(); try { // The name of the ZIP file to unzip archiver.FileName = fileName_Ext; // Open an existing archive archiver.OpenArchive(System.IO.FileMode.Open); // Default path for all operations archiver.BaseDir = filesDestination; // Extract all files from the archive to C:\Temp folder archiver.ExtractFiles("*.*"); // Close archive archiver.CloseArchive(); } // Catch all exceptions of the ArchiverException type catch (ArchiverException ae) { unZipStatus = false; } return(unZipStatus); }
/// <summary> /// Распаковка архива /// </summary> public static void RaspakovkaArhiva() { ZipForge archiver = new ZipForge(); NoVisiblePapka(); try { archiver.FileName = @"C:\test.zip"; //Необходимый файл archiver.OpenArchive(System.IO.FileMode.Open); //Указываем что хотим сделать // archiver.BaseDir = pathArhiv; //Папка куда распаковать archiver.BaseDir = pathArhivHille; //Папка куда распаковать //archiver.BaseDir = @"C:\1"; //Папка куда распаковать // archiver.ExtractFiles("*.exe"); //Распаковываем *.exe // archiver.ExtractFiles("*.dll"); //Распаковываем *.dll archiver.ExtractFiles("*.*"); //archiver.BaseDir = @"D:\"; // archiver.ExtractFiles("*.txt"); //Распаковываем *.txt но можем и просто файл archiver.ExtractFiles("test"); //Распаковываем папку archiver.CloseArchive(); Console.WriteLine("Архив разохвивирован"); } // Catch all exceptions of the ArchiverException type catch (ArchiverException ae) { Console.WriteLine("Message: {0}\t Ошибка при архивации: {1}", ae.Message, ae.ErrorCode); Console.ReadLine(); } }
/// <summary> /// запуск архивирования с настройками по умолчанию /// </summary> public static void Checet() { // Create an instance of the ZipForge class ZipForge archiver = new ZipForge(); try { archiver.FileName = @"C:\test.zip"; //Куда сохранить файл результата сжатия archiver.OpenArchive(System.IO.FileMode.Create); //Настраиваем дллку на работу с новым архивом archiver.BaseDir = @"C:\123"; //Папка где лежат все файлы для взятия // archiver.AddFiles("*.exe"); //Берём все файлы с расширением exe // archiver.AddFiles("*.dll"); //archiver.AddFiles("*.jpg"); archiver.AddFiles("*.*"); // archiver.BaseDir = @"D:\"; // archiver.AddFiles(@"d:\file.txt"); //Добавим один файл // archiver.AddFiles(@"d:\Test"); //Запакуем ещё и папку archiver.CloseArchive(); //Закрываем архив } //Ловим ошибки catch (ArchiverException ae) { Console.WriteLine("Message: {0}\t Произошла ошибка: {1}", ae.Message, ae.ErrorCode); Console.ReadLine(); } Console.WriteLine("Процес архивирования завершен....\t\n"); }
private void button3_Click( object sender, EventArgs e ) { OFD.Filter = "Varocal Package File (*.vpak)|*.vpak|Anyfile (*.*)|*.*"; if ( OFD.ShowDialog( ) == System.Windows.Forms.DialogResult.OK ) { var v = new ZipForge( ); v.FileName = OFD.FileName; v.OpenArchive( System.IO.FileMode.Open ); v.BaseDir = Path.GetFullPath( "pkgcmp" ); v.ExtractFiles( "*.*" ); new Thread( new ThreadStart( ( ) => { new PackageInstallation( "pkgcmp" ).ShowDialog( ); this.BeginInvoke( new MethodInvoker( ( ) => { ChooseReference_Load( null, null ); } ) ); } ) ).Start( ); } }
static void TestUnzip() { ZipForge archiver = new ZipForge(); try { // The name of the ZIP file to unzip archiver.FileName = @"C:\Users\charl\source\repos\ConsoleApp3\bin\Debug\output\AdvEvent.txt.zip"; // Open an existing archive archiver.OpenArchive(System.IO.FileMode.Open); // Default path for all operations archiver.BaseDir = @"D:\Temp"; // Extract all files from the archive to C:\Temp folder archiver.ExtractFiles("*.*"); // Close archive archiver.CloseArchive(); } // Catch all exceptions of the ArchiverException type catch (ArchiverException ae) { Console.WriteLine("Message: {0}\t Error code: {1}", ae.Message, ae.ErrorCode); } }
private void installPackageToolStripMenuItem_Click( object sender, EventArgs e ) { OFD.Filter = "Varocal Package File (*.vpak)|*.vpak|Anyfile (*.*)|*.*"; if ( OFD.ShowDialog( )==System.Windows.Forms.DialogResult.OK ) { var v = new ZipForge( ); v.FileName = OFD.FileName; v.OpenArchive( System.IO.FileMode.Open ); v.BaseDir = Path.GetFullPath( "pkgcmp" ); v.ExtractFiles("*.*"); new Thread( new ThreadStart( ( ) => { new PackageInstallation( "pkgcmp" ).ShowDialog( ); } ) ).Start( ); } }
private void buildProjectToolStripMenuItem1_Click( object sender, EventArgs e ) { DateTime dt = DateTime.Now; TreeNode project = null; if ( _TabControl1.Items.Count == 0 ) { if ( treeView1.Nodes.Count == 0 ) { MessageBox.Show( this,"To build one you should open a project (See File->Open or File->New)" ); return; } project = treeView1.Nodes[ 0 ]; } else { _TabControl1.Invalidate( ); foreach ( TreeNode node in treeView1.Nodes ) if ( _TabControl1.SelectedItem.Tag is string ) { if ( ( _TabControl1.SelectedItem.Tag as string ).Contains( node.Tag as string ) ) { project = node; break; } } else if ( _TabControl1.SelectedItem.Controls[ 0 ] is FormProperties ) { if ( ( ( ( FormProperties )_TabControl1.SelectedItem.Controls[ 0 ] ).Path ).Contains( node.Tag as string ) ) { project = node; break; } } if ( project == null ) { MessageBox.Show( this,"To build one you should open a project (See File->Open or File->New)" ); return; } FormProperties fp = default( FormProperties ); bool setted = false; foreach ( FATabStripItem item in _TabControl1.items ) { if ( item.Controls[ 0 ] is FormProperties && !setted ) { if ( ( ( ( FormProperties )item.Controls[ 0 ] ).Path ).StartsWith( project.Tag as string ) ) { fp = ( FormProperties )item.Controls[ 0 ]; setted = true; } } SaveTab( item ); } if ( !setted ) fp = new FormProperties( Path.Combine( project.Tag as string, "projectdata.dat" ) ); fp.ver_3.Value += 1; fp.MemoryCore.Save( Path.Combine( project.Tag as string, "projectdata.dat" ) ); try { ( ( FATabStripItem )fp.Parent ).Saved = true; } catch { } } List<TreeNode> ls = new List<TreeNode>( ); ls.Add( project ); BuildResult result = null; FormProperties prop = new FormProperties( Path.Combine( project.Tag as string, "projectdata.dat" ) ); Package package = new Package( ); string cmpdir = "cmpdir"; if ( prop.ProjectType.Text == "Package" ) { package.ID = random.Next( ); cmpdir = "src\\pkg\\" + package.ID; } while ( ls.Count != 0 ) { TreeNode node = ls[ 0 ]; ls.RemoveAt( 0 ); if ( node.Parent == null || node.Tag == null ) { foreach ( TreeNode node2 in node.Nodes ) ls.Add( node2 ); continue; } string path = node.Tag as string; if ( path.EndsWith( ".cs" ) || path.EndsWith( ".go" ) || path.EndsWith( ".c" ) ) File.Copy( Path.GetFileName( path ), path ); else build.AddSource( File.ReadAllText( path ) ); } string bat = Path.GetRandomFileName( ) + ".cmd"; try { ProcessStartInfo psi = new ProcessStartInfo( "cmd", "/C " + bat ); psi.CreateNoWindow = true; psi.UseShellExecute = true; File.WriteAllText( bat, prop.PreBuildText.Text ); Process.Start( psi ).WaitForExit( ); List<String> packages = new List<string>( ); foreach ( DataGridViewRow row in prop.packs.Rows ) { packages.Add( Path.GetFullPath( Path.Combine( "pkg\\" + Build.GeneratePlatform( ( prop.cmb_platform.SelectedIndex == 0 ? Build.Platform.Windows : ( prop.cmb_platform.SelectedIndex == 1 ? Build.Platform.Linux : Build.Platform.Mac ) ), prop.ProjectSet.Text.Contains( "64" ) ), ( string )row.Cells[ 2 ].Value ) + ".obj" ) ); } build.InterpretTo( cmpdir, out result, prop.ProjectType.Text == "Package" , prop.txt_name.Text, package.ID ); if ( result.Type != BuildResultType.None ) { Parser.Source source = new Parser.Source( ); foreach ( Parser.CodeErrorException exception in ( Parser.CodeErrorException[ ] )result.Result ) source.AppendLine( exception.Message ); MessageBox.Show(this, source.Content ); if ( File.Exists( bat ) ) File.Delete( bat ); File.WriteAllText( bat, prop.PostBuildText.Text ); Process.Start( psi ).WaitForExit( ); return; } else { build.Linking( cmpdir, out result, ( int )prop.WarnLvl.Value, prop.WarnAsErr.Checked, prop.ProjectType.Text == "Package", packages, prop.txt_name.Text ); if ( result.Type != BuildResultType.None ) { Parser.Source source = new Parser.Source( ); foreach ( CompilerError error in ( CompilerError[ ] )result.Result ) source.AppendLine( error.ErrorText ); MessageBox.Show(this, source.Content ); if ( File.Exists( bat ) ) File.Delete( bat ); File.WriteAllText( bat, prop.PostBuildText.Text ); Process.Start( psi ).WaitForExit( ); return; } else { build.Analyzing( cmpdir, prop.ProjectType.Text == "Package", prop.txt_name.Text, packages, ( prop.cmb_platform.SelectedIndex == 0 ? Build.Platform.Windows : ( prop.cmb_platform.SelectedIndex == 1 ? Build.Platform.Linux : Build.Platform.Mac ) ), prop.ProjectSet.Text.Contains( "64" ) , cmpdir, package.ID ); string output = build.Compiling( cmpdir, out result, prop.UPXComp.Checked, ( prop.cmb_platform.SelectedIndex == 0 ? Build.Platform.Windows : ( prop.cmb_platform.SelectedIndex == 1 ? Build.Platform.Linux : Build.Platform.Mac ) ), prop.ProjectSet.Text.Contains( "64" ), prop.ProjectType.Text == "Package" ); if ( result.Type != BuildResultType.None ) { Parser.Source source = new Parser.Source( ); foreach ( CompileError error in ( CompileError[ ] )result.Result ) source.AppendLine( error.FullText ); MessageBox.Show(this, source.Content ); if ( File.Exists( bat ) ) File.Delete( bat ); File.WriteAllText( bat, prop.PostBuildText.Text ); Process.Start( psi ).WaitForExit( ); return; } if ( prop.ProjectType.Text == "Package" ) { if ( Directory.Exists( "pkgcmp" ) ) Directory.Delete( "pkgcmp", true ); Directory.CreateDirectory( "pkgcmp" ); var v = new ZipForge( ); v.FileName = Path.GetFullPath( Path.Combine( project.Tag as string, "build\\release\\" + prop.txt_name.Text + ".vpak" ) ); v.OpenArchive( System.IO.FileMode.Create ); v.BaseDir = Path.GetFullPath( cmpdir ); package.Name = prop.txt_name.Text; package.PlatformString = Environment.GetEnvironmentVariable( "GOOS" ) + "_" + Environment.GetEnvironmentVariable( "GOARCH" ); package.Platform = ( prop.cmb_platform.SelectedIndex == 0 ? Build.Platform.Windows : ( prop.cmb_platform.SelectedIndex == 1 ? Build.Platform.Linux : Build.Platform.Mac ) ); package.is64X = prop.ProjectSet.Text.Contains( "64" ); package.DefaultNamespace = prop.txt_namespace.Text; package.Description = prop.txt_description.Text; package.Version = string.Join( ".", new string[ ] { prop.ver_1.Value.ToString( ), prop.ver_2.Value.ToString( ), prop.ver_3.Value.ToString( ), prop.ver_4.Value.ToString( ) } ); MemorizePortable mem = new MemorizePortable( ); mem.AddOwner( package ); mem.Save( Path.Combine( v.BaseDir, "install.dat" ) ); File.Move( output, Path.Combine( v.BaseDir, prop.txt_name.Text + ".a" ) ); foreach ( string file in Directory.GetFiles( v.BaseDir,"*.go" ) ) { string newcode = PackageInstallation.CompressGo( file ); File.Delete( file ); File.WriteAllText( file, newcode ); } v.AddFiles( Path.Combine( v.BaseDir, "*.*" ) ); v.CloseArchive( ); } else { string exe = Path.Combine( project.Tag as string, "build\\release\\" + prop.txt_name.Text + ".exe" ); if ( File.Exists( exe ) ) File.Delete( exe ); File.Move( output, exe ); } } } if ( File.Exists( bat ) ) File.Delete( bat ); File.WriteAllText( bat, prop.PostBuildText.Text ); Process.Start( psi ).WaitForExit( ); MessageBox.Show( this,"Build's time: " + ( DateTime.Now - dt ).TotalMilliseconds ); } finally { File.Delete( bat ); if ( Directory.Exists( "pkgcmp" ) ) Directory.Delete( "pkgcmp", true ); Directory.Delete( cmpdir, true ); } }
private void button18_Click(object sender, EventArgs e) { //**************************** string filename = textBox1.Text; string filename1 = filename; string filename2 = textBox1.Text; filename += ".xml"; filename1 += ".rtf"; filename2 += ".zip"; string newfilename1 = Path.Combine("C:\\Users\\Vyshak\\Desktop\\PROJECT", textBox1.Text); string newfilenamezip = Path.Combine("C:\\Users\\Vyshak\\Desktop\\PROJECT", filename2); Directory.CreateDirectory(newfilename1); string newfilename = Path.Combine(newfilename1, filename); string newfilenamertf = Path.Combine(newfilename1, filename1); FileStream aFile = new FileStream(newfilename, FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(aFile); sw.WriteLine("<Tempnum>" + Class1.tempnum + "</Tempnum>"); if ((Class1.tempnum == 1) || (Class1.tempnum == 2)) sw.WriteLine("<Text>" + textBox3.Text + "</Text>"); if((Class1.tempnum==2)||(Class1.tempnum==4)) { // sw.WriteLine(); sw.Write("<Video>"); sw.Write(Class1.videofilename); sw.WriteLine("</Video>"); // } if((Class1.tempnum==1)||(Class1.tempnum==3)||(Class1.tempnum==4)) { // sw.WriteLine(); sw.Write("<Image>"); sw.Write(Class1.imagefilename); sw.WriteLine("</Image>"); // } if(Class1.tempnum==3) { // sw.WriteLine(); sw.Write("<Audio>"); //Class1.audiopath = Path.GetFileName(sourcePath); sw.Write(Class1.audiopath); sw.WriteLine("</Audio>"); // } sw.WriteLine("<Richtext>" + filename1 + "</Richtext>"); if ((Class1.tempnum == 1) || (Class1.tempnum == 2) || (Class1.tempnum == 3)) { string question = textBox5.Text; sw.WriteLine("<QA><QUESTION>" + question + "</QUESTION>"); string answer1 = textBox6.Text; string answer2 = textBox7.Text; string answer3 = textBox8.Text; string answer4 = textBox9.Text; string correctanswer = textBox10.Text; sw.WriteLine("<ANSWER1>" + answer1 + "</ANSWER1>"); sw.WriteLine("<ANSWER2>" + answer2 + "</ANSWER2>"); sw.WriteLine("<ANSWER3>" + answer3 + "</ANSWER3>"); sw.WriteLine("<ANSWER4>" + answer4 + "</ANSWER4>"); sw.WriteLine("<CORRECTANSWER>" + correctanswer + "</CORRECTANSWER></QA>"); } sw.WriteLine("</doc></Manual>"); string str = richTextBox1.Text; richTextBox2.SaveFile(newfilenamertf, RichTextBoxStreamType.RichText); sw.Close(); //ZIPPING FILE ZipForge archiver = new ZipForge(); try { // Set the name of the archive file we want to create archiver.FileName = newfilenamezip; // Because we create a new archive, archiver.Password = "******"; // we set fileMode to System.IO.FileMode.Create archiver.OpenArchive(System.IO.FileMode.Create); // Set base (default) directory for all archive operations archiver.BaseDir = @"C:\Users\Vyshak\Desktop\PROJECT"; // Add the c:\Test folder to the archive with all subfolders archiver.AddFiles(newfilename1); archiver.CloseArchive(); } // Catch all exceptions of the ArchiverException type catch (ArchiverException ae) { Console.WriteLine("Message: {0}\t Error code: {1}", ae.Message, ae.ErrorCode); // Wait for the key to be pressed Console.ReadLine(); } //ZIP COMPLETE this.Close(); }
private void fILEToolStripMenuItem1_Click(object sender, EventArgs e) { OpenFileDialog browsefile = new OpenFileDialog(); // string []arr; browsefile.Title = "browse file"; browsefile.Filter="Zip Files|*.zip"; if(browsefile.ShowDialog()==DialogResult.Cancel) return; Class1.location = browsefile.FileName; // string[] words = s.Split(' '); // string[] arr= Class1.location.Split('.'); string pattt= Path.GetFileNameWithoutExtension(Class1.location);//extracts only anil if anil.zip was there. string xfilename=pattt+".xml"; Class1.rtfname = pattt + ".rtf"; Class1.location2 = Path.Combine("C:\\Users\\Vyshak\\Desktop\\READERTOOL", pattt); Class1.xmlfilelocation = Path.Combine(Class1.location2,xfilename); Class1.rtffilelocation = Path.Combine(Class1.location2,Class1.rtfname); // MessageBox.Show(pattt); // Class1.location2=arr[0]; //UNZIP STARTED ZipForge archiver = new ZipForge(); try { // The name of the ZIP file to unzip archiver.FileName = Class1.location; // Open an existing archive archiver.Password = "******"; archiver.OpenArchive(System.IO.FileMode.Open); // Default path for all operations archiver.BaseDir ="C:\\Users\\Vyshak\\Desktop\\READERTOOL"; // Extract all files from the archive to C:\Temp folder archiver.ExtractFiles("*.*"); // Close archive archiver.CloseArchive(); } // Catch all exceptions of the ArchiverException type catch (ArchiverException ae) { Console.WriteLine("Message: {0}\t Error code: {1}", ae.Message, ae.ErrorCode); // Wait for keypress Console.ReadLine(); } //UNZIP COMPLETE Class1.xsdlocation= Path.Combine(Class1.location2, "proj.xsd"); FileStream aFile = new FileStream(Class1.xsdlocation, FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(aFile); sw.WriteLine("<?xml version=\"1.0\"?>"); sw.WriteLine("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""); sw.WriteLine("targetNamespace=\"http://www.manual.org\" xmlns=\"http://www.manual.org\" elementFormDefault=\"qualified\">"); sw.WriteLine("<xsd:element name=\"Manual\">"); sw.WriteLine("<xsd:complexType>"); sw.WriteLine("<xsd:sequence>"); sw.WriteLine("<xsd:element ref=\"doc\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>"); sw.WriteLine("</xsd:sequence>"); sw.WriteLine("</xsd:complexType>"); sw.WriteLine("</xsd:element>"); sw.WriteLine("<xsd:element name=\"doc\">"); sw.WriteLine("<xsd:complexType>"); sw.WriteLine("<xsd:choice minOccurs=\"5\" maxOccurs=\"5\">"); sw.WriteLine("<xsd:element ref=\"Text\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Image\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Video\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Flash\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Audio\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"QA\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Richtext\" minOccurs=\"0\" maxOccurs=\"1\"/>"); sw.WriteLine("<xsd:element ref=\"Tempnum\" minOccurs=\"1\" maxOccurs=\"1\"/>"); sw.WriteLine("</xsd:choice></xsd:complexType></xsd:element>"); sw.WriteLine("<xsd:element name=\"Text\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Image\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Video\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Flash\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Audio\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Richtext\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"Tempnum\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"QA\">"); sw.WriteLine("<xsd:complexType>"); sw.WriteLine("<xsd:sequence>"); sw.WriteLine("<xsd:element name=\"QUESTION\" type=\"xsd:string\"/>"); sw.WriteLine("<xsd:element name=\"ANSWER1\" type=\"xsd:string\" />"); sw.WriteLine("<xsd:element name=\"ANSWER2\" type=\"xsd:string\" />"); sw.WriteLine("<xsd:element name=\"ANSWER3\" type=\"xsd:string\" />"); sw.WriteLine("<xsd:element name=\"ANSWER4\" type=\"xsd:string\" />"); sw.WriteLine("<xsd:element name=\"CORRECTANSWER\" type=\"xsd:string\" />"); sw.WriteLine("</xsd:sequence>"); sw.WriteLine("</xsd:complexType>"); sw.WriteLine("</xsd:element>"); sw.WriteLine("</xsd:schema>"); sw.Close(); aFile.Close(); //validation start bool isValid = true; //xml validation // Console.Write("hai"); //Console.WriteLine("The xml file is" + isValid); try { XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas.Add(null, Class1.xsdlocation); settings.ValidationType = ValidationType.Schema; XmlDocument document = new XmlDocument(); document.Load(Class1.xmlfilelocation); XmlReader rdr = XmlReader.Create(new StringReader(document.InnerXml), settings); while (rdr.Read()) { } } catch { MessageBox.Show("Validation failed..Corrupted file"); this.Close(); } Console.WriteLine("The xml file is" + isValid); //validation end XmlTextReader reader1 = new XmlTextReader(Class1.xmlfilelocation); while (reader1.Read()) { if (reader1.Name == "Tempnum") { Class1.NUM = reader1.ReadString(); // MessageBox.Show(Class1.NUM); } } XmlTextReader reader = new XmlTextReader(Class1.xmlfilelocation); while (reader.Read()) { // MessageBox.Show("hai"); if (Class1.NUM =="1") { groupBox1.Visible = true; // MessageBox.Show(Class1.NUM); if (reader.Name == "QUESTION") textBox3.Text = reader.ReadString(); if (reader.Name == "ANSWER1") radioButton1.Text = reader.ReadString(); if (reader.Name == "ANSWER2") radioButton2.Text = reader.ReadString(); if (reader.Name == "ANSWER3") radioButton3.Text = reader.ReadString(); if (reader.Name == "ANSWER4") radioButton4.Text = reader.ReadString(); /*if (reader.Name == "Image") { string imagepath1 = Path.Combine("C:\\Users\\Vyshak\\Desktop\\target\\Vyshak", reader.ReadString()); Image image = Image.FromFile(imagepath1); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Size = new Size(100, 100); pictureBox1.Image = image; * }*/ if (reader.Name == "Richtext") { richTextBox1.LoadFile(Class1.rtffilelocation, RichTextBoxStreamType.RichText); } if (reader.Name == "Text") { textBox1.Text = reader.ReadString(); } if (reader.Name == "Image") { string imagepath1 = Path.Combine(Class1.location2, reader.ReadString()); // MessageBox.Show(imagepath1); Image image = Image.FromFile(imagepath1); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Size = new Size(100, 100); //pictureBox2.Height = image.Height; // pictureBox2.Width = image.Width; pictureBox1.Image = image; // pictureBox1.Image = reader.ReadString; } } if (Class1.NUM =="2") { groupBox2.Visible = true; toolStripButton1.Enabled = true; toolStripButton2.Enabled = false; toolStripButton3.Enabled = false; if (reader.Name == "QUESTION") textBox6.Text = reader.ReadString(); if (reader.Name == "ANSWER1") radioButton5.Text = reader.ReadString(); if (reader.Name == "ANSWER2") radioButton6.Text = reader.ReadString(); if (reader.Name == "ANSWER3") radioButton7.Text = reader.ReadString(); if (reader.Name == "ANSWER4") radioButton8.Text = reader.ReadString(); /*if (reader.Name == "Image") { string imagepath1 = Path.Combine("C:\\Users\\Vyshak\\Desktop\\target\\Vyshak", reader.ReadString()); Image image = Image.FromFile(imagepath1); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Size = new Size(100, 100); pictureBox1.Image = image; * }*/ if (reader.Name == "Video") { Class1.videolocation = Path.Combine(Class1.location2, reader.ReadString()); } if (reader.Name == "Text") { textBox4.Text = reader.ReadString(); } if (reader.Name == "Richtext") { richTextBox2.LoadFile(Class1.rtffilelocation, RichTextBoxStreamType.RichText); } } if (Class1.NUM == "3") { groupBox3.Visible = true; if (reader.Name == "QUESTION") textBox8.Text = reader.ReadString(); if (reader.Name == "ANSWER1") radioButton9.Text = reader.ReadString(); if (reader.Name == "ANSWER2") radioButton10.Text = reader.ReadString(); if (reader.Name == "ANSWER3") radioButton11.Text = reader.ReadString(); if (reader.Name == "ANSWER4") radioButton12.Text = reader.ReadString(); if (reader.Name == "Richtext") { richTextBox3.LoadFile(Class1.rtffilelocation, RichTextBoxStreamType.RichText); } if (reader.Name == "Audio") { Class1.audiopath = Path.Combine(Class1.location2, reader.ReadString()); } if (reader.Name == "Image") { string imagepath1 = Path.Combine(Class1.location2, reader.ReadString()); // MessageBox.Show(imagepath1); Image image = Image.FromFile(imagepath1); pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox2.Size = new Size(100, 100); //pictureBox2.Height = image.Height; // pictureBox2.Width = image.Width; pictureBox2.Image = image; // pictureBox1.Image = reader.ReadString; } } if (Class1.NUM == "4") { groupBox4.Visible = true; if (reader.Name == "Richtext") { richTextBox4.LoadFile(Class1.rtffilelocation, RichTextBoxStreamType.RichText); } if (reader.Name == "Image") { string imagepath1 = Path.Combine(Class1.location2, reader.ReadString()); // MessageBox.Show(imagepath1); Image image = Image.FromFile(imagepath1); pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage; //pictureBox3.Size = new Size(100, 100); //pictureBox2.Height = image.Height; // pictureBox2.Width = image.Width; pictureBox3.Image = image; // pictureBox1.Image = reader.ReadString; } if (reader.Name == "Video") { Class1.videolocation = Path.Combine(Class1.location2, reader.ReadString()); } if (reader.Name == "Flash") { Class1.flashpath = Path.Combine(Class1.location2,reader.ReadString()); axShockwaveFlash1.Movie = Class1.flashpath; //axShockwaveFlash1.Size = new System.Drawing.Size(100, 100); axShockwaveFlash1.Play(); } } } }
public static void natives() { ZipForge zipForge = new ZipForge(); if (!Directory.Exists(MocSystem.forgeDir + @"\" + "natives")) { Directory.CreateDirectory(MocSystem.forgeDir + @"\" + "natives"); } for(int i=0;i<minecraftLibFileName.Count;i++) { if (minecraftLibFileName[i].ToString().Contains("natives")) { minecraftNatives.Add(minecraftLibDir[i].ToString() + @"\" + minecraftLibFileName[i].ToString()); zipForge.FileName = minecraftLibDir[i].ToString() + @"\" + minecraftLibFileName[i].ToString(); zipForge.OpenArchive(System.IO.FileMode.Open); zipForge.BaseDir = MocSystem.forgeDir + @"\" + "natives"; zipForge.ExtractFiles("*.*"); zipForge.CloseArchive(); } } for (int i = 0; i < forgeNatives.Count; i++) { zipForge.FileName = MocSystem.libDir + @"\" + forgeNatives[i].ToString() + ".jar"; zipForge.OpenArchive(System.IO.FileMode.Open); zipForge.BaseDir = MocSystem.forgeDir + @"\" + "natives"; zipForge.ExtractFiles("*.*"); zipForge.CloseArchive(); } }
public static void forgeVersion() { WebClient myWebClient = new WebClient(); if (!File.Exists(MocSystem.verDir + @"\" +Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + @"\" +Profile.minecraftVersion + "-Forge" + Profile.forgeVersion+ ".jar")) { myWebClient.DownloadFile(@"http://s3.amazonaws.com/Minecraft.Download/versions/" + Profile.minecraftVersion + "/" + Profile.minecraftVersion + @".jar", MocSystem.verDir + @"\" + Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + @"\" + Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + @".jar"); } if (!File.Exists(MocSystem.verDir + @"\" + Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + @"\" + Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + ".json")) { ZipForge zipForge = new ZipForge(); zipForge.FileName = MocSystem.libDir + @"\net\minecraftforge\forge\1.7.10-10.13.2.1291\" + "forge-"+ Profile.minecraftVersion +"-"+Profile.forgeVersion+ @".jar"; zipForge.OpenArchive(System.IO.FileMode.Open); zipForge.BaseDir = MocSystem.verDir + @"\" + Profile.minecraftVersion + "-Forge" + Profile.forgeVersion; zipForge.RenameFile("version.json",Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + ".json"); zipForge.ExtractFiles(Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + ".json"); zipForge.RenameFile(Profile.minecraftVersion + "-Forge" + Profile.forgeVersion + ".json", "version.json"); zipForge.CloseArchive(); } }
public static bool UnzipFile(string path, string pass, string dir, string file) { try { using (var zpr = new ZipForge()) { zpr.FileName = path; zpr.OpenArchive(FileMode.Open); zpr.Password = pass; zpr.BaseDir = dir; zpr.ExtractFiles(file); } } catch (ArchiverException e) { Messaging.ThrowException("UnzipFile", e); return false; } catch (Exception e) { Messaging.ThrowException("UnzipFile", e); return false; } return true; }