Exemple #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);
        }