Вы находитесь на странице: 1из 8

, C#

: : 26.10.2010 . , " . . wars , C#/lisp/F#/Haskell/... , . ". , , , , " " , " C# " , , ", C++. " holy ". , , .

"

PVS-Studio ,

C#

C#, Microsoft Visual Studio. , , C++.

combobox
, . combobox

combobox . . , .

private void OnMenuMyDropDownCombo(object sender, EventArgs e) { if (e == EventArgs.Empty) { throw (new ArgumentException());

OleMenuCmdEventArgs eventArgs = e as OleMenuCmdEventArgs;

if (eventArgs != null) { string newChoice = eventArgs.InValue as string; IntPtr vOut = eventArgs.OutValue;

if (vOut != IntPtr.Zero && newChoice != null) { throw (new ArgumentException()); } else if (vOut != IntPtr.Zero) { Marshal.GetNativeVariantForObject( this.currentDropDownComboChoice, vOut); }

else if (newChoice != null) { bool validInput = false; int indexInput = -1; for (indexInput = 0; indexInput < dropDownComboChoices.Length; indexInput++) { if (String.Compare( dropDownComboChoices[indexInput], newChoice, true) == 0)

{ validInput = true; break; } }

if (validInput) { this.currentDropDownComboChoice = dropDownComboChoices[indexInput]; if (currentDropDownComboChoice == Resources.Viva64) UseViva64Analysis(null, null); else if (currentDropDownComboChoice == Resources.GeneralAnalysis) UseGeneralAnalysis(null, null); else if (currentDropDownComboChoice == Resources.VivaMP) UseVivaMPAnalysis(null, null); else { throw (new ArgumentException()); } } else { throw (new ArgumentException()); } } else

{ throw (new ArgumentException()); } } else { throw (new ArgumentException()); } }

IntPtr.Zero Marshal.GetNativeVariantForObject()? . . . C# OLE, , . . . . , ,

...

combobox

OnMenuMyDropDownComboGetList()

, . ?

Visual Studio
Visual Studio .
public void OpenDocumentAndNavigateTo(string path, int line, int column) { IVsUIShellOpenDocument openDoc = Package.GetGlobalService( typeof(IVsUIShellOpenDocument)) as IVsUIShellOpenDocument; if (openDoc == null) return; IVsWindowFrame frame; Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp; IVsUIHierarchy hier;

uint itemid; Guid logicalView = VSConstants.LOGVIEWID_Code; if (ErrorHandler.Failed( openDoc.OpenDocumentViaProject(path, ref logicalView, out sp, out hier, out itemid, out frame)) || frame == null) return; object docData; frame.GetProperty((int)__VSFPROPID.VSFPR OPID_DocData, out docData);

VsTextBuffer buffer = docData as VsTextBuffer; if (buffer == null) { IVsTextBufferProvider bufferProvider = docData as IVsTextBufferProvider; if (bufferProvider != null) { IVsTextLines lines; ErrorHandler.ThrowOnFailure( bufferProvider.GetTextBuffer(out lines)); buffer = lines as VsTextBuffer; if (buffer == null) return; } } IVsTextManager mgr = Package.GetGlobalService(typeof(VsTextManagerClass)) as IVsTextManager; if (mgr == null)

return; mgr.NavigateToLineAndColumn( buffer, ref logicalView, line, column, line, column); }

... "

. . "

. ,

C#, XYZ? .

, . __time64_t, C#

C# , ,

! DateTime. ,

__time64_t DataTime :

public static DateTime Time_T2DateTime(long time_t) { //116444736000000000 1600

long win32FileTime = 10000000 * time_t + 116444736000000000; return DateTime.FromFileTime(win32FileTime); }

C# DateTime ,

... ? " " , ?

(solution)
, solution). foreach : (Visual Studio

Solution2 solution = PVSStudio.DTE.Solution as Solution2; SolutionBuild2 solutionBuild = (SolutionBuild2)solution.SolutionBuild; SolutionContexts projectContexts = solutionBuild.ActiveConfiguration.SolutionContexts;

int prjCount = projectContexts.Count; for (int i = 1; i <= prjCount; i++) { SolutionContext projectContext = null; try { projectContext = projectContexts.Item(i); } catch (Exception) { // try/catch block is a workaround. // It's needed for correct working on solution // with unloaded projects. continue; } ...

, . " -

foreach , . .

. ,

, for, . "

C#

, C/C++. , . , 1. Studio API. 2. C++3. C#4. , . . . . API. , , "C# , " ",

C# ( C#"

) .

C++? Visual

__time64_t

Windows. , . "+1"

: 1. 2. , , C#, C# . .