├── .gitattributes ├── .gitignore ├── API.cs ├── CCAPI-NCAPI.csproj ├── CCAPI.cs ├── NCAppInterface.dll ├── NCAppInterface.pdb ├── PS3API.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs └── Resources.resx └── Resources ├── ccapi-2.60.jpg ├── fenetre.ico └── ps3.ico /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /API.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NCAppInterface; 6 | 7 | namespace CCAPI_NCAPI 8 | { 9 | public class API : IAPI 10 | { 11 | 12 | private bool enabled = false; 13 | public API() 14 | { 15 | 16 | } 17 | 18 | //Declarations of all our internal API variables 19 | string myName = "Control Console API"; 20 | string myDescription = "NetCheat API for the Control Console API (PS3).\n\nCEX and DEX supported!"; 21 | string myAuthor = "Enstone and iMCSx"; 22 | string myVersion = "2.60"; 23 | string myPlatform = "PS3"; 24 | string myContactLink = "http://www.nextgenupdate.com/forums/ps3-cheats-customization/693857-controlconsoleapi-2-60-rev3-ccapi-4-70-a-37.html"; 25 | System.Drawing.Image myIcon = Properties.Resources.ico; 26 | 27 | /// 28 | /// Website link to contact info or download (leave "" if no link) 29 | /// 30 | public string ContactLink 31 | { 32 | get { return myContactLink; } 33 | } 34 | 35 | /// 36 | /// Name of the API (displayed on title bar of NetCheat) 37 | /// 38 | public string Name 39 | { 40 | get { return myName; } 41 | } 42 | 43 | /// 44 | /// Description of the API's purpose 45 | /// 46 | public string Description 47 | { 48 | get { return myDescription; } 49 | } 50 | 51 | /// 52 | /// Author(s) of the API 53 | /// 54 | public string Author 55 | { 56 | get { return myAuthor; } 57 | 58 | } 59 | 60 | /// 61 | /// Current version of the API 62 | /// 63 | public string Version 64 | { 65 | get { return myVersion; } 66 | } 67 | 68 | /// 69 | /// Name of platform (abbreviated, i.e. PC, PS3, XBOX, iOS) 70 | /// 71 | public string Platform 72 | { 73 | get { return myPlatform; } 74 | } 75 | 76 | /// 77 | /// Returns whether the platform is little endian by default 78 | /// 79 | public bool isPlatformLittleEndian 80 | { 81 | get { return false; } 82 | } 83 | 84 | /// 85 | /// Icon displayed along with the other data in the API tab, if null NetCheat icon is displayed 86 | /// 87 | public System.Drawing.Image Icon 88 | { 89 | get { return myIcon; } 90 | } 91 | 92 | /// 93 | /// Read bytes from memory of target process. 94 | /// Returns read bytes into bytes array. 95 | /// Returns false if failed. 96 | /// 97 | public bool GetBytes(ulong address, ref byte[] bytes) 98 | { 99 | if (!enabled) 100 | return false; 101 | if (_ccapi == null) 102 | _ccapi = new CCAPI(); 103 | 104 | return _ccapi.GetMemory((uint)address, bytes) >= 0; 105 | } 106 | 107 | /// 108 | /// Write bytes to the memory of target process. 109 | /// 110 | public void SetBytes(ulong address, byte[] bytes) 111 | { 112 | if (!enabled) 113 | return; 114 | if (_ccapi == null) 115 | _ccapi = new CCAPI(); 116 | 117 | _ccapi.SetMemory((uint)address, bytes); 118 | } 119 | 120 | /// 121 | /// Shutdown game or platform 122 | /// 123 | public void Shutdown() 124 | { 125 | if (!enabled) 126 | return; 127 | if (_ccapi == null) 128 | _ccapi = new CCAPI(); 129 | 130 | _ccapi.ShutDown(CCAPI.RebootFlags.ShutDown); 131 | } 132 | 133 | private CCAPI _ccapi; 134 | private string ip = ""; 135 | /// 136 | /// Connects to target. 137 | /// If platform doesn't require connection, just return true. 138 | /// 139 | public bool Connect() 140 | { 141 | if (!enabled) 142 | return false; 143 | 144 | if (_ccapi == null) 145 | _ccapi = new CCAPI(); 146 | 147 | if (ip == "") 148 | { 149 | bool ret = _ccapi.ConnectTarget(); 150 | ip = _ccapi.ps3api.GetConsoleIP(); 151 | return ret; 152 | } 153 | else 154 | return _ccapi.ConnectTarget(ip) >= 0; 155 | } 156 | 157 | /// 158 | /// Disconnects from target. 159 | /// 160 | public void Disconnect() 161 | { 162 | if (!enabled) 163 | return; 164 | if (_ccapi == null) 165 | _ccapi = new CCAPI(); 166 | 167 | _ccapi.DisconnectTarget(); 168 | 169 | _ccapi = new CCAPI(); 170 | } 171 | 172 | /// 173 | /// Attaches to target process. 174 | /// This should automatically continue the process if it is stopped. 175 | /// 176 | public bool Attach() 177 | { 178 | if (_ccapi == null) 179 | _ccapi = new CCAPI(); 180 | 181 | return _ccapi.AttachProcess(CCAPI.ProcessType.CURRENTGAME) >= 0; 182 | } 183 | 184 | /// 185 | /// Pauses the attached process (return false if not available feature) 186 | /// 187 | public bool PauseProcess() 188 | { 189 | return false; 190 | } 191 | 192 | /// 193 | /// Continues the attached process (return false if not available feature) 194 | /// 195 | public bool ContinueProcess() 196 | { 197 | return false; 198 | } 199 | 200 | /// 201 | /// Tells NetCheat if the process is currently stopped (return false if not available feature) 202 | /// 203 | public bool isProcessStopped() 204 | { 205 | return false; 206 | } 207 | 208 | /// 209 | /// Called by user. 210 | /// Should display options for the API. 211 | /// Can be used for other things. 212 | /// 213 | public void Configure() 214 | { 215 | if (_ccapi == null) 216 | _ccapi = new CCAPI(); 217 | 218 | _ccapi.OpenManager(); 219 | } 220 | 221 | /// 222 | /// Called on initialization 223 | /// 224 | public void Initialize() 225 | { 226 | if (IntPtr.Size == 8) 227 | { 228 | System.Windows.Forms.MessageBox.Show("CCAPI does not support 64 bit mode!\nPlease switch to 32 bit NetCheat."); 229 | } 230 | else 231 | enabled = true; 232 | } 233 | 234 | /// 235 | /// Called when disposed 236 | /// 237 | public void Dispose() 238 | { 239 | //Put any cleanup code in here for when the program is stopped 240 | } 241 | 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /CCAPI-NCAPI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BE529977-4618-43D1-B589-979BFFD044A7} 8 | Library 9 | Properties 10 | CCAPI_NCAPI 11 | CCAPI-NCAPI 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | NCAppInterface.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Resources.resx 51 | True 52 | True 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | ResXFileCodeGenerator 65 | Resources.Designer.cs 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /CCAPI.cs: -------------------------------------------------------------------------------- 1 | // ************************************************* // 2 | // --- Copyright (c) 2014 iMCS Productions --- // 3 | // ************************************************* // 4 | // PS3Lib v4 By FM|T iMCSx // 5 | // // 6 | // Features v4.4 : // 7 | // - Support CCAPI v2.6 C# by iMCSx // 8 | // - Set Boot Console ID // 9 | // - Popup better form with icon // 10 | // - CCAPI Consoles List Popup French/English // 11 | // - CCAPI Get Console Info // 12 | // - CCAPI Get Console List // 13 | // - CCAPI Get Number Of Consoles // 14 | // - Get Console Name TMAPI/CCAPI // 15 | // // 16 | // Credits : FM|T Enstone , Buc-ShoTz // 17 | // // 18 | // Follow me : // 19 | // // 20 | // FrenchModdingTeam.com // 21 | // Youtube.com/iMCSx // 22 | // Twitter.com/iMCSx // 23 | // Facebook.com/iMCSx // 24 | // // 25 | // ************************************************* // 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Runtime.InteropServices; 31 | using System.Text; 32 | using System.Reflection; 33 | using System.Windows.Forms; 34 | using System.IO; 35 | using System.Diagnostics; 36 | using Microsoft.Win32; 37 | using System.Security.Cryptography; 38 | 39 | namespace CCAPI_NCAPI 40 | { 41 | public class CCAPI 42 | { 43 | [DllImport("user32.dll")] 44 | internal static extern IntPtr SetForegroundWindow(IntPtr hWnd); 45 | 46 | [DllImport("user32.dll")] 47 | internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); 48 | 49 | [DllImport("kernel32.dll")] 50 | static extern IntPtr LoadLibrary(string dllName); 51 | 52 | [DllImport("kernel32.dll")] 53 | static extern IntPtr GetProcAddress(IntPtr hModule, string procName); 54 | 55 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 56 | private delegate int connectConsoleDelegate(string targetIP); 57 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 58 | private delegate int disconnectConsoleDelegate(); 59 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 60 | private delegate int getConnectionStatusDelegate(ref int status); 61 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 62 | private delegate int getConsoleInfoDelegate(int index, IntPtr ptrN, IntPtr ptrI); 63 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 64 | private delegate int getDllVersionDelegate(); 65 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 66 | private delegate int getFirmwareInfoDelegate(ref int firmware, ref int ccapi, ref int consoleType); 67 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 68 | private delegate int getNumberOfConsolesDelegate(); 69 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 70 | private delegate int getProcessListDelegate(ref uint numberProcesses, IntPtr processIdPtr); 71 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 72 | private delegate int getProcessMemoryDelegate(uint processID, ulong offset, uint size, byte[] buffOut); 73 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 74 | private delegate int getProcessNameDelegate(uint processID, IntPtr strPtr); 75 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 76 | private delegate int getTemperatureDelegate(ref int cell, ref int rsx); 77 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 78 | private delegate int notifyDelegate(int mode, string msgWChar); 79 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 80 | private delegate int ringBuzzerDelegate(int type); 81 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 82 | private delegate int setBootConsoleIdsDelegate(int idType, int on, byte[] ID); 83 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 84 | private delegate int setConsoleIdsDelegate(int idType, byte[] consoleID); 85 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 86 | private delegate int setConsoleLedDelegate(int color, int status); 87 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 88 | private delegate int setProcessMemoryDelegate(uint processID, ulong offset, uint size, byte[] buffIn); 89 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 90 | private delegate int shutdownDelegate(int mode); 91 | 92 | private connectConsoleDelegate connectConsole; 93 | private disconnectConsoleDelegate disconnectConsole; 94 | private getConnectionStatusDelegate getConnectionStatus; 95 | private getConsoleInfoDelegate getConsoleInfo; 96 | private getDllVersionDelegate getDllVersion; 97 | private getFirmwareInfoDelegate getFirmwareInfo; 98 | private getNumberOfConsolesDelegate getNumberOfConsoles; 99 | private getProcessListDelegate getProcessList; 100 | private getProcessMemoryDelegate getProcessMemory; 101 | private getProcessNameDelegate getProcessName; 102 | private getTemperatureDelegate getTemperature; 103 | private notifyDelegate notify; 104 | private ringBuzzerDelegate ringBuzzer; 105 | private setBootConsoleIdsDelegate setBootConsoleIds; 106 | private setConsoleIdsDelegate setConsoleIds; 107 | private setConsoleLedDelegate setConsoleLed; 108 | private setProcessMemoryDelegate setProcessMemory; 109 | private shutdownDelegate shutdown; 110 | 111 | private IntPtr libModule = IntPtr.Zero; 112 | private readonly string CCAPIHASH = "C2FE9E1C387CF29AAC781482C28ECF86"; 113 | private string programPath = ""; 114 | 115 | public CCAPI() 116 | { 117 | RegistryKey Key = Registry 118 | .CurrentUser 119 | .OpenSubKey(@"Software\FrenchModdingTeam\CCAPI\InstallFolder"); 120 | 121 | if (Key != null) 122 | { 123 | string Path = Key.GetValue("path") as String; 124 | programPath = Path; 125 | if (!string.IsNullOrEmpty(Path)) 126 | { 127 | string DllUrl = Path + @"\CCAPI.dll"; 128 | if (File.Exists(DllUrl)) 129 | { 130 | if (BitConverter.ToString(MD5.Create() 131 | .ComputeHash(File.ReadAllBytes(DllUrl))) 132 | .Replace("-", "").Equals(CCAPIHASH)) 133 | { 134 | if (libModule == IntPtr.Zero) 135 | libModule = LoadLibrary(DllUrl); 136 | 137 | if (libModule != IntPtr.Zero) 138 | { 139 | connectConsole = (connectConsoleDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIConnectConsole"), typeof(connectConsoleDelegate)); 140 | disconnectConsole = (disconnectConsoleDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIDisconnectConsole"), typeof(disconnectConsoleDelegate)); 141 | getConnectionStatus = (getConnectionStatusDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetConnectionStatus"), typeof(getConnectionStatusDelegate)); 142 | getConsoleInfo = (getConsoleInfoDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetConsoleInfo"), typeof(getConsoleInfoDelegate)); 143 | getDllVersion = (getDllVersionDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetDllVersion"), typeof(getDllVersionDelegate)); 144 | getFirmwareInfo = (getFirmwareInfoDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetFirmwareInfo"), typeof(getFirmwareInfoDelegate)); 145 | getNumberOfConsoles = (getNumberOfConsolesDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetNumberOfConsoles"), typeof(getNumberOfConsolesDelegate)); 146 | getProcessList = (getProcessListDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetProcessList"), typeof(getProcessListDelegate)); 147 | 148 | getProcessMemory = (getProcessMemoryDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetMemory"), typeof(getProcessMemoryDelegate)); 149 | getProcessName = (getProcessNameDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetProcessName"), typeof(getProcessNameDelegate)); 150 | getTemperature = (getTemperatureDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIGetTemperature"), typeof(getTemperatureDelegate)); 151 | notify = (notifyDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIVshNotify"), typeof(notifyDelegate)); 152 | ringBuzzer = (ringBuzzerDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIRingBuzzer"), typeof(ringBuzzerDelegate)); 153 | setBootConsoleIds = (setBootConsoleIdsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPISetBootConsoleIds"), typeof(setBootConsoleIdsDelegate)); 154 | setConsoleIds = (setConsoleIdsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPISetConsoleIds"), typeof(setConsoleIdsDelegate)); 155 | setConsoleLed = (setConsoleLedDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPISetConsoleLed"), typeof(setConsoleLedDelegate)); 156 | 157 | setProcessMemory = (setProcessMemoryDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPISetMemory"), typeof(setProcessMemoryDelegate)); 158 | shutdown = (shutdownDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(libModule, "CCAPIShutdown"), typeof(shutdownDelegate)); 159 | } 160 | else 161 | { 162 | MessageBox.Show("Impossible to load CCAPI.dll version 2.60.", "CCAPI.dll cannot be load", MessageBoxButtons.OK, MessageBoxIcon.Error); 163 | } 164 | } 165 | else 166 | { 167 | MessageBox.Show("You're not using the right CCAPI.dll please install the version 2.60.", "CCAPI.dll version incorrect", MessageBoxButtons.OK, MessageBoxIcon.Error); 168 | } 169 | } 170 | else 171 | { 172 | MessageBox.Show("You need to install CCAPI to use this library.", "CCAPI.dll not found", MessageBoxButtons.OK, MessageBoxIcon.Error); 173 | } 174 | } 175 | else 176 | { 177 | MessageBox.Show("Invalid CCAPI folder, please re-install it.", "CCAPI not installed", MessageBoxButtons.OK, MessageBoxIcon.Error); 178 | } 179 | } 180 | else 181 | { 182 | MessageBox.Show("You need to install CCAPI to use this library.", "CCAPI not installed", MessageBoxButtons.OK, MessageBoxIcon.Error); 183 | } 184 | } 185 | 186 | public enum IdType 187 | { 188 | IDPS, 189 | PSID 190 | } 191 | 192 | public enum NotifyIcon 193 | { 194 | INFO, 195 | CAUTION, 196 | FRIEND, 197 | SLIDER, 198 | WRONGWAY, 199 | DIALOG, 200 | DIALOGSHADOW, 201 | TEXT, 202 | POINTER, 203 | GRAB, 204 | HAND, 205 | PEN, 206 | FINGER, 207 | ARROW, 208 | ARROWRIGHT, 209 | PROGRESS, 210 | TROPHY1, 211 | TROPHY2, 212 | TROPHY3, 213 | TROPHY4 214 | } 215 | 216 | public enum ConsoleType 217 | { 218 | CEX = 1, 219 | DEX = 2, 220 | TOOL = 3 221 | } 222 | 223 | public enum ProcessType 224 | { 225 | VSH, 226 | SYS_AGENT, 227 | CURRENTGAME 228 | } 229 | 230 | public enum RebootFlags 231 | { 232 | ShutDown = 1, 233 | SoftReboot = 2, 234 | HardReboot = 3 235 | } 236 | 237 | public enum BuzzerMode 238 | { 239 | Continuous, 240 | Single, 241 | Double 242 | } 243 | 244 | public enum LedColor 245 | { 246 | Green = 1, 247 | Red = 2 248 | } 249 | 250 | public enum LedMode 251 | { 252 | Off, 253 | On, 254 | Blink 255 | } 256 | 257 | private TargetInfo pInfo = new TargetInfo(); 258 | 259 | private IntPtr ReadDataFromUnBufPtr(IntPtr unBuf, ref T storage) 260 | { 261 | storage = (T)Marshal.PtrToStructure(unBuf, typeof(T)); 262 | return new IntPtr(unBuf.ToInt64() + Marshal.SizeOf((T)storage)); 263 | } 264 | 265 | private class System 266 | { 267 | public static int 268 | connectionID = -1; 269 | public static uint 270 | processID = 0; 271 | public static uint[] 272 | processIDs; 273 | } 274 | 275 | /// Get informations from your target. 276 | public class TargetInfo 277 | { 278 | public int 279 | Firmware = 0, 280 | CCAPI = 0, 281 | ConsoleType = 0, 282 | TempCell = 0, 283 | TempRSX = 0; 284 | public ulong 285 | SysTable = 0; 286 | } 287 | 288 | /// Get Info for targets. 289 | public class ConsoleInfo 290 | { 291 | public string 292 | Name, 293 | Ip; 294 | } 295 | 296 | private void CompleteInfo(ref TargetInfo Info, int fw, int ccapi, ulong sysTable, int consoleType, int tempCELL, int tempRSX) 297 | { 298 | Info.Firmware = fw; 299 | Info.CCAPI = ccapi; 300 | Info.SysTable = sysTable; 301 | Info.ConsoleType = consoleType; 302 | Info.TempCell = tempCELL; 303 | Info.TempRSX = tempRSX; 304 | } 305 | 306 | public bool OpenManager() 307 | { 308 | if (programPath == null || programPath == "") 309 | return false; 310 | 311 | string[] files = Directory.GetFiles(programPath, "*.exe", SearchOption.AllDirectories); 312 | for (int x = 0; x < files.Length; x++) 313 | { 314 | if (files[x].IndexOf("Manager") > 0) 315 | { 316 | //Check if process already open 317 | Process[] res = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(files[x])); 318 | if (res.Length > 0) //Open existing process 319 | { 320 | IntPtr hWnd = res[0].MainWindowHandle; 321 | if (hWnd != IntPtr.Zero) 322 | { 323 | SetForegroundWindow(hWnd); 324 | ShowWindow(hWnd, 1); 325 | } 326 | } 327 | else //Open new instance 328 | { 329 | Process.Start(files[x]); 330 | } 331 | 332 | return true; 333 | } 334 | } 335 | 336 | return false; 337 | } 338 | 339 | /// Return true if a ccapi function return a good integer. 340 | public bool SUCCESS(int Void) 341 | { 342 | if (Void == 0) 343 | return true; 344 | else return false; 345 | } 346 | 347 | /// Connect your console by console list. 348 | public PS3API ps3api = new PS3API(); 349 | public bool ConnectTarget() 350 | { 351 | return new PS3API.ConsoleList(ps3api).Show(); 352 | } 353 | 354 | /// Connect your console by ip address. 355 | public int ConnectTarget(string targetIP) 356 | { 357 | int code = connectConsole(targetIP); 358 | return code; 359 | } 360 | 361 | /// Get the status of the console. 362 | public int GetConnectionStatus() 363 | { 364 | int status = 0; 365 | getConnectionStatus(ref status); 366 | return status; 367 | } 368 | 369 | /// Disconnect your console. 370 | public int DisconnectTarget() 371 | { 372 | return disconnectConsole(); 373 | } 374 | 375 | /// Attach the default process (Current Game). 376 | public int AttachProcess() 377 | { 378 | int result = -1; System.processID = 0; 379 | result = GetProcessList(out System.processIDs); 380 | if (SUCCESS(result) && System.processIDs.Length > 0) 381 | { 382 | for (int i = 0; i < System.processIDs.Length; i++) 383 | { 384 | string name = String.Empty; 385 | result = GetProcessName(System.processIDs[i], out name); 386 | if (!SUCCESS(result)) 387 | break; 388 | if (!name.Contains("flash")) 389 | { 390 | System.processID = System.processIDs[i]; 391 | break; 392 | } 393 | else result = -1; 394 | } 395 | if (System.processID == 0) 396 | System.processID = System.processIDs[System.processIDs.Length - 1]; 397 | } 398 | else result = -1; 399 | return result; 400 | } 401 | 402 | /// Attach your desired process. 403 | public int AttachProcess(ProcessType procType) 404 | { 405 | int result = -1; System.processID = 0; 406 | result = GetProcessList(out System.processIDs); 407 | if (result >= 0 && System.processIDs.Length > 0) 408 | { 409 | for (int i = 0; i < System.processIDs.Length; i++) 410 | { 411 | string name = String.Empty; 412 | result = GetProcessName(System.processIDs[i], out name); 413 | if (result < 0) 414 | break; 415 | if (procType == ProcessType.VSH && name.Contains("vsh")) 416 | { 417 | System.processID = System.processIDs[i]; break; 418 | } 419 | else if (procType == ProcessType.SYS_AGENT && name.Contains("agent")) 420 | { 421 | System.processID = System.processIDs[i]; break; 422 | } 423 | else if (procType == ProcessType.CURRENTGAME && !name.Contains("flash")) 424 | { 425 | System.processID = System.processIDs[i]; break; 426 | } 427 | } 428 | if (System.processID == 0) 429 | System.processID = System.processIDs[System.processIDs.Length - 1]; 430 | } 431 | else result = -1; 432 | return result; 433 | } 434 | 435 | /// Attach your desired process. 436 | public int AttachProcess(uint process) 437 | { 438 | int result = -1; 439 | uint[] procs = new uint[64]; 440 | result = GetProcessList(out procs); 441 | if (SUCCESS(result)) 442 | { 443 | for (int i = 0; i < procs.Length; i++) 444 | { 445 | if (procs[i] == process) 446 | { 447 | result = 0; 448 | System.processID = process; 449 | break; 450 | } 451 | else result = -1; 452 | } 453 | } 454 | procs = null; 455 | return result; 456 | } 457 | 458 | /// Get a list of all processes available. 459 | public int GetProcessList(out uint[] processIds) 460 | { 461 | uint numOfProcs = 64; int result = -1; 462 | IntPtr ptr = Marshal.AllocHGlobal((int)(4 * 0x40)); 463 | result = getProcessList(ref numOfProcs, ptr); 464 | processIds = new uint[numOfProcs]; 465 | if (SUCCESS(result)) 466 | { 467 | IntPtr unBuf = ptr; 468 | for (uint i = 0; i < numOfProcs; i++) 469 | unBuf = ReadDataFromUnBufPtr(unBuf, ref processIds[i]); 470 | } 471 | Marshal.FreeHGlobal(ptr); 472 | return result; 473 | } 474 | 475 | /// Get the process name of your choice. 476 | public int GetProcessName(uint processId, out string name) 477 | { 478 | IntPtr ptr = Marshal.AllocHGlobal((int)(0x211)); int result = -1; 479 | result = getProcessName(processId, ptr); 480 | name = String.Empty; 481 | if (SUCCESS(result)) 482 | name = Marshal.PtrToStringAnsi(ptr); 483 | Marshal.FreeHGlobal(ptr); 484 | return result; 485 | } 486 | 487 | /// Return the current process attached. Use this function only if you called AttachProcess before. 488 | public uint GetAttachedProcess() 489 | { 490 | return System.processID; 491 | } 492 | 493 | /// Set memory to offset (uint). 494 | public int SetMemory(uint offset, byte[] buffer) 495 | { 496 | return setProcessMemory(System.processID, (ulong)offset, (uint)buffer.Length, buffer); 497 | } 498 | 499 | /// Set memory to offset (ulong). 500 | public int SetMemory(ulong offset, byte[] buffer) 501 | { 502 | return setProcessMemory(System.processID, offset, (uint)buffer.Length, buffer); 503 | } 504 | 505 | /// Set memory to offset (string hex). 506 | public int SetMemory(ulong offset, string hexadecimal) 507 | { 508 | byte[] Entry = StringToByteArray(hexadecimal); 509 | Array.Reverse(Entry); 510 | return setProcessMemory(System.processID, offset, (uint)Entry.Length, Entry); 511 | } 512 | 513 | /// Get memory from offset (uint). 514 | public int GetMemory(uint offset, byte[] buffer) 515 | { 516 | return getProcessMemory(System.processID, (ulong)offset, (uint)buffer.Length, buffer); 517 | } 518 | 519 | /// Get memory from offset (ulong). 520 | public int GetMemory(ulong offset, byte[] buffer) 521 | { 522 | return getProcessMemory(System.processID, offset, (uint)buffer.Length, buffer); 523 | } 524 | 525 | /// Like Get memory but this function return directly the buffer from the offset (uint). 526 | public byte[] GetBytes(uint offset, uint length) 527 | { 528 | byte[] buffer = new byte[length]; 529 | GetMemory(offset, buffer); 530 | return buffer; 531 | } 532 | 533 | /// Like Get memory but this function return directly the buffer from the offset (ulong). 534 | public byte[] GetBytes(ulong offset, uint length) 535 | { 536 | byte[] buffer = new byte[length]; 537 | GetMemory(offset, buffer); 538 | return buffer; 539 | } 540 | 541 | /// Display the notify message on your PS3. 542 | public int Notify(NotifyIcon icon, string message) 543 | { 544 | return notify((int)icon, message); 545 | } 546 | 547 | /// Display the notify message on your PS3. 548 | public int Notify(int icon, string message) 549 | { 550 | return notify(icon, message); 551 | } 552 | 553 | /// You can shutdown the console or just reboot her according the flag selected. 554 | public int ShutDown(RebootFlags flag) 555 | { 556 | return shutdown((int)flag); 557 | } 558 | 559 | /// Your console will emit a song. 560 | public int RingBuzzer(BuzzerMode flag) 561 | { 562 | return ringBuzzer((int)flag); 563 | } 564 | 565 | /// Change leds for your console. 566 | public int SetConsoleLed(LedColor color, LedMode mode) 567 | { 568 | return setConsoleLed((int)color, (int)mode); 569 | } 570 | 571 | private int GetTargetInfo() 572 | { 573 | int result = -1; int[] sysTemp = new int[2]; 574 | int fw = 0, ccapi = 0, consoleType = 0; ulong sysTable = 0; 575 | result = getFirmwareInfo(ref fw, ref ccapi, ref consoleType); 576 | if (result >= 0) 577 | { 578 | result = getTemperature(ref sysTemp[0], ref sysTemp[1]); 579 | if (result >= 0) 580 | CompleteInfo(ref pInfo, fw, ccapi, sysTable, consoleType, sysTemp[0], sysTemp[1]); 581 | } 582 | 583 | return result; 584 | } 585 | 586 | /// Get informations of your console and store them into TargetInfo class. 587 | public int GetTargetInfo(out TargetInfo Info) 588 | { 589 | Info = new TargetInfo(); 590 | int result = -1; int[] sysTemp = new int[2]; 591 | int fw = 0, ccapi = 0, consoleType = 0; ulong sysTable = 0; 592 | result = getFirmwareInfo(ref fw, ref ccapi, ref consoleType); 593 | if (result >= 0) 594 | { 595 | result = getTemperature(ref sysTemp[0], ref sysTemp[1]); 596 | if (result >= 0) 597 | { 598 | CompleteInfo(ref Info, fw, ccapi, sysTable, consoleType, sysTemp[0], sysTemp[1]); 599 | CompleteInfo(ref pInfo, fw, ccapi, sysTable, consoleType, sysTemp[0], sysTemp[1]); 600 | } 601 | } 602 | return result; 603 | } 604 | 605 | /// Return the current firmware of your console in string format. 606 | public string GetFirmwareVersion() 607 | { 608 | if (pInfo.Firmware == 0) 609 | GetTargetInfo(); 610 | 611 | string ver = pInfo.Firmware.ToString("X8"); 612 | string char1 = ver.Substring(1, 1) + "."; 613 | string char2 = ver.Substring(3, 1); 614 | string char3 = ver.Substring(4, 1); 615 | return char1 + char2 + char3; 616 | } 617 | 618 | /// Return the current temperature of your system in string. 619 | public string GetTemperatureCELL() 620 | { 621 | if (pInfo.TempCell == 0) 622 | GetTargetInfo(out pInfo); 623 | 624 | return pInfo.TempCell.ToString() + " C"; 625 | } 626 | 627 | /// Return the current temperature of your system in string. 628 | public string GetTemperatureRSX() 629 | { 630 | if (pInfo.TempRSX == 0) 631 | GetTargetInfo(out pInfo); 632 | return pInfo.TempRSX.ToString() + " C"; 633 | } 634 | 635 | /// Return the type of your firmware in string format. 636 | public string GetFirmwareType() 637 | { 638 | if (pInfo.ConsoleType.ToString() == "") 639 | GetTargetInfo(out pInfo); 640 | string type = String.Empty; 641 | if (pInfo.ConsoleType == (int)ConsoleType.CEX) 642 | type = "CEX"; 643 | else if (pInfo.ConsoleType == (int)ConsoleType.DEX) 644 | type = "DEX"; 645 | else if (pInfo.ConsoleType == (int)ConsoleType.TOOL) 646 | type = "TOOL"; 647 | return type; 648 | } 649 | 650 | /// Clear informations into the DLL (PS3Lib). 651 | public void ClearTargetInfo() 652 | { 653 | pInfo = new TargetInfo(); 654 | } 655 | 656 | /// Set a new ConsoleID in real time. (string) 657 | public int SetConsoleID(string consoleID) 658 | { 659 | if (string.IsNullOrEmpty(consoleID)) 660 | { 661 | MessageBox.Show("Cannot send an empty value", "Empty or null console id", MessageBoxButtons.OK, MessageBoxIcon.Error); 662 | return -1; 663 | } 664 | string newCID = String.Empty; 665 | if (consoleID.Length >= 32) 666 | newCID = consoleID.Substring(0, 32); 667 | return SetConsoleID(StringToByteArray(newCID)); 668 | } 669 | 670 | /// Set a new ConsoleID in real time. (bytes) 671 | public int SetConsoleID(byte[] consoleID) 672 | { 673 | if (consoleID.Length <= 0) 674 | { 675 | MessageBox.Show("Cannot send an empty value", "Empty or null console id", MessageBoxButtons.OK, MessageBoxIcon.Error); 676 | return -1; 677 | } 678 | return setConsoleIds((int)IdType.IDPS, consoleID); 679 | } 680 | 681 | /// Set a new PSID in real time. (string) 682 | public int SetPSID(string PSID) 683 | { 684 | if (string.IsNullOrEmpty(PSID)) 685 | { 686 | MessageBox.Show("Cannot send an empty value", "Empty or null psid", MessageBoxButtons.OK, MessageBoxIcon.Error); 687 | return -1; 688 | } 689 | string PS_ID = String.Empty; 690 | if (PSID.Length >= 32) 691 | PS_ID = PSID.Substring(0, 32); 692 | return SetPSID(StringToByteArray(PS_ID)); 693 | } 694 | 695 | /// Set a new PSID in real time. (bytes) 696 | public int SetPSID(byte[] consoleID) 697 | { 698 | if (consoleID.Length <= 0) 699 | { 700 | MessageBox.Show("Cannot send an empty value", "Empty or null psid", MessageBoxButtons.OK, MessageBoxIcon.Error); 701 | return -1; 702 | } 703 | return setConsoleIds((int)IdType.PSID, consoleID); 704 | } 705 | 706 | /// Set a console ID when the console is running. (string) 707 | public int SetBootConsoleID(string consoleID, IdType Type = IdType.IDPS) 708 | { 709 | string newCID = String.Empty; 710 | if (consoleID.Length >= 32) 711 | newCID = consoleID.Substring(0, 32); 712 | return SetBootConsoleID(StringToByteArray(consoleID), Type); 713 | } 714 | 715 | /// Set a console ID when the console is running. (bytes) 716 | public int SetBootConsoleID(byte[] consoleID, IdType Type = IdType.IDPS) 717 | { 718 | return setBootConsoleIds((int)Type, 1, consoleID); 719 | } 720 | 721 | /// Reset a console ID when the console is running. 722 | public int ResetBootConsoleID(IdType Type = IdType.IDPS) 723 | { 724 | return setBootConsoleIds((int)Type, 0, null); 725 | } 726 | 727 | /// Return CCAPI Version. 728 | public int GetDllVersion() 729 | { 730 | return getDllVersion(); 731 | } 732 | 733 | /// Return a list of informations for each console available. 734 | public List GetConsoleList() 735 | { 736 | List data = new List(); 737 | int targetCount = getNumberOfConsoles(); 738 | IntPtr name = Marshal.AllocHGlobal((int)(256)), 739 | ip = Marshal.AllocHGlobal((int)(256)); 740 | for (int i = 0; i < targetCount; i++) 741 | { 742 | ConsoleInfo Info = new ConsoleInfo(); 743 | getConsoleInfo(i, name, ip); 744 | Info.Name = Marshal.PtrToStringAnsi(name); 745 | Info.Ip = Marshal.PtrToStringAnsi(ip); 746 | data.Add(Info); 747 | } 748 | Marshal.FreeHGlobal(name); 749 | Marshal.FreeHGlobal(ip); 750 | return data; 751 | } 752 | 753 | internal static byte[] StringToByteArray(string hex) 754 | { 755 | try 756 | { 757 | string replace = hex.Replace("0x", ""); 758 | string Stringz = replace.Insert(replace.Length - 1, "0"); 759 | 760 | int Odd = replace.Length; 761 | bool Nombre; 762 | if (Odd % 2 == 0) 763 | Nombre = true; 764 | else 765 | Nombre = false; 766 | if (Nombre == true) 767 | { 768 | return Enumerable.Range(0, replace.Length) 769 | .Where(x => x % 2 == 0) 770 | .Select(x => Convert.ToByte(replace.Substring(x, 2), 16)) 771 | .ToArray(); 772 | } 773 | else 774 | { 775 | return Enumerable.Range(0, replace.Length) 776 | .Where(x => x % 2 == 0) 777 | .Select(x => Convert.ToByte(Stringz.Substring(x, 2), 16)) 778 | .ToArray(); 779 | } 780 | } 781 | catch 782 | { 783 | MessageBox.Show("Incorrect value (empty)", "StringToByteArray Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 784 | return new byte[1]; 785 | } 786 | } 787 | } 788 | } 789 | -------------------------------------------------------------------------------- /NCAppInterface.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dnawrkshp/CCAPI-NCAPI/03f5ebbf5f3484f0fa8fa5101d804f26b3f15b59/NCAppInterface.dll -------------------------------------------------------------------------------- /NCAppInterface.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dnawrkshp/CCAPI-NCAPI/03f5ebbf5f3484f0fa8fa5101d804f26b3f15b59/NCAppInterface.pdb -------------------------------------------------------------------------------- /PS3API.cs: -------------------------------------------------------------------------------- 1 | // ************************************************* // 2 | // --- Copyright (c) 2014 iMCS Productions --- // 3 | // ************************************************* // 4 | // PS3Lib v4 By FM|T iMCSx // 5 | // // 6 | // Features v4.4 : // 7 | // - Support CCAPI v2.6 C# by iMCSx // 8 | // - Set Boot Console ID // 9 | // - Popup better form with icon // 10 | // - CCAPI Consoles List Popup French/English // 11 | // - CCAPI Get Console Info // 12 | // - CCAPI Get Console List // 13 | // - CCAPI Get Number Of Consoles // 14 | // - Get Console Name TMAPI/CCAPI // 15 | // // 16 | // Credits : FM|T Enstone , Buc-ShoTz // 17 | // // 18 | // Follow me : // 19 | // // 20 | // FrenchModdingTeam.com // 21 | // Youtube.com/iMCSx // 22 | // Twitter.com/iMCSx // 23 | // Facebook.com/iMCSx // 24 | // // 25 | // ************************************************* // 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Drawing; 30 | using System.Globalization; 31 | using System.Linq; 32 | using System.Reflection; 33 | using System.Text; 34 | using System.Windows.Forms; 35 | using CCAPI_NCAPI.Properties; 36 | 37 | namespace CCAPI_NCAPI 38 | { 39 | public enum Lang 40 | { 41 | Null, 42 | French, 43 | English 44 | } 45 | 46 | public class PS3API 47 | { 48 | private static string targetName = String.Empty; 49 | private static string targetIp = String.Empty; 50 | public PS3API() 51 | { 52 | 53 | } 54 | 55 | public void setTargetName(string value) 56 | { 57 | targetName = value; 58 | } 59 | 60 | private void MakeInstanceAPI() 61 | { 62 | if (Common.CcApi == null) 63 | Common.CcApi = new CCAPI(); 64 | } 65 | 66 | private class SetLang 67 | { 68 | public static Lang defaultLang = Lang.Null; 69 | } 70 | 71 | 72 | private class Common 73 | { 74 | public static CCAPI CcApi; 75 | } 76 | 77 | /// Force a language for the console list popup. 78 | public void SetFormLang(Lang Language) 79 | { 80 | SetLang.defaultLang = Language; 81 | } 82 | 83 | /// init again the connection if you use a Thread or a Timer. 84 | public void InitTarget() 85 | { 86 | 87 | } 88 | 89 | /// Connect your console with selected API. 90 | public bool ConnectTarget(int target = 0) 91 | { 92 | // We'll check again if the instance has been done, else you'll got an exception error. 93 | MakeInstanceAPI(); 94 | 95 | bool result = false; 96 | result = new ConsoleList(this).Show(); 97 | return result; 98 | } 99 | 100 | /// Connect your console with CCAPI. 101 | public bool ConnectTarget(string ip) 102 | { 103 | // We'll check again if the instance has been done. 104 | MakeInstanceAPI(); 105 | if (Common.CcApi.SUCCESS(Common.CcApi.ConnectTarget(ip))) 106 | { 107 | targetIp = ip; 108 | return true; 109 | } 110 | else return false; 111 | } 112 | 113 | /// Disconnect Target with selected API. 114 | public void DisconnectTarget() 115 | { 116 | Common.CcApi.DisconnectTarget(); 117 | } 118 | 119 | /// Attach the current process (current Game) with selected API. 120 | public bool AttachProcess() 121 | { 122 | // We'll check again if the instance has been done. 123 | MakeInstanceAPI(); 124 | 125 | bool AttachResult = false; 126 | AttachResult = Common.CcApi.SUCCESS(Common.CcApi.AttachProcess()); 127 | return AttachResult; 128 | } 129 | 130 | public string GetConsoleName() 131 | { 132 | if (targetName != String.Empty) 133 | return targetName; 134 | 135 | if (targetIp != String.Empty) 136 | { 137 | List Data = new List(); 138 | Data = Common.CcApi.GetConsoleList(); 139 | if (Data.Count > 0) 140 | { 141 | for (int i = 0; i < Data.Count; i++) 142 | if (Data[i].Ip == targetIp) 143 | return Data[i].Name; 144 | } 145 | } 146 | return targetIp; 147 | } 148 | 149 | public string GetConsoleIP() 150 | { 151 | return targetIp; 152 | } 153 | 154 | /// Set memory to offset with selected API. 155 | public void SetMemory(uint offset, byte[] buffer) 156 | { 157 | Common.CcApi.SetMemory(offset, buffer); 158 | } 159 | 160 | /// Get memory from offset using the Selected API. 161 | public void GetMemory(uint offset, byte[] buffer) 162 | { 163 | Common.CcApi.GetMemory(offset, buffer); 164 | } 165 | 166 | /// Get memory from offset with a length using the Selected API. 167 | public byte[] GetBytes(uint offset, int length) 168 | { 169 | byte[] buffer = new byte[length]; 170 | Common.CcApi.GetMemory(offset, buffer); 171 | return buffer; 172 | } 173 | 174 | /// Access to all CCAPI functions. 175 | public CCAPI CCAPI 176 | { 177 | get { return new CCAPI(); } 178 | } 179 | 180 | public class ConsoleList 181 | { 182 | private PS3API Api; 183 | private List data; 184 | 185 | public ConsoleList(PS3API f) 186 | { 187 | Api = f; 188 | data = Api.CCAPI.GetConsoleList(); 189 | } 190 | 191 | /// Return the systeme language, if it's others all text will be in english. 192 | private Lang getSysLanguage() 193 | { 194 | if (SetLang.defaultLang == Lang.Null) 195 | { 196 | if (CultureInfo.CurrentCulture.ThreeLetterWindowsLanguageName.StartsWith("FRA")) 197 | return Lang.French; 198 | else return Lang.English; 199 | } 200 | else return SetLang.defaultLang; 201 | } 202 | 203 | private string strTraduction(string keyword) 204 | { 205 | if (getSysLanguage() == Lang.French) 206 | { 207 | switch (keyword) 208 | { 209 | case "btnConnect": return "Connexion"; 210 | case "btnRefresh": return "Rafraîchir"; 211 | case "errorSelect": return "Vous devez d'abord sélectionner une console."; 212 | case "errorSelectTitle": return "Sélectionnez une console."; 213 | case "selectGrid": return "Sélectionnez une console dans la grille."; 214 | case "selectedLbl": return "Sélection :"; 215 | case "formTitle": return "Choisissez une console..."; 216 | case "noConsole": return "Aucune console disponible, démarrez CCAPI Manager (v2.5) et ajoutez une nouvelle console."; 217 | case "noConsoleTitle": return "Aucune console disponible."; 218 | } 219 | } 220 | else 221 | { 222 | switch (keyword) 223 | { 224 | case "btnConnect": return "Connection"; 225 | case "btnRefresh": return "Refresh"; 226 | case "errorSelect": return "You need to select a console first."; 227 | case "errorSelectTitle": return "Select a console."; 228 | case "selectGrid": return "Select a console within this grid."; 229 | case "selectedLbl": return "Selected :"; 230 | case "formTitle": return "Select a console..."; 231 | case "noConsole": return "None consoles available, run CCAPI Manager (v2.5) and add a new console."; 232 | case "noConsoleTitle": return "None console available."; 233 | } 234 | } 235 | return "?"; 236 | } 237 | 238 | public bool Show() 239 | { 240 | bool Result = false; 241 | int tNum = -1; 242 | 243 | // Instance of widgets 244 | Label lblInfo = new Label(); 245 | Button btnConnect = new Button(); 246 | Button btnRefresh = new Button(); 247 | ListViewGroup listViewGroup = new ListViewGroup("Consoles", HorizontalAlignment.Left); 248 | ListView listView = new ListView(); 249 | Form formList = new Form(); 250 | 251 | // Create our button connect 252 | btnConnect.Location = new Point(12, 254); 253 | btnConnect.Name = "btnConnect"; 254 | btnConnect.Size = new Size(198, 23); 255 | btnConnect.TabIndex = 1; 256 | btnConnect.Text = strTraduction("btnConnect"); 257 | btnConnect.UseVisualStyleBackColor = true; 258 | btnConnect.Enabled = false; 259 | btnConnect.Click += (sender, e) => 260 | { 261 | if (tNum > -1) 262 | { 263 | if (Api.ConnectTarget(data[tNum].Ip)) 264 | { 265 | Api.setTargetName(data[tNum].Name); 266 | Result = true; 267 | } 268 | else Result = false; 269 | formList.Close(); 270 | } 271 | else 272 | MessageBox.Show(strTraduction("errorSelect"), strTraduction("errorSelectTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); 273 | }; 274 | 275 | // Create our button refresh 276 | btnRefresh.Location = new Point(216, 254); 277 | btnRefresh.Name = "btnRefresh"; 278 | btnRefresh.Size = new Size(86, 23); 279 | btnRefresh.TabIndex = 1; 280 | btnRefresh.Text = strTraduction("btnRefresh"); 281 | btnRefresh.UseVisualStyleBackColor = true; 282 | btnRefresh.Click += (sender, e) => 283 | { 284 | tNum = -1; 285 | listView.Clear(); 286 | lblInfo.Text = strTraduction("selectGrid"); 287 | btnConnect.Enabled = false; 288 | data = Api.CCAPI.GetConsoleList(); 289 | int sizeD = data.Count(); 290 | for (int i = 0; i < sizeD; i++) 291 | { 292 | ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip); 293 | item.ImageIndex = 0; 294 | listView.Items.Add(item); 295 | } 296 | }; 297 | 298 | // Create our list view 299 | listView.Font = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 300 | listViewGroup.Header = "Consoles"; 301 | listViewGroup.Name = "consoleGroup"; 302 | listView.Groups.AddRange(new ListViewGroup[] { listViewGroup }); 303 | listView.HideSelection = false; 304 | listView.Location = new Point(12, 12); 305 | listView.MultiSelect = false; 306 | listView.Name = "ConsoleList"; 307 | listView.ShowGroups = false; 308 | listView.Size = new Size(290, 215); 309 | listView.TabIndex = 0; 310 | listView.UseCompatibleStateImageBehavior = false; 311 | listView.View = View.List; 312 | listView.ItemSelectionChanged += (sender, e) => 313 | { 314 | tNum = e.ItemIndex; 315 | btnConnect.Enabled = true; 316 | string Name, Ip = "?"; 317 | if (data[tNum].Name.Length > 18) 318 | Name = data[tNum].Name.Substring(0, 17) + "..."; 319 | else Name = data[tNum].Name; 320 | if (data[tNum].Ip.Length > 16) 321 | Ip = data[tNum].Name.Substring(0, 16) + "..."; 322 | else Ip = data[tNum].Ip; 323 | lblInfo.Text = strTraduction("selectedLbl") + " " + Name + " / " + Ip; 324 | }; 325 | 326 | // Create our label 327 | lblInfo.AutoSize = true; 328 | lblInfo.Location = new Point(12, 234); 329 | lblInfo.Name = "lblInfo"; 330 | lblInfo.Size = new Size(158, 13); 331 | lblInfo.TabIndex = 3; 332 | lblInfo.Text = strTraduction("selectGrid"); 333 | 334 | // Create our form 335 | formList.MinimizeBox = false; 336 | formList.MaximizeBox = false; 337 | formList.ClientSize = new Size(314, 285); 338 | formList.AutoScaleDimensions = new SizeF(6F, 13F); 339 | formList.AutoScaleMode = AutoScaleMode.Font; 340 | formList.FormBorderStyle = FormBorderStyle.FixedSingle; 341 | formList.StartPosition = FormStartPosition.CenterScreen; 342 | formList.Text = strTraduction("formTitle"); 343 | formList.Controls.Add(listView); 344 | formList.Controls.Add(lblInfo); 345 | formList.Controls.Add(btnConnect); 346 | formList.Controls.Add(btnRefresh); 347 | 348 | // Start to update our list 349 | ImageList imgL = new ImageList(); 350 | imgL.Images.Add(Resources.ps3); 351 | listView.SmallImageList = imgL; 352 | int sizeData = data.Count(); 353 | 354 | for (int i = 0; i < sizeData; i++) 355 | { 356 | ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip); 357 | item.ImageIndex = 0; 358 | listView.Items.Add(item); 359 | } 360 | 361 | // If there are more than 0 targets we show the form 362 | // Else we inform the user to create a console. 363 | if (sizeData > 0) 364 | formList.ShowDialog(); 365 | else 366 | { 367 | Result = false; 368 | formList.Close(); 369 | MessageBox.Show(strTraduction("noConsole"), strTraduction("noConsoleTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); 370 | } 371 | 372 | return Result; 373 | } 374 | } 375 | } 376 | } 377 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CCAPI-NCAPI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CCAPI-NCAPI")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("dc7aee4c-e3ec-469b-8c91-bba505d311a0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CCAPI_NCAPI.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CCAPI_NCAPI.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 65 | /// 66 | internal static System.Drawing.Icon fenetre { 67 | get { 68 | object obj = ResourceManager.GetObject("fenetre", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap ico { 77 | get { 78 | object obj = ResourceManager.GetObject("ico", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 85 | /// 86 | internal static System.Drawing.Icon ps3 { 87 | get { 88 | object obj = ResourceManager.GetObject("ps3", resourceCulture); 89 | return ((System.Drawing.Icon)(obj)); 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\fenetre.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\ccapi-2.60.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Resources\ps3.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /Resources/ccapi-2.60.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dnawrkshp/CCAPI-NCAPI/03f5ebbf5f3484f0fa8fa5101d804f26b3f15b59/Resources/ccapi-2.60.jpg -------------------------------------------------------------------------------- /Resources/fenetre.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dnawrkshp/CCAPI-NCAPI/03f5ebbf5f3484f0fa8fa5101d804f26b3f15b59/Resources/fenetre.ico -------------------------------------------------------------------------------- /Resources/ps3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dnawrkshp/CCAPI-NCAPI/03f5ebbf5f3484f0fa8fa5101d804f26b3f15b59/Resources/ps3.ico --------------------------------------------------------------------------------