converting the code n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Converting the Code PowerPoint Presentation
Download Presentation
Converting the Code

Loading in 2 Seconds...

play fullscreen
1 / 11

Converting the Code - PowerPoint PPT Presentation


  • 127 Views
  • Uploaded on

Converting the Code. What the code consists of ?. Using declarations Namespace declaration Class declaration Variable declarations Method declarations Return Type Parameters Method body Operations (Method calls, Variable declarations).

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Converting the Code' - dalila


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
what the code consists of
What the code consists of ?
  • Using declarations
  • Namespace declaration
    • Class declaration
      • Variable declarations
      • Method declarations
        • Return Type
        • Parameters
      • Method body
        • Operations

(Method calls,

Variable declarations)

changes in the net framework net 4 0 vs net 4 5 metro
Changes in the .NET framework? .NET 4.0 vs .NET 4.5 (Metro)
  • Why we need to convert the code?
    • Location of classes have changed
      • E.g. System.Windows.Forms.TextBox is now in Windows.UI.Xaml.Controls.TextBox.
    • Methods have changed
      • E.g. System.IO.File.ReadAllText()has been replaced with Windows.Storage.PathIO.ReadTextAsync()
changes in the net framework cont d
Changes in the .NET framework? (cont’d)
  • Some Controls are removed
    • No DataGridView
    • No Multiple Document Interface
    • MessageBox have changed
  • Try to provide our own controls to fullfil these needs
changes in the net framework cont d1
Changes in the .NET framework?(cont’d)
  • More emphasis for asynchronous calls
    • New async, await keywords
    • New methods in classes which run asynchronously
      • e.g. System.IO.Stream.ReadAsync()
steps in code conversion
Steps in code conversion
  • Convert the using declarations
    • Change old using declarations to new ones
    • Add additional required using declarations
  • Convert class declaration
  • Convert method declarations
    • Data type changes
    • Event handler special cases
  • Convert Operations
    • Method calls
    • Assignment operations
    • Etc.
steps in code conversion1
Steps in code conversion

Convert method declarations

Convert operations

Convert class declaration

.NET 4.5 (Metro style)

.NET 4.0

Convert the using declarations

overview of the conversion process
Overview of the conversion process

Input C# code file (.cs)

Output C# code file (.xaml.cs)

Extract Information about classes, methods, etc. in the files

Convert using declarations

Convert method declarations

Convert operations

Control mapping, Data type mapping,

Method invocation mappings

Using declaration conversion rules

Data type mapping

how the conversion is done
How the conversion is done
  • The basic process in which using declarations, method declarations, operations etc. are converted from .NET 4.0 to .NET 4.5 is the same. But each need special handlings as well.
  • Following is an example of one such scenario
conversion of a simple operation method call
Conversion of a simple operation (method call)

1) Use Roslyn APIs to break down the code

Ex. Basic structure of code line

MessageBox.Show(count.ToString(), "Message");

  • Build up information of what the user written code mean
  • MessageBox, Show, count, ToString are knows as identifier tokens
  • Identify that MessageBox.Show together is a Method call
conversion of a simple operation
Conversion of a simple operation

2) Check if this method call need to be converted. If so get what the new call is. (Known as a conversion rule)

  • Generated the new Method call as TransMessageBox.Show(count.ToString(), "Message");
  • Replace the old method call in the code with the newly converted method call

System.Windows.Forms.MessageBox.Show(Old) => TranscendersWrapper.TransMessageBox.Show(New)

MethodSignature.xml