تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] طلب تعديل كود من c# الي vb وبعض التعديلات
#1
السلام عليكم ورحمة الله وبركاته

اريد التعديل علي كود بلغة c#

الي لغة 

vb

مع الغاء اوامر التحديث الخاصة بالكود ويكون الكود عبارة عن فتح الملف الموجود مع الملف المساعد ليه

كود :
using Ionic.Zip;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace Scream_Sport_Luncher
{
   public partial class Form1 : Form
   {
       private Process process = new Process();
       private IContainer components;
       private Label label1;
       public Form1()
       {
           this.InitializeComponent();

       }
       private void button1_Click(object sender, EventArgs e)
       {
       }
       public void ExtractFileToDirectory(string zipFileName, string outputDirectory)
       {
       }
       private void Form1_Load(object sender, EventArgs e)
       {
           string startupPath = Application.StartupPath;
           string tempPath = Path.GetTempPath();
           if (File.Exists(Application.StartupPath + "\\libs1_updated.exe"))
           {
               if (File.Exists(Application.StartupPath + "\\libs1.exe"))
               {
                   File.Delete(Application.StartupPath + "\\libs1.exe");
               }
               File.Move(Application.StartupPath + "\\libs1_updated.exe", Application.StartupPath + "\\libs1.exe");
           }
           if (File.Exists(Application.StartupPath + "\\config.ini") && Directory.Exists(Application.StartupPath + "\\BeinSave1"))
           {
               string text = File.ReadLines(Application.StartupPath + "\\config.ini").First<string>();
               string str = File.ReadLines(Application.StartupPath + "\\config.ini").ElementAt(1);
               Directory.CreateDirectory(tempPath + "\\Abdou");
               string text2 = tempPath + "Abdou1";
               if (!File.Exists(text2 + "\\helper1.exe"))
               {
                   using (ZipFile zipFile = ZipFile.Read("helper1.dll"))
                   {
                       zipFile.Password = "abdoudodo1";
                       zipFile["helper1.exe"].Extract(text2, ExtractExistingFileAction.OverwriteSilently);
                   }
               }
               Directory.CreateDirectory(tempPath + "\\System36");
               StreamWriter streamWriter = new StreamWriter(tempPath + "\\System36\\check.ini");
               streamWriter.WriteLine("true");
               streamWriter.Close();
               streamWriter.Dispose();
               string pathRoot = Path.GetPathRoot(Environment.SystemDirectory);
               string baseDirectory = pathRoot + "ProgramData\\Microsoft\\PlayReady\\";
               try
               {
                   if (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1)
                   {
                       baseDirectory = pathRoot + "Documents and Settings\\All Users\\Application Data\\Microsoft\\PlayReady\\";
                   }
               }
               catch
               {
               }
               using (ZipFile zipFile2 = ZipFile.Read(startupPath + "\\BeinSave\\" + str))
               {
                   zipFile2.Password = "stikstik";
                   try
                   {
                       Form1.killprocessPlayready();
                       zipFile2["mspr.hds"].Extract(baseDirectory, ExtractExistingFileAction.OverwriteSilently);
                   }
                   catch
                   {
                   }
               }
               ProcessStartInfo processStartInfo = new ProcessStartInfo();
               this.process.StartInfo = processStartInfo;
               processStartInfo.UseShellExecute = false;
               processStartInfo.CreateNoWindow = true;
               processStartInfo.RedirectStandardError = true;
               processStartInfo.FileName = text2 + "\\helper.exe";
               processStartInfo.Arguments = string.Concat(new string[]
              {
                  "/immediate /movetime ",
                  text,
                  " \"",
                  startupPath,
                  "\\libs.exe\""
              });
               this.process.Start();
               base.Close();
               return;
           }
           if (File.Exists(Application.StartupPath + "\\config.ini"))
           {
               File.Delete(Application.StartupPath + "\\config.ini");
           }
           if (File.Exists(Application.StartupPath + "\\helper.dll") && File.Exists(Application.StartupPath + "\\libs.exe") && File.Exists(Application.StartupPath + "\\Ionic.Zip.dll"))
           {
               Directory.CreateDirectory(tempPath + "\\System36");
               StreamWriter streamWriter2 = new StreamWriter(tempPath + "\\System36\\check.ini");
               streamWriter2.WriteLine("false");
               streamWriter2.Close();
               streamWriter2.Dispose();
               Process.Start("libs.exe");
               base.Close();
               return;
           }
           MessageBox.Show("helper.dll wla libs.exe makaynch", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Hand);
           base.Close();
       }
       private void Form1_FormClosed(object sender, FormClosedEventArgs e)
       {
           try
           {
               this.process.Close();
           }
           catch
           {
           }
       }
       public static void killprocessPlayready()
       {
           Process[] processes = Process.GetProcesses();
           for (int i = 0; i < processes.Length; i++)
           {
               Process process = processes[i];
               try
               {
                   foreach (ProcessModule processModule in process.Modules)
                   {
                       if (processModule.FileName.ToString().Contains("PlayReady"))
                       {
                           process.Kill();
                           while (!process.HasExited)
                           {
                               process.WaitForExit();
                           }
                       }
                   }
               }
               catch
               {
               }
           }
       }
       private static void deletePlayreadyFolder(string masar)
       {
           DirectoryInfo directoryInfo = new DirectoryInfo(masar);
           FileInfo[] files = directoryInfo.GetFiles();
           for (int i = 0; i < files.Length; i++)
           {
               FileInfo fileInfo = files[i];
               fileInfo.Delete();
           }
           DirectoryInfo[] directories = directoryInfo.GetDirectories();
           for (int j = 0; j < directories.Length; j++)
           {
               DirectoryInfo directoryInfo2 = directories[j];
               directoryInfo2.Delete(true);
           }
       }
       protected override void Dispose(bool disposing)
       {
           if (disposing && this.components != null)
           {
               this.components.Dispose();
           }
           base.Dispose(disposing);
       }
       private void InitializeComponent()
       {
           ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
           this.label1 = new Label();
           base.SuspendLayout();
           this.label1.AutoSize = true;
           this.label1.Font = new Font("Microsoft Sans Serif", 30f, FontStyle.Regular, GraphicsUnit.Point, 0);
           this.label1.ForeColor = Color.Red;
           this.label1.Location = new Point(1, 16);
           this.label1.Name = "label1";
           this.label1.Size = new Size(581, 46);
           this.label1.TabIndex = 0;
           this.label1.Text = "حدث خطأ ما المرجوا اعادة تشغيل البرنامج";
           base.AutoScaleDimensions = new SizeF(6f, 13f);
           base.AutoScaleMode = AutoScaleMode.Font;
           base.AutoSizeMode = AutoSizeMode.GrowAndShrink;
           this.BackColor = SystemColors.ActiveCaptionText;
           base.ClientSize = new Size(584, 74);
           base.Controls.Add(this.label1);
           base.FormBorderStyle = FormBorderStyle.SizableToolWindow;
           base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
           base.Name = "Form1";
           base.FormClosed += new FormClosedEventHandler(this.Form1_FormClosed);
           base.Load += new EventHandler(this.Form1_Load);
           base.ResumeLayout(false);
           base.PerformLayout();
       }
   }
}

ولكم حزيل الشكر
الرد }}}
تم الشكر بواسطة:
#2
كود :
Imports Ionic.Zip
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Drawing
Imports System.IO
Imports System.Linq
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports System.Data
Imports System.Text
Imports System.Threading.Tasks
Imports System.Text.RegularExpressions

Partial Public Class Form1
   Inherits Form

   Public Sub New()
       InitializeComponent()
   End Sub

   Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
   End Sub

   Public Sub ExtractFileToDirectory(ByVal zipFileName As String, ByVal outputDirectory As String)
   End Sub

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
       Dim startupPath As String = Application.StartupPath
       Dim tempPath As String = Path.GetTempPath()

       If File.Exists(Application.StartupPath & "\libs1_updated.exe") Then

           If File.Exists(Application.StartupPath & "\libs1.exe") Then
               File.Delete(Application.StartupPath & "\libs1.exe")
           End If

           File.Move(Application.StartupPath & "\libs1_updated.exe", Application.StartupPath & "\libs1.exe")
       End If

       If File.Exists(Application.StartupPath & "\config.ini") AndAlso Directory.Exists(Application.StartupPath & "\BeinSave1") Then
           Dim text As String = File.ReadLines(Application.StartupPath & "\config.ini").First '.First(Of String)()
           Dim str As String = File.ReadLines(Application.StartupPath & "\config.ini").ElementAt(1)
           Directory.CreateDirectory(tempPath & "\Abdou")
           Dim text2 As String = tempPath & "Abdou1"

           If Not File.Exists(text2 & "\helper1.exe") Then

               Using zipFile As ZipFile = zipFile.Read("helper1.dll")
                   zipFile.Password = "abdoudodo1"
                   zipFile("helper1.exe").Extract(text2, ExtractExistingFileAction.OverwriteSilently)
               End Using
           End If

           Directory.CreateDirectory(tempPath & "\System36")
           Dim streamWriter As StreamWriter = New StreamWriter(tempPath & "\System36\check.ini")
           streamWriter.WriteLine("true")
           streamWriter.Close()
           streamWriter.Dispose()
           Dim pathRoot As String = Path.GetPathRoot(Environment.SystemDirectory)
           Dim baseDirectory As String = pathRoot & "ProgramData\Microsoft\PlayReady\"

           Try

               If Environment.OSVersion.Version.Major = 5 AndAlso Environment.OSVersion.Version.Minor = 1 Then
                   baseDirectory = pathRoot & "Documents and Settings\All Users\Application Data\Microsoft\PlayReady\"
               End If

           Catch
           End Try

           Using zipFile2 As ZipFile = ZipFile.Read(startupPath & "\BeinSave\" & str)
               zipFile2.Password = "stikstik"

               Try
                   Form1.killprocessPlayready()
                   zipFile2("mspr.hds").Extract(baseDirectory, ExtractExistingFileAction.OverwriteSilently)
               Catch
               End Try
           End Using

           Dim processStartInfo As ProcessStartInfo = New ProcessStartInfo()
           Me.Process1.StartInfo = processStartInfo
           processStartInfo.UseShellExecute = False
           processStartInfo.CreateNoWindow = True
           processStartInfo.RedirectStandardError = True
           processStartInfo.FileName = text2 & "\helper.exe"
           processStartInfo.Arguments = String.Concat(New String() {"/immediate /movetime ", text, " """, startupPath, "\libs.exe"""})
           Me.Process1.Start()
           MyBase.Close()
           Return
       End If

       If File.Exists(Application.StartupPath & "\config.ini") Then
           File.Delete(Application.StartupPath & "\config.ini")
       End If

       If File.Exists(Application.StartupPath & "\helper.dll") AndAlso File.Exists(Application.StartupPath & "\libs.exe") AndAlso File.Exists(Application.StartupPath & "\Ionic.Zip.dll") Then
           Directory.CreateDirectory(tempPath & "\System36")
           Dim streamWriter2 As StreamWriter = New StreamWriter(tempPath & "\System36\check.ini")
           streamWriter2.WriteLine("false")
           streamWriter2.Close()
           streamWriter2.Dispose()
           Process.Start("libs.exe")
           MyBase.Close()
           Return
       End If

       MessageBox.Show("helper.dll wla libs.exe makaynch", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Hand)
       MyBase.Close()
   End Sub

   Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs)
       Try
           Me.Process1.Close()
       Catch
       End Try
   End Sub

   Public Shared Sub killprocessPlayready()
       Dim processes As Process() = Process.GetProcesses()

       For i As Integer = 0 To processes.Length - 1
           Dim process As Process = processes(i)

           Try

               For Each processModule As ProcessModule In process.Modules

                   If processModule.FileName.ToString().Contains("PlayReady") Then
                       process.Kill()

                       While Not process.HasExited
                           process.WaitForExit()
                       End While
                   End If
               Next

           Catch
           End Try
       Next
   End Sub

   Private Shared Sub deletePlayreadyFolder(ByVal masar As String)
       Dim directoryInfo As DirectoryInfo = New DirectoryInfo(masar)
       Dim files As FileInfo() = directoryInfo.GetFiles()

       For i As Integer = 0 To files.Length - 1
           Dim fileInfo As FileInfo = files(i)
           fileInfo.Delete()
       Next

       Dim directories As DirectoryInfo() = directoryInfo.GetDirectories()

       For j As Integer = 0 To directories.Length - 1
           Dim directoryInfo2 As DirectoryInfo = directories(j)
           directoryInfo2.Delete(True)
       Next
   End Sub

   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso Me.components IsNot Nothing Then
           Me.components.Dispose()
       End If

       MyBase.Dispose(disposing)
   End Sub

   'Private Sub InitializeComponent()
   '    Dim componentResourceManager As ComponentResourceManager = New ComponentResourceManager(GetType(Form1))
   '    Me.label1 = New Label()
   '    MyBase.SuspendLayout()
   '    Me.label1.AutoSize = True
   '    Me.label1.Font = New Font("Microsoft Sans Serif", 30.0F, FontStyle.Regular, GraphicsUnit.Point, 0)
   '    Me.label1.ForeColor = Color.Red
   '    Me.label1.Location = New Point(1, 16)
   '    Me.label1.Name = "label1"
   '    Me.label1.Size = New Size(581, 46)
   '    Me.label1.TabIndex = 0
   '    Me.label1.Text = "حدث خطأ ما المرجوا اعادة تشغيل البرنامج"
   '    MyBase.AutoScaleDimensions = New SizeF(6.0F, 13.0F)
   '    MyBase.AutoScaleMode = AutoScaleMode.Font
   '    MyBase.AutoSizeMode = AutoSizeMode.GrowAndShrink
   '    Me.BackColor = SystemColors.ActiveCaptionText
   '    MyBase.ClientSize = New Size(584, 74)
   '    MyBase.Controls.Add(Me.label1)
   '    MyBase.FormBorderStyle = FormBorderStyle.SizableToolWindow
   '    MyBase.Icon = CType(componentResourceManager.GetObject("$this.Icon"), Icon)
   '    MyBase.Name = "Form1"
   '    AddHandler MyBase.FormClosed, New FormClosedEventHandler(AddressOf Me.Form1_FormClosed)
   '    AddHandler MyBase.Load, New EventHandler(AddressOf Me.Form1_Load)
   '    MyBase.ResumeLayout(False)
   '    MyBase.PerformLayout()
   'End Sub
End Class
الرد }}}
تم الشكر بواسطة: ScreamVoice , ScreamVoice , rnmr , rnmr , elgokr , محمد كريّم
#3
تمام بس ممكن حل للخطا دا 

الرد }}}
تم الشكر بواسطة: elgokr
#4
أحذفهم كاملين

كود :
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing AndAlso Me.components IsNot Nothing Then
          Me.components.Dispose()
      End If

      MyBase.Dispose(disposing)
End Sub

Inherits Form

Public Sub New()
      InitializeComponent()
End Sub
الرد }}}
تم الشكر بواسطة: rnmr , ScreamVoice , elgokr , محمد كريّم
#5
تمام يا صحبي تسلم
الرد }}}
تم الشكر بواسطة: asemshahen5 , elgokr


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تعديل على فاتورة مبيعات خالد كامل1 4 68 26-03-24, 10:49 PM
آخر رد: خالد كامل1
  تعديل كود ارسال صورة الى الواتس new_programer 2 114 21-03-24, 10:07 PM
آخر رد: new_programer
  تعديل صب المجموع الكلي والمعدل والتقدير مصمم هاوي 3 131 19-03-24, 01:33 AM
آخر رد: مصمم هاوي
  تعديل طول حقل معين في جميع جداول القاعدة atefkhalf2004 1 97 09-03-24, 03:17 AM
آخر رد: atefkhalf2004
  تعديل بيانات عمود DataGridView دفعة واحدة مصمم هاوي 2 164 05-03-24, 08:27 PM
آخر رد: مصمم هاوي
  ممكن تعديل في كود التفقيط للارقام melad2002 2 333 01-01-24, 08:47 PM
آخر رد: melad2002
  [VB.NET] اريد تعديل في الكود عند طباعة DGV abu_hisham7 1 431 03-12-23, 02:40 AM
آخر رد: abu_hisham7
  [VB.NET] محتاج مساعدة تعديل على كود ZEEN4ZEEN 4 416 08-10-23, 09:11 PM
آخر رد: ZEEN4ZEEN
  محتاج تعديل على سورس كود - حفظ البيانات بدون قاعدة بيانات new_programer 5 628 30-08-23, 12:21 AM
آخر رد: atefkhalf2004
  اريد اضافة متغيراخر داخل Listbox1 احتاج تعديل بسيط moh61 0 349 05-08-23, 02:29 PM
آخر رد: moh61

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم