0% found this document useful (0 votes)
90 views73 pages

CoBrA (Code Browsing Analyzer) PDF

This document describes a software project called CoBrA (Code Browsing Analyzer) undertaken by Abdul Hanan and Muhammad Umer. The project aims to help C++ programmers analyze their code by removing comments, managing macros, identifying functions and variables, populating a database, and generating a report. It was developed using C# and a local database under the supervision of Dr. Faisal Azam. The project scope involves comment removal, macro management, function/variable identification, database population, and report generation to help programmers understand the overall structure and details of their code.

Uploaded by

azamfaisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views73 pages

CoBrA (Code Browsing Analyzer) PDF

This document describes a software project called CoBrA (Code Browsing Analyzer) undertaken by Abdul Hanan and Muhammad Umer. The project aims to help C++ programmers analyze their code by removing comments, managing macros, identifying functions and variables, populating a database, and generating a report. It was developed using C# and a local database under the supervision of Dr. Faisal Azam. The project scope involves comment removal, macro management, function/variable identification, database population, and report generation to help programmers understand the overall structure and details of their code.

Uploaded by

azamfaisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

CoBrA (Code Browsing Analyzer)

ABDUL HANAN
MUHAMMAD UMER

DEPARTMENT OF COMPUTER SCIENCES


COMSATS UNIVERSITY ISLAMABAD, WAH CAMPUS
WAH CANTT – PAKISTAN

SESSION 2016-2020
CoBrA (Code Browsing Analyzer)
Undertaken By:
ABDUL HANAN
REG.NO. CIIT/FA16-BCS-145/WAH

MUHAMMAD UMER
REG.NO. CIIT/FA16-BCS-116/WAH

Supervised By:
DR. FAISAL AZAM

A DISSERTATION SUBMITTED AS A PARTIAL FULFILLMENT OF THE


REQUIREMENTS FOR THE DEGREE OF BACHELORS IN COMPUTER SCIENCE

DEPARTMENT OF COMPUTER SCIENCES


COMSATS UNIVERSITY ISLAMABAD, WAH CAMPUS
WAH CANTT – PAKISTAN

SESSION 2016-2020
DEDICATION
To our beloved parents and helping teachers who supported us in every step
of our life. Without their support, we would not able to complete our project.
We specially thank to our teachers who always motivated and helped us out
in our difficult times. Special dedication to all the current successors of Chistia
Order for their blessings and prayers for me. Special Thanks to Almighty Allah
who has blessings upon us and with His help we are able to complete our
project within stipulated time.

Abdul Hanan
Muhammad Umer

i
ACKNOWLEDGEMENT
All the deepest sense of gratitude to Almighty ALLAH, the most
compassionate and merciful who is omnipotent and omnipresent, and has
divulged His knowledge to man, without His help and blessings, we wouldn’t
have completed this project.

We are highly obliged to our teachers especially Sir Faisal Azam and Sir
Naveed Zaidi, who helped in improvising project idea as well as motivated us
time to time and made us work hard to complete and present our project in a
better way, especially the trust of our supervisor upon our skills, which enabled
us to complete our project.

I would like to thank my colleagues for making my four years at COMSATS


is one of the most precious times in my life. Thanks to Dr. Faisal Azam for
giving us a chance to work under his supervision and for making the
comfortable discussions about everything regarding project.

ii
PROJECT BRIEF
PROJECT NAME: CoBrA (Code Browsing Analyzer Windows
based).
PROJECT OBJECTIVE: OBJECTIVE OF SYSTEM IS TO HELP CPP
PROGRAMMERS TO ANALYZE THEIR CODE
IN SENSE OF NUMBER OF LINE OF CODE,
FUNCTIONS, LOCAL AND GLOBAL
VARIABLES AND ALSO MAKING REPORT
OF THE WHOLE PROGRAM.
UNDERTAKEN BY: ABDUL HANAN
MUHAMMAD UMER
SUPERVISED BY: DR. FAISAL AZAM
DEPARTMENT OF COMPUTER SCIENCES
CUI, WAH CAMPUS
PAKISTAN
STARTED IN: SEPTEMBER 2019
COMPLETED ON: AUGUST, 2020
SOURCE LANGUAGE: C#

COMPUTER USED: HIRE Y11C


OPERATING SYSTEM: WINDOWS 10
TOOLS USED: VISUAL STUDIO, LOCAL DATABASE,
ADOBE PHOTOSHOP

iii
ABSTRACT
CoBrA (Code Browsing Analyzing) is a Windows-based application which help the
programmers to see overview of their program while removing comment and detecting
functions and variables in their program. Comment removing is done by reading whole code
line by line all comments are detected and removed by self-written code. Macros are detected
by reading all lines in user-written program and resolve all macros by replacing all macros
with its values all work is done by self-written code. Variables and functions are detected by
reading whole program line by line. All modules have code written by our team no single
external library is used in implementation of whole project.

iv
Table of Contents
CHAPTER 1 ................................................................................................................................................. 1
INTRODUCTION ......................................................................................................................................... 1
1.1. Introduction.................................................................................................................................. 2
1.2. Project Overview .............................................................................................................................. 2
1.2.1. Product Features and Functions ......................................................................................... 2
1.2.2. Remove Comment................................................................................................................. 2
1.2.3. Manage Macros..................................................................................................................... 3
1.2.4. Identify functions and variables .......................................................................................... 3
1.2.5. Populate Database ................................................................................................................ 3
1.2.6. Generate Report.................................................................................................................... 3
1.3.1 Program’s Report generation ............................................................................................... 4
1.3.2 Understanding Overall code details ..................................................................................... 4
1.4. Similar system information .............................................................................................................. 4
1.4.1. Sourcetrail ............................................................................................................................. 4
1.4.2. Source Insight ....................................................................................................................... 4
1.5. Scope of the project .......................................................................................................................... 4
1.6. Area of application ........................................................................................................................... 5
1.7. Machinery .......................................................................................................................................... 5
1.8. Goal .................................................................................................................................................... 5
1.9. Software Requirements .................................................................................................................... 5
1.10. Hardware Involved ......................................................................................................................... 5
1.11. Target users ..................................................................................................................................... 5
CHAPTER 2 ................................................................................................................................................. 7
BACKGROUND RESEARCH ................................................................................................................... 7
2.1. Existing Systems................................................................................................................................ 8
2.2. Sourcetrail ......................................................................................................................................... 8
2.3. Source Insight.................................................................................................................................... 8
2.4. Idea generation.................................................................................................................................. 8
2.5. Software development ...................................................................................................................... 9
2.6. Hardware development .................................................................................................................... 9
2.7. Limitations and constraints ............................................................................................................. 9
2.7.1. Software constraint............................................................................................................... 9
2.7.2. Hardware constraint ............................................................................................................ 9
2.8. Language constraint ......................................................................................................................... 9
2.9. Conclusion ......................................................................................................................................... 9
CHAPTER 3 ...............................................................................................................................................10
DESIGN ......................................................................................................................................................10
3.1. Introduction.....................................................................................................................................11
3.2. Requirements ..................................................................................................................................11
3.2.1. Software requirements .......................................................................................................11
3.2.2. Hardware Requirements ....................................................................................................11
3.3. Functional Requirements ...............................................................................................................11
3.4. Other non-functional attributes ....................................................................................................14
3.5. UML Diagrams ...............................................................................................................................16
3.5.3. Class Diagram .....................................................................................................................19
3.5.4. Sequence Diagram: .............................................................................................................19
3.5.6. Activity Diagram: ...............................................................................................................22
CHAPTER 4 ...............................................................................................................................................24
IMPLEMENTATION ..................................................................................................................................24
4.1. Introduction.....................................................................................................................................25
4.2. Connectivity with Database ...........................................................................................................25
4.3. Application Development ...............................................................................................................26
CHAPTER 5 ...............................................................................................................................................33
TESTING AND INTEGRATION ..............................................................................................................33
5.1. Introduction.....................................................................................................................................34
5.2. Types of testing ...............................................................................................................................34
5.2.1. Unit testing ..........................................................................................................................34
5.2.2. Integration testing...............................................................................................................34
5.2.3. System testing ......................................................................................................................35
5.3. Testing Strategies ............................................................................................................................35
5.4. Test Cases ........................................................................................................................................35
5.4.1. Test Case 1 ...........................................................................................................................35
5.4.2. Test Case 2 ...........................................................................................................................36
5.4.3. Test Case 3 ...........................................................................................................................36
5.4.4. Test Case 4 ...........................................................................................................................36
5.4.5. Test Case 5 ...........................................................................................................................36
5.4.6. Test Case 6 ...........................................................................................................................37
5.4.7. Test Case 7 ...........................................................................................................................37
5.5. Ease of use .......................................................................................................................................37
CHAPTER 6 ...............................................................................................................................................38
CONCLUSION ...........................................................................................................................................38
6.1. Conclusion ...........................................................................................................................................39
REFERENCES & APPENDICES ...........................................................................................................40
References...................................................................................................................................................... i
Appendix A Abbreviations........................................................................................................................... i
Appendix B Code Schematics ..................................................................................................................... ii
List of Figures
Figure 3.1. Use Case ...................................................................................................................................18
Figure 3.2. Class Diagram ..........................................................................................................................18
Figure 3.3. Sequence Diagram....................................................................................................................21
Figure 3.4. Activity Diagram ......................................................................................................................23
Figure 4.1. Database ...................................................................................................................................25
Figure 4.2. Database Connection ................................................................................................................26
Figure 4.3. Main Interface of Application ..................................................................................................27
Figure 4.4. Browse ......................................................................................................................................16
Figure 4.5. Folder Selected .........................................................................................................................28
Figure 4.6. Remove Comments ..................................................................................................................19
Figure 4.7. Resolve Macros ........................................................................................................................21
Figure 4.8. Analyze.....................................................................................................................................29
Figure 4.9. After Analyze ............................................................................................................................30
Figure 4.10. Results .....................................................................................................................................30
Figure 4.11. Variables..................................................................................................................................31
Figure 4.12. Functions .................................................................................................................................31
Figure 4.13. Libraries ..................................................................................................................................32
List of Tables
Table 3.1. Browse ........................................................................................................................................11
Table 3.2. Syntax .........................................................................................................................................12
Table 3.3. Tokenization ...............................................................................................................................12
Table 3.4. Populating database ....................................................................................................................13
Table 3.5. Definition ....................................................................................................................................14
Table 3.6. Report Generation.......................................................................................................................14
Table 5.1. Testing of Browsing ...................................................................................................................35
Table 5.2. Testing Browsed Data ................................................................................................................36
Table 5.3. Testing Macros ...........................................................................................................................36
Table 5.4. Testing Macros are Resolved .....................................................................................................36
Table 5.5. Testing variables .........................................................................................................................36
Table 5.6. Testing functions ........................................................................................................................37
Table 5.7. Testing database .........................................................................................................................37
CHAPTER 1
INTRODUCTION
Introduction

1.1. Introduction
In today’s world, programmers face difficulty while making large projects and making test cases
for white box testing of their project. They make great effort to understand code of project to find
out all variables and function. There have been many technological advancements for
programmers. But some of these products are either highly expensive or some of these products
are offering less features. So, it is a dream of every programmer to have a such product which can
offer maximum support to them in an economical cost.

CoBrA is designed to offer the following things to programmer community to make their lives
much easier:

• Remove Comment
• Manage Macros
• Identify functions and variables
• Populate Database
• Generate Report

1.2. Project Overview


Embedded code developed in C Language is based on external libraries. The tool is being
developed to primarily browse the code visually and secondly for finding out the gap in code
appear due to use of hardware specific libraries. By gap in code we mean calling built-in function
from built-in or external libraries included. Browsing code visually means we will read ‘C’ file from
given directory analyse it, check error, and show error notification in different text file and auto
correct implicit errors.
Some of features are:
a) To detect and then remove single line and multi-line comments.
b) To identify and resolve macros. For example, # define.
c) To check if a variable and function definition, use is present.
d) To check if a function is called from a built-in or external library by backtracking the
libraries. (Stubbing).

1.2.1. Product Features and Functions


CoBrA (Code Browsing Analyzer) is windows-based Software application based on following
features:

1.2.2. Remove Comment


Comments is removed using comment removing algorithm programmed by self-effort.

CoBrA 2
Introduction

1.2.3. Manage Macros


Macros are firstly detected and then removed by programming using self-effort.

1.2.4. Identify functions and variables


Function and variables are firstly detected and then saved for later use by programming using self-
effort.

1.2.5. Populate Database


Database is populated using the data save during function and variable identification.

1.2.6. Generate Report


Report is generated using database to facilitate programmers to understand their code and overview
of their code.

CoBrA 3
Introduction

1.3. Project’s objective

All the applications or projects have some objectives. These objectives are achieved using tools
and continuous working on the target goal. The main objectives of CoBrA Windows Based User
& Assistant App are as follows:

1.3.1 Program’s Report generation


Our device helps the blind person to move safely from one place to another by wearing our device.
Furthermore, blind person can contact assistant easily in emergency by using assigned features for
this purpose.

1.3.2 Understanding Overall code details


Assistant person can monitor the blind person live parameters through which he/she can easily
locate the blind person and can view live streaming to help blind person while moving from one
place to another.

1.4. Similar system information


There are many existing wearable devices for the blind available in the market. Some of these are:

1.4.1. Sourcetrail

Sourcetrail is a cross-platform source explorer that helps you get productive on


unfamiliar source code. It uses static analysis on C, C++ source code and lets you
navigate the collected information within a user interface that interactively combines
graph visualization and code display.

1.4.2. Source Insight

Source Insight parses your source code and maintains its own database of symbolic
information dynamically while you work and presents useful contextual information to
you automatically. Source Insight also can display reference trees, class inheritance
diagrams, and function call trees. Source Insight has a group of auxiliary panel windows
that work together to give you quick and useful navigation of source code and source
information.

1.5. Scope of the project


Almost every project we encounter, confronts some hurdles. It is just the nature of any project
work and something that simply needs to be taken in progress. Project scope is the part of

CoBrA 4
Introduction

project planning that involves determining and documenting a list of specific project goals,
deliverables, features, functions, tasks, deadlines, and ultimately costs. The application
performs Remove Comment, Manage Macros, identify functions and variables, Populate Database,
Generate Report. Report generation is of variables and functions details from database is 1st time done
for the ease of programmer community.

. 1.6. Area of application

Area of application is necessary to take into consideration to determine whether device is going to
be useable and helpful for someone or it is just useless. Windows-based application has vast area
of deployment for the programmer community as they were our primary target to facilitate them.

1.7. Machinery
Due to rapidly changing technologies, latest software today will become the old version of
tomorrow. So latest tools and technologies have being used which will enable the user and
developer to work efficiently and to meet the future requirements.

1.8. Goal
Goal is to facilitate maximum to the programmer community after coding their program to keep
informed about their overall code to know about their logic while making a large program.

1.9. Software Requirements


This product of CoBrA windows-based application requires the following minimum Windows OS
requirements for running this application.

• It works on all devices having Windows XP and above.


• It works on all android devices having Windows OS.

1.10. Hardware Involved


N/A

1.11. Target users


Target users are basically from every age of programmers. Device covers all the programmer
community as they are willing to use such products which can make their lives easier. So,
application is expected to influence a major portion of community.

CoBrA 5
Introduction

CoBrA 6
CHAPTER 2
BACKGROUND RESEARCH
Background Research

2.1. Existing Systems


Along with the technological advancements in every sphere of life, different solutions were
proposed to solve the different problems being faced by the programmers in their daily life routine.
Currently, there are different products available in the market which are providing different
facilities embedded in these products. Some of these are highly expensive and some of these
products are cheap which an average community can afford. So, now we will analyze the following
existing systems which are available in the market:

2.2. Sourcetrail
Sourcetrail is a cross-platform source explorer that helps you get productive on unfamiliar source
code. It uses static analysis on C, C++ source code and lets you navigate the collected
information within a user interface that interactively combines graph visualization and code
display

2.3. Source Insight

Source Insight parses your source code and maintains its own database of symbolic information
dynamically while you work and presents useful contextual information to you automatically.
Source Insight also can display reference trees, class inheritance diagrams, and function call
trees. Source Insight has a group of auxiliary panel windows that work together to give you
quick and useful navigation of source code and source information.

2.4. Idea generation


The idea is generated based on analyzing the various products available in the market for the
programmers. Each product offers unique features for programmers to make their lives easier.
According to a recent survey, nearly 27 million persons around the world are working as
programmers. So, these people face a lot of difficulties in their lives. In the previous chapter, we
analyzed the Different products before development of this product to find out what others are
offering for programmer community. So, the following features are different from the other
products currently available in the market.

• Sourcetrail is a cross-platform source explorer that helps you get productive on unfamiliar
source code. It uses static analysis on C, C++ source code and lets you navigate the
collected information within a user interface that interactively combines graph
visualization and code display

CoBrA 8
Background Research

• Source Insight parses your source code and maintains its own database of symbolic
information dynamically while you work and presents useful contextual information to
you automatically. Source Insight also can display reference trees, class inheritance
diagrams, and function call trees. Source Insight has a group of auxiliary panel windows
that work together to give you quick and useful navigation of source code and source
information.

2.5. Software development


Software development is the process of understanding the problem statement of computer science
domain and developing a software system using software engineering processes within the
domain of computer science.
During development of this product we have followed the Waterfall Software Approach to enhance results

2.6. Hardware development


N/A

2.7. Limitations and constraints

The limitations and constraints of CoBrA are:


2.7.1. Software constraint
N/A
2.7.2. Hardware constraint
N/A

2.8. Language constraint


The application has some limitations on language which have been restricted to English only.

2.9. Conclusion
In this chapter we have discussed the various products which are available in the market for the
target community. As each product varies from one to another with difference in the features
provided to user community which always lefts a room for the improvement. So, our product is
basically a step forward to improve the feature quality within an affordable cost.

CoBrA 9
CHAPTER 3
DESIGN
Design

3.1. Introduction
CoBrA is a Windows based application build to facilitate programmers. It has some system requirements to
facilitate. For proper functioning of system this chapter will provide all the knowledge about system.

3.2. Requirements
As whenever we are going to develop a product, it has some requirements related to the system on which it is
being to be developed.
3.2.1. Software requirements
As every product is developed with the use of tools and software. So, the software which are
involved during the development of this product are as follows:
• Visual Studio IDE
• Local Database
• Windows OS
• Adobe Photoshop
• Dev IDE.
3.2.2. Hardware Requirements
N/A

3.3. Functional Requirements


The functional requirements of Let’s Move (Android Based User & Assistant App) are as follows:

1. User should be able to browse their project folder containing C++ file.

Table 3.1. Browse

Criteria Remarks
Criticality This requirement is most essential in our project, as project name
shows our main task is to browse code for its analysis. If this
requirement is missing from the project the project will collapse and
became a garbage for user.
Technical Issues Designing is not a complicated task, but implementation of this
requirement involves some issues such as checking whether the selected
folder is C++ project or not, folder contains many different files, so we
must extract (.cpp) file.

CoBrA 11
Design

Cost The cost applied for the above discussed issue are we just added if
conditions that increases the compilation time of software.
Risk There are two main circumstances in which this functionality will not work:

i. User have already selected a folder and trying to select the


other folder. To select another folder, used must clear first
selected folder.
ii. User press the Analyze button the system is busy in analyzing
the code files and user want to select another folder at that
time. To select another folder, user must wait for system to
complete analyzing firstly selected folder.

2. Checking syntax of C++ code file that the code written is file is according to C++ syntax.
Table 3.2. Syntax

Criteria Remarks
Criticality This requirement is an essential in our project, as project name shows our main
task is to browse code for its analysis. If this requirement is missing from the
project the project will unable to perform actual functionality as if the syntax is
not correct according to C++ the variables and function will surely not be
extracted correctly and then system will have no value.
Technical Issues Implementation of this requirement involves some issues such as
identifying whether C++ language have only one syntax for a statement
or there exist different syntax.
Cost The cost applied for the above discussed issue are we studied this
language from different websites
Risk There are some circumstances in which this functionality will not work:
The selected folder is empty or does not have any C++ file.
3. Extract every word written in C++ code file (Tokenization) .
Table 3.3. Tokenization

Criteria Description
Criticality This requirement is an essential in our project, as project name shows
our main task is to browse code for its analysis. If this requirement is
missing from the project the project will be unable to perform actual

CoBrA 12
Design

functionality as if tokens are not separated it is impossible to save data


in database.
Technical Issues Implementation of this requirement involves some issues such as
identifying whether a token is function or variable.
Cost The cast applied for the above discussed issue are we just added different
conditions that increases the compilation time of software.
Risk There are three main circumstances in which this functionality will not
work:
i. The selected folder has one or more file that have some
syntax error. User must clear the syntax error for perfect
working.
ii. The selected folder is empty or does not contain any C++
file.
Syntax Analyzer ignore syntax error.
4. Populate database using tokens.
Table 3.4. Populating database

Criteria Description
Criticality This requirement is an essential in our project, as project name shows our main
task is to browse code for its analysis database is important for stubbing. If this
requirement is missing from the project the project will unable to perform some
functionalities like stubbing and report generation.
Technical Issues Implementation of this requirement involves some issues such as data is
dependent on each other that is why for populating data sometimes we
first must extract data from database.
Cost The cast applied for the above discussed issue are we made extra function that
increases the compilation time as well as run time of system.
Risk i. The selected folder has one or more file that have some syntax
error. User must clear the syntax error for perfect working.
ii. The selected folder is empty or does not contain any C++ file.
iii. Syntax Analyzer ignore syntax error.
5. Defining declared but undefined functions and variable.

CoBrA 13
Design

Table 3.5. Definition

Criteria Description
Criticality This requirement is an essential in our project, as project name shows
our main task is to browse code for its analysis stubbing is required. If
this requirement is missing from the project the project will unable to
perform some functionalities in case if the project is embedded system.
Technical Issues Implementation of this requirement involves some issues such as
function is declared in header file but defined in source file.
Cost The cast applied for the above discussed issue are we used database
every time function is checked from database that function is defined or
not.
Risk i. The selected folder has one or more file that have some syntax
error. User must clear the syntax error for perfect working.
ii. The selected folder is empty or does not contain any C++ file.
iii. Syntax Analyzer ignore syntax error.
iv. Tokens are not extracted perfectly.
6. Report generation using database.
Table 3.6. Report Generation

Criteria Description
Criticality This requirement is an essential in our project as one of our main tasks is report
generation of project.
Technical Issues There is no as such issue in report generation.
Cost No cost is involved.
Risk No risk.

3.4. Other non-functional attributes


Following are the non-functional attributes which are considered to be non-functional for
“CoBrA.”

CoBrA 14
Design

Table 3.7. Non-Functional Attributes

Attributes Description
Reliability Our system is reliable in its environment it will work perfectly and achieve its
goal.
Maintainability The system is maintainable we will give our services to maintain the
system.
Portability System is portable, if user want to change their computer, they can
install the system on another computer and simply analyze their project,
but it cannot be converted to another platform.
Extensibility System is extensible if user want another functionality, we can add that
functionality easily to some extent.
Reusability The system is reusable every time. If system analyzed the project after
that it will be ready to analyze another project
Application System is compatible with windows platform
Affinity/Compatibility
Resource Utilization The system will use some resources of computer as RAM and Hard disk
for database
Serviceability The system is serviceable if system fails in some unknown
circumstances, we will give our service to check error.

CoBrA 15
Design

3.5. UML Diagrams


This section contains preliminary UML Diagrams to explain the functionalities of the software
“CoBrA”

3.5.1. Use Case Diagram

A use case diagram is a dynamic or behavior diagram in UML. Use case diagrams model the
functionality of a system using actors and use cases. Use cases are a set of actions, services, and
functions that the system needs to perform. In this context, a "system" is something being
developed or operated, such as a web site. The "actors" are people or entities operating under
defined roles within the system.

CoBrA 16
Design

Actor specifies a role played by a user or any other system that


interacts with the subject.

Use case is a list of steps, typically defining interactions between an


actor and a system, to achieve a goal.

Package is used to group elements, and to provide a namespace for


the grouped elements.

Objects are model elements that represent instances of a class or of


classes.

Interfaces are model elements that define sets of operations that other
model elements, such as classes, or components must implement.

Constraint is an extension mechanism that enables you to refine


the semantics of a UML model element.

CoBrA 17
Design

Use case diagram or this system:

Figure 3.1. Use Case

CoBrA 18
Design

3.5.3. Class Diagram


Class diagram is used to express the different kinds of relationships between the users and the end
product. In our device, there is one to one relationship b/w app and users.

Figure 3.2. Class Diagram

3.5.4. Sequence Diagram:

A sequence diagram simply depicts interaction between objects in a sequential order i.e. the
order in which these interactions take place. We can also use the terms event diagrams or event
scenarios to refer to a sequence diagram. Sequence diagrams describe how and in what order the
objects in a system function. These diagrams are widely used by businessmen and software
developers to document and understand requirements for new and existing systems.

Sequence Diagram Notations –

Actors – An actor in a UML diagram represents a type of role where it interacts with the system
and its objects. It is important to note here that an actor is always outside the scope of the system
we aim to model using the UML diagram.
We use actors to depict various roles including human users and other external subjects. We
represent an actor in a UML diagram using a stick person notation. We can have multiple actors
in a sequence diagram.

CoBrA 19
Design

Lifelines – A lifeline is a named element which depicts an individual participant in a sequence


diagram. So basically, each instance in a sequence diagram is represented by a lifeline. Lifeline
elements are located at the top in a sequence diagram. The standard in UML for naming a lifeline
follows the following format

– Instance Name: Class Name

We display a lifeline in a rectangle called head with its name and type. The head is located on
top of a vertical dashed line (referred to as the stem) as shown above. If we want to model an
unnamed instance, we follow the same pattern except now the portion of lifeline’s name is left
blank.

CoBrA 20
Design

Figure 3.3. Sequence Diagram

CoBrA 21
Design

3.5.6. Activity Diagram:

We use Activity Diagrams to illustrate the flow of control in a system and refer to
the steps involved in the execution of a use case. We model sequential and
concurrent activities using activity diagrams. So, we basically depict workflows
visually using an activity diagram. An activity diagram focuses on condition of flow
and the sequence in which it happens. We describe or depict what causes a event
using an activity diagram.

UML models basically three types of diagrams, namely, structure diagrams,


interaction diagrams, and behavior diagrams. An activity diagram is a behavioral
diagram i.e. it depicts the behavior of a system.

An activity diagram portrays the control flow from a start point to a finish point
showing the various decision paths that exist while the activity is being executed.
We can depict both sequential processing and concurrent processing of activities
using an activity diagram. They are used in business and process modelling where
their primary use is to depict the dynamic aspects of a system.

CoBrA 22
Design

Figure 3.4. Activity Diagram

CoBrA 23
CHAPTER 4
IMPLEMENTATION
Implementation

4.1. Introduction
In the software development, implementation phase comes right after the design phase. It is a most
critical phase of development where we have to integrate software modules.

Here we will divide the development of the device into two phases which are as follows:

• Software Implementation
• Connectivity with Database

So, the above-mentioned phases are the most important phases that are involved in software
development.

4.2. Connectivity with Database


In the second phase of development of CoBrA, the database is created and connected with C#
project. For this purpose, each table is created within the same database with different key so that
they can be fetched separately in the database.

Figure 4.1. Database

CoBrA 25
Implementation

Figure 4.2. Database Connection

4.3. Application Development


In the last phase of the development of CoBrA Application is developed by using C#. The front
end of application is done by C# designing and the backend of application is also done through
C#.

CoBrA 26
Implementation

Figure 4.3. Main Interface of Application


Below interface is basically the result after clicking browse button.

Figure 4.4. Browse

CoBrA 27
Implementation

Below interface is the interface after selecting folder containing C++ files.

Figure 4.5. Folder Selected


Below interface after clicking remove Comments.

Figure 4.6. Remove Comments

CoBrA 28
Implementation

Below interface after clicking resolve macros.

Figure 4.7. Resolve Macros

Below interface after clicking Analyze.

Figure 4.8. Analyze

CoBrA 29
Implementation

Below interface after clicking ok.

Figure 4.9. After Analyze

Below interface after clicking Results.

Figure 4.10. Results

CoBrA 30
Implementation

Below interface after clicking Variables.

Figure 4.11. Variables

Below interface after clicking Functions.

Figure 4.11. Functions

CoBrA 31
Implementation

Below interface after clicking Libraries.

Figure 4.11. Libraries

CoBrA 32
CHAPTER 5
TESTING AND INTEGRATION
Testing and Integration

5.1. Introduction
Testing is an investigation conducted to provide information about the quality of the product or
service under test. It can also provide an objective, independent view of the product and
understand the risks of products. Test techniques include, but are not limited to, the process of
executing a program or application with the intent of finding bugs (errors or other defects).
Testing has been done step by step after the completion of each module of the hardware and
android application. The development of hardware and application is divided in small chunks
which have been tested as they are developed so they can be ready and bug free for use. Testing
can be stated as the process of validating and verifying that a product.
• Meets the requirements that guided its design and development.
• Works as expected.
• Can be implemented with the same characteristics.

5.2. Types of testing


Many techniques are used for testing depending on type of software and its requirements some
of them are given below:
5.2.1. Unit testing
Unit testing is basically the testing of individual components one by one which is mostly
performed by the programmers to evaluate the developed systems. Unit testing requires the
detailed knowledge of internal program design and code.
Android Application has many functionalities and modules such as login, signup, preparation,
display of questions, navigation, selection of answer by user, display of right answer by the
system and databases etc. all of the systems modules needs to be tested separately. These
separate testing have been done in unit testing.
Furthermore, hardware has sensors and camera attached to the raspberry pi such as distance,
motion sensor and pi camera which involves the testing of the correct sensors results as well as
live streamed videos. So, separate testing has been done in unit testing.
5.2.2. Integration testing
After integrating all the system functionalities, an integrated test has been done which
checks system integrated performance. Signup and login functionalities should be

CoBrA 34
Testing and Integration

working properly. Any person has to signup first before login. Either hardware is working
properly or not. We have to check either hardware data is being stored in the real time
database or not. We have to check either the data is being correctly displayed in the
android application or not. All of this is done in the integration testing.
5.2.3. System testing
Entire system is tested as per the requirements. Black-box type testing that is based on
overall requirements specifications, covers all integrated parts of a system.
Complete testing is done after completion of hardware and android application. We go
through all the scripts of project and all functionalities, interfaces and databases. Features
and functionality and working is viewed and tested separately.

5.3. Testing Strategies


A strategy for device testing integrates test case design techniques into a well - planned
series of steps that result in the successful construction of hardware device and android
application. Common Characteristics of testing strategies Testing begins at module level
and works outward towards the integration of the entire system. Different testing
techniques are appropriate at different points in time. Black and white box testing both
are done. Unit testing and integration testing are done while the development of android
application. We used test driven approach. Each module is developed and tested so we
use the strategy of agile.

5.4. Test Cases


A test case is a set of conditions or variables under which a tester determines whether a
system under test satisfies requirements or works correctly. The process of developing
test cases can also help find problems in the requirements or design of an application.
5.4.1. Test Case 1
Table 5.1. Testing of Browsing

Test case This test checks if the algorithm is browsing folder or not.
Test Procedure Folder is selected to check browsing results.
Expected Result C++ files are detecting properly.
Actual Result Yes, browsing is performed accurately.

CoBrA 35
Testing and Integration

Comment Result function is working fine.


Accuracy Accuracy is achieved.
5.4.2. Test Case 2
Table 5.2. Testing Browsed files

Test case This test checks whether browse function is working properly or not.
Test Procedure Check the browse function results in the application.
Expected Result Files extracted by browse function have cpp code showed in application.
Actual Result Browse function fetched data properly.
Comment Result function is working fine.
Accuracy Accuracy is achieved.
5.4.3. Test Case 3
Table 5.3. Testing Macros

Test case Testing whether macros are detected properly.


Test Procedure Check the macros are detected properly in application.
Expected Result Result is accurate.
Actual Result Accurate location results.
Comment Result function is working fine.
Accuracy Accuracy is achieved.
5.4.4. Test Case 4
Table 5.4. Testing Macros are Resolved

Test case This test checks whether macros are resolved properly or not.
Test Procedure Check the macros are resolved in application.
Expected Result Macros are resoling properly.
Actual Result Result is correct.
Comment Result function is working fine.
Accuracy Accuracy is achieved.
5.4.5. Test Case 5
Table 5.5. Testing variables

CoBrA 36
Testing and Integration

Test case This test checks whether variables are detected.


Test Procedure User click variable detection button.
Expected Result Variables are detected properly.
Actual Result Result is correct.
Comment Result function is working fine.
Accuracy Accuracy is achieved.
5.4.6. Test Case 6
Table 5.6. Testing functions

Test case This test checks whether functions are detected properly.
Test Procedure User click function detection button.
Expected Result functions are detected properly.
Actual Result Result is correct.
Comment Result function is working fine.
Accuracy Accuracy is achieved.

5.4.7. Test Case 7


Table 5.7. Testing database

Test case This test checks whether functions are detected properly.
Test Procedure User click update database function.
Expected Result Database is populated properly.
Actual Result Result is correct.
Comment Result function is working fine.
Accuracy Accuracy is achieved.

5.5. Ease of use


CoBrA is easy to use. This is the era of computer and internet so almost every second
person has a computer or laptop in his/her ownership so they can have this application
within an economical cost.

CoBrA 37
Testing and Integration

Furthermore, in addition to this, the application can be easily moved from one computer
to another because this application has its own local database that will also copy with this
application.

CHAPTER 6
CONCLUSION

CoBrA 38
Conclusion

6.1. Conclusion
CoBrA is windows-based application developed for programmers and students of computer
programming specifically which helps them most in their work. Further improvements in
this project can be made. That is use for hardware-based programs in different languages.
Until now we have achieved Browsing Code, Detecting, and resolving macros, detecting
variables and functions, Creating Database and populating it. The future versions of this project
can include multiple features like language detection etc.
So, we have multiple opportunities for CoBrA. As it is an economical product due to its low
development cost. So, this product can become a successful venture in the market and it will be
a true achievement.

CoBrA 39
REFERENCES & APPENDICES
References & Appendices

Appendix A Abbreviations
Definition, Acronym & Abbreviations
Acronym &Abbreviations Meanings
CoBrA Code Browsing Analyzer
SRS Software Requirement Specification
UML Unified Modeling Language
GUI Graphical User Interface
CLI Command Line Interface
API Application Program Interface
RAM Random Access Memory
GB Giga Byte
GHz Gigahertz
ROM Read Only Memory
ER Entity Relationship

Let’s Move i
References & Appendices

Appendix B Code Schematics


Finction and Variables Detection
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace CoBra_revise

class variable_function

public string line;

public string[] lines;

string[] tokens;

public variable_function(string line)

this.line = line;

public void change_line(string line)

this.line = line;

this.lines = null;

Let’s Move ii
References & Appendices

//split line by ;

public bool split_line()

if (line.Contains(";"))

this.lines = this.line.Split(';');

return true;

return false;

//seprate each variable if any

List<string> seprate_v_of_same_type(string variable_line, string data_type)

List<string> sep_v_of_same_t_list = new List<string>();

string[] sep_v_of_same_t;

if (variable_line.Contains(","))

if (data_type.Contains("*")) {

data_type = data_type.Trim('*');

sep_v_of_same_t_list.Add(data_type+" pointer");

sep_v_of_same_t = variable_line.Split(',');

for (int i = 0; i < sep_v_of_same_t.Length; i++)

sep_v_of_same_t[i] = sep_v_of_same_t[i].Trim('*');

sep_v_of_same_t[i] = sep_v_of_same_t[i].Trim();

Let’s Move iii


References & Appendices

if (sep_v_of_same_t[i].Contains(data_type))

sep_v_of_same_t[i] = sep_v_of_same_t[i].Remove(0, data_type.Length);

sep_v_of_same_t_list.Add(sep_v_of_same_t[i]);

//not working condition

else if (data_type.Contains("["))

sep_v_of_same_t_list.Add(data_type + " array");

sep_v_of_same_t = variable_line.Split(',');

for (int i = 0; i < sep_v_of_same_t.Length; i++)

sep_v_of_same_t[i] = sep_v_of_same_t[i].Trim();

if (sep_v_of_same_t[i].Contains(data_type))

sep_v_of_same_t[i] = sep_v_of_same_t[i].Remove(0, data_type.Length);

sep_v_of_same_t_list.Add(sep_v_of_same_t[i]);

else

sep_v_of_same_t_list.Add(data_type);

Let’s Move iv
References & Appendices

sep_v_of_same_t = variable_line.Split(',');

for (int i = 0; i < sep_v_of_same_t.Length; i++)

sep_v_of_same_t[i] = sep_v_of_same_t[i].Trim();

if (sep_v_of_same_t[i].Contains(data_type))

sep_v_of_same_t[i] = sep_v_of_same_t[i].Remove(0, data_type.Length);

sep_v_of_same_t_list.Add(sep_v_of_same_t[i]);

//seprate it

else

if (data_type.Contains("*"))

data_type = data_type.Trim('*');

variable_line = variable_line.Remove(0, data_type.Length);

data_type = data_type + " pointer";

variable_line = variable_line.Trim('*');

variable_line = variable_line.Trim();

sep_v_of_same_t_list.Add(data_type);

sep_v_of_same_t_list.Add(variable_line);

else if (variable_line.Contains("["))

variable_line = variable_line.Remove(0, data_type.Length);

Let’s Move v
References & Appendices

data_type = data_type + " array";

//variable_line = variable_line.Trim('[');

//variable_line = variable_line.Trim(']');

variable_line = variable_line.Trim();

sep_v_of_same_t_list.Add(data_type);

sep_v_of_same_t_list.Add(variable_line);

else

variable_line = variable_line.Trim();

sep_v_of_same_t_list.Add(data_type);

variable_line = variable_line.Remove(0, data_type.Length);

sep_v_of_same_t_list.Add(variable_line);

return sep_v_of_same_t_list;

public List<List<string>> process_lines()

List<List<string>> variable_lines = new List<List<string>>();

List<string> variable_list = new List<string>();

string datatype="";

if (this.lines == null)

Let’s Move vi
References & Appendices

datatype = check_for_premitive_dt(line);

if (datatype!=null)

if (!line.Contains("("))

variable_lines.Add(seprate_v_of_same_type(this.line, datatype));

else {

//for multiple lines

//check if line contain built in data type

for (int i = 0; i < lines.Length; i++) {

datatype = check_for_premitive_dt(lines[i]);

if (datatype!= null)

if (!lines[i].Contains("(")) {

variable_lines.Add(seprate_v_of_same_type(this.lines[i], datatype));

return variable_lines ;

Let’s Move vii


References & Appendices

//check for premitive data types

public string check_for_premitive_dt(string str)

List<int> indexs = new List<int>();

if(str.Contains("short")) {

//can be int only

if (str.Contains("*"))

indexs = AllIndexesOf_substring(str, "short");

if (indexs.Count > 0)

if (str.Contains("short int ")) { return "short int*"; }

return "short*";

else {

indexs = AllIndexesOf_substring(str, "short");

if (indexs.Count > 0) {

if (str.Contains("short int ")) { return "short int"; }

return "short"; }

if (str.Contains("long"))

//can be long / long double / long int

if (str.Contains(" int "))

Let’s Move viii


References & Appendices

if (str.Contains("*"))

//long int

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long int*"; }

else

//long int

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long int"; }

if (str.Contains(" double "))

//long double

if (str.Contains("*")) {

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long double*"; }

else {

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long double"; }

else

Let’s Move ix
References & Appendices

if (str.Contains("*")) {

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long*"; }

} else {

indexs = AllIndexesOf_substring(str, "long");

if (indexs.Count > 0) { return "long"; }

//simple long

if (str.Contains("int"))

if (str.Contains("*")) {

//MessageBox.Show(" i am called");

indexs = AllIndexesOf_substring(str, "int");

if (indexs.Count > 0) { return "int*"; }

else

//MessageBox.Show(" i am called");

indexs = AllIndexesOf_substring(str, "int");

if (indexs.Count > 0) { return "int"; }

//remaining typess

if (str.Contains("float"))

Let’s Move x
References & Appendices

if (str.Contains("*"))

indexs = AllIndexesOf_substring(str, "float");

if (indexs.Count > 0) { return "float*"; }

else

//remaining typess

indexs = AllIndexesOf_substring(str, "float");

if (indexs.Count > 0) { return "float"; }

if (str.Contains("double"))

if (str.Contains("*"))

//remaining typess

indexs = AllIndexesOf_substring(str, "double");

if (indexs.Count > 0) { return "double*"; }

else

//remaining typess

indexs = AllIndexesOf_substring(str, "double");

if (indexs.Count > 0) { return "double"; }

if (str.Contains("char"))

Let’s Move xi
References & Appendices

if (str.Contains("*"))

indexs = AllIndexesOf_substring(str, "char");

if (indexs.Count > 0) { return "char*"; }

else

//remaining typess

indexs = AllIndexesOf_substring(str, "char");

if (indexs.Count > 0) { return "char"; }

if (str.Contains("bool"))

if (str.Contains("*"))

//remaining typess

indexs = AllIndexesOf_substring(str, "bool");

if (indexs.Count > 0) { return "bool*"; }

else

//remaining typess

indexs = AllIndexesOf_substring(str, "bool");

if (indexs.Count > 0) { return "bool"; }

Let’s Move xii


References & Appendices

if (str.Contains("wchar_t"))

if (str.Contains("*"))

indexs = AllIndexesOf_substring(str, "wchar_t");

if (indexs.Count > 0) { return "wchar_t*"; }

else

//remaining typess

indexs = AllIndexesOf_substring(str, "wchar_t");

if (indexs.Count > 0) { return "wchar_t"; }

else

//check for reserve words

//could be a object type

//remaining typess

return null;

//all index of subtring

public List<int> AllIndexesOf_substring(string str, string value)

if (String.IsNullOrEmpty(value))

Let’s Move xiii


References & Appendices

throw new ArgumentException("the string to find may not be empty", "value");

List<int> indexes = new List<int>();

if (str.Contains(value))

for (int index = 0; ; index += value.Length)

index = str.IndexOf(value, index);

if (index == -1)

return indexes;

if (verify_is_premitive(str, value, index))

indexes.Add(index);

return indexes;

//check for premitive data types variables

public bool verify_is_premitive(string str, string value, int index)

if (index != 0)

if (index + value.Length != str.Length)

//middle case

if (isalphabet_numb(str[index - 1]) || isalphabet_numb(str[index + value.Length]))

return false;

Let’s Move xiv


References & Appendices

else

return true;

else if (isalphabet_numb(str[index - 1]))

//last case

return false;

else

return true;

else if (index == 0)

if (index + value.Length != str.Length)

if (isalphabet_numb(str[index + value.Length]))

return false;

else

return true;

Let’s Move xv
References & Appendices

else

return true;

return false;

//check surrounding alphabets

public bool isalphabet_numb(char c)

if (!(c >= 'A' && c <= 'Z') &&

!(c >= 'a' && c <= 'z') &&

!(c >= '0' && c <= '9') &&

!(c == '_'))

//is not alphanumeric

return false;

//is alphanumeric

return true;

public bool find_pair_of_qoutes_for_var(string str, int index)

//check for cout<< statement

if (str.Contains("cout<<")) { return false;}

return false;

Let’s Move xvi


References & Appendices

//get libraries

public bool check_libraries()

if (this.lines == null)

string lib_line = this.line.Replace(" ", "");

if (lib_line.Contains("#include")) { return true; }

return false;

public bool check_macro()

{ if (this.lines == null)

string lib_line = this.line.Replace(" ", "");

if (lib_line.Contains("#define")) { return true; }

return false;

Let’s Move xvii


References & Appendices

Data handler:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CoBra_revise
{
public class DataHandler
{

SqlConnection conn = new SqlConnection(@"Data


Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\cobradb.mdf;Integrated
Security=True;Connect Timeout=30");

public bool addvariable(string nam, string typ, int dec, int def)
{
string query = @"INSERT INTO variable VALUES(@vname, @vtype, @vdef, @vdec)";
SqlCommand cmd = new SqlCommand(query, conn);

cmd.Parameters.AddWithValue("@vname", nam);
cmd.Parameters.AddWithValue("@vtype", typ);
cmd.Parameters.AddWithValue("@vdef", def);
cmd.Parameters.AddWithValue("@vdec", dec);

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

public BindingSource showvariable()


{
try
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM variable",
conn);
DataTable data = new DataTable();
adapter.Fill(data);

BindingSource bdsource = new BindingSource();


bdsource.DataSource = data;
return bdsource;

/* foreach (DataRow row in data.Rows)


{

Let’s Move xviii


References & Appendices

MessageBox.Show(row["vname"].ToString()+ row["vtype"].ToString() +
row["vdef"].ToString() + row["vdec"].ToString());
}*/
}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}
}

public bool addfunction(string nam, string type, int dec, int def, int fuse)
{

string query = @"INSERT INTO functions VALUES(@fname, @ftype, @fdec, @fdef,


@fuse)";
SqlCommand cmd = new SqlCommand(query, conn);

cmd.Parameters.AddWithValue("@fname", nam);
cmd.Parameters.AddWithValue("@ftype", type);
cmd.Parameters.AddWithValue("@fdec", dec);
cmd.Parameters.AddWithValue("@fdef", def);
cmd.Parameters.AddWithValue("@fuse", fuse);

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

public bool updatefunction_use(string nam)


{

string query = @"UPDATE functions SET fuse ='" +1+ "' Where fname =
'"+nam+"'";

query = "UPDATE functions " +

"SET fuse=@fuse " +


"WHERE CONVERT(VARCHAR, fname) = @fname";
SqlCommand cmd = new SqlCommand(query, conn);

cmd.Parameters.Add("@fname", SqlDbType.VarChar,100).Value = nam;


cmd.Parameters.Add("@fuse", SqlDbType.TinyInt).Value = 1;

// cmd.Parameters.AddWithValue("@fuse", 1);
//cmd.Parameters.AddWithValue("@fname", nam);

Let’s Move xix


References & Appendices

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

public BindingSource showfunction()


{
try
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM functions",
conn);
DataTable data = new DataTable();
adapter.Fill(data);

BindingSource bdsource = new BindingSource();


bdsource.DataSource = data;
return bdsource;

}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}
}

public bool addliberary(string nam)


{
string query = @"INSERT INTO library VALUES(@lname)";
SqlCommand cmd = new SqlCommand(query, conn);

cmd.Parameters.AddWithValue("@lname", nam);

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

public BindingSource showlibrary()


{
try
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM library",
conn);

Let’s Move xx
References & Appendices

DataTable data = new DataTable();


adapter.Fill(data);

BindingSource bdsource = new BindingSource();


bdsource.DataSource = data;
return bdsource;

}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}
}

public bool addmacro(string nam, string type)


{
string query = @"INSERT INTO macro VALUES(@mname, @mtype)";
SqlCommand cmd = new SqlCommand(query, conn);

cmd.Parameters.AddWithValue("@mname", nam);
cmd.Parameters.AddWithValue("@mtype", type);

conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

public void showmacros()


{
try
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM macro", conn);
DataTable data = new DataTable();
adapter.Fill(data);
foreach (DataRow row in data.Rows)
{
MessageBox.Show(row["mname"].ToString() + row["mtype"].ToString());
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();

Let’s Move xxi


References & Appendices

}
}

public bool deleteall()


{
string query = @"DELETE FROM variable";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

query = @"DELETE FROM functions";


cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

query = @"DELETE FROM library";


cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

query = @"DELETE FROM macro";


cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
return true;
}

}
}

Let’s Move xxii

You might also like