Ejemplo n.º 1
0
 public Class6 method_0(string string_0)
 {
     for (int i = 0; i < 100; i++)
     {
         bool flag;
         if (i != 0)
         {
             Thread.Sleep(100);
         }
         using (new Mutex(true, string_0 + "-Startup", out flag))
         {
             if (flag)
             {
                 string str;
                 string str2;
                 if (!smethod_4(out str))
                 {
                     return(Class6.smethod_2("Could not get image file name"));
                 }
                 if (!File.Exists(str))
                 {
                     string location = Assembly.GetEntryAssembly().Location;
                     if (!File.Exists(location))
                     {
                         string str5;
                         string str4 = Path.Combine(Path.GetDirectoryName(str), string_0 + ".exe");
                         if (!this.method_1(str4, out str5))
                         {
                             return(Class6.smethod_2("Someone else won the rename race but the sym link could not be resolved"));
                         }
                         smethod_5(string_0, str);
                         return(Class6.smethod_0(str5));
                     }
                     str = location;
                 }
                 if (!this.method_1(str, out str2))
                 {
                     return(Class6.smethod_2("Could not get final path for image file name"));
                 }
                 if (!string.Equals(str, str2, StringComparison.OrdinalIgnoreCase))
                 {
                     return(Class6.smethod_1(str));
                 }
                 Class6 class1 = smethod_0(str, string_0);
                 if (class1.Enum1_0 == Enum1.Success)
                 {
                     smethod_5(string_0, str);
                 }
                 return(class1);
             }
         }
     }
     return(Class6.smethod_2("Failed to rename after several tries"));
 }
Ejemplo n.º 2
0
        private static Class6 smethod_0(string string_0, string string_1)
        {
            string path = Path.Combine(Path.GetDirectoryName(string_0), string_1 + ".exe");

            File.Delete(path);
            string fileName = Path.GetFileName(smethod_1(string_0));

            if (!CreateSymbolicLink(path, fileName, Enum2.File))
            {
                if (Marshal.GetLastWin32Error() == 1)
                {
                    throw new Exception("Could not setup new sym link - the device does not support symbolic links.\r\n" + string.Format("Please make sure the drive you are attempting to use {0} on is ", string_1) + string.Format("formatted with the NTFS file system, or copy {0} to the system drive.", string_1));
                }
                Win32Exception exception = new Win32Exception();
                throw new Exception(string.Format("Could not setup new sym link - {0} ({1:x8}", exception.Message, exception.NativeErrorCode));
            }
            if (string.Equals(string_0, path, StringComparison.OrdinalIgnoreCase))
            {
                return(Class6.smethod_1(path));
            }
            return(Class6.smethod_0(path));
        }