예제 #1
0
 public NewProject( NewProjectResult resulttarget )
 {
     npr = resulttarget;
     InitializeComponent( );
     if ( Directory.Exists( "templates" ) )
         treeView1.Nodes.AddRange( ( from v in Directory.GetDirectories( "templates" ) select new TreeNode( new DirectoryInfo( v ).Name ) ).ToArray( ) );
     textBox1.Focus( );
 }
예제 #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" );
            }
        }