コード例 #1
0
ファイル: SOP.cs プロジェクト: conankzhang/fez
        private static unsafe bool ContainsApplication(IntPtr session, IntPtr profile, SOP.Profile profileDescriptor, ushort[] unicodeApplicationName, out SOP.Application application)
        {
            application = new SOP.Application();
            if ((int)profileDescriptor.numOfApps == 0)
            {
                return(false);
            }
            SOP.Application[] applicationArray = new SOP.Application[(IntPtr)profileDescriptor.numOfApps];
            uint appCount = profileDescriptor.numOfApps;

            fixed(SOP.Application *allApplications = applicationArray)
            {
                allApplications->version = 147464U;
                if (SOP.CheckForError(SOP.EnumApplications(session, profile, 0U, ref appCount, allApplications)))
                {
                    return(false);
                }
                for (uint index = 0U; index < appCount; ++index)
                {
                    // ISSUE: reference to a compiler-generated field
                    if (SOP.UnicodeStringCompare(&((SOP.Application *)((IntPtr)allApplications + (IntPtr)((long)index * (long)sizeof(SOP.Application))))->appName.FixedElementField, unicodeApplicationName))
                    {
                        application = *(SOP.Application *)((IntPtr)allApplications + (IntPtr)((long)index * (long)sizeof(SOP.Application)));
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #2
0
ファイル: SOP.cs プロジェクト: conankzhang/fez
        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);
        }
コード例 #3
0
ファイル: SOP.cs プロジェクト: conankzhang/fez
        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);
        }
コード例 #4
0
ファイル: SOP.cs プロジェクト: conankzhang/fez
        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);
        }