Changeset 905

Show
Ignore:
Timestamp:
10/09/08 08:30:23 (3 months ago)
Author:
mloskot
Message:

trunk/csharp: Catch SystemException? in HelloWorldLAS to diagnose DLL Not Found problems.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/csharp/HelloWorldLAS/Program.cs

    r870 r905  
    11using System; 
    2  
    32using System.Text; 
    4  
    53using LibLAS; 
    6  
    7  
    84 
    95class Program 
    106{ 
    11  
    12  
    137    static void Main(string[] args) 
    148    { 
    15  
    16  
    179        try 
    1810        { 
    19         LASReader lasreader = new LASReader(@"c:\las\sample_our2.las"); 
     11            LASReader lasreader = new LASReader(@"c:\las\sample_our2.las"); 
    2012 
    21         LASPoint laspoint; 
     13            LASPoint laspoint; 
    2214 
    23         LASHeader lasheader = lasreader.GetHeader(); 
    24         Console.WriteLine(lasheader.SoftwareId);//  
    25         lasheader.VersionMinor = 0;  
    26         LASWriter laswriter = new LASWriter(@"c:\las\sample_our.las", lasheader, LASReadWriteMode.LASModeWrite); 
     15            LASHeader lasheader = lasreader.GetHeader(); 
     16            Console.WriteLine(lasheader.SoftwareId);//  
     17            lasheader.VersionMinor = 0; 
     18            LASWriter laswriter = new LASWriter(@"c:\las\sample_our.las", lasheader, LASReadWriteMode.LASModeWrite); 
    2719 
    28         Console.WriteLine("Number of points in file= {0}", lasheader.PointRecordsCount); 
     20            Console.WriteLine("Number of points in file= {0}", lasheader.PointRecordsCount); 
    2921 
    30         while (lasreader.GetNextPoint()) 
    31         { 
     22            while (lasreader.GetNextPoint()) 
     23            { 
     24                laspoint = lasreader.GetPoint(); 
     25                laspoint.X = laspoint.X + 3; 
    3226 
    33             laspoint = lasreader.GetPoint(); 
    34             laspoint.X = laspoint.X + 3; 
     27                //Console.WriteLine(laspoint.X + "," + laspoint.Y + "," + laspoint.Z); 
    3528 
    36             //Console.WriteLine(laspoint.X + "," + laspoint.Y + "," + laspoint.Z); 
    37  
    38             laswriter.WritePoint(laspoint); 
    39  
    40         } 
    41  
     29                laswriter.WritePoint(laspoint); 
     30            } 
    4231        } 
    4332        catch (LASException e) 
    4433        { 
    4534            Console.WriteLine("\nLASException! Msg: {0}", e.Message); 
     35        } 
     36        catch (SystemException e) 
     37        { 
     38            Console.WriteLine("\nException! Msg: {0}", e.Message); 
    4639        } 
    4740        catch 
     
    5750    } 
    5851} 
    59