Ejemplo n.º 1
0
 private void button4_Click( object sender, EventArgs e )
 {
     if ( packs.SelectedRows.Count != 0 ) {
         StreamReader sr = new StreamReader( "pkg.m" );
         MemorizePortable MemoryCore = new MemorizePortable( );
         while ( !sr.EndOfStream ) {
             Package package = new Package( );
             MemorizePortable package_mem = new MemorizePortable( );
             package_mem.AddOwner( package );
             package_mem.Load( sr );
             MemoryCore.AddOwner( package );
         }
         sr.Close( );
         List<DataGridViewRow> lggr = new List<DataGridViewRow>( );
         foreach ( DataGridViewRow row in packs.SelectedRows ) {
             lggr.Add( row );
             foreach ( PropertyInfo prop in MemoryCore.lpi )
                 if ( prop.DeclaringType.Name == "Package" && prop.Name == "ID" )
                     if ( ( ( string )row.Cells[ 2 ].Value ) == prop.GetGetMethod( ).Invoke(
                         MemoryCore.owners[ MemoryCore.lpi.IndexOf( prop ) ], new object[ 0 ] ).ToString( ) ) {
                         Package _pack = ( Package )MemoryCore.owners[ MemoryCore.lpi.IndexOf( prop ) ];
                         string str = "pkg\\" + Build.GeneratePlatform( _pack.Platform, _pack.is64X ) + "\\" + _pack.ID;
                         MemoryCore.DeleteOwner( _pack );
                         try {
                             File.Delete( str + ".a" );
                         } catch {
                         }
                         try {
                             File.Delete( str + ".obj" );
                         } catch {
                         }
                         try {
                             Directory.Delete( "src\\pkg\\" + _pack.ID, true );
                         } catch {
                         }
                         break;
                     }
         }
         foreach ( var v in lggr )
             packs.Rows.Remove( v );
         File.Delete( "pkg.m" );
         MemoryCore.Save( "pkg.m" );
     }
 }
Ejemplo n.º 2
0
        private void projectToolStripMenuItem1_Click( object sender, EventArgs e )
        {
            NewProjectResult result = new NewProjectResult( );
            new NewProject( result ).ShowDialog( );
            if ( !result.Cancelled ) {
                Directory.CreateDirectory( "projects\\" + result.Name + "\\Source" );
                Directory.CreateDirectory( "projects\\" + result.Name + "\\Source-Debug" );
                Directory.CreateDirectory( "projects\\" + result.Name + "\\Build\\Debug" );
                Directory.CreateDirectory( "projects\\" + result.Name + "\\Build\\Release" );
                Directory.CreateDirectory( "projects\\" + result.Name + "\\Data" );
                foreach ( string import in result.importfrom )
                    DirectoryCopy( import, "projects\\" + result.Name );
                int tab=int.Parse(preferencesWindow.tab_spaces.Text);
                File.WriteAllText( "projects\\" + result.Name + "\\Data\\main", @"using System;

            namespace " + result.Name.Replace( ' ', '_' ) + @" {
            " + new string( ' ', tab ) + @"class Program {
            " + new string( ' ', tab * 2 ) + @"static void Main() {
            " + new string( ' ', tab * 3 ) + @"
            " + new string( ' ', tab * 2 ) + @"}
            " + new string( ' ', tab ) + @"}
            }" );
                LoadProject( "projects\\" + result.Name );
                FormProperties prop = new FormProperties( "projects\\" + result.Name + "\\projectdata.dat" );
                if ( File.Exists( "pkg.m" ) ) {
                    StreamReader reader = new StreamReader( "pkg.m" );
                    while ( !reader.EndOfStream ) {
                        Package package = new Package( );
                        MemorizePortable mem = new MemorizePortable( );
                        mem.AddOwner( package );
                        mem.Load( reader );
                        if ( package.Name == "BaseProject" ) {
                            prop.MemoryCore.AddOwner( package );
                        }
                    }
                    reader.Close( );
                }
                prop.MemoryCore.Save( prop.Path );
                FATabStripItem item = new FATabStripItem( );
                item.Title = "Properties";
                item.Controls.Add( new FormProperties( prop.Path ) );
                _TabControl1.Items.Add( _TabControl1.SelectedItem = item );
                OpenTab( "projects\\" + result.Name + "\\Data\\main" );
            }
        }
Ejemplo n.º 3
0
 private void button2_Click( object sender, EventArgs e )
 {
     StreamWriter streamWriter = new StreamWriter( Stream.Null );
     try {
         List<Package> packages = new List<Package>( );
         MemorizePortable mem;
         StreamReader SR = new StreamReader( Stream.Null );
         try {
             SR = new StreamReader( "pkg.m" );
             while ( !SR.EndOfStream ) {
                 Package package = new Package( );
                 mem = new MemorizePortable( );
                 mem.AddOwner( package );
                 mem.Load( SR );
                 packages.Add( package );
             }
         } catch {
         } finally {
             SR.Close( );
         }
         foreach ( Package pack in packages )
             if ( package.ID == pack.ID ) {
                 alertLabel1.Alert( Color.Red, "Package is exists" );
                 return;
             }
         streamWriter = new StreamWriter( "pkg.m", true );
         mem = new MemorizePortable( );
         mem.AddOwner( package );
         File.Move( Directory.GetFiles( pkg, "*.a" )[ 0 ], Path.Combine("pkg\\"+Build.GeneratePlatform(package.Platform,package.is64X),package.ID + ".a") );
         if ( Directory.Exists( "src\\pkg\\" + package.ID ) )
             Directory.Delete( "src\\pkg\\" + package.ID, true );
         Directory.CreateDirectory( "src\\pkg\\" + package.ID );
         File.Move( Directory.GetFiles( pkg, "*.obj" )[ 0 ], Path.Combine( "pkg\\" + Build.GeneratePlatform( package.Platform, package.is64X ), package.ID + ".obj" ) );
         //foreach ( string file in Directory.GetFiles( pkg, "*.c" ) )
         //    File.Move( file, "src\\pkg\\" + package.ID + "\\" + Path.GetFileName( file ) );
         foreach ( string file in Directory.GetFiles( pkg, "*.go" ) )
             File.Move( file, "src\\pkg\\" + package.ID + "\\" + Path.GetFileName( file ) );
         foreach ( string file in Directory.GetFiles( pkg, "*.cs" ) )
             File.Move( file, "src\\pkg\\" + package.ID + "\\" + Path.GetFileName( file ) );
         alertLabel1.Alert( Color.Green, "Package's installation succesfully installed" );
         mem.Save( streamWriter );
         streamWriter.Close( );
     //} catch (Exception ex) {
         //alertLabel1.Alert( Color.Red, "Unable to install package" );
     } finally {
         streamWriter.Close( );
     }
 }
Ejemplo n.º 4
0
 private void PackageInstallation_Load( object sender, EventArgs e )
 {
     MemorizePortable mem = new MemorizePortable( );
     mem.AddOwner( package );
     mem.Load( Path.Combine( pkg, "install.dat" ) );
     txt_name.Text = package.Name;
     txt_platform.Text = package.Platform.ToString( ) + " (" + ( package.is64X ? "64x)" : "86x)" );
     txt_namespace.Text = package.DefaultNamespace;
     txt_description.Text = package.Description;
     txt_version.Text = package.Version;
 }
Ejemplo n.º 5
0
 private void ChooseReference_Load( object sender, EventArgs e )
 {
     List<Package> packages = new List<Package>( );
     MemorizePortable mem;
     dataGridView1.Rows.Clear( );
     try {
         StreamReader SR = new StreamReader( "pkg.m" );
         while ( !SR.EndOfStream ) {
             Package package = new Package( );
             mem = new MemorizePortable( );
             mem.AddOwner( package );
             mem.Load( SR );
             foreach (int id in una)
                 if ( id == package.ID ) {
                     package = null;
                 }
             if ( package == null )
                 continue;
             else {
                 if ( package.Platform != platform || package.is64X != is64x )
                     continue;
             }
             dataGridView1.Rows.Add( false, package.Name, package.Version, package.ID.ToString( ), package.DefaultNamespace );
         }
         SR.Close( );
     } catch {
     }
 }
Ejemplo n.º 6
0
 private void PackageManager_Load( object sender, EventArgs e )
 {
     MemorizePortable mem;
     packs.Rows.Clear( );
     try {
         StreamReader SR = new StreamReader( "pkg.m" );
         while ( !SR.EndOfStream ) {
             Package package = new Package( );
             mem = new MemorizePortable( );
             mem.AddOwner( package );
             mem.Load( SR );
             packs.Rows.Add( package.Name, package.Version, package.ID.ToString( ), package.DefaultNamespace );
         }
         SR.Close( );
     } catch {
     }
 }