# ============================================================================== # OmniDrop Pro - Smart Wireless Bridge & Privacy Hub # ממשק: עברית מלאה (RTL) | קובץ EXE עצמאי (Standalone) ללא תלויות # נבנה על ידי בינארי חכם (IVRIT.SMARTBINARY.ORG) # ============================================================================== $ErrorActionPreference = "Stop" [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $ProgressPreference = "SilentlyContinue" Write-Host "" Write-Host "=================================================================" -ForegroundColor Cyan Write-Host " OmniDrop Pro - גשר העברת קבצים, שיתוף לוח ופרטיות מקומי " -ForegroundColor White Write-Host " נבנה על ידי בינארי חכם (IVRIT.SMARTBINARY.ORG) " -ForegroundColor Yellow Write-Host "=================================================================" -ForegroundColor Cyan Write-Host "" $destDir = "$env:USERPROFILE\Desktop\OmniDrop" if (!(Test-Path $destDir)) { New-Item -ItemType Directory -Path $destDir -Force | Out-Null } $tempDir = "$destDir\build_temp" if (Test-Path $tempDir) { Remove-Item $tempDir -Recurse -Force } New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { Write-Host "[1/5] מוריד ומחלץ רכיבי QR Code מאובטחים מ-NuGet..." -ForegroundColor Green [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $nugetUrl = "https://www.nuget.org/api/v2/package/QRCoder/1.6.0" $nugetZip = "$tempDir\qrcoder.zip" Invoke-WebRequest -Uri $nugetUrl -OutFile $nugetZip -UseBasicParsing Expand-Archive -Path $nugetZip -DestinationPath "$tempDir\pkg" -Force Copy-Item "$tempDir\pkg\lib\net40\QRCoder.dll" "$tempDir\QRCoder.dll" -Force Write-Host "[2/5] יוצר אייקון ייעודי רב-שכבתי (.ico)..." -ForegroundColor Green $iconGenCs = @' using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; public class IconGenerator { public static void Main(string[] args) { int[] sizes = new int[] { 16, 32, 48, 64, 128, 256 }; using (MemoryStream ms = new MemoryStream()) { BinaryWriter bw = new BinaryWriter(ms); bw.Write((short)0); bw.Write((short)1); bw.Write((short)sizes.Length); byte[][] pngBytes = new byte[sizes.Length][]; int offset = 6 + (16 * sizes.Length); for (int i = 0; i < sizes.Length; i++) { int s = sizes[i]; using (Bitmap bmp = new Bitmap(s, s, PixelFormat.Format32bppArgb)) using (Graphics g = Graphics.FromImage(bmp)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.Clear(Color.Transparent); float pad = s * 0.04f; float diam = s - (pad * 2); using (GraphicsPath path = new GraphicsPath()) { path.AddEllipse(pad, pad, diam, diam); using (PathGradientBrush pgb = new PathGradientBrush(path)) { pgb.CenterColor = Color.FromArgb(255, 30, 41, 69); pgb.SurroundColors = new Color[] { Color.FromArgb(255, 11, 15, 25) }; g.FillEllipse(pgb, pad, pad, diam, diam); } } using (Pen borderPen = new Pen(Color.FromArgb(220, 6, 182, 212), Math.Max(1.2f, s * 0.04f))) { g.DrawEllipse(borderPen, pad + 1, pad + 1, diam - 2, diam - 2); } float cx = s / 2f; float cy = s * 0.44f; using (Pen wavePen = new Pen(Color.FromArgb(245, 255, 255, 255), Math.Max(1.5f, s * 0.055f))) { wavePen.StartCap = LineCap.Round; wavePen.EndCap = LineCap.Round; float r1 = s * 0.28f; float r2 = s * 0.17f; g.DrawArc(wavePen, cx - r1, cy - r1, r1 * 2, r1 * 2, 210, 120); g.DrawArc(wavePen, cx - r2, cy - r2, r2 * 2, r2 * 2, 215, 110); } float arrowY = s * 0.62f; float arrowSize = s * 0.18f; using (GraphicsPath arrowPath = new GraphicsPath()) { PointF[] pts = new PointF[] { new PointF(cx, arrowY + arrowSize), new PointF(cx - arrowSize, arrowY - (arrowSize * 0.4f)), new PointF(cx - (arrowSize * 0.45f), arrowY - (arrowSize * 0.4f)), new PointF(cx - (arrowSize * 0.45f), arrowY - arrowSize), new PointF(cx + (arrowSize * 0.45f), arrowY - arrowSize), new PointF(cx + (arrowSize * 0.45f), arrowY - (arrowSize * 0.4f)), new PointF(cx + arrowSize, arrowY - (arrowSize * 0.4f)) }; arrowPath.AddPolygon(pts); using (LinearGradientBrush lgb = new LinearGradientBrush( new RectangleF(cx - arrowSize, arrowY - arrowSize, arrowSize * 2, arrowSize * 2), Color.FromArgb(255, 6, 182, 212), Color.FromArgb(255, 99, 102, 241), LinearGradientMode.Vertical)) { g.FillPath(lgb, arrowPath); } } using (MemoryStream pngMs = new MemoryStream()) { bmp.Save(pngMs, ImageFormat.Png); pngBytes[i] = pngMs.ToArray(); } } } for (int i = 0; i < sizes.Length; i++) { int s = sizes[i]; bw.Write((byte)(s >= 256 ? 0 : s)); bw.Write((byte)(s >= 256 ? 0 : s)); bw.Write((byte)0); bw.Write((byte)0); bw.Write((short)1); bw.Write((short)32); bw.Write((int)pngBytes[i].Length); bw.Write((int)offset); offset += pngBytes[i].Length; } for (int i = 0; i < sizes.Length; i++) { bw.Write(pngBytes[i]); } File.WriteAllBytes(args[0], ms.ToArray()); } } } '@ [System.IO.File]::WriteAllText("$tempDir\IconGen.cs", $iconGenCs, [System.Text.Encoding]::UTF8) & "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" /target:exe /out:"$tempDir\IconGen.exe" /r:System.Drawing.dll "$tempDir\IconGen.cs" | Out-Null & "$tempDir\IconGen.exe" "$tempDir\OmniDrop.ico" Write-Host "[3/5] מחלץ את קוד המקור המלא של OmniDrop..." -ForegroundColor Green $csSource = @' using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Effects; using System.Windows.Media.Imaging; using System.Windows.Threading; using QRCoder; namespace OmniDrop { public class SharedFileItem { public string Name { get; set; } public string FullPath { get; set; } public long Size { get; set; } public string SizeStr { get; set; } public DateTime AddedAt { get; set; } } public class ReceivedFileItem { public string Name { get; set; } public string FullPath { get; set; } public long Size { get; set; } public string SizeStr { get; set; } public DateTime ReceivedAt { get; set; } } public class Program { private static Mutex mutex = null; static Program() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { string name = new AssemblyName(args.Name).Name + ".dll"; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { if (stream == null) return null; byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); return Assembly.Load(data); } }; } [STAThread] public static void Main() { bool isNew; mutex = new Mutex(true, "OmniDropPro_SingleInstance_Mutex_SmartBinary", out isNew); if (!isNew) { MessageBox.Show("OmniDrop Pro כבר פועל ברקע!\nהשתמש ב-Ctrl+Shift+D או פתח ממגש המערכת (ליד השעון).", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Information); return; } try { System.Windows.Application app = new System.Windows.Application(); MainWindow window = new MainWindow(); app.Run(window); } finally { if (mutex != null) { mutex.ReleaseMutex(); mutex.Close(); } } } } public class LocalHttpServer { private TcpListener listener; private bool isRunning; private int port; private string downloadDir; public event Action FileReceived; public event Action ClipboardReceived; public event Action ClientActivity; public List SharedFiles = new List(); public string ServerClipboardText = "ברוכים הבאים ל-OmniDrop Pro!"; public bool AutoScrubPrivacy = true; public string LocalIpAddress = "127.0.0.1"; public LocalHttpServer(int port, string downloadDir) { this.port = port; this.downloadDir = downloadDir; if (!Directory.Exists(downloadDir)) Directory.CreateDirectory(downloadDir); DetectLocalIp(); } private void DetectLocalIp() { try { using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) { socket.Connect("8.8.8.8", 65530); IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint; if (endPoint != null) { LocalIpAddress = endPoint.Address.ToString(); return; } } } catch { } try { foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork && !IPAddress.IsLoopback(ip)) { LocalIpAddress = ip.ToString(); return; } } } catch { } } public void Start() { try { listener = new TcpListener(IPAddress.Any, port); listener.Start(); isRunning = true; listener.BeginAcceptTcpClient(OnAcceptClient, null); } catch (Exception ex) { MessageBox.Show("שגיאה בהפעלת שרת רשת מקומי: " + ex.Message, "שגיאת רשת", MessageBoxButton.OK, MessageBoxImage.Warning); } } public void Stop() { isRunning = false; if (listener != null) { try { listener.Stop(); } catch { } } } private void OnAcceptClient(IAsyncResult ar) { if (!isRunning) return; try { TcpClient client = listener.EndAcceptTcpClient(ar); listener.BeginAcceptTcpClient(OnAcceptClient, null); ThreadPool.QueueUserWorkItem(HandleClient, client); } catch { } } private void HandleClient(object state) { using (TcpClient client = (TcpClient)state) { client.ReceiveTimeout = 60000; client.SendTimeout = 60000; try { using (NetworkStream stream = client.GetStream()) { byte[] buffer = new byte[8192]; int bytesRead = stream.Read(buffer, 0, buffer.Length); if (bytesRead <= 0) return; int headerEnd = -1; for (int i = 0; i < bytesRead - 3; i++) { if (buffer[i] == '\r' && buffer[i + 1] == '\n' && buffer[i + 2] == '\r' && buffer[i + 3] == '\n') { headerEnd = i; break; } } if (headerEnd == -1) return; string headerStr = Encoding.UTF8.GetString(buffer, 0, headerEnd); string[] lines = headerStr.Split(new string[] { "\r\n" }, StringSplitOptions.None); if (lines.Length == 0) return; string reqLine = lines[0]; string[] reqParts = reqLine.Split(' '); if (reqParts.Length < 2) return; string method = reqParts[0].ToUpper(); string url = reqParts[1]; Dictionary headers = new Dictionary(StringComparer.OrdinalIgnoreCase); for (int i = 1; i < lines.Length; i++) { int colon = lines[i].IndexOf(':'); if (colon > 0) { string k = lines[i].Substring(0, colon).Trim(); string v = lines[i].Substring(colon + 1).Trim(); headers[k] = v; } } if (ClientActivity != null) ClientActivity(1); if (method == "GET" && (url == "/" || url.StartsWith("/?"))) { ServeMobileHtml(stream); } else if (method == "GET" && url.StartsWith("/api/status")) { ServeStatusJson(stream); } else if (method == "GET" && url.StartsWith("/api/ping")) { SendJsonResponse(stream, "{\"status\":\"ok\",\"pong\":true}"); } else if (method == "GET" && url.StartsWith("/download")) { ServeFileDownload(stream, url); } else if (method == "POST" && url.StartsWith("/upload")) { HandleFileUpload(stream, headers, buffer, headerEnd + 4, bytesRead); } else if (method == "POST" && url.StartsWith("/api/clipboard")) { HandleClipboardPost(stream, headers, buffer, headerEnd + 4, bytesRead); } else { Send404(stream); } } } catch { } } } private void ServeMobileHtml(NetworkStream stream) { string html = GetMobilePortalHtml(); byte[] body = Encoding.UTF8.GetBytes(html); string headers = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=utf-8\r\n" + "Content-Length: " + body.Length + "\r\n" + "Connection: close\r\n\r\n"; byte[] hBytes = Encoding.ASCII.GetBytes(headers); stream.Write(hBytes, 0, hBytes.Length); stream.Write(body, 0, body.Length); stream.Flush(); } private void ServeStatusJson(NetworkStream stream) { StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("\"machineName\":\"").Append(EscapeJson(Environment.MachineName)).Append("\","); sb.Append("\"clipboard\":\"").Append(EscapeJson(ServerClipboardText)).Append("\","); sb.Append("\"files\":["); lock (SharedFiles) { for (int i = 0; i < SharedFiles.Count; i++) { var f = SharedFiles[i]; if (i > 0) sb.Append(","); sb.Append("{") .Append("\"name\":\"").Append(EscapeJson(f.Name)).Append("\",") .Append("\"size\":").Append(f.Size).Append(",") .Append("\"sizeStr\":\"").Append(EscapeJson(f.SizeStr)).Append("\",") .Append("\"url\":\"/download?file=").Append(Uri.EscapeDataString(f.Name)).Append("\"") .Append("}"); } } sb.Append("]}"); SendJsonResponse(stream, sb.ToString()); } private void ServeFileDownload(NetworkStream stream, string url) { int q = url.IndexOf("file="); if (q == -1) { Send404(stream); return; } string filename = Uri.UnescapeDataString(url.Substring(q + 5)); int amp = filename.IndexOf('&'); if (amp != -1) filename = filename.Substring(0, amp); SharedFileItem target = null; lock (SharedFiles) { target = SharedFiles.Find(f => f.Name.Equals(filename, StringComparison.OrdinalIgnoreCase)); } if (target == null || !File.Exists(target.FullPath)) { Send404(stream); return; } try { using (FileStream fs = new FileStream(target.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { long len = fs.Length; string ext = Path.GetExtension(target.FullPath).ToLower(); string mime = "application/octet-stream"; if (ext == ".png") mime = "image/png"; else if (ext == ".jpg" || ext == ".jpeg") mime = "image/jpeg"; else if (ext == ".mp4") mime = "video/mp4"; else if (ext == ".pdf") mime = "application/pdf"; else if (ext == ".txt") mime = "text/plain; charset=utf-8"; string head = "HTTP/1.1 200 OK\r\n" + "Content-Type: " + mime + "\r\n" + "Content-Length: " + len + "\r\n" + "Content-Disposition: attachment; filename=\"" + Path.GetFileName(target.FullPath) + "\"\r\n" + "Connection: close\r\n\r\n"; byte[] headBytes = Encoding.ASCII.GetBytes(head); stream.Write(headBytes, 0, headBytes.Length); byte[] buf = new byte[65536]; int r; while ((r = fs.Read(buf, 0, buf.Length)) > 0) { stream.Write(buf, 0, r); } stream.Flush(); } } catch { } } private void HandleFileUpload(NetworkStream stream, Dictionary headers, byte[] initialBuffer, int bodyOffset, int initialBytesRead) { long contentLength = 0; if (headers.ContainsKey("Content-Length")) long.TryParse(headers["Content-Length"], out contentLength); string contentType = headers.ContainsKey("Content-Type") ? headers["Content-Type"] : ""; int bIdx = contentType.IndexOf("boundary="); if (bIdx == -1) { SendJsonResponse(stream, "{\"error\":\"Missing boundary\"}"); return; } string boundary = contentType.Substring(bIdx + 9).Trim().Trim('"'); MemoryStream ms = new MemoryStream(); int firstChunkLen = initialBytesRead - bodyOffset; if (firstChunkLen > 0) ms.Write(initialBuffer, bodyOffset, firstChunkLen); long totalRead = firstChunkLen; byte[] chunk = new byte[65536]; while (totalRead < contentLength) { int toRead = (int)Math.Min(chunk.Length, contentLength - totalRead); int r = stream.Read(chunk, 0, toRead); if (r <= 0) break; ms.Write(chunk, 0, r); totalRead += r; } byte[] body = ms.ToArray(); List savedFiles = ParseMultipartAndSave(body, boundary, downloadDir, AutoScrubPrivacy); foreach (string sf in savedFiles) { long sz = new FileInfo(sf).Length; if (FileReceived != null) FileReceived(sf, sz); } SendJsonResponse(stream, "{\"success\":true,\"filesCount\":" + savedFiles.Count + "}"); } private void HandleClipboardPost(NetworkStream stream, Dictionary headers, byte[] initialBuffer, int bodyOffset, int initialBytesRead) { long contentLength = 0; if (headers.ContainsKey("Content-Length")) long.TryParse(headers["Content-Length"], out contentLength); MemoryStream ms = new MemoryStream(); int firstChunkLen = initialBytesRead - bodyOffset; if (firstChunkLen > 0) ms.Write(initialBuffer, bodyOffset, firstChunkLen); long totalRead = firstChunkLen; byte[] chunk = new byte[4096]; while (totalRead < contentLength) { int toRead = (int)Math.Min(chunk.Length, contentLength - totalRead); int r = stream.Read(chunk, 0, toRead); if (r <= 0) break; ms.Write(chunk, 0, r); totalRead += r; } string json = Encoding.UTF8.GetString(ms.ToArray()); string text = ""; int tIdx = json.IndexOf("\"text\":\""); if (tIdx != -1) { int tEnd = json.IndexOf("\"", tIdx + 8); if (tEnd != -1) text = UnescapeJson(json.Substring(tIdx + 8, tEnd - (tIdx + 8))); } if (!string.IsNullOrEmpty(text)) { ServerClipboardText = text; if (ClipboardReceived != null) ClipboardReceived(text); } SendJsonResponse(stream, "{\"success\":true}"); } private List ParseMultipartAndSave(byte[] body, string boundary, string outDir, bool scrubExif) { List savedPaths = new List(); byte[] boundaryBytes = Encoding.ASCII.GetBytes("--" + boundary); byte[] dlf = Encoding.ASCII.GetBytes("\r\n\r\n"); int idx = 0; while (idx < body.Length) { int found = IndexOf(body, boundaryBytes, idx); if (found == -1) break; idx = found + boundaryBytes.Length; if (idx + 2 <= body.Length && body[idx] == '-' && body[idx + 1] == '-') break; if (idx + 2 <= body.Length && body[idx] == '\r' && body[idx + 1] == '\n') idx += 2; int headEnd = IndexOf(body, dlf, idx); if (headEnd == -1) break; string headerText = Encoding.UTF8.GetString(body, idx, headEnd - idx); idx = headEnd + 4; int nextB = IndexOf(body, boundaryBytes, idx); if (nextB == -1) break; int dataEnd = nextB; if (dataEnd >= 2 && body[dataEnd - 2] == '\r' && body[dataEnd - 1] == '\n') dataEnd -= 2; if (headerText.Contains("filename=\"")) { int fnS = headerText.IndexOf("filename=\"") + 10; int fnE = headerText.IndexOf("\"", fnS); string rawName = headerText.Substring(fnS, fnE - fnS); string filename = Path.GetFileName(rawName); if (!string.IsNullOrEmpty(filename)) { string targetPath = Path.Combine(outDir, filename); int count = 1; string stem = Path.GetFileNameWithoutExtension(filename); string ext = Path.GetExtension(filename); while (File.Exists(targetPath)) { targetPath = Path.Combine(outDir, string.Format("{0}_{1}{2}", stem, count++, ext)); } int dataLen = dataEnd - idx; byte[] fileBytes = new byte[dataLen]; Buffer.BlockCopy(body, idx, fileBytes, 0, dataLen); bool scrubbed = false; if (scrubExif && (ext.ToLower() == ".jpg" || ext.ToLower() == ".jpeg")) { try { using (MemoryStream inMs = new MemoryStream(fileBytes)) using (System.Drawing.Image img = System.Drawing.Image.FromStream(inMs)) using (Bitmap bmp = new Bitmap(img.Width, img.Height)) { using (Graphics g = Graphics.FromImage(bmp)) { g.DrawImage(img, 0, 0, img.Width, img.Height); } bmp.Save(targetPath, ImageFormat.Jpeg); scrubbed = true; } } catch { } } if (!scrubbed) { File.WriteAllBytes(targetPath, fileBytes); } savedPaths.Add(targetPath); } } idx = nextB; } return savedPaths; } private static int IndexOf(byte[] src, byte[] pattern, int start) { for (int i = start; i <= src.Length - pattern.Length; i++) { bool match = true; for (int j = 0; j < pattern.Length; j++) { if (src[i + j] != pattern[j]) { match = false; break; } } if (match) return i; } return -1; } private void SendJsonResponse(NetworkStream stream, string json) { byte[] body = Encoding.UTF8.GetBytes(json); string headers = "HTTP/1.1 200 OK\r\n" + "Content-Type: application/json; charset=utf-8\r\n" + "Access-Control-Allow-Origin: *\r\n" + "Content-Length: " + body.Length + "\r\n" + "Connection: close\r\n\r\n"; byte[] hBytes = Encoding.ASCII.GetBytes(headers); stream.Write(hBytes, 0, hBytes.Length); stream.Write(body, 0, body.Length); stream.Flush(); } private void Send404(NetworkStream stream) { byte[] body = Encoding.UTF8.GetBytes("404 Not Found"); string headers = "HTTP/1.1 404 Not Found\r\nContent-Length: " + body.Length + "\r\nConnection: close\r\n\r\n"; byte[] hBytes = Encoding.ASCII.GetBytes(headers); stream.Write(hBytes, 0, hBytes.Length); stream.Write(body, 0, body.Length); stream.Flush(); } private string EscapeJson(string s) { if (string.IsNullOrEmpty(s)) return ""; return s.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\r", "\\r").Replace("\n", "\\n").Replace("\t", "\\t"); } private string UnescapeJson(string s) { if (string.IsNullOrEmpty(s)) return ""; return s.Replace("\\n", "\n").Replace("\\r", "\r").Replace("\\t", "\t").Replace("\\\"", "\"").Replace("\\\\", "\\"); } private string GetMobilePortalHtml() { return @" OmniDrop Mobile - שיתוף חכם
OmniDrop Mobile
מחובר למחשב
מחובר חי
📤 שליחת קבצים למחשב
מעלה קבצים... 0%
✅ הקובץ הועבר בהצלחה למחשב ונשמר בתיקיית OmniDrop!
📥 קבצים זמינים להורדה מהמחשב
אין כרגע קבצים משותפים במחשב.
גרור קובץ לחלון המחשב כדי שיופיע כאן!
📋 לוח המחשב (זמין להעתקה)
טוען נתונים...
🚀 שליחת טקסט למחשב
✅ הטקסט שוגר בהצלחה והועתק ללוח במחשב!
נבנה על ידי בינארי חכם
"; } } public class MainWindow : Window { private LocalHttpServer server; private int serverPort = 8899; private string downloadsFolder; private System.Windows.Forms.NotifyIcon trayIcon; private DispatcherTimer clipboardTimer; private string lastClipboardText = ""; private StackPanel sidebarPanel; private Grid contentGrid; private List tabButtons = new List(); private List tabPanels = new List(); private int currentTabIndex = 0; private System.Windows.Controls.Image qrImageControl; private TextBlock serverUrlText; private TextBlock serverStatusBadge; private ListBox sharedListBox; private ListBox receivedListBox; private TextBox pcClipboardBox; private TextBox pcSendTextBox; private TextBox langInputBox; private TextBox langOutputBox; private TextBlock exifReportText; private CheckBox autoScrubCheckBox; private string inspectedImagePath = ""; [DllImport("user32.dll")] private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk); [DllImport("user32.dll")] private static extern bool UnregisterHotKey(IntPtr hWnd, int id); private const int HOTKEY_ID = 9000; private const uint MOD_CONTROL = 0x0002; private const uint MOD_SHIFT = 0x0004; private const uint VK_D = 0x44; public MainWindow() { Title = "OmniDrop Pro - גשר שיתוף וסנכרון אלחוטי חכם"; Width = 960; Height = 650; MinWidth = 860; MinHeight = 580; FlowDirection = FlowDirection.RightToLeft; WindowStartupLocation = WindowStartupLocation.CenterScreen; Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(11, 15, 25)); downloadsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "OmniDrop_Downloads"); if (!Directory.Exists(downloadsFolder)) Directory.CreateDirectory(downloadsFolder); server = new LocalHttpServer(serverPort, downloadsFolder); server.FileReceived += OnServerFileReceived; server.ClipboardReceived += OnServerClipboardReceived; server.Start(); BuildUI(); InitTrayIcon(); InitClipboardMonitor(); RefreshQrCode(); LoadExistingDownloads(); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); IntPtr handle = new WindowInteropHelper(this).Handle; HwndSource source = HwndSource.FromHwnd(handle); source.AddHook(HwndHook); RegisterHotKey(handle, HOTKEY_ID, MOD_CONTROL | MOD_SHIFT, VK_D); } private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { const int WM_HOTKEY = 0x0312; if (msg == WM_HOTKEY && wParam.ToInt32() == HOTKEY_ID) { ToggleWindowVisibility(); handled = true; } return IntPtr.Zero; } private void ToggleWindowVisibility() { if (Visibility == Visibility.Visible) { if (WindowState == WindowState.Minimized) { WindowState = WindowState.Normal; Activate(); } else { Hide(); } } else { Show(); WindowState = WindowState.Normal; Activate(); } } private void BuildUI() { Grid root = new Grid(); root.RowDefinitions.Add(new RowDefinition { Height = new GridLength(60) }); root.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); root.RowDefinitions.Add(new RowDefinition { Height = new GridLength(32) }); Border headerBorder = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(240, 18, 26, 43)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(50, 255, 255, 255)), BorderThickness = new Thickness(0, 0, 0, 1), Padding = new Thickness(16, 8, 16, 8) }; headerBorder.MouseLeftButtonDown += (s, e) => { if (e.ButtonState == MouseButtonState.Pressed) DragMove(); }; Grid headerGrid = new Grid(); headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); StackPanel logoSp = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; Border logoBox = new Border { Width = 36, Height = 36, CornerRadius = new CornerRadius(8), Background = new LinearGradientBrush( System.Windows.Media.Color.FromRgb(6, 182, 212), System.Windows.Media.Color.FromRgb(99, 102, 241), 45), Margin = new Thickness(0, 0, 12, 0) }; TextBlock logoGlyph = new TextBlock { Text = "⚡", FontSize = 20, Foreground = System.Windows.Media.Brushes.White, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; logoBox.Child = logoGlyph; logoSp.Children.Add(logoBox); StackPanel titleSp = new StackPanel { VerticalAlignment = VerticalAlignment.Center }; TextBlock titleTb = new TextBlock { Text = "OmniDrop Pro", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White }; TextBlock subTb = new TextBlock { Text = "גשר שיתוף, לוח ופרטיות אלחוטי למחשב ולנייד", FontSize = 11, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)) }; titleSp.Children.Add(titleTb); titleSp.Children.Add(subTb); logoSp.Children.Add(titleSp); Grid.SetColumn(logoSp, 0); headerGrid.Children.Add(logoSp); StackPanel statusSp = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Border statusPill = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 16, 185, 129)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 16, 185, 129)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(14), Padding = new Thickness(12, 4, 12, 4) }; serverStatusBadge = new TextBlock { Text = string.Format("🟢 שרת פעיל ב-Wi-Fi: http://{0}:{1}", server.LocalIpAddress, serverPort), FontSize = 12, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(52, 211, 153)) }; statusPill.Child = serverStatusBadge; statusSp.Children.Add(statusPill); Grid.SetColumn(statusSp, 1); headerGrid.Children.Add(statusSp); StackPanel winBtns = new StackPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center }; Button btnOpenFolder = CreateStyledButton("📁 תיקיית הורדות", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnOpenFolder.Margin = new Thickness(0, 0, 12, 0); btnOpenFolder.Click += (s, e) => Process.Start("explorer.exe", downloadsFolder); winBtns.Children.Add(btnOpenFolder); Button btnMin = CreateIconButton("—", (s, e) => WindowState = WindowState.Minimized); Button btnClose = CreateIconButton("✕", (s, e) => Hide()); winBtns.Children.Add(btnMin); winBtns.Children.Add(btnClose); Grid.SetColumn(winBtns, 2); headerGrid.Children.Add(winBtns); headerBorder.Child = headerGrid; Grid.SetRow(headerBorder, 0); root.Children.Add(headerBorder); Grid bodyGrid = new Grid(); bodyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(210) }); bodyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); Border sidebarBorder = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(200, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(10, 14, 10, 14) }; sidebarPanel = new StackPanel(); AddSidebarTab("📱 שיתוף ו-QR", 0); AddSidebarTab("📥 קבצים שהתקבלו", 1); AddSidebarTab("📋 לוח טקסט חי", 2); AddSidebarTab("🛡️ מגן פרטיות", 3); AddSidebarTab("⌨️ תיקון מקלדת", 4); AddSidebarTab("⚙️ הגדרות ואודות", 5); sidebarBorder.Child = sidebarPanel; Grid.SetColumn(sidebarBorder, 0); bodyGrid.Children.Add(sidebarBorder); contentGrid = new Grid { Margin = new Thickness(18) }; tabPanels.Add(BuildTab0_ShareAndQr()); tabPanels.Add(BuildTab1_ReceivedFiles()); tabPanels.Add(BuildTab2_LiveClipboard()); tabPanels.Add(BuildTab3_PrivacyShield()); tabPanels.Add(BuildTab4_KeyboardFixer()); tabPanels.Add(BuildTab5_SettingsAbout()); for (int i = 0; i < tabPanels.Count; i++) { contentGrid.Children.Add(tabPanels[i]); } Grid.SetColumn(contentGrid, 1); bodyGrid.Children.Add(contentGrid); Grid.SetRow(bodyGrid, 1); root.Children.Add(bodyGrid); Border footerBorder = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(16, 4, 16, 4) }; Grid footerGrid = new Grid(); TextBlock hotkeyHint = new TextBlock { Text = "קיצור מקשים להקפצה מכל מקום: Ctrl + Shift + D", FontSize = 11, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(100, 116, 139)), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center }; TextBlock creditTb = new TextBlock { FontSize = 11, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)) }; System.Windows.Documents.Hyperlink link = new System.Windows.Documents.Hyperlink { NavigateUri = new Uri("https://ivrit.smartbinary.org"), Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)) }; link.RequestNavigate += (s, e) => { Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; }; link.Inlines.Add("נבנה על ידי בינארי חכם (IVRIT.SMARTBINARY.ORG)"); creditTb.Inlines.Add(link); footerGrid.Children.Add(creditTb); footerGrid.Children.Add(hotkeyHint); footerBorder.Child = footerGrid; Grid.SetRow(footerBorder, 2); root.Children.Add(footerBorder); Content = root; SwitchTab(0); } private void AddSidebarTab(string text, int index) { Border btn = new Border { CornerRadius = new CornerRadius(10), Margin = new Thickness(0, 0, 0, 6), Padding = new Thickness(12, 10, 12, 10), Cursor = Cursors.Hand, Background = System.Windows.Media.Brushes.Transparent }; TextBlock tb = new TextBlock { Text = text, FontSize = 13, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)) }; btn.Child = tb; btn.MouseLeftButtonDown += (s, e) => SwitchTab(index); tabButtons.Add(btn); sidebarPanel.Children.Add(btn); } private void SwitchTab(int index) { currentTabIndex = index; for (int i = 0; i < tabButtons.Count; i++) { Border b = tabButtons[i]; TextBlock tb = (TextBlock)b.Child; if (i == index) { b.Background = new LinearGradientBrush( System.Windows.Media.Color.FromArgb(60, 6, 182, 212), System.Windows.Media.Color.FromArgb(60, 99, 102, 241), 45); b.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)); b.BorderThickness = new Thickness(1); tb.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)); } else { b.Background = System.Windows.Media.Brushes.Transparent; b.BorderThickness = new Thickness(0); tb.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)); } } for (int i = 0; i < tabPanels.Count; i++) { tabPanels[i].Visibility = (i == index) ? Visibility.Visible : Visibility.Collapsed; } } private UIElement BuildTab0_ShareAndQr() { Grid grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(340) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); Border qrCard = CreateCard(); qrCard.Margin = new Thickness(0, 0, 16, 0); StackPanel qrSp = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center }; TextBlock qrTitle = new TextBlock { Text = "סרוק במצלמת הנייד 📱", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 0, 8) }; TextBlock qrSub = new TextBlock { Text = "פתיחה מיידית בדפדפן - ללא אפליקציה!", FontSize = 11, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 0, 12) }; Border qrBorder = new Border { Background = System.Windows.Media.Brushes.White, Padding = new Thickness(12), CornerRadius = new CornerRadius(14), HorizontalAlignment = HorizontalAlignment.Center, Effect = new DropShadowEffect { Color = Colors.Black, BlurRadius = 15, ShadowDepth = 4, Opacity = 0.4 } }; qrImageControl = new System.Windows.Controls.Image { Width = 200, Height = 200 }; qrBorder.Child = qrImageControl; serverUrlText = new TextBlock { Text = string.Format("http://{0}:{1}", server.LocalIpAddress, serverPort), FontSize = 13, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)), HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 12, 0, 8) }; Button btnCopyUrl = CreateStyledButton("📋 העתק קישור לדפדפן", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnCopyUrl.Click += (s, e) => { System.Windows.Clipboard.SetText(serverUrlText.Text); MessageBox.Show("הקישור הועתק ללוח!", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Information); }; qrSp.Children.Add(qrTitle); qrSp.Children.Add(qrSub); qrSp.Children.Add(qrBorder); qrSp.Children.Add(serverUrlText); qrSp.Children.Add(btnCopyUrl); qrCard.Child = qrSp; Grid.SetColumn(qrCard, 0); grid.Children.Add(qrCard); Border shareCard = CreateCard(); Grid shareGrid = new Grid(); shareGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); shareGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); shareGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); Border dropZone = new Border { BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(180, 6, 182, 212)), BorderThickness = new Thickness(2), CornerRadius = new CornerRadius(14), Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(30, 6, 182, 212)), Padding = new Thickness(20), Cursor = Cursors.Hand, AllowDrop = true }; dropZone.Drop += OnDropFilesToShare; dropZone.DragEnter += (s, e) => { if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop)) { e.Effects = System.Windows.DragDropEffects.Copy; dropZone.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(60, 6, 182, 212)); } }; dropZone.DragLeave += (s, e) => { dropZone.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(30, 6, 182, 212)); }; StackPanel dropSp = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center }; TextBlock dropIcon = new TextBlock { Text = "📥", FontSize = 32, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 0, 6) }; TextBlock dropTb = new TextBlock { Text = "גרור לכאן קבצים לשיתוף מיידי עם הנייד", FontSize = 14, FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)), HorizontalAlignment = HorizontalAlignment.Center }; TextBlock dropHint = new TextBlock { Text = "הקובץ יופיע בשנייה זו במסך הטלפון ויהיה זמין להורדה", FontSize = 11, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 4, 0, 0) }; dropSp.Children.Add(dropIcon); dropSp.Children.Add(dropTb); dropSp.Children.Add(dropHint); dropZone.Child = dropSp; Grid.SetRow(dropZone, 0); shareGrid.Children.Add(dropZone); StackPanel actSp = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 10, 0, 10) }; Button btnAddFiles = CreateStyledButton("➕ הוסף קבצים לשיתוף...", System.Windows.Media.Color.FromRgb(6, 182, 212), System.Windows.Media.Brushes.White); btnAddFiles.Click += OnBrowseFilesToShare; btnAddFiles.Margin = new Thickness(0, 0, 8, 0); Button btnClearShared = CreateStyledButton("נקה רשימה", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnClearShared.Click += (s, e) => { lock (server.SharedFiles) server.SharedFiles.Clear(); sharedListBox.Items.Clear(); }; actSp.Children.Add(btnAddFiles); actSp.Children.Add(btnClearShared); Grid.SetRow(actSp, 1); shareGrid.Children.Add(actSp); sharedListBox = new ListBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(1), Foreground = System.Windows.Media.Brushes.White }; Grid.SetRow(sharedListBox, 2); shareGrid.Children.Add(sharedListBox); shareCard.Child = shareGrid; Grid.SetColumn(shareCard, 1); grid.Children.Add(shareCard); return grid; } private void OnDropFilesToShare(object sender, System.Windows.DragEventArgs e) { if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop); AddFilesToShare(files); } } private void OnBrowseFilesToShare(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog { Multiselect = true, Title = "בחר קבצים לשיתוף עם הנייד" }; if (ofd.ShowDialog() == true) { AddFilesToShare(ofd.FileNames); } } private void AddFilesToShare(string[] paths) { foreach (string p in paths) { if (File.Exists(p)) { FileInfo fi = new FileInfo(p); SharedFileItem item = new SharedFileItem { Name = fi.Name, FullPath = fi.FullName, Size = fi.Length, SizeStr = FormatFileSize(fi.Length), AddedAt = DateTime.Now }; lock (server.SharedFiles) { server.SharedFiles.RemoveAll(x => x.Name.Equals(item.Name, StringComparison.OrdinalIgnoreCase)); server.SharedFiles.Add(item); } sharedListBox.Items.Add(string.Format("📄 {0} ({1})", item.Name, item.SizeStr)); } } } private UIElement BuildTab1_ReceivedFiles() { Border card = CreateCard(); Grid grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); Grid headGrid = new Grid(); headGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); headGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); StackPanel titleSp = new StackPanel(); TextBlock titleTb = new TextBlock { Text = "קבצים שהתקבלו מהטלפון הנייד 📥", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White }; TextBlock subTb = new TextBlock { Text = "כל קובץ שנשלח מהטלפון נשמר כאן אוטומטית ובאיכות המקורית", FontSize = 12, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)) }; titleSp.Children.Add(titleTb); titleSp.Children.Add(subTb); Grid.SetColumn(titleSp, 0); headGrid.Children.Add(titleSp); Button btnOpenRecFolder = CreateStyledButton("📂 פתח תיקייה ב-Explorer", System.Windows.Media.Color.FromRgb(6, 182, 212), System.Windows.Media.Brushes.White); btnOpenRecFolder.Click += (s, e) => Process.Start("explorer.exe", downloadsFolder); Grid.SetColumn(btnOpenRecFolder, 1); headGrid.Children.Add(btnOpenRecFolder); Grid.SetRow(headGrid, 0); grid.Children.Add(headGrid); receivedListBox = new ListBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(1), Foreground = System.Windows.Media.Brushes.White, Margin = new Thickness(0, 14, 0, 14) }; receivedListBox.MouseDoubleClick += (s, e) => { if (receivedListBox.SelectedItem != null) { string sel = receivedListBox.SelectedItem.ToString(); string path = sel.Substring(sel.IndexOf("--> ") + 4); if (File.Exists(path)) Process.Start(path); } }; Grid.SetRow(receivedListBox, 1); grid.Children.Add(receivedListBox); StackPanel bottomSp = new StackPanel { Orientation = Orientation.Horizontal }; Button btnOpenSelected = CreateStyledButton("הפעל קובץ נבחר", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnOpenSelected.Click += (s, e) => { if (receivedListBox.SelectedItem != null) { string sel = receivedListBox.SelectedItem.ToString(); string path = sel.Substring(sel.IndexOf("--> ") + 4); if (File.Exists(path)) Process.Start(path); } }; bottomSp.Children.Add(btnOpenSelected); Grid.SetRow(bottomSp, 2); grid.Children.Add(bottomSp); card.Child = grid; return card; } private void LoadExistingDownloads() { try { if (Directory.Exists(downloadsFolder)) { string[] files = Directory.GetFiles(downloadsFolder); foreach (string f in files) { FileInfo fi = new FileInfo(f); receivedListBox.Items.Add(string.Format("📥 {0} ({1}) - {2:dd/MM HH:mm} --> {3}", fi.Name, FormatFileSize(fi.Length), fi.CreationTime, fi.FullName)); } } } catch { } } private void OnServerFileReceived(string path, long size) { Dispatcher.Invoke(new Action(() => { FileInfo fi = new FileInfo(path); receivedListBox.Items.Insert(0, string.Format("📥 {0} ({1}) - {2:dd/MM HH:mm} --> {3}", fi.Name, FormatFileSize(size), DateTime.Now, path)); trayIcon.ShowBalloonTip(3000, "OmniDrop Pro", string.Format("התקבל קובץ חדש מהטלפון: {0} ({1})", fi.Name, FormatFileSize(size)), System.Windows.Forms.ToolTipIcon.Info); try { System.Media.SystemSounds.Asterisk.Play(); } catch { } })); } private UIElement BuildTab2_LiveClipboard() { Border card = CreateCard(); Grid grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); TextBlock titleTb = new TextBlock { Text = "סנכרון לוח עתק-הדבק וטקסט בזמן אמת 📋", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White, Margin = new Thickness(0, 0, 0, 14) }; Grid.SetRow(titleTb, 0); grid.Children.Add(titleTb); Border pcClipCard = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(12), Padding = new Thickness(14), Margin = new Thickness(0, 0, 0, 12) }; Grid g1 = new Grid(); g1.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); g1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); g1.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); TextBlock g1Title = new TextBlock { Text = "טקסט נוכחי בלוח המחשב (מוצג בטלפון הנייד):", FontSize = 13, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)), Margin = new Thickness(0, 0, 0, 8) }; Grid.SetRow(g1Title, 0); g1.Children.Add(g1Title); pcClipboardBox = new TextBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), Foreground = System.Windows.Media.Brushes.White, FontSize = 13, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, IsReadOnly = true, Padding = new Thickness(8) }; Grid.SetRow(pcClipboardBox, 1); g1.Children.Add(pcClipboardBox); Button btnRefreshClip = CreateStyledButton("🔄 רענן מלוח המחשב עכשיו", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnRefreshClip.Margin = new Thickness(0, 8, 0, 0); btnRefreshClip.Click += (s, e) => ReadPcClipboard(); Grid.SetRow(btnRefreshClip, 2); g1.Children.Add(btnRefreshClip); pcClipCard.Child = g1; Grid.SetRow(pcClipCard, 1); grid.Children.Add(pcClipCard); Border sendCard = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(12), Padding = new Thickness(14) }; Grid g2 = new Grid(); g2.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); g2.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); g2.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); TextBlock g2Title = new TextBlock { Text = "שליחת טקסט או קישור מהיר לטלפון:", FontSize = 13, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(99, 102, 241)), Margin = new Thickness(0, 0, 0, 8) }; Grid.SetRow(g2Title, 0); g2.Children.Add(g2Title); pcSendTextBox = new TextBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), Foreground = System.Windows.Media.Brushes.White, FontSize = 13, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Padding = new Thickness(8) }; Grid.SetRow(pcSendTextBox, 1); g2.Children.Add(pcSendTextBox); Button btnSendToPhone = CreateStyledButton("🚀 שדר לטלפון עכשיו", System.Windows.Media.Color.FromRgb(99, 102, 241), System.Windows.Media.Brushes.White); btnSendToPhone.Margin = new Thickness(0, 8, 0, 0); btnSendToPhone.Click += (s, e) => { string txt = pcSendTextBox.Text; if (!string.IsNullOrEmpty(txt)) { server.ServerClipboardText = txt; MessageBox.Show("הטקסט שודר! הטלפון יציג אותו מיידית במסך.", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Information); } }; Grid.SetRow(btnSendToPhone, 2); g2.Children.Add(btnSendToPhone); sendCard.Child = g2; Grid.SetRow(sendCard, 2); grid.Children.Add(sendCard); card.Child = grid; return card; } private void InitClipboardMonitor() { clipboardTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1.5) }; clipboardTimer.Tick += (s, e) => ReadPcClipboard(); clipboardTimer.Start(); } private void ReadPcClipboard() { try { if (System.Windows.Clipboard.ContainsText()) { string txt = System.Windows.Clipboard.GetText(); if (!string.IsNullOrEmpty(txt) && txt != lastClipboardText) { lastClipboardText = txt; server.ServerClipboardText = txt; if (pcClipboardBox != null) pcClipboardBox.Text = txt; } } } catch { } } private void OnServerClipboardReceived(string text) { Dispatcher.Invoke(new Action(() => { try { System.Windows.Clipboard.SetText(text); lastClipboardText = text; if (pcClipboardBox != null) pcClipboardBox.Text = text; trayIcon.ShowBalloonTip(3000, "OmniDrop Pro", "התקבל טקסט מהטלפון והועתק ללוח במחשב!", System.Windows.Forms.ToolTipIcon.Info); } catch { } })); } private UIElement BuildTab3_PrivacyShield() { Border card = CreateCard(); StackPanel sp = new StackPanel(); TextBlock titleTb = new TextBlock { Text = "מגן פרטיות וניקוי מטא-דאטה (EXIF / GPS) 🛡️", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White, Margin = new Thickness(0, 0, 0, 6) }; TextBlock subTb = new TextBlock { Text = "תמונות שצולמו בסמארטפונים מכילות מיקום GPS מדויק, דגם מכשיר ומספרים סידוריים.\nכאן תוכל לנקות כל תמונה ולהגן על פרטיותך לפני העלאה לרשת.", FontSize = 12, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), Margin = new Thickness(0, 0, 0, 16) }; sp.Children.Add(titleTb); sp.Children.Add(subTb); autoScrubCheckBox = new CheckBox { Content = "נקה אוטומטית נתוני GPS ומטא-דאטה מכל תמונה שמתקבלת מהטלפון", IsChecked = true, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(52, 211, 153)), FontWeight = FontWeights.SemiBold, Margin = new Thickness(0, 0, 0, 18) }; autoScrubCheckBox.Checked += (s, e) => server.AutoScrubPrivacy = true; autoScrubCheckBox.Unchecked += (s, e) => server.AutoScrubPrivacy = false; sp.Children.Add(autoScrubCheckBox); Border dropBorder = new Border { BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(160, 99, 102, 241)), BorderThickness = new Thickness(2), CornerRadius = new CornerRadius(14), Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(30, 99, 102, 241)), Padding = new Thickness(24), AllowDrop = true, Cursor = Cursors.Hand }; dropBorder.Drop += OnDropImageToScrub; dropBorder.DragEnter += (s, e) => { if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop)) e.Effects = System.Windows.DragDropEffects.Copy; }; StackPanel dsp = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center }; TextBlock dIcon = new TextBlock { Text = "🔍", FontSize = 30, HorizontalAlignment = HorizontalAlignment.Center }; TextBlock dTb = new TextBlock { Text = "גרור לכאן תמונה לבדיקה וניקוי מטא-דאטה", FontSize = 14, FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(99, 102, 241)), HorizontalAlignment = HorizontalAlignment.Center }; dsp.Children.Add(dIcon); dsp.Children.Add(dTb); dropBorder.Child = dsp; sp.Children.Add(dropBorder); Button btnBrowseImg = CreateStyledButton("או בחר תמונה מקובץ...", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnBrowseImg.Margin = new Thickness(0, 10, 0, 14); btnBrowseImg.Click += (s, e) => { Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog { Filter = "תמונות (*.jpg;*.jpeg;*.png)|*.jpg;*.jpeg;*.png", Title = "בחר תמונה לניקוי מטא-דאטה" }; if (ofd.ShowDialog() == true) InspectAndScrubImage(ofd.FileName); }; sp.Children.Add(btnBrowseImg); exifReportText = new TextBlock { Text = "טרם נבחרה תמונה לבדיקה.", FontSize = 13, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), Margin = new Thickness(0, 10, 0, 14) }; sp.Children.Add(exifReportText); Button btnCleanNow = CreateStyledButton("🛡️ נקה מטא-דאטה עכשיו ושמור עותק נקי", System.Windows.Media.Color.FromRgb(16, 185, 129), System.Windows.Media.Brushes.White); btnCleanNow.Click += (s, e) => { if (!string.IsNullOrEmpty(inspectedImagePath) && File.Exists(inspectedImagePath)) { string stem = Path.GetFileNameWithoutExtension(inspectedImagePath); string ext = Path.GetExtension(inspectedImagePath); string dir = Path.GetDirectoryName(inspectedImagePath); string cleanPath = Path.Combine(dir, stem + "_clean" + ext); try { using (System.Drawing.Image img = System.Drawing.Image.FromFile(inspectedImagePath)) using (Bitmap bmp = new Bitmap(img.Width, img.Height)) { using (Graphics g = Graphics.FromImage(bmp)) { g.DrawImage(img, 0, 0, img.Width, img.Height); } bmp.Save(cleanPath, ImageFormat.Jpeg); } MessageBox.Show("הקובץ הנקי נשמר בהצלחה:\n" + cleanPath, "OmniDrop Privacy Shield", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("שגיאה בניקוי התמונה: " + ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("אנא גרור או בחר תמונה תחילה.", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Warning); } }; sp.Children.Add(btnCleanNow); card.Child = sp; return card; } private void OnDropImageToScrub(object sender, System.Windows.DragEventArgs e) { if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop); if (files.Length > 0) InspectAndScrubImage(files[0]); } } private void InspectAndScrubImage(string path) { inspectedImagePath = path; try { using (System.Drawing.Image img = System.Drawing.Image.FromFile(path)) { bool hasGps = false; foreach (int id in img.PropertyIdList) { if (id == 0x0001 || id == 0x0002 || id == 0x0003 || id == 0x0004) { hasGps = true; break; } } if (hasGps) { exifReportText.Text = string.Format("⚠️ אזהרה: בתמונה '{0}' נמצאו קואורדינטות מיקום GPS מדויקות ופרטי מכשיר!\nלחץ על הכפתור למטה כדי לייצר עותק נקי ומאובטח.", Path.GetFileName(path)); exifReportText.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(248, 113, 113)); } else { exifReportText.Text = string.Format("ℹ️ תמונה נבדקה: '{0}'. לא נמצאו נתוני GPS גלויים, אך ניתן לבצע ניקוי מטא-דאטה מקיף.", Path.GetFileName(path)); exifReportText.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(56, 189, 248)); } } } catch (Exception ex) { exifReportText.Text = "שגיאה בקריאת הקובץ: " + ex.Message; } } private UIElement BuildTab4_KeyboardFixer() { Border card = CreateCard(); Grid grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); TextBlock titleTb = new TextBlock { Text = "תיקון מקלדת הפוכה וג'יבריש (LangSwitch) ⌨️", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White, Margin = new Thickness(0, 0, 0, 4) }; TextBlock subTb = new TextBlock { Text = "הקלדת משפט שלם בעברית כשהמקלדת הייתה באנגלית? (למשל: akuo gkui -> שלום עולם)\nהמערכת מזהה וממירה את הטקסט בזמן אמת!", FontSize = 12, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), Margin = new Thickness(0, 0, 0, 12) }; StackPanel tsp = new StackPanel(); tsp.Children.Add(titleTb); tsp.Children.Add(subTb); Grid.SetRow(tsp, 0); grid.Children.Add(tsp); langInputBox = new TextBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), Foreground = System.Windows.Media.Brushes.White, FontSize = 14, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Padding = new Thickness(10) }; langInputBox.TextChanged += (s, e) => { langOutputBox.Text = ConvertKeyboardInversion(langInputBox.Text); }; Grid.SetRow(langInputBox, 1); grid.Children.Add(langInputBox); TextBlock arrowTb = new TextBlock { Text = "⬇️ טקסט מתוקן בזמן אמת:", FontSize = 12, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)), Margin = new Thickness(0, 6, 0, 6) }; Grid.SetRow(arrowTb, 2); grid.Children.Add(arrowTb); langOutputBox = new TextBox { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(52, 211, 153)), FontSize = 14, AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, IsReadOnly = true, Padding = new Thickness(10) }; Grid.SetRow(langOutputBox, 3); grid.Children.Add(langOutputBox); StackPanel actSp = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 10, 0, 0) }; Button btnCopyFixed = CreateStyledButton("📋 העתק טקסט מתוקן ללוח", System.Windows.Media.Color.FromRgb(6, 182, 212), System.Windows.Media.Brushes.White); btnCopyFixed.Margin = new Thickness(0, 0, 10, 0); btnCopyFixed.Click += (s, e) => { if (!string.IsNullOrEmpty(langOutputBox.Text)) { System.Windows.Clipboard.SetText(langOutputBox.Text); MessageBox.Show("הטקסט המתוקן הועתק ללוח!", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Information); } }; Button btnSendFixedToPhone = CreateStyledButton("🚀 שדר ישירות לטלפון", System.Windows.Media.Color.FromRgb(99, 102, 241), System.Windows.Media.Brushes.White); btnSendFixedToPhone.Click += (s, e) => { if (!string.IsNullOrEmpty(langOutputBox.Text)) { server.ServerClipboardText = langOutputBox.Text; MessageBox.Show("הטקסט המתוקן שודר לטלפון בהצלחה!", "OmniDrop Pro", MessageBoxButton.OK, MessageBoxImage.Information); } }; actSp.Children.Add(btnCopyFixed); actSp.Children.Add(btnSendFixedToPhone); Grid.SetRow(actSp, 4); grid.Children.Add(actSp); card.Child = grid; return card; } private static Dictionary enToHeMap = new Dictionary(); private static Dictionary heToEnMap = new Dictionary(); static MainWindow() { string en = "qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"; string he = "/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ./'קראטוןםפ}{שדגכעיחלךף:\"זסבהנמצתץ?"; for (int i = 0; i < en.Length; i++) { if (!enToHeMap.ContainsKey(en[i])) enToHeMap[en[i]] = he[i]; if (!heToEnMap.ContainsKey(he[i])) heToEnMap[he[i]] = en[i]; } } private string ConvertKeyboardInversion(string input) { if (string.IsNullOrEmpty(input)) return ""; int hebrewCount = 0; int englishCount = 0; foreach (char c in input) { if (c >= 'א' && c <= 'ת') hebrewCount++; else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) englishCount++; } StringBuilder sb = new StringBuilder(); if (englishCount >= hebrewCount) { foreach (char c in input) { if (enToHeMap.ContainsKey(c)) sb.Append(enToHeMap[c]); else sb.Append(c); } } else { foreach (char c in input) { if (heToEnMap.ContainsKey(c)) sb.Append(heToEnMap[c]); else sb.Append(c); } } return sb.ToString(); } private UIElement BuildTab5_SettingsAbout() { Border card = CreateCard(); StackPanel sp = new StackPanel(); TextBlock titleTb = new TextBlock { Text = "הגדרות ואודות המערכת ⚙️", FontSize = 16, FontWeight = FontWeights.Bold, Foreground = System.Windows.Media.Brushes.White, Margin = new Thickness(0, 0, 0, 14) }; sp.Children.Add(titleTb); TextBlock fTitle = new TextBlock { Text = "תיקיית שמירת הורדות במחשב:", FontSize = 13, FontWeight = FontWeights.SemiBold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), Margin = new Thickness(0, 0, 0, 6) }; sp.Children.Add(fTitle); Grid fGrid = new Grid(); fGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); fGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); TextBox fPathBox = new TextBox { Text = downloadsFolder, IsReadOnly = true, Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 11, 15, 25)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), Foreground = System.Windows.Media.Brushes.White, FontSize = 12, Padding = new Thickness(8) }; Grid.SetColumn(fPathBox, 0); fGrid.Children.Add(fPathBox); Button btnBrowseDir = CreateStyledButton("📂 פתח תיקייה", System.Windows.Media.Color.FromRgb(30, 41, 59), System.Windows.Media.Brushes.White); btnBrowseDir.Margin = new Thickness(8, 0, 0, 0); btnBrowseDir.Click += (s, e) => Process.Start("explorer.exe", downloadsFolder); Grid.SetColumn(btnBrowseDir, 1); fGrid.Children.Add(btnBrowseDir); sp.Children.Add(fGrid); Border aboutCard = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(120, 15, 23, 42)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 255, 255, 255)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(14), Padding = new Thickness(18), Margin = new Thickness(0, 24, 0, 0) }; StackPanel asp = new StackPanel(); TextBlock aTitle = new TextBlock { Text = "OmniDrop Pro - גרסה 1.0 Standalone", FontSize = 15, FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)), Margin = new Thickness(0, 0, 0, 6) }; TextBlock aDesc = new TextBlock { Text = "תוכנת Windows מתקדמת לשיתוף קבצים, לוח עתק-הדבק חי והגנת פרטיות מקומית.\n" + "• פועלת ישירות ברשת ה-Wi-Fi המקומית ללא תלות בענן או ירידה באיכות הקבצים.\n" + "• ללא צורך בהתקנת אפליקציות כלשהן בטלפון (אייפון או אנדרואיד).\n" + "• קובץ EXE עצמאי מלא (Standalone) ללא צורך בספריות חיצוניות.", FontSize = 12, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(203, 213, 225)), LineHeight = 20 }; Border sigBorder = new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(40, 6, 182, 212)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 6, 182, 212)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(10), Padding = new Thickness(12), Margin = new Thickness(0, 16, 0, 0) }; TextBlock sigTb = new TextBlock { FontSize = 13, FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)) }; System.Windows.Documents.Hyperlink sigLink = new System.Windows.Documents.Hyperlink { NavigateUri = new Uri("https://ivrit.smartbinary.org"), Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 182, 212)) }; sigLink.RequestNavigate += (s, e) => { Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; }; sigLink.Inlines.Add("נבנה על ידי בינארי חכם (IVRIT.SMARTBINARY.ORG)"); sigTb.Inlines.Add(sigLink); sigBorder.Child = sigTb; asp.Children.Add(aTitle); asp.Children.Add(aDesc); asp.Children.Add(sigBorder); aboutCard.Child = asp; sp.Children.Add(aboutCard); card.Child = sp; return card; } private void RefreshQrCode() { try { string url = string.Format("http://{0}:{1}", server.LocalIpAddress, serverPort); QRCodeGenerator qrGen = new QRCodeGenerator(); QRCodeData qrData = qrGen.CreateQrCode(url, QRCodeGenerator.ECCLevel.M); QRCode qr = new QRCode(qrData); using (Bitmap bmp = qr.GetGraphic(8, System.Drawing.Color.FromArgb(15, 23, 42), System.Drawing.Color.White, true)) using (MemoryStream ms = new MemoryStream()) { bmp.Save(ms, ImageFormat.Png); ms.Seek(0, SeekOrigin.Begin); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.StreamSource = ms; bi.CacheOption = BitmapCacheOption.OnLoad; bi.EndInit(); qrImageControl.Source = bi; } } catch { } } private void InitTrayIcon() { trayIcon = new System.Windows.Forms.NotifyIcon(); try { using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("OmniDrop.ico")) { if (s != null) trayIcon.Icon = new System.Drawing.Icon(s); else trayIcon.Icon = System.Drawing.SystemIcons.Application; } } catch { trayIcon.Icon = System.Drawing.SystemIcons.Application; } trayIcon.Text = "OmniDrop Pro - פעיל ברקע"; trayIcon.Visible = true; trayIcon.DoubleClick += (s, e) => { Show(); WindowState = WindowState.Normal; Activate(); }; System.Windows.Forms.ContextMenu menu = new System.Windows.Forms.ContextMenu(); menu.MenuItems.Add("הצג חלון ראשי", (s, e) => { Show(); WindowState = WindowState.Normal; Activate(); }); menu.MenuItems.Add("פתח תיקיית הורדות", (s, e) => Process.Start("explorer.exe", downloadsFolder)); menu.MenuItems.Add("-"); menu.MenuItems.Add("יציאה", (s, e) => { trayIcon.Visible = false; server.Stop(); System.Windows.Application.Current.Shutdown(); }); trayIcon.ContextMenu = menu; } protected override void OnClosing(CancelEventArgs e) { e.Cancel = true; Hide(); trayIcon.ShowBalloonTip(2000, "OmniDrop Pro", "התוכנה ממשיכה לרוץ ברקע במגש המערכת. לחץ פעמיים לפתיחה או השתמש ב-Ctrl+Shift+D.", System.Windows.Forms.ToolTipIcon.Info); } private Border CreateCard() { return new Border { Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(220, 22, 30, 49)), BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(50, 255, 255, 255)), BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(16), Padding = new Thickness(18), Effect = new DropShadowEffect { Color = Colors.Black, BlurRadius = 20, ShadowDepth = 4, Opacity = 0.3 } }; } private Button CreateStyledButton(string text, System.Windows.Media.Color bg, System.Windows.Media.Brush fg) { Button btn = new Button { Content = text, Foreground = fg, Background = new SolidColorBrush(bg), FontSize = 12, FontWeight = FontWeights.SemiBold, Padding = new Thickness(14, 8, 14, 8), Cursor = Cursors.Hand }; return btn; } private Button CreateIconButton(string symbol, RoutedEventHandler onClick) { Button btn = new Button { Content = symbol, Width = 32, Height = 32, Margin = new Thickness(4, 0, 0, 0), Background = System.Windows.Media.Brushes.Transparent, Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(148, 163, 184)), BorderThickness = new Thickness(0), FontSize = 13, FontWeight = FontWeights.Bold, Cursor = Cursors.Hand }; btn.Click += onClick; return btn; } private static string FormatFileSize(long bytes) { if (bytes >= 1073741824) return string.Format("{0:0.0} GB", bytes / 1073741824.0); if (bytes >= 1048576) return string.Format("{0:0.0} MB", bytes / 1048576.0); if (bytes >= 1024) return string.Format("{0:0.0} KB", bytes / 1024.0); return bytes + " Bytes"; } } } '@ [System.IO.File]::WriteAllText("$tempDir\OmniDrop.cs", $csSource, [System.Text.Encoding]::UTF8) Write-Host "[4/5] מקמפל לתוכנת EXE עצמאית (Standalone Native Windows)..." -ForegroundColor Green $finalExe = "$destDir\OmniDrop.exe" $cscCompiler = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" $compilerArgs = @( "/target:winexe", "/out:$finalExe", "/codepage:65001", "/lib:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF", "/r:PresentationFramework.dll,PresentationCore.dll,WindowsBase.dll,System.Xaml.dll,System.Drawing.dll,System.Windows.Forms.dll", "/r:$tempDir\QRCoder.dll", "/res:$tempDir\QRCoder.dll,QRCoder.dll", "/res:$tempDir\OmniDrop.ico,OmniDrop.ico", "/win32icon:$tempDir\OmniDrop.ico", "$tempDir\OmniDrop.cs" ) & $cscCompiler $compilerArgs | Out-Null Write-Host "[5/5] יוצר קיצור דרך על שולחן העבודה ומנקה קבצי בנייה..." -ForegroundColor Green try { $wsh = New-Object -ComObject WScript.Shell $shortcut = $wsh.CreateShortcut("$env:USERPROFILE\Desktop\OmniDrop Pro.lnk") $shortcut.TargetPath = $finalExe $shortcut.IconLocation = "$finalExe,0" $shortcut.Description = "OmniDrop Pro - שיתוף וסנכרון אלחוטי חכם" $shortcut.Save() } catch {} Remove-Item -Path $tempDir -Recurse -Force | Out-Null Write-Host "" Write-Host "=================================================================" -ForegroundColor Green Write-Host " הבנייה הושלמה בהצלחה! התוכנה מוכנה לפעולה מיידית. " -ForegroundColor Green Write-Host " קובץ ה-EXE נשמר ב: $finalExe" -ForegroundColor White Write-Host " קיצור דרך נוצר על שולחן העבודה: 'OmniDrop Pro' " -ForegroundColor White Write-Host "=================================================================" -ForegroundColor Green Write-Host "" Write-Host "מפעיל את OmniDrop Pro כעת..." -ForegroundColor Cyan Start-Process -FilePath $finalExe } catch { Write-Host "`nשגיאה במהלך הבנייה: $($_.Exception.Message)" -ForegroundColor Red }