تقييم الموضوع :
  • 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();
       }
   }
}

ولكم حزيل الشكر
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
طلب تعديل كود من c# الي vb وبعض التعديلات - بواسطة ScreamVoice - 27-10-18, 05:55 PM


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


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