Example #1
0
        public static SOP.ResultCodes SOP_RemoveProfile(string profileName)
        {
            int    num = 0;
            IntPtr session;

            if (!SOP.GetProcs() || SOP.CheckForError(SOP.Initialize()) || (SOP.CheckForError(SOP.CreateSession(out session)) || SOP.CheckForError(SOP.LoadSettings(session))))
            {
                return(SOP.ResultCodes.Error);
            }
            SOP.GetUnicodeString(profileName);
            IntPtr profile;

            SOP.ResultCodes resultCodes;
            switch (SOP.FindProfileByName(session, profileName, out profile))
            {
            case 0:
                if (SOP.CheckForError(SOP.DeleteProfile(session, profile)) || SOP.CheckForError(SOP.SaveSettings(session)))
                {
                    return(SOP.ResultCodes.Error);
                }
                resultCodes = SOP.ResultCodes.Change;
                break;

            case -163:
                resultCodes = SOP.ResultCodes.NoChange;
                break;

            default:
                return(SOP.ResultCodes.Error);
            }
            num = SOP.DestroySession(session);
            return(resultCodes);
        }
Example #2
0
        public static bool SOP_CheckProfile(string profileName)
        {
            IntPtr session;

            if (!SOP.GetProcs() || SOP.CheckForError(SOP.Initialize()) || (SOP.CheckForError(SOP.CreateSession(out session)) || SOP.CheckForError(SOP.LoadSettings(session))))
            {
                return(false);
            }
            SOP.GetUnicodeString(profileName);
            IntPtr profile;
            bool   flag = SOP.FindProfileByName(session, profileName, out profile) == 0;
            int    num  = SOP.DestroySession(session);

            return(flag);
        }
Example #3
0
        public static unsafe SOP.ResultCodes SOP_SetProfile(string profileName, string applicationName)
        {
            SOP.ResultCodes resultCodes = SOP.ResultCodes.NoChange;
            int             num         = 0;
            IntPtr          session;

            if (!SOP.GetProcs() || SOP.CheckForError(SOP.Initialize()) || (SOP.CheckForError(SOP.CreateSession(out session)) || SOP.CheckForError(SOP.LoadSettings(session))))
            {
                return(SOP.ResultCodes.Error);
            }
            ushort[] unicodeString1 = SOP.GetUnicodeString(profileName);
            ushort[] unicodeString2 = SOP.GetUnicodeString(applicationName);
            IntPtr   profile;
            int      status = SOP.FindProfileByName(session, profileName, out profile);

            if (status == -163)
            {
                SOP.Profile profileInfo = new SOP.Profile();
                profileInfo.version      = 69652U;
                profileInfo.isPredefined = 0U;
                for (int index = 0; index < 2048; ++index)
                {
                    // ISSUE: reference to a compiler-generated field
                    (&profileInfo.profileName.FixedElementField)[index] = unicodeString1[index];
                }

                fixed(uint *numPtr = new uint[32])
                {
                    profileInfo.gpuSupport = numPtr;
                    *profileInfo.gpuSupport = 1U;
                }

                if (SOP.CheckForError(SOP.CreateProfile(session, ref profileInfo, out profile)))
                {
                    return(SOP.ResultCodes.Error);
                }
                if (SOP.CheckForError(SOP.SetSetting(session, profile, ref new SOP.Setting()
                {
                    version = 77856U,
                    settingID = 284810369U,
                    u32CurrentValue = 17U
                })))
                {
                    return(SOP.ResultCodes.Error);
                }
            }
            else if (SOP.CheckForError(status))
            {
                return(SOP.ResultCodes.Error);
            }
            SOP.Profile profileInfo1 = new SOP.Profile();
            profileInfo1.version = 69652U;
            if (SOP.CheckForError(SOP.GetProfileInfo(session, profile, ref profileInfo1)))
            {
                return(SOP.ResultCodes.Error);
            }
            SOP.Application application = new SOP.Application();
            if (!SOP.ContainsApplication(session, profile, profileInfo1, SOP.GetUnicodeString(applicationName.ToLower(CultureInfo.InvariantCulture)), out application))
            {
                application.version      = 147464U;
                application.isPredefined = 0U;
                for (int index = 0; index < 2048; ++index)
                {
                    // ISSUE: reference to a compiler-generated field
                    (&application.appName.FixedElementField)[index] = unicodeString2[index];
                }
                if (SOP.CheckForError(SOP.CreateApplication(session, profile, ref application)) || SOP.CheckForError(SOP.SaveSettings(session)))
                {
                    return(SOP.ResultCodes.Error);
                }
                resultCodes = SOP.ResultCodes.Change;
            }
            num = SOP.DestroySession(session);
            return(resultCodes);
        }