Exemplo n.º 1
0
        private void addToNowPlaying()
        {
            string selItem = null;

            NPlist = null;
            try
            {
                String[] tempList = new String[NPlistbox.Items.Count];
                int      i        = 0;
                int      count    = playlist.count;

                for (int j = 0; j < count; j++)
                {
                    playlist.removeItem(playlist.get_Item(0));
                }

                NPlistbox.Items.Clear();

                selItem = PLlistBox.SelectedItem.ToString();
                Boolean firstLoopTurn = false;
                foreach (String listItem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                        value = "    " + value;
                        NPlistbox.Items.Add(value);

                        media = MediaPlayerControl.newMedia(listItem);
                        playlist.appendItem(media);
                    }
                    firstLoopTurn = true;
                }

                NPlist        = new String[MyPlaylistData.getPlaylist(selItem).Length - 1];
                i             = 0;
                firstLoopTurn = true;
                foreach (String listitem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        firstLoopTurn = false;
                        continue;
                    }
                    NPlist[i] = listitem;
                    i++;
                }

                MediaPlayerControl.Ctlcontrols.play();
                tabControl1.SelectedTab = tabPage1;
                NPlistbox.SelectedIndex = 0;
            }

            catch (Exception ex)
            {
                MessageBox.Show("Unable to Play!\n\n" + ex.Message);
            }
        }
Exemplo n.º 2
0
        public static List <WMPLib.IWMPMedia> Where(this WMPLib.IWMPPlaylist source, Func <WMPLib.IWMPMedia, bool> predicate)
        {
            List <WMPLib.IWMPMedia> list = new List <WMPLib.IWMPMedia>();

            for (int i = 0; i < source.count; i++)
            {
                list.Add(source.get_Item(i));
            }
            return(list.Where(predicate).ToList());
        }
Exemplo n.º 3
0
        private void Del_Click(object sender, EventArgs e)
        {
            if (List.Items.Count > 0)
            {
                WMPLib.IWMPMedia media = playlist.get_Item(List.SelectedIndex);
                playlist.removeItem(media);

                List.Items.RemoveAt(List.SelectedIndex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Executes the specified param.
        /// </summary>
        /// <param name="param">The param.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public OpResult Execute(string param)
        {
            reset_globals();

            debug_last_action = "Execute: Start";

            HashSet<int> results = new HashSet<int>();

            DateTime startTime = DateTime.Now;

            OpResult opResult = new OpResult();
            opResult.StatusCode = OpStatusCode.Ok;

            string template = "";

            page_limit = 0xFFFF;
            page_start = 0;

            bool bFilter = false;
            string clean_filter_params = "";
            string clean_paging_params = "";

            try
            {
                if (param.IndexOf("-help") >= 0)
                {
                    opResult = showHelp(opResult);
                    return opResult;
                }
                if (action == CLEAR_CACHE)
                {
                    opResult = clear_cache();
                    launch_generate_tags_list();
                    return opResult;
                }
                if (Player == null) Player = new WMPLib.WindowsMediaPlayer();
                photo_media_play_list = Player.mediaCollection.getByAttribute("MediaType", "Photo");

                debug_last_action = "Execution: Parsing params";
                // "Paging"?
                if (param.Contains("page-limit:"))
                {
                    page_limit = parse_int(param.Substring(param.IndexOf("page-limit:") + "page-limit:".Length));
                    clean_paging_params += "page-limit:" + page_limit + " ";
                }
                if (param.Contains("page-start:"))
                {
                    page_start = parse_int(param.Substring(param.IndexOf("page-start:") + "page-start:".Length));
                    clean_paging_params += "page-start:" + page_start + " ";
                }

                // Use Custom Template?
                if (param.Contains("template:"))
                {
                    template = param.Substring(param.IndexOf("template:") + "template:".Length);
                    if (template.IndexOf(" ") >= 0) template = template.Substring(0, template.IndexOf(" "));
                    clean_paging_params += "template:" + template + " ";
                }

                // Check if any filters are used
                if (param.Contains("is-tagged:"))
                {
                    bFilter = true;
                    string tag_string = param.Substring(param.IndexOf("is-tagged:") + "is-tagged:".Length);
                    if (tag_string.IndexOf(" ") >= 0) tag_string = tag_string.Substring(0, tag_string.IndexOf(" "));
                    List<string> tag_list = new List<string>(tag_string.Split(';'));
                    tag_list.Sort();
                    clean_filter_params += "is-tagged:" + String.Join(";", tag_list.ToArray()) + " ";
                }
                if (param.Contains("not-tagged:"))
                {
                    bFilter = true;
                    string tag_string = param.Substring(param.IndexOf("not-tagged:") + "not-tagged:".Length);
                    if (tag_string.IndexOf(" ") >= 0) tag_string = tag_string.Substring(0, tag_string.IndexOf(" "));
                    List<string> tag_list = new List<string>(tag_string.Split(';'));
                    tag_list.Sort();
                    clean_filter_params += "not-tagged:" + String.Join(";", tag_list.ToArray()) + " ";
                }
                if (param.Contains("start-date:"))
                {
                    bFilter = true;
                    string date_string = param.Substring(param.IndexOf("start-date:") + "start-date:".Length);
                    DateTime date;
                    if (date_string.IndexOf(" ") >= 0) date_string = date_string.Substring(0, date_string.IndexOf(" "));
                    string[] date_elements = date_string.Split('-');
                    if (date_elements.Length >= 3)
                    {
                        date = new DateTime(Int32.Parse(date_elements[2]),
                            Int32.Parse(date_elements[0]), Int32.Parse(date_elements[1]));
                        date_string = date.ToShortDateString();
                        date_string = date_string.Replace("/", "-");
                        clean_filter_params += "start-date:" + date_string + " ";
                    }
                }
                if (param.Contains("end-date:"))
                {
                    bFilter = true;
                    string date_string = param.Substring(param.IndexOf("end-date:") + "end-date:".Length);
                    DateTime date;
                    if (date_string.IndexOf(" ") >= 0) date_string = date_string.Substring(0, date_string.IndexOf(" "));
                    string[] date_elements = date_string.Split('-');
                    if (date_elements.Length >= 3)
                    {
                        date = new DateTime(Int32.Parse(date_elements[2]),
                            Int32.Parse(date_elements[0]), Int32.Parse(date_elements[1]));
                        date_string = date.ToShortDateString();
                        date_string = date_string.Replace("/", "-");
                        clean_filter_params += "end-date:" + date_string + " ";
                    }
                }

                // Results specified? OVERRIDES OTHER FILTERS!
                if (param.Contains("ids:"))
                {
                    results = parse_ids(param.Substring(param.IndexOf("ids:") + "ids:".Length));
                    clean_filter_params = "ids:" + results.GetHashCode();
                }

                // Validate caches:
                validate_cache();
                // look for page cache - use filter + paging params, return if found
                if (action != PLAY_PHOTOS && action != QUEUE_PHOTOS && action != SERV_PHOTO && action != SHOW_STATS) //Check cache
                {
                    try
                    {
                        OpResult or = new OpResult();
                        or.StatusCode = OpStatusCode.Ok;
                        or = deserialize_rendered_page(or, action + "_" + clean_filter_params + clean_paging_params);
                        if (or != null) return or;
                    }
                    catch (Exception) { ; }
                }

                switch (action)
                {
                    case SHOW_STATS:
                    case LIST_TAGS:
                        //int pic_count = photo_media_play_list.count;
                        if (bFilter)    // Generate subset of tags based on images
                        {
                            if (results.Count == 0) results = get_list(results, clean_filter_params);
                            //pic_count = results.Count;
                            opResult = list_tags(opResult, template, generate_filtered_tags_list(results));
                        }
                        else            // Full set of tags
                            opResult = list_tags(opResult, template);
                        if (action == SHOW_STATS) opResult = show_stats(template, results);
                        break;
                    case LIST_PHOTOS:
                    case PLAY_PHOTOS:
                    case QUEUE_PHOTOS:
                    case SERV_PHOTO:
                        if (results.Count == 0)
                        {
                            results = get_list(results, clean_filter_params);
                        }

                        // Output results
                        if (action == SERV_PHOTO)
                        {
                            int size_x = 0;
                            int size_y = 0;
                            int size_short = 0;
                            int size_long = 0;

                            debug_last_action = "Execute: Serv Start";
                            if (param.Contains("size-x:"))
                            {
                                string tmp_size = param.Substring(param.IndexOf("size-x:") + "size-x:".Length);
                                if (tmp_size.IndexOf(" ") >= 0) tmp_size = tmp_size.Substring(0, tmp_size.IndexOf(" "));
                                size_x = Convert.ToInt32(tmp_size);
                            }
                            if (param.Contains("size-y:"))
                            {
                                string tmp_size = param.Substring(param.IndexOf("size-y:") + "size-y:".Length);
                                if (tmp_size.IndexOf(" ") >= 0) tmp_size = tmp_size.Substring(0, tmp_size.IndexOf(" "));
                                size_y = Convert.ToInt32(tmp_size);
                            }
                            if (param.Contains("size-short:"))
                            {
                                string tmp_size = param.Substring(param.IndexOf("size-short:") + "size-short:".Length);
                                if (tmp_size.IndexOf(" ") >= 0) tmp_size = tmp_size.Substring(0, tmp_size.IndexOf(" "));
                                size_short = Convert.ToInt32(tmp_size);
                            }
                            if (param.Contains("size-long:"))
                            {
                                string tmp_size = param.Substring(param.IndexOf("size-long:") + "size-long:".Length);
                                if (tmp_size.IndexOf(" ") >= 0) tmp_size = tmp_size.Substring(0, tmp_size.IndexOf(" "));
                                size_long = Convert.ToInt32(tmp_size);
                            }
                            // Return one photo (may be only one)
                            int random_index = -1;
                            int image_index = 0;
                            if (param.Contains("random")) random_index = new Random().Next(results.Count);
                            int result_count = 0;
                            foreach (int i in results)
                            {
                                if (random_index < 0 && result_count >= page_start && result_count < page_start + page_limit)
                                {
                                    image_index = i;
                                    break;
                                }
                                else if (random_index >= 0 && random_index <= result_count)
                                {
                                    image_index = i;
                                    break;
                                }
                                result_count++;
                            }
                            last_img_served = image_index;
                            opResult = getPhoto(photo_media_play_list.get_Item(image_index), size_x, size_y, size_short, size_long);
                            debug_last_action = "Execute: Serv End";
                        }
                        else
                        {
                            string template_result = (action == LIST_PHOTOS) ? getTemplate(template, DEFAULT_RESULT) : getTemplate(template, DEFAULT_PLAY_RESULT);
                            template_result = file_includer(template_result);

                            debug_last_action = "Execute: List: Header";
                            string s_head = (action == LIST_PHOTOS) ? getTemplate(template + "+", DEFAULT_HEAD):getTemplate(template + "+", DEFAULT_PLAY_HEAD);
                            s_head = file_includer(s_head);
                            s_head = do_conditional_replace(s_head, "results_count", String.Format("{0}", results.Count));
                            opResult.AppendFormat("{0}", s_head);

                            debug_last_action = "Execute: List: Items";

                            if (action == PLAY_PHOTOS)
                            {
                                clear_slide_show();
                            }

                            int result_count = 0;
                            string in_file = "";
                            string out_file = "";
                            foreach (int i in results)
                            {
                                if (action == PLAY_PHOTOS || action == QUEUE_PHOTOS)
                                {
                                    //Create dir if needed:
                                    if (!Directory.Exists(SLIDE_SHOW_DIR)) create_dirs();
                                    // Add photo to slideshow directory
                                    in_file = photo_media_play_list.get_Item(i).getItemInfo("SourceURL");
                                    out_file = SLIDE_SHOW_DIR + "\\" + make_cache_fn(in_file, 100);
                                    File.Copy(in_file, out_file, true);
                                }
                                else if (result_count >= page_start && result_count < page_start + page_limit)
                                {
                                    string s = "";
                                    s = replacer(template_result, photo_media_play_list.get_Item(i), i);
                                    opResult.AppendFormat("{0}", s);
                                }
                                result_count++;
                            }
                            if (action == PLAY_PHOTOS || action == QUEUE_PHOTOS)
                            {
                                // Start playing:
                                Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment.NavigateToPage(Microsoft.MediaCenter.PageId.Slideshow, SLIDE_SHOW_DIR);
                                //Old: Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment.NavigateToPage(Microsoft.MediaCenter.PageId.MyPictures, SLIDE_SHOW_DIR);
                            }
                            debug_last_action = "Execute: List: Footer";
                            TimeSpan duration = DateTime.Now - startTime;
                            string s_foot = (action == LIST_PHOTOS) ? getTemplate(template + "-", DEFAULT_FOOT):getTemplate(template + "-", DEFAULT_PLAY_FOOT);
                            s_foot = file_includer(s_foot);
                            s_foot = do_conditional_replace(s_foot, "elapsed_time", String.Format("{0}", duration.TotalSeconds));
                            s_foot = do_conditional_replace(s_foot, "results_count", String.Format("{0}", results.Count));
                            opResult.AppendFormat("{0}", s_foot);
                        }

                        break;
                }
            }
            catch (Exception ex)
            {
                opResult = new OpResult();
                opResult.StatusCode = OpStatusCode.Exception;
                opResult.StatusText = ex.Message;
                opResult.AppendFormat("{0}", debug_last_action);
                opResult.AppendFormat("{0}", ex.Message);
            }

            if (action == LIST_TAGS)
            {
                debug_last_action = "Execute: List: Footer";
                TimeSpan duration = DateTime.Now - startTime;
                string s_foot = getTemplate(template + "-", DEFAULT_REPORT_FOOT);
                s_foot = file_includer(s_foot);
                s_foot = do_conditional_replace(s_foot, "elapsed_time", String.Format("{0}", duration.TotalSeconds));
                s_foot = do_conditional_replace(s_foot, "results_count", String.Format("{0}", kw_count));
                s_foot = do_conditional_replace(s_foot, "first_date", String.Format("{0}", first_date.ToShortDateString()));
                s_foot = do_conditional_replace(s_foot, "last_date", String.Format("{0}", last_date.ToShortDateString()));
                opResult.AppendFormat("{0}", s_foot);
            }

            // save page to cache - use filter + paging params
            // TODO: elapsed time is incorrectly cached! Add is_cached to custom templates
            if (opResult.StatusCode == OpStatusCode.Ok &&
                action != PLAY_PHOTOS && action != QUEUE_PHOTOS && action != SERV_PHOTO && action != SHOW_STATS) // Save cache
            {
                debug_last_action = "Execute: Saving page to cache";
                try { serialize_rendered_page(opResult, action + "_" + clean_filter_params + clean_paging_params); }
                catch (Exception e) { debug_last_action = "Execute: Save to Cache failed: " + e.Message; }
            }

            debug_last_action = "Execute: End";

            return opResult;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Executes the specified param.
        /// </summary>
        /// <param name="param">The param.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public OpResult Execute(string param)
        {
            OpResult opResult = new OpResult();
            bool     bFirst   = !queue;
            bool     bByIndex = false;
            int      idx      = 0;

            opResult.StatusCode = OpStatusCode.Ok;
            try
            {
                if (Player == null)
                {
                    Player = new WMPLib.WindowsMediaPlayer();
                }

                if (param.IndexOf("-help") >= 0)
                {
                    opResult = showHelp(opResult);
                    return(opResult);
                }

                DateTime startTime = DateTime.Now;

                // Use custom format?
                Match custom_match = custom_regex.Match(param);
                if (custom_match.Success)
                {
                    showWhat = System.Convert.ToInt32(custom_match.Groups["index"].Value, 10);
                    param    = custom_match.Groups["remainder"].Value;
                }

                Match match = index_regex.Match(param);
                if (match.Success)
                {
                    idx      = System.Convert.ToInt32(match.Groups["index"].Value, 10);
                    bByIndex = true;
                    param    = "";
                }
                else
                {
                    idx   = 0;
                    param = param.ToLower();
                }

                if (showWhat == 0)
                {
                    opResult = listArtistsOnly(opResult, param);
                    TimeSpan duration = DateTime.Now - startTime;
                    opResult.AppendFormat("elapsed_time={0}", duration.TotalSeconds);
                    return(opResult);
                }
                if (param.Length > 0)
                {
                    mediaPlaylist = byArtist(param);
                }
                else
                {
                    mediaPlaylist = Player.mediaCollection.getByAttribute("MediaType", "Audio");
                }

                bool bArtistMatch = false;
                the_state.init();

                int iCount = mediaPlaylist.count;

                string keyArtist = "";
                string keyAlbum  = "";

                // Header:
                templateOut(String.Format("{0}H", showWhat), opResult, 0, -1);

                for (int x = idx; x < iCount; x++)
                {
                    media = mediaPlaylist.get_Item(x);
                    the_state.nextArtist = media.getItemInfo("WM/AlbumArtist");
                    if (the_state.nextArtist == "")
                    {
                        the_state.nextArtist = media.getItemInfo("Author");
                    }
                    the_state.nextAlbum = media.getItemInfo("WM/AlbumTitle");
                    if (bByIndex && x == idx)
                    {
                        keyArtist = the_state.nextArtist;
                        keyAlbum  = the_state.nextAlbum;
                    }
                    else
                    {
                        if (showBy == by_track && keyArtist.Length > 0 && x != idx)
                        {
                            break;
                        }
                        if (showBy == by_artist && keyArtist.Length > 0 && the_state.nextArtist != keyArtist)
                        {
                            break;
                        }
                        if (showBy == by_album && keyArtist.Length > 0 && (the_state.nextAlbum != keyAlbum || the_state.nextArtist != keyArtist))
                        {
                            break;
                        }
                    }

                    if (the_state.nextArtist != the_state.artist) // New artist?
                    {
                        if (bArtistMatch)                         // Did last artist match?
                        {
                            // Close album:
                            if (the_state.album.Length > 0)
                            {
                                if (!templateOut(String.Format("{0}.{1}-", showWhat, show_albums), opResult, x, -1) && ((showWhat & show_albums) != 0) && the_state.albumTrackCount > 0)
                                {
                                    opResult.AppendFormat("    Album_song_count: {0}", the_state.albumTrackCount);
                                }
                            }
                            the_state.resetAlbum();
                            // Close artist"
                            if (!templateOut(String.Format("{0}.{1}-", showWhat, show_artists), opResult, x, -1))
                            {
                                if (the_state.artistAlbumCount > 0)
                                {
                                    opResult.AppendFormat("  Artist_album_count: {0}", the_state.artistAlbumCount);
                                }
                                if (the_state.artistTrackCount > 0)
                                {
                                    opResult.AppendFormat("  Artist_song_count: {0}", the_state.artistTrackCount);
                                }
                            }
                            the_state.resetArtist();
                        }
                        if (the_state.nextArtist.ToLower().StartsWith(param))
                        {
                            bArtistMatch           = true;
                            the_state.artistCount += 1;

                            the_state.artistIndex = x;

                            if (keyArtist.Length <= 0)
                            {
                                keyArtist = the_state.nextArtist;
                                keyAlbum  = the_state.nextAlbum;
                            }
                        }
                        else
                        {
                            bArtistMatch = false;
                        }
                        the_state.artist = the_state.nextArtist;
                        if (bArtistMatch)
                        {
                            // Open Artist
                            if (!templateOut(String.Format("{0}.{1}+", showWhat, show_artists), opResult, x, -1) && ((showWhat & show_artists) != 0))
                            {
                                opResult.AppendFormat("Artist:<{0}> \"{1}\"", x, the_state.artist);
                            }
                        }
                    }
                    if (bArtistMatch)
                    {
                        the_state.artistTrackCount += 1;
                        the_state.trackCount       += 1;
                        if (the_state.nextAlbum != the_state.album)
                        {
                            if (the_state.album.Length > 0)
                            {
                                // Close album
                                if (!templateOut(String.Format("{0}.{1}-", showWhat, show_albums), opResult, x, -1) && ((showWhat & show_albums) != 0) && the_state.albumTrackCount > 0)
                                {
                                    opResult.AppendFormat("    Album_song_count: {0}", the_state.albumTrackCount);
                                }
                            }
                            the_state.resetAlbum();
                            the_state.album = the_state.nextAlbum;
                            if (the_state.nextAlbum.Length > 0)
                            {
                                the_state.albumIndex        = x;
                                the_state.albumCount       += 1;
                                the_state.artistAlbumCount += 1;
                                the_state.albumList_add(the_state.nextAlbum);
                                the_state.albumYear  = media.getItemInfo("WM/Year");
                                the_state.albumGenre = media.getItemInfo("WM/Genre");
                                the_state.findAlbumCover(media.sourceURL);
                                // Open album
                                if (!templateOut(String.Format("{0}.{1}+", showWhat, show_albums), opResult, x, -1) && ((showWhat & show_albums) != 0))
                                {
                                    opResult.AppendFormat("  Album:<{0}> \"{1}\"", x, the_state.nextAlbum);
                                }
                            }
                        }
                        the_state.album            = the_state.nextAlbum;
                        the_state.albumTrackCount += 1;
                        the_state.song             = media.getItemInfo("Title");
                        the_state.songLocation     = media.sourceURL;
                        the_state.songTrackNumber  = media.getItemInfo("WM/TrackNumber");
                        the_state.songLength       = media.durationString;
                        if (the_state.albumYear == "" || the_state.albumYear.Length < 4)
                        {
                            the_state.albumYear = media.getItemInfo("WM/OriginalReleaseYear");
                        }
                        the_state.albumGenre_add(media.getItemInfo("WM/Genre"));
                        the_state.findAlbumCover(the_state.songLocation);

                        // Open / close song
                        if (!templateOut(String.Format("{0}.{1}-", showWhat, show_songs), opResult, x, -1) && ((showWhat & show_songs) != 0) && the_state.song.Length > 0)
                        {
                            opResult.AppendFormat("    Song:<{0}> \"{1}\" ({2})", x, the_state.song, the_state.songLength);
                        }
                        templateOut(String.Format("{0}.{1}+", showWhat, show_songs), opResult, x, -1);

                        // Play / queue song?
                        if (play)
                        {
                            PlayMediaCmd pmc;
                            pmc      = new PlayMediaCmd(MediaType.Audio, !bFirst);
                            bFirst   = false;
                            opResult = pmc.Execute(media.sourceURL);
                        }
                    }
                }
                if (play)
                {
                    opResult.AppendFormat("Queued {0} songs to play", the_state.trackCount);
                }
                else
                {
                    // Close album:
                    if (the_state.album.Length > 0)
                    {
                        if (!templateOut(String.Format("{0}.{1}-", showWhat, show_albums), opResult, the_state.trackCount, -1) && ((showWhat & show_albums) != 0) && the_state.albumTrackCount > 0)
                        {
                            opResult.AppendFormat("    Album_song_count: {0}", the_state.albumTrackCount);
                        }
                    }
                    the_state.resetAlbum();
                    // Close artist:
                    if (!templateOut(String.Format("{0}.{1}-", showWhat, show_artists), opResult, the_state.trackCount, -1))
                    {
                        if (the_state.artistAlbumCount > 0)
                        {
                            opResult.AppendFormat("  Artist_album_count: {0}", the_state.artistAlbumCount);
                        }
                        if (the_state.artistTrackCount > 0)
                        {
                            opResult.AppendFormat("  Artist_song_count: {0}", the_state.artistTrackCount);
                        }
                    }
                    the_state.resetArtist();
                }
                // Footer:
                TimeSpan elapsed_duration = DateTime.Now - startTime;
                if (!templateOut(String.Format("{0}F", showWhat), opResult, the_state.trackCount, elapsed_duration.TotalSeconds))
                {
                    if (the_state.artistCount > 0)
                    {
                        opResult.AppendFormat("Artist_count: {0}", the_state.artistCount);
                    }
                    if (the_state.albumCount > 0)
                    {
                        opResult.AppendFormat("Album_count: {0}", the_state.albumCount);
                    }
                    if (the_state.trackCount > 0)
                    {
                        opResult.AppendFormat("Song_count: {0}", the_state.trackCount);
                    }
                    opResult.AppendFormat("elapsed_time={0}", elapsed_duration.TotalSeconds);
                }
            }
            catch (Exception ex)
            {
                opResult.StatusCode = OpStatusCode.Exception;
                opResult.StatusText = ex.Message;
            }
            return(opResult);
        }