screen sharing script in unity

i am a app developer i want to develop an application in which i am getting problem in screen sharing can anyone help me in getting screen sharing script

public long Method1(int numAttempts)
02
{
03
// Stopwatch stopWatch = new Stopwatch()
04
// stopWatch.Start();
05
for (int i = 0; i < numAttempts; i++)
06
{
07
SIZE size;
08
IntPtr hBitmap;
09
IntPtr hDC = Win32Stuff.GetDC(Win32Stuff.GetDesktopWindow());
10
IntPtr hMemDC = GDIStuff.CreateCompatibleDC(hDC);
11

12
        size.cx = Win32Stuff.GetSystemMetrics
13
                  (Win32Stuff.SM_CXSCREEN);
14
 
15
        size.cy = Win32Stuff.GetSystemMetrics
16
                  (Win32Stuff.SM_CYSCREEN);
17
 
18
        hBitmap = GDIStuff.CreateCompatibleBitmap(hDC, size.cx / 2, size.cy);
19
 
20
        if (hBitmap != IntPtr.Zero)
21
        {
22
            IntPtr hOld = (IntPtr)GDIStuff.SelectObject
23
                                   (hMemDC, hBitmap);
24
 
25
            GDIStuff.BitBlt(hMemDC, 0, 0, size.cx / 2, size.cy, hDC,
26
                                           0, 0, GDIStuff.SRCCOPY);
27
 
28
            GDIStuff.SelectObject(hMemDC, hOld);
29
            GDIStuff.DeleteDC(hMemDC);
30
            Win32Stuff.ReleaseDC(Win32Stuff.GetDesktopWindow(), hDC);
31
            Bitmap bmp = System.Drawing.Image.FromHbitmap(hBitmap);
32
            GDIStuff.DeleteObject(hBitmap);
33
            GC.Collect();
34
            return bmp;
35
        }
36
        return null;
37
    }
38
   // stopWatch.Stop();
39
  //  return stopWatch.ElapsedMilliseconds;
40
}

this code in c# can u please convert it into unity java

public long Method1(int numAttempts)
02
{
03
// Stopwatch stopWatch = new Stopwatch()
04
// stopWatch.Start();
05
for (int i = 0; i < numAttempts; i++)
06
{
07
SIZE size;
08
IntPtr hBitmap;
09
IntPtr hDC = Win32Stuff.GetDC(Win32Stuff.GetDesktopWindow());
10
IntPtr hMemDC = GDIStuff.CreateCompatibleDC(hDC);
11

12
        size.cx = Win32Stuff.GetSystemMetrics
13
                  (Win32Stuff.SM_CXSCREEN);
14
 
15
        size.cy = Win32Stuff.GetSystemMetrics
16
                  (Win32Stuff.SM_CYSCREEN);
17
 
18
        hBitmap = GDIStuff.CreateCompatibleBitmap(hDC, size.cx / 2, size.cy);
19
 
20
        if (hBitmap != IntPtr.Zero)
21
        {
22
            IntPtr hOld = (IntPtr)GDIStuff.SelectObject
23
                                   (hMemDC, hBitmap);
24
 
25
            GDIStuff.BitBlt(hMemDC, 0, 0, size.cx / 2, size.cy, hDC,
26
                                           0, 0, GDIStuff.SRCCOPY);
27
 
28
            GDIStuff.SelectObject(hMemDC, hOld);
29
            GDIStuff.DeleteDC(hMemDC);
30
            Win32Stuff.ReleaseDC(Win32Stuff.GetDesktopWindow(), hDC);
31
            Bitmap bmp = System.Drawing.Image.FromHbitmap(hBitmap);
32
            GDIStuff.DeleteObject(hBitmap);
33
            GC.Collect();
34
            return bmp;
35
        }
36
        return null;
37
    }
38
   // stopWatch.Stop();
39
  //  return stopWatch.ElapsedMilliseconds;
40
}

this code in c# can u please convert it into unity java