예제 #1
0
        private String determineNewShowName(ShowList showList, DownloadShow downloadShow)
        {
            String baseFileName = DriveInfo.CheckFileName(downloadShow.DataFileName.ToString());
            String fileExt      = FileUtil.DetermineFileExtFromURL(downloadShow.ShowURL.ToString());

            if (fileExt == null)
            {
                fileExt = "";
            }

            if (baseFileName.Length + fileExt.Length > DataFileNameMaxLen)
            {
                baseFileName = baseFileName.Substring(0, DataFileNameMaxLen - fileExt.Length);
            }

            int    count        = 2;
            String testFileName = baseFileName + fileExt;

            while (true)
            {
                if (!showList.ContainsByDataFileName(testFileName))
                {
                    return(testFileName);
                }

                String postfix = String.Format(" ({0})", count++);

                if (baseFileName.Length + postfix.Length + fileExt.Length > DataFileNameMaxLen)
                {
                    baseFileName = baseFileName.Substring(0, DataFileNameMaxLen - postfix.Length - fileExt.Length);
                }
                testFileName = baseFileName + postfix + fileExt;
            }
        }
예제 #2
0
        private async void SetTimes(int obj)

        {
            var time = new Time();

            for (int j = 0; j < obj; j++)
            {
                for (int i = 0; i < SelectedRunners.Count; i++)
                {
                    time.Times       = new TimeSpan(0, 0, 0);
                    time.Distance    = listofraces.DistanceName;
                    time.Repetitions = j + 1;
                    await TimeServices.AddTime(time);

                    time.Runner = SelectedRunners[i];
                    time.Event  = NewEvent;
                    await TimeServices.AddEventToTime(time);
                }
            }
            ShowList.Add(new ListofRaces()
            {
                DistanceName = listofraces.DistanceName, Reps = listofraces.Reps, EventId = NewEvent.Id
            });
            listofraces.Reps         = 1;
            listofraces.DistanceName = null;
        }
예제 #3
0
        private async void ModifyTimes(int id)

        {
            var distances = StoredTimes.Select(e => e.Distance).Distinct();

            foreach (var distance in distances)

            {
                var reps = StoredTimes.Where(e => e.Distance == distance).Select(r => r.Repetitions).Max();
                ShowList.Add(new ListofRaces()
                {
                    DistanceName = distance, Reps = reps, EventId = id
                });
            }

            //borrar null EventId Times
            await TimeServices.DeleteNullEventIdTimes();

            //correr SetTimes por cada linea de Showlist.
            foreach (var race in ShowList)

            {
                ReSetTimes(race, race.Reps);
            }

            IsBusy = false;
        }
예제 #4
0
        private void CompareUserListInsert(DownloadShowList downloadShowList)
        {
            //Insert Show in UserList
            ShowList showList = UserDataMgr.GetThe().ShowList;

            bool bRentedShowIDFound_Flag = false;
            bool bNewShowInserted        = false;

            if (downloadShowList != null)
            {
                foreach (DownloadShow downloadShow in downloadShowList)
                {
                    bRentedShowIDFound_Flag = false;
                    bRentedShowIDFound_Flag = showList.ContainsByRentedShowID(downloadShow.RentedShowID);
                    if (!bRentedShowIDFound_Flag)
                    {
                        //Insert Show In User List
                        Logger.LogInfo(this, "CompareUserListInsert", "Insert Show In User List");
                        AddDownloadShowToList(showList, downloadShow);
                        bNewShowInserted = true;
                    }
                }

                //Write User Xml if any show is inserted
                if (bNewShowInserted)
                {
                    // Write user XML
                    UserDataMgr.GetThe().SaveShowList(showList);
                    //Session.GetThe().WriteUserDataToXML(userData);
                }
            }
        }
예제 #5
0
        private void navLink3_Click(object sender, EventArgs e)
        {
            Program  app      = Program.GetInstance();
            ShowList showList = app.GetScreen <ShowList>("showList");

            app.ShowScreen(showList);
        }
예제 #6
0
        private async void RemoveDistanceMethod(ListofRaces item)
        {
            var distance = item.DistanceName;
            var @event   = item.EventId;
            await TimeServices.DeleteTime(distance, @event);

            ShowList.Remove(item);
        }
예제 #7
0
        private void DelegateOp()
        {
            ShowList showList = InitializeList;

            showList += ShowDataList;

            showList?.Invoke();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ShowList showList = db.ShowLists.Find(id);

            db.ShowLists.Remove(showList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #9
0
 private void FrontPage_Click(object sender, RoutedEventArgs e)
 {
     if (ShowList.page > 1)
     {
         ShowList.page -= 1;
         NavMenuPrimaryListView.ItemsSource = ShowList.GetListShow();
     }
 }
예제 #10
0
        public int Solution(int[][] grid, bool showDp = false)
        {
            if (grid == null)
            {
                return(0);
            }
            int len = grid.Length;

            int[][] dp = new int[len][];

            for (int i = 0; i < len; i++)
            {
                dp[i] = new int[len];
            }

            for (int i = len - 1; i >= 0; i--)
            {
                if (i + 1 == len)
                {
                    dp[len - 1][i] = grid[len - 1][i];
                }
                else
                {
                    dp[len - 1][i] = Math.Max(grid[len - 1][i], dp[len - 1][i + 1]);
                }
            }

            for (int i = len - 2; i >= 0; i--)
            {
                for (int j = 0; j < len; j++)
                {
                    dp[i][j] = Math.Max(grid[i][j], dp[i + 1][j]);
                }

                for (int j = 1; j < len; j++)
                {
                    if (j > 0 && dp[i][j] >= grid[i][j - 1] && dp[i][j] > dp[i][j - 1])
                    {
                        dp[i][j] = Math.Max(dp[i][j - 1], grid[i][j]);
                    }
                }

                for (int j = len - 2; j >= 0; j--)
                {
                    if (j + 1 < len && dp[i][j] >= grid[i][j + 1] && dp[i][j] > dp[i][j + 1])
                    {
                        dp[i][j] = Math.Max(dp[i][j + 1], grid[i][j]);
                    }
                }
            }

            if (showDp)
            {
                Console.WriteLine(ShowList.GetStr(dp));
            }

            return(dp[0][0]);
        }
예제 #11
0
        /**
         *
         * Runtime: 104 ms, faster than 100.00% of C# online submissions for Swim in Rising Water.
         * Memory Usage: 23.4 MB, less than 100.00% of C# online submissions for Swim in Rising Water.
         *
         * nice~~ 有所付出,总会有所收获 yeah~
         *
         */
        public int Solution2(int[][] grid, bool showTest = false)
        {
            if (grid == null)
            {
                return(0);
            }
            int len = grid.Length;

            int[][] dp = new int[len][];

            for (int i = 0; i < len; i++)
            {
                dp[i] = new int[len];
            }

            // 确定最后一行为基准
            // because : 最后一行的值是可以通过当前值和后一个路径值确定的 dp[i][j] = Math.Max(grid[i][j], dp[i][j+1]);
            for (int i = len - 1; i >= 0; i--)
            {
                if (i + 1 == len)
                {
                    dp[len - 1][i] = grid[len - 1][i];
                }
                else
                {
                    dp[len - 1][i] = Math.Max(grid[len - 1][i], dp[len - 1][i + 1]);
                }
            }

            // 从倒数第二行往上遍历
            for (int i = len - 2; i >= 0; i--)
            {
                // ps 此处之所以使用两个循环拆分是由于改变周边值时由于遍历顺序导致周边值尚未更新从而无法影响,从而导致影响不起作用...

                // 确定猜测值 : 当前值 or 下方路径值
                // ps 之所以为猜测值是由于路径还可以选择左右方
                for (int j = 0; j < len; j++)
                {
                    dp[i][j] = Math.Max(grid[i][j], dp[i + 1][j]);
                }

                // 从当前点出发,试图改变周边路径值
                for (int j = 0; j < len; j++)
                {
                    ChangeOther(i, j, grid, dp);
                }
            }

            if (showTest)
            {
                Console.WriteLine(ShowList.GetStr(grid));
                Console.WriteLine("------------------------ dp:");
                Console.WriteLine(ShowList.GetStr(dp));
            }

            return(dp[0][0]);
        }
예제 #12
0
        //Create Show from DownloadShow
        private void AddDownloadShowToList(ShowList showList, DownloadShow downloadShow)
        {
            Show show = Show.NewInstance(downloadShow.RentedShowID);

            show.ShowURL        = downloadShow.ShowURL;
            show.DataFileName   = new TString(determineNewShowName(showList, downloadShow));
            show.DownloadStatus = DownloadStatus.NotStarted;

            showList.Add(show);
        }
예제 #13
0
        private static void MenuSistema()
        {
            Console.WriteLine("Escolha uma das opcoes do menu: ");
            Console.WriteLine("1 - Calculo de area");
            Console.WriteLine("2 - Mostrar Animacao");
            Console.WriteLine("3 -  Listar as cervejas ");
            Console.WriteLine("4 -  Listar Car");
            Console.WriteLine("5 - sair do sistema");

            var menuEscolhido = int.Parse(Console.ReadLine());

            switch (menuEscolhido)
            {
            case 1:
            {
                CalculaArea();
                MenuSistema();
            } break;

            case 2:

            {
                // quando nao é static cpodemos colocar new objeto static ja esta na memoria
                AnimacoesEmFrames.Iniciar();

                MenuSistema();
            } break;

            case 3:
            {
                ShowList.ListaString();
            }
            break;

            case 4:
            {
                ListCar.ListaCar();
            }
            break;


            case 5:

            {
                Console.WriteLine("Saindo.....");

                return;
            }

            //break;

            default:
                break;
            }
        }
예제 #14
0
        public List <Control> action()
        {
            page = 1;
            List <Control> result = new List <Control>();

            searchBar  = new SearchBar();
            resultList = new ShowList(new List <ShowListItem>());
            searchBar.SearchSubmitted += searchBar_searchSubmitted;
            result.Add(resultList);
            result.Add(searchBar);
            return(result);
        }
 public ActionResult Edit([Bind(Include = "Id,UserId,PerformanceId")] ShowList showList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(showList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId        = new SelectList(db.AspNetUsers.Where(x => x.Email == User.Identity.Name), "Id", "Email", showList.UserId);
     ViewBag.PerformanceId = new SelectList(db.Performances, "Id", "Name", showList.PerformanceId);
     return(View(showList));
 }
예제 #16
0
        private void ui_main_panel_Load(object sender, EventArgs e)
        {
            // tips绑定
            tip_main_panel.SetToolTip(picBox_setting, "右键单击,展示工具箱");
            tip_main_panel.SetToolTip(picBox_user_icon, "单击修改个人信息");

            show_list = new ShowList(SetList);
            handout   = new Handout(SetForm);

            // 设置用户昵称、签名
            this.lbl_nickname.Text  = user.Nickname;
            this.tbx_signature.Text = user.Signature;
        }
        // GET: ShowList/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShowList showList = db.ShowLists.Find(id);

            if (showList == null)
            {
                return(HttpNotFound());
            }
            return(View(showList));
        }
        public ActionResult Create([Bind(Include = "Id,UserId,PerformanceId")] ShowList showList)
        {
            if (ModelState.IsValid)
            {
                if (!db.ShowLists.Any(row => row.UserId == showList.UserId && row.PerformanceId == showList.PerformanceId))
                {
                    db.ShowLists.Add(showList);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.UserId        = new SelectList(db.AspNetUsers.Where(x => x.Email == User.Identity.Name), "Id", "Email", showList.UserId);
            ViewBag.PerformanceId = new SelectList(db.Performances, "Id", "Name", showList.PerformanceId);
            return(View(showList));
        }
        // GET: ShowList/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShowList showList = db.ShowLists.Find(id);

            if (showList == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId        = new SelectList(db.AspNetUsers.Where(x => x.Email == User.Identity.Name), "Id", "Email", showList.UserId);
            ViewBag.PerformanceId = new SelectList(db.Performances, "Id", "Name", showList.PerformanceId);
            return(View(showList));
        }
예제 #20
0
        public int Try(int[][] grid)
        {
            int sum = 0;

            for (int i = 0; i < grid.Length; i++)
            {
                for (int j = 0; j < grid[i].Length; j++)
                {
                    grid[i][j] = Helper(grid, i, j);
                    sum       += grid[i][j];
                }
            }

            Console.WriteLine(ShowList.GetStr(grid));

            return(sum);
        }
예제 #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mode"></param>
        public void Serach(int mode, string key)
        {
            ShowList.Clear();
            PageList.Clear();

            //启动动画
            myProgress.Visibility = Visibility.Visible;
            myProgress.Start();

            switch (Auth.Type)
            {
            case BTType.BT蚂蚁:
                new BTMY().Serach(mode, key, new Action <List <BT>, List <Models.Page>, string>((list, pagelist, info) =>
                {
                    if (list != null)
                    {
                        Dispatcher.Invoke(new Action(() =>
                        {
                            for (int i = 0; i < list.Count; i++)
                            {
                                ShowList.Add(list[i]);
                            }
                        }));
                        Dispatcher.Invoke(new Action(() =>
                        {
                            for (int i = 0; i < pagelist.Count; i++)
                            {
                                PageList.Add(new Models.Page()
                                {
                                    Name = pagelist[i].Name, Path = pagelist[i].Path, Type = BTType.BT蚂蚁
                                });
                            }
                        }));
                    }
                    Dispatcher.Invoke(new Action(() =>
                    {
                        myProgress.Stop();
                        myProgress.Visibility = Visibility.Collapsed;
                    }));
                }));
                break;

            default:
                break;
            }
        }
예제 #22
0
        /// <summary>
        /// 设置功能号发送数据
        /// </summary>
        private void SetFunctionIdSendStr()
        {
            if (string.IsNullOrWhiteSpace(FunctionId))
            {
                SetTipInfo("功能号不能为空!", "error");
                return;
            }
            var menuId          = Convert.ToInt32(FunctionId);
            var codeToolService = new CodeToolService();

            codeToolService.FuntionSend(menuId, FunctionIdGenerationStr, args =>
            {
                _showList = args;
                SetData(window.DataGrid);
                DataGridContentShow = Visibility.Visible;
            });
        }
예제 #23
0
        public bool CreateSeries(ShowList showList, List <GetSeries> getSeries)
        {
            Status status = new Status();

            try
            {
                if (!getSeries.Where(x => x.tvdbId == showList.show.ids.tvdb).Any())
                {
                    AddSeries series = new AddSeries
                    {
                        monitored      = true,
                        tvdbId         = showList.show.ids.tvdb,
                        title          = showList.show.title,
                        titleSlug      = showList.show.ids.slug,
                        seasonFolder   = true,
                        profileId      = Settings._settings.SonarrProfileId,
                        rootFolderPath = $"{Settings._settings.SonarrRootFolderPath}/{showList.show.title}"
                    };

                    AddOptions addOptions = new AddOptions {
                        ignoreEpisodesWithFiles = false, searchForMissingEpisodes = true
                    };
                    series.addOptions = addOptions;

                    status = PushSeries(series);

                    if (status.Success)
                    {
                        Console.WriteLine($"Added {series.title}");
                    }
                    else
                    {
                        Console.WriteLine($"Failed to add {series.title}, {status.ErrorMessage}");
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Failed to add {showList.show.title}, {ex.Message}");
                return(false);
            }
        }
예제 #24
0
        private void CompareUserListHDDDelete()
        {
            ShowList showList    = UserDataMgr.GetThe().ShowList;
            ShowList newShowList = new ShowList();

            bool fileExistFlag  = false;
            bool showDeleteFlag = false;

            foreach (Show show in showList)
            {
                if (DownloadStatus.Completed.Equals(show.DownloadStatus))
                {
                    try
                    {
                        fileExistFlag = DriveInfo.CheckFileExistOnHDD(show.DataFileName.ToString());
                    }
                    catch (Exception e)
                    {
                        Logger.LogError(this, "CompareUserListHDDDelete", e);
                    }

                    if (!fileExistFlag)
                    {
                        //Delete File from the user list and download list
                        Logger.LogInfo(this, "CompareUserListHDDDelete", "Delete File from the userlist and downloadlist");
                        Session.GetThe().ReleaseShow(show.RentedShowID);
                        showDeleteFlag = true;
                    }
                    else
                    {
                        newShowList.Add(show);
                    }
                }
                else
                {
                    newShowList.Add(show);
                }
            }

            //if any show is deleted from showlist then Write new User.XML
            if (showDeleteFlag)
            {
                UserDataMgr.GetThe().SaveShowList(newShowList);
            }
        }
예제 #25
0
        private void timFlush_Tick(object sender, EventArgs e)
        {
            lock (lockObject)
            {
                if (imgOne == null || imgTwo == null || img == null)
                {
                    InitGrpahic();
                }
                if (delayStart > 0)
                {
                    if ((senceNow == ShowList.First && ((Environment.TickCount - delayStart) >= first.DelayTime)) ||
                        (senceNow == ShowList.Second && ((Environment.TickCount - delayStart) >= second.DelayTime)))
                    {
                        delayStart = -1;
                    }
                }
                else
                {
                    if ((changeIndex * changeEveryTime) >= this.Height)
                    {
                        senceNow    = (ShowList)((1 + (int)senceNow) % 2);
                        changeIndex = 0;
                        delayStart  = Environment.TickCount;
                        All.Class.Api.BitBlt(hdc, 0, 0, this.Width, this.Height, senceNow == ShowList.First ? hdcOne : hdcTwo, 0, 0, All.Class.Api.ROP_SrcCopy);
                    }
                    else
                    {
                        switch (senceNow)
                        {
                        case ShowList.First:
                            All.Class.Api.BitBlt(hdc, 0, 0, this.Width, imgOne.Height - (int)(changeIndex * changeEveryTime), hdcOne, 0, (int)(changeIndex * changeEveryTime), All.Class.Api.ROP_SrcCopy);
                            All.Class.Api.BitBlt(hdc, 0, imgOne.Height - (int)(changeIndex * changeEveryTime), this.Width, (int)(changeIndex * changeEveryTime), hdcTwo, 0, 0, All.Class.Api.ROP_SrcCopy);
                            break;

                        case ShowList.Second:
                            All.Class.Api.BitBlt(hdc, 0, 0, this.Width, imgOne.Height - (int)(changeIndex * changeEveryTime), hdcTwo, 0, (int)(changeIndex * changeEveryTime), All.Class.Api.ROP_SrcCopy);
                            All.Class.Api.BitBlt(hdc, 0, imgOne.Height - (int)(changeIndex * changeEveryTime), this.Width, (int)(changeIndex * changeEveryTime), hdcOne, 0, 0, All.Class.Api.ROP_SrcCopy);
                            break;
                        }
                        changeIndex++;
                    }
                }
            }
        }
예제 #26
0
        /**
         * Runtime: 88 ms, faster than 100.00% of C# online submissions for Max Increase to Keep City Skyline.
         * Memory Usage: 24.8 MB, less than 12.50% of C# online submissions for Max Increase to Keep City Skyline.
         */
        public int Solution(int[][] grid)
        {
            int len = grid.Length, colLen = grid[0].Length;

            int[] vertical = new int[colLen], across = new int[len];

            for (int i = 0; i < len; i++)
            {
                var max = 0;
                for (int j = 0; j < colLen; j++)
                {
                    max = Math.Max(max, grid[i][j]);
                }

                across[i] = max;
            }

            for (int i = 0; i < colLen; i++)
            {
                var max = 0;
                for (int j = 0; j < len; j++)
                {
                    max = Math.Max(max, grid[j][i]);
                }

                vertical[i] = max;
            }

            int sum = 0;

            for (int i = 0; i < len; i++)
            {
                for (int j = 0; j < colLen; j++)
                {
                    sum       -= grid[i][j];
                    grid[i][j] = Math.Min(vertical[j], across[i]);
                    sum       += grid[i][j];
                }
            }

            Console.WriteLine(ShowList.GetStr(grid));

            return(sum);
        }
예제 #27
0
        public List <Control> action()
        {
            List <ShowListItem> showList = new List <ShowListItem>();

            foreach (Show s in Window.controller.showsByCategory(this.category))
            {
                showList.Add(new ShowListItem(s));
            }
            List <Control> result = new List <Control>();

            showListControl                    = new ShowList(showList);
            stateFilterControl                 = new StateFilter();
            stateFilterControl.Dock            = DockStyle.Top;
            stateFilterControl.FiltersChanged += stateFilter_filtersChanged;

            result.Add(showListControl);
            result.Add(stateFilterControl);

            return(result);
        }
예제 #28
0
        private bool CompareUserListDownload()
        {
            ShowList showList = UserDataMgr.GetThe().ShowList;
            String   filePath = UserDataMgr.GetThe().LocalShowPath.ToString();

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            foreach (Show show in showList)
            {
                if (DownloadStatus.NotStarted.Equals(show.DownloadStatus) ||
                    DownloadStatus.InProgress.Equals(show.DownloadStatus))
                {
                    //Download File
                    Logger.LogInfo(this, "CompareUserListDownload", "DownloadFile");

                    // Mark show as started download
                    show.DownloadStatus = DownloadStatus.InProgress;
                    UserDataMgr.GetThe().SaveShowList(showList);

                    String fullFileName = Path.Combine(filePath, show.DataFileName.ToString());
                    if (DownloadFile(show.ShowURL.ToString(), fullFileName))
                    {
                        //Update Show status
                        show.DownloadStatus = DownloadStatus.Completed;
                    }
                    else
                    {
                        show.DownloadStatus = DownloadStatus.NotStarted;
                    }

                    UserDataMgr.GetThe().SaveShowList(showList);
                    return(true); // only process one show at a time
                }
            }                     //End foreach(Show show in showList)

            return(false);
        }
예제 #29
0
        private void CompareUserListDelete(DownloadShowList downloadShowList)
        {
            //Delete Show From UserList
            ShowList showList    = UserDataMgr.GetThe().ShowList;
            ShowList newShowList = new ShowList();

            bool bRentedShowIDFound_Flag = false;
            bool bShowDeleted            = false;

            foreach (Show show in showList)
            {
                bRentedShowIDFound_Flag = downloadShowList.ContainsByRentedShowID(show.RentedShowID);
                if (!bRentedShowIDFound_Flag)
                {
                    //Delete Show From User List
                    Logger.LogInfo(this, "CompareUserListDelete", "Delete Show From User List and HDD");
                    try
                    {
                        DriveInfo.DeleteShowFromHDD(show.DataFileName.ToString());
                        bShowDeleted = true;
                    }
                    catch (Exception e)
                    {
                        Logger.LogError(this, "CompareUserListDelete", e);
                    }
                }
                else
                {
                    newShowList.Add(show);
                }
            }

            // Write user XML if any show is deleted
            if (bShowDeleted)
            {
                UserDataMgr.GetThe().SaveShowList(newShowList);
            }
        }
예제 #30
0
        public void UnPack(CT2UnPacker lpUnPack)
        {
            var flag  = 0;
            var count = lpUnPack.GetRowCount();

            _showlist           = new ShowList();
            _showlist.ValueList = new List <string> [count];
            _showlist.NameList  = new List <string>();

            for (int i = 0; i < count; i++)
            {
                _showlist.ValueList[i] = new List <string>();
            }


            while (lpUnPack.IsEOF() != 1)
            {
                for (int j = 0; j < lpUnPack.GetColCount(); j++)
                {
                    var   colName = lpUnPack.GetColName(j);
                    sbyte colType = lpUnPack.GetColType(j);
                    if (colType != 'R')
                    {
                        var colValue = lpUnPack.GetStrByIndex(j);
                        if (flag == 0)
                        {
                            _showlist.NameList.Add(colName);
                        }
                        _showlist.ValueList[flag].Add(colValue);
                    }
                }

                lpUnPack.Next();
                flag++;
            }
            var aa = _showlist;
        }