private static void OutputTreeView(TreeView TreeviewNode, IEnumerable <string> UniqueFilesPath, char PathSeparator) { TreeNode LastNode = null; foreach (string PathToFile in UniqueFilesPath) { string SubPathAgg = string.Empty; foreach (string SubPath in PathToFile.Split(PathSeparator)) { SubPathAgg += SubPath + PathSeparator; TreeNode[] Nodes = TreeviewNode.Nodes.Find(SubPathAgg, true); if (Nodes.Length == 0) { if (LastNode == null) { TreeviewNode.Invoke(new Action(() => LastNode = TreeviewNode.Nodes.Add(SubPathAgg, SubPath)));; } else { TreeviewNode.Invoke(new Action(() => LastNode = LastNode.Nodes.Add(SubPathAgg, SubPath))); } } else { LastNode = Nodes[0]; } } } }
private void UpdateFieldsFromObject() { Name.Text = selectedItem.Name; PathToFile.SetValue(selectedItem.PathToFile); MobileTemplate.SetValue(selectedItem.MobileTemplate); Layout.Text = selectedItem.Layout; UseLayout.Checked = selectedItem.UseLayout; }
private void UpdateObjectFromFields() { selectedItem.Name = Name.Text; selectedItem.PathToFile = PathToFile.GetValue().ToString(); selectedItem.MobileTemplate = MobileTemplate.GetValue().ToString(); selectedItem.Layout = Layout.Text; selectedItem.UseLayout = UseLayout.Checked; }
internal ShapeFromTextureProperties( ) { PathToFile = new PathToFile { AbsolutePath = @"c:\" }; AlphaTolerance = 20; HullTolerance = 1.5f; }
public static void StartMenu(HotSpotPanel panel, PathToFile filePath, IEnumerable <HotSpotReports> repList) { Console.Title = "Where WiFi?"; Console.CursorVisible = false; while (true) { ShowMenu(); PickOption(); RunOption(panel, filePath, repList); } }
public InfoLog(string path) { if (path.Contains(".txt")) { var stop = path.LastIndexOf('\\'); PathToDirectory = path.Remove(stop, path.Remove(0, stop).Length); PathToFile = path.Remove(0, stop + 1); } else { PathToFile = $@"\ErrorLogServer.txt"; PathToFile = PathToFile.Remove(0, 1); } }
private bool IsPathValid() { if (String.IsNullOrWhiteSpace(PathToFile)) { MessageChanged?.Invoke("Enter a path to a texture file or .zip file."); return(false); } if (File.Exists(PathToFile) == false) { MessageChanged?.Invoke("File does not exist"); return(false); } if (PathToFile.EndsWith(".zip") == false && PathToFile.EndsWith(".uasset") == false) { MessageChanged?.Invoke("The selected file is invalid. You must choose a .zip or .uasset file."); return(false); } return(true); }
static void Main(string[] args) { PathToFile filePath = new PathToFile(); var fileWifiGdansk = File.ReadAllLines(filePath.FullFilePath); var fileReportFeb = File.ReadAllLines(filePath.TransferReportFeb); var fileReportMarch = File.ReadAllLines(filePath.TransferReportMarch); HotSpotPanel wifi = new HotSpotPanel(); wifi.OrganizeData(fileWifiGdansk); HotSpotReports feb = new HotSpotReports(); feb.OrganizeReports(fileReportFeb); HotSpotReports march = new HotSpotReports(); march.OrganizeReports(fileReportMarch); var res = feb.MergingTwoLists(feb.listOfReports, march.listOfReports); var lowestHotSpotsUserNumber = res.OrderBy(r => r.CurrentHotSpotUsers); StartMenu(wifi, filePath, lowestHotSpotsUserNumber); Console.ReadLine(); }
private static void RunOption(HotSpotPanel panel, PathToFile filePath, IEnumerable <HotSpotReports> repList) { switch (_activeMenuPosition) { case 0: Console.Clear(); InProgress("NNAJBLIŻSZY HOTSPOT"); break; case 1: Console.Clear(); InProgress("DODAJ HOTSPOT"); try { panel.AddNewHotSpot(filePath.FullFilePath); } catch (Exception m) { Console.WriteLine(m.StackTrace); } break; case 2: Console.Clear(); InProgress("LISTA HOTSPOTÓW"); Console.WriteLine(); panel.ShowAllLocalizations(); break; case 3: Console.Clear(); InProgress("NAJMNIEJ POŁĄCZEŃ"); Console.WriteLine("Podaj liczbę interesujących Cię wyników"); var shortedList = repList.Take(int.Parse(Console.ReadLine())); foreach (var r in shortedList) { Console.WriteLine($"ID: {r.Id}, Miejsce: {r.LocationName}, Średnia dzienna liczba użytkowników to: {r.CurrentHotSpotUsers}", CultureInfo.CurrentUICulture.TextInfo); } Console.ReadKey(); break; case 4: Console.Clear(); InProgress("PODEJRZANIE DUŻE TRANSFERY"); var exitSubMenu = false; do { _activeMenuPosition = 0; ShowMenuOverloadTransfer(); exitSubMenu = PickOptionOverload(); RunOptionOverload(); } while (!exitSubMenu); _activeMenuPosition = 0; break; case 5: Console.Clear(); InProgress("Edycja Twoich punktów HOTSPOT"); panel.EditAddedHotspots(); break; case 6: Console.Clear(); Environment.Exit(0); break; } }
private List <string> GetFiles(string path, string pattern) { var prev = 0; var files = new List <string>(); char PathSeparator = '\\'; try { files.AddRange(Directory.GetFiles(path, pattern, SearchOption.TopDirectoryOnly)); filesFound += files.Count; foreach (var directory in Directory.GetDirectories(path)) { _manualEvent.WaitOne(); files.AddRange(GetFiles(directory, pattern)); Action b = () => textBox4.Text = filesFound.ToString(); if (InvokeRequired) { Invoke(b); } else { b(); } Action c = () => textBox3.Text = directory.ToString(); if (InvokeRequired) { Invoke(c); } if (files.Count > 0) { TreeNode LastNode = null; foreach (string PathToFile in files) { string SubPathAgg = string.Empty; foreach (string SubPath in PathToFile.Split(PathSeparator)) { SubPathAgg += SubPath + PathSeparator; TreeNode[] Nodes = treeView1.Nodes.Find(SubPathAgg, true); if (Nodes.Length == 0) { if (LastNode == null) { Action action = () => LastNode = treeView1.Nodes.Add(SubPathAgg, SubPath); if (InvokeRequired) { Invoke(action); } else { action(); } } else { Action action = () => LastNode = LastNode.Nodes.Add(SubPathAgg, SubPath); if (InvokeRequired) { Invoke(action); } else { action(); } } } else { LastNode = Nodes[0]; } } } } } } catch (UnauthorizedAccessException) { } return(files); }