Sunteți pe pagina 1din 10

visual studio

add c++ file:


1-file->new->file: not add to project and we have to add existing
2-rmb on project/solution: add to project

fast create of functions


select codes and choose "extract function"

///
comment for one line

//
comment for block

auto surrond with {}


shift + {

orgnaize logic of code with TODO(pseudocode)


-place "//TODO algorithmic part of code" on each part in code, then in "task list"
you can track them
-for more options, search "task" in option window
-also good for remember some changes that we wandt to do in future

auto brac:select texts and press curly brace


-----------------------
\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
ide path: \Common7\IDE\devenv
c# compiler:\MSBuild\15.0\Bin\Roslyn\csc.exe
vb compiler:\MSBuild\15.0\Bin\Roslyn\vbc.exe
build project: \MSBuild\15.0\Bin\msbuild.exe

change ide setting/solution and project path


tools/options/enviroment/import and export settings
tools/options/project and solutions/locations

where .net framework installed? C:\Windows\Microsoft.NET\Framework


where mobile emulators store? C:\Program Files (x86)\Microsoft XDE

vs cmd tools : Developer Command Prompt, Debuggable Package Manager, x64 Native
Tools Command Prompt, Cross Tools Command Prompt

autocompelete tip: double tab on items with scissor icon in left side create nested
items
autocompelete tip: double tab on items

manage project: tools->options-<enviroment->startup/web browser

show all files in solution explorer->select project and active show all files

unload project

more space and fast navagtion in ui: hide ui:window->auto hide, ctrl+tab

rest docked window to priveus location: ctrl+double click

full screen: alt+shift+enter

quick lunch: ctrl+q


touch simulator: C:\Program Files (x86)\Common Files\Microsoft Shared\Windows
Simulator\15.0

----------------------
-set startup app: solution explorer->rmb on project->set as startup app(bold name)

- solution is container to one or more project

- bold project name is start project: rmb and "set as start"

- show/hide solution: tools->options->projects and solution->always show solution

- one solution at a time

-add project: reference other project we need to add them to solution

-blank solution: new project->other type projects->blank solution

- reference other project to current project


1-create wpf app 2-add a button 3-add this code to button_click
"MessageBox.show("hello")"
4- add c# library(dll) project and create classes 5-add this code to class:
public class Greeting{
public string getMessage(){
string msg="hello"; int hour=DateTime.Now.Hour;
if(hour<=12){msg="morning"}else if(hour>=18){msg="afternoon"}
return msg;
}
}
6-add classes to wfp reference by "add reference" 7-change code in button_click:
using GreetingLogic;
Greeting logic = new Greeting(); MessageBox.show(logic.getMessage());

auto complete
press tab when select item from auto complete menu

- quick action(light blob)


delete unused "usings"

solution extention: sln/suo, is a text file


project:c#/csproj, vb/vbproj, is a xml file

-structure:
solutionName\.sln
\projectName\bin\debug\(optimal)
\projectName\bin\relase\(optimal)
\projectName\obj\
\projectName\Properties\
\projectName\.csproj

-change exe file name: rmb on project name->properties->application->assambely name


-change exe path(bin\debug): rmb on project name->properties->build->output path

manage project from start page: file->start page

comment code: ctrl+k + ctrl+c


uncomment: ctrl+k + ctrl+u
browse inside of refrence classes: object browser

track errors/warrnings/messages realtime: color lines in code view / error list

track building process: output view

rearrange ui: drag tab/drag title bar hold ctrl to no dock

split code view to comparing: rmb on file tabs->new vertical/horizontal group

place most using tab files in left-side by "pinning" them

show pined tabs in seperate row:


Tools -> Options -> Environment -> Tabs and Windows -> Show pinned tabs in separate
row

track pined tabs even if close them or project


Tools->Options->Environment->Tabs and Windows->Maintain pin status if document is
removed from well

-visulaizing and analyise classes/methods/fields:


class view/object browser/code map/class diagam
google class view/object broser icons

- find definetion:
cursor over name/click on name + rmb-> + go to difinition/peek difinition(multiple
in one window)

- who call method ?


click name + rmb->view call heararvy or find all references/"x references" word in
code view

back/forward in tabs(undo/redo): ctrl+-/ctrl+shift+-

- fast access to code parts(presentation/debug) and organazing by bookmarks(assign


name to code parts): view->bookmark manager

- finding implementions and unimplementation parts in code: dropdown menu above of


code view->whites=implement in current code/grays=implement somewhere else

- manage complex codes and get big image


1-edit->outlining(collapse/expand blocks)
create colapsable by select code block+ rmb->outlining->hide selection

- visual debug and get info from state of each line of code by enhanced scroll bar
green/yellow=saved/unsaved after last changes in this line - orange=find result
blue=current line - gray= line of bookmark - red=error - drak red=breakpoint
change options: tools->options->text editor->c#->scroll bar

- searching and filtering


1-select a word in code view
2-select word + ctrl+f, f3=next search even after close quick find
3-find in file
4-search boxs in views/toolbox
5-ctrl+t(go to) is very useful

-let's visual studio help us


1- alt+enter(light blob) on errors/warrnings
example: create usings, method extract for hardcoded variables, correct wrong
typing, change position of arguments, create local variable from method's argument,
renaming, inline variable to local
2-snippet: write keywords and press tab twice, example: if, sw
to access to list of all snippets: rmb on code view->snippet->insert snippet

- if intelisence give you no suggestions, means something is wrong

-refactoring
1-surround with: select code + rmb->snippets->surround with, examples: try/catch
2-edit->advance->format
3-reorder/remove method's arguments: select method + edit->refactor->reorder
parameter

-help
1-select + f1
2-help viewer insted of browser: help->set help perfernce(i can't find it in 2017)
3-double click errors in erorr list
4-help->sample(i can't find it in 2017)
5-quick lunch

-debuging:
A- first breakpoint: select line of code+f9 or click left side of number line, then
f5
B- then walk in code:
code line by line=step over
inside block(methods)=into(inside block) - over(next line) - out(exit from block)
exit and run code = f5(continue)
C- now examine values:
1-callstack = functions
2- data visualizer :hover cursor over variable to see value in
text/xml/html/json/database format(magnify glass icon)
also we can select and copy value in code view or locals window to text file
3- pin a tip: hover mouse and active pin in righside of popup, now you can see it
always
or while popup is open press ctrl to hide popup and then relase to see it
4- local/auto/watch
local:track variables
auto: same as local, more focuse, show value when step over on next line
watches: same as local/auto, see value by type variable name or rmb on variable in
code view->add watch
5- quick watch/immediate window: see and edit experssions
quick watch: rmb on variable in code view->quick watch
immediate window: type ?var_name or ?var_name+13 to reevulate
6- command window: manage/debug from cmd: ??(quick watch with preset of variables)
of filname.cs open file (fast way)

conditional brekpoint: loops


is true: when condtion is true, stop
when value change: variable value change to specific value will stop
action: print message with variable value in output window

7- nonlinear walk in code


run to cursor: loops or moudle that geting called multiple,
jump loops insted of press continus repeatly, start debuging from everywhere
place cursor where want to stop->rmb and turn to cursor
set next statment: drag yellow arrow/rmb set next statment
show next statment: show next line to debug

debug
-add breakpoint programically:
if(System.Diagnostics.Debugger.IsAttached){System.Diagonstics.Debugger.Break();}

debug: data tip


-see primary/struct/class/hash data value
-data tip rmb + text file:great way to variable examine and learn coding, 1-create
text file,2-unpin data tip, 3-unpin data tip again to make it float, 4-rmb on data
pin and copy value to see data structure and copy experssion to see equal
experssion in code 5-also we can add/change/remove experssion in realtime(add new
setter or hash value)
-debug->save/import/clear data tips

debug: data visualizer(data tip/local)


-see database/xml/json/html/text data values

debug:type of breakpoint
-conditonal is true:go to breakpoint and stop running when condition be true
-conditonal when changed:
-hit count:go to breakpoint when loops hit specified value
-function:use when we have multiple function with same name but diffrent parameters
and we want to know which one was called!, method 1: place breakpoint on each
function signture
method2: using function breakpoint

-action: print value to output window, when its value change, your message:
{variable name}

organize breakpoints: put breakpoints in same category by assagin same label to


them then use in column to filter based on label and finally enter label name in
search box

debug:watch

debug:local vs auto: local show everything in scope + method's parameters, auto


show current and previus

clear/disable all breakpoints: debug menu

export/import breakpoints: breakpoints window

debug: immediate: great way to test return value of methods/ assgin new value to
variables/place breakpoint on method's return and call method on immediate window

go to disassambely: shows assembly code corresponding to the instructions created


by the compiler

debug and performance: perfTips: give time to evelate each statment, by compare
these times we can find where code is slow

change varible in debuging: refining values

debug vshost: faster debugging

low level debugging: diassambely, rigestery, memory


debug - debug->window->modules:display .dlls and lib files that used by your code
we can see them in solution explorer->references, but only dll and libs display
that used as call methods in our code !
-order tab tell us, order that dll files load and run

debug: console utilitys:


-powercfg:
-ping:

debug: automate value for cmd parameters: project propertes->debug->command-line


arguments, enter arguments as /imageName=robot.png /color=red

-some useful extenstions


spell checker
VSColorOutput: add color to output window
power tools: rmb on project->power command->open power commands

inteliTrace
no changing in past or future, only current line and when gone to next line you
can't back to last one

- debug
code map(visualize): create map of events

opening
project/soultion: single project/container of multiple project
folder: folecr contain project/solution
website: asp websites
source control: git/team project
file: single file

get path of files: solution explorer->rmb on file -> copy path


open file/project in xplorer: solution explorer->rmb on file -> open containing
folder
-cmd from file path: solution explorer->rmb on file -> open command prompet
fast access tp file path to run it from command line

-lightweight load

- fast know about structure of code and nested blocks ?


hover cursor on dash lines in left side of code

-store editor configuration with .editorconfig

marking white space: edit->advance->white space

keep all extenstion on any computer: roaming extenstion manager

debug:run to cursor: another way click green arrow(run execution here)

debug:attach running app's process to debugging code:1-run projectName\bin\debug or


relase
2-in debug->attach to process, attach running app process 3-start debugging

debug: disable all breakpoints: breakpoint view

debug:exception helper: multi exception in one popup


debug asp with chrome/ie debugging support: 1-place breakpoint on js
2-select chrome from toolbar
3-go where breakpoint marked code will executed

debug: continue: go to next breakpoint

test: live unit testing

09133251687

45270136
45243120

45271126

32650064
32656847
32287139

32724355

09133296523
hod
09133016850
shah nazari - PARDEH

45 - ab
42 - daste/
110 - pardeh
280 - rang
220 - ghabz
370 - keraye
15- hod

masomeh
mASOMEH5364

-----------------------------------------------------------------------------------
------
yellow highligt with yellow arrow: will execute

cntinue: execute code line by line until next breakpoint or end of code

Edit & Continus


purpol error: uncomment commented codes(uncompile code), change value in external
block
we are in a block of code and change variable in above block

change value in realtime: move yellow arrow to changed line, step over, show values

add new value to code

show variable's values(pin/visualize/watch/local/auto)


resourse debug: compare memory used by app in each part of it ?
1-go in each page(part) of app 2-then take a snapshot for each page in memory usage
3-finally compare these snapshots

Diagnostic Tools
Diagnostic Tools, we mean tools that allow you to see historical information (data
collected over time), as opposed to just a single moment in time (like when you are
stopped at a live breakpoint)
diagnostic tools in this window surface information in two complementary ways: by
adding graphs to the timeline in the upper half of the window, and by providing
detailed information in the tabs in the bottom half of the window. Diagnostic tools
use graphs to surface at-a-glance information, and when you see something of
interest you can select a range of time (as described in the next section) to
filter the detailed information in the tabs below

build configurations you should know about: Debug and Release


Debug
configuration typically includes extensive debug information in the build as well
as turning off
optimizations to speed up compilation. Release builds are often optimized (either
for size or for
speed), take a bit longer to build, and result in smaller or faster executables.
Behavior stepping
through with the debugger is often better in the Debug mode than the Release mode

by default, you won't be able to save-out


your customized Fonts and Colors settings. You will need something called the
Visual Studio
Theme Editor extension to do so
If you go to Tools | Options | Environment | General, you can change
the theme to one of the three pre-installed stock themes (Light, Blue, and Dark
Go to Tools | Extensions and Updates
Visual Studio 2015 Color
Theme Editor
After restarting, go to Tools | Customize Colors to open the Color Themes editor
page
Adding a theme to your Visual Studio installs it as an extension in Tools |
Extensions and
Updates…, To remove a theme, simply Uninstall its Extension

Go to Tools | Options | Text Editor | C/C++.


when you type { , a corresponding
} is automatically typed for you

Auto list members on, as that displays a nice dialog with the
complete names of data members listed for you as soon as you start typing
Ctrl + Spacebar

Text Editor | C/C++ |Formatting | auto format bract


Highlight a section of text and select Edit | Advanced | Format
Selection

Ctrl + - [navigate backwards]. Navigation through different pages


of source code (the last place you were at, and the place you are at now) is done
by
pressing Ctrl + - and Ctrl + Shift +
Say, for example, you're editing code in one place, and you want to go back to the
place you've just been (or go back to the section in the code you came from).
Simply
press Ctrl + -, and that will warp you back to the location in the code you were at
last.
To warp forward to the location you were at before you pressed Ctrl + -, press Ctrl
+
Shift + -. To warp back, the previous location should be more than 10 lines away,
or
in a different file. These correspond to the Forward and Back menu buttons in the
toolbar:

Ctrl + W to highlight a single word

Press and hold Ctrl + Shift + right arrow (or left arrow) (not Shift + right arrow)
just to
move to the right and left of the cursor, selecting entire words

Ctrl + M, Ctrl + M collapses a code section

y pressing Ctrl + C, you push


the text that you are copying into an effective stack. Pressing Ctrl + C a second
time on different text pushes that text into the Clipboard Stack
pressing Ctrl + V pastes the top item in the stack. Pressing Ctrl + Shift
+ V accesses a very long history of all the items ever copied in that session

Hold down the Ctrl key while clicking to select an entire word
Hold down the Alt key to select a box of text (Alt + Left Click + Drag).

Alt + Left Click + Drag for selecting a row of text, then typing as well. The
characters you
type will be repeated in rows

Epic Games Launcher is the program that you need to start up the engine itself. It
keeps a
copy of all your projects and libraries in the Library tab

downloading some of the free library packages in the Library | Vault section

Via your local file explorer. Navigate to the root of where your project
is stored, and double-click on the ProjectName.sln file.
ff From UE4, click on File | Open Visual Studio

Logging is extremely important for outputting internal game data. Using log tools
lets you print
information into a handy little Output Log window in the UE4 editor
When coding, we may sometimes want to send some debug information out to the UE log
window. This is possible using the UE_LOG macro. Log messages are an extremely
important
and convenient way to keep track of information in your program as you are
developing it
1. In your code, enter a line of code using the form:
UE_LOG(LogTemp, Warning, TEXT("Some warning message") );
2. Turn on the Output Log inside the UE4 editor to see your log messages printed in
that
window as your program is running.
int intVar = 5;
float floatVar = 3.7f;
FString fstringVar = "an fstring variable";
UE_LOG(LogTemp, Warning, TEXT("Text, %d %f %s"), intVar, floatVar, *fstringVar );
* just before FString variables when using UE_LOG to dereference
the FString to a regular C-style TCHAR pointer

TCHAR is usually defined as a variable type where, if Unicode is being


used in the compile, the TCHAR resolves to wchar_t. If Unicode is
off (compiler switch _UNICODE not defined), then TCHAR resolves to
simply char

construct a string from variables


FString name = "Tim";
int32 mana = 450;
FString string = FString::Printf( TEXT( "Name = %s Mana = %d" ), *name, mana );

FString name = "Tim";


int32 mana = 450;
TArray< FStringFormatArg > args;
args.Add( FStringFormatArg( name ) );
args.Add( FStringFormatArg( mana ) );
FString string = FString::Format( TEXT( "Name = {0} Mana = {1}" ), args );
UE_LOG( LogTemp, Warning, TEXT( "Your string: %s" ), *string );

S-ar putea să vă placă și