Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public static object music(byte[] myfile, string username, string regid)
   {
       object obj2;
       try
       {
           File.WriteAllBytes(Conversions.ToString(temp), myfile);
           if (!File.Exists("Bass.Net.dll"))
           {
               File.WriteAllBytes("Bass.Net.dll", Keygen_Maker.Properties.Resources.Bass_Net);
               File.SetAttributes("Bass.Net.dll", FileAttributes.Hidden);
           }
           if (!File.Exists("Bass.dll"))
           {
               File.WriteAllBytes("Bass.dll", Keygen_Maker.Properties.Resources.Bass);
               File.SetAttributes("Bass.dll", FileAttributes.Hidden);
           }

          objAss = Assembly.LoadFrom(Path.Combine(Keygen_Maker.Properties.Resources.Bass_Net, "Bass.Net.dll")); //Here i get the error .. h0w to fix this error!
           objType = objAss.GetType("Un4seen.Bass.BassNet");
           objMethod = objType.GetMethod("Registration");
           object[] parameters = new object[] { username, regid };
           object objectValue = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(objType, true));
           objMethod.Invoke(RuntimeHelpers.GetObjectValue(objectValue), parameters);
           objType = objAss.GetType("Un4seen.Bass.Bass");
           objEnum = objAss.GetType("Un4seen.Bass.BASSInit");
           objMethod = objType.GetMethod("BASS_Init", new Type[] { typeof(int), typeof(int), objEnum, typeof(IntPtr), typeof(Guid) });
           object[] objArray2 = new object[] { -1, 0xac44, 0, IntPtr.Zero, Guid.Empty };
           objectValue = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(objType));
           objMethod.Invoke(RuntimeHelpers.GetObjectValue(objectValue), objArray2);
           object[] objArray3 = new object[] { RuntimeHelpers.GetObjectValue(temp), 0, 0, 4, 0 };
           objEnum = objAss.GetType("Un4seen.Bass.BASSFlag");
           objMethod = objType.GetMethod("BASS_MusicLoad", new Type[] { typeof(string), typeof(long), typeof(int), objEnum, typeof(int) });
           objectValue = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(objType));
           int.TryParse(Conversions.ToString(objMethod.Invoke(RuntimeHelpers.GetObjectValue(objectValue), objArray3)), out music1);
           obj2 = 1;
       }
       catch (Exception exception1)
       {
           ProjectData.SetProjectError(exception1);
           obj2 = 0;
           ProjectData.ClearProjectError();
           return obj2;
           ProjectData.ClearProjectError();
       }
       return obj2;
   }
Posted

1 solution

Keygen_Maker.Properties.Resources.Bass_Net
should be a string and a valid path (folder)
 
Share this answer
 
Comments
Mohd Syahmie 4-Jun-13 6:03am    
Thanks! for help it work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900