diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49f18f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,303 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git "a/V\303\251letlenV\303\241laszt\303\263.sln" "b/V\303\251letlenV\303\241laszt\303\263.sln" new file mode 100644 index 0000000..234d7d8 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263.sln" @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VéletlenVálasztó", "VéletlenVálasztó\VéletlenVálasztó.csproj", "{328586CB-1298-422E-B103-B88DE056E192}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {328586CB-1298-422E-B103-B88DE056E192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {328586CB-1298-422E-B103-B88DE056E192}.Debug|Any CPU.Build.0 = Debug|Any CPU + {328586CB-1298-422E-B103-B88DE056E192}.Release|Any CPU.ActiveCfg = Release|Any CPU + {328586CB-1298-422E-B103-B88DE056E192}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E864AFAE-FAF4-4081-AFC6-40AD065DB649} + EndGlobalSection +EndGlobal diff --git "a/V\303\251letlenV\303\241laszt\303\263/App.config" "b/V\303\251letlenV\303\241laszt\303\263/App.config" new file mode 100644 index 0000000..8e15646 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/App.config" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/V\303\251letlenV\303\241laszt\303\263/Form1.Designer.cs" "b/V\303\251letlenV\303\241laszt\303\263/Form1.Designer.cs" new file mode 100644 index 0000000..876e04b --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Form1.Designer.cs" @@ -0,0 +1,231 @@ +namespace VéletlenVálasztó +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.megnyitásToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mentésToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.label1 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(384, 32); + this.button1.Margin = new System.Windows.Forms.Padding(5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(157, 36); + this.button1.TabIndex = 0; + this.button1.Text = "Hozzáadás"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1.Location = new System.Drawing.Point(4, 36); + this.textBox1.Margin = new System.Windows.Forms.Padding(5); + this.textBox1.MaxLength = 100; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(375, 30); + this.textBox1.TabIndex = 1; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.HorizontalScrollbar = true; + this.listBox1.ItemHeight = 25; + this.listBox1.Location = new System.Drawing.Point(4, 76); + this.listBox1.Margin = new System.Windows.Forms.Padding(5); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(537, 129); + this.listBox1.TabIndex = 2; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(4, 215); + this.button2.Margin = new System.Windows.Forms.Padding(5); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(264, 36); + this.button2.TabIndex = 3; + this.button2.Text = "Elem eltávolítása"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(277, 215); + this.button3.Margin = new System.Windows.Forms.Padding(5); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(264, 36); + this.button3.TabIndex = 5; + this.button3.Text = "Lista kiürítése"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(4, 260); + this.button4.Margin = new System.Windows.Forms.Padding(4); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(479, 36); + this.button4.TabIndex = 6; + this.button4.Text = "Választás"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(4, 0); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.MaximumSize = new System.Drawing.Size(537, 100); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(0, 25); + this.label2.TabIndex = 1; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.flowLayoutPanel1.Controls.Add(this.label2); + this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 304); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel1.MaximumSize = new System.Drawing.Size(537, 500); + this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(537, 29); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(537, 29); + this.flowLayoutPanel1.TabIndex = 7; + // + // menuStrip1 + // + this.menuStrip1.Font = new System.Drawing.Font("Segoe UI", 10F); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.megnyitásToolStripMenuItem, + this.mentésToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); + this.menuStrip1.Size = new System.Drawing.Size(543, 31); + this.menuStrip1.TabIndex = 8; + this.menuStrip1.Text = "menuStrip1"; + // + // megnyitásToolStripMenuItem + // + this.megnyitásToolStripMenuItem.Name = "megnyitásToolStripMenuItem"; + this.megnyitásToolStripMenuItem.Size = new System.Drawing.Size(100, 27); + this.megnyitásToolStripMenuItem.Text = "Megnyitás"; + this.megnyitásToolStripMenuItem.Click += new System.EventHandler(this.megnyitásToolStripMenuItem_Click); + // + // mentésToolStripMenuItem + // + this.mentésToolStripMenuItem.Name = "mentésToolStripMenuItem"; + this.mentésToolStripMenuItem.Size = new System.Drawing.Size(78, 27); + this.mentésToolStripMenuItem.Text = "Mentés"; + this.mentésToolStripMenuItem.Click += new System.EventHandler(this.mentésToolStripMenuItem_Click); + // + // label1 + // + this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.label1.Location = new System.Drawing.Point(489, 262); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 36); + this.label1.TabIndex = 11; + this.label1.Text = "0"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Form1 + // + this.AcceptButton = this.button4; + this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ClientSize = new System.Drawing.Size(543, 336); + this.Controls.Add(this.label1); + this.Controls.Add(this.flowLayoutPanel1); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.menuStrip1); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(5); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(565, 500); + this.MinimumSize = new System.Drawing.Size(565, 370); + this.Name = "Form1"; + this.ShowIcon = false; + this.Text = "Véletlen választó program"; + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem megnyitásToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mentésToolStripMenuItem; + private System.Windows.Forms.Label label1; + } +} + diff --git "a/V\303\251letlenV\303\241laszt\303\263/Form1.cs" "b/V\303\251letlenV\303\241laszt\303\263/Form1.cs" new file mode 100644 index 0000000..853c75f --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Form1.cs" @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; +using System.Diagnostics; + +namespace VéletlenVálasztó +{ + public partial class Form1 : Form + { + String újElem; + Random véletlen; + Int32 elemIndex; + Int32 választásokSzáma; + + OpenFileDialog megnyitás; + Int32 fájlAzonosító; + String fájlNév; + String fájlÚtvonal; + Int32 fájlokSzáma; + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + újElem = textBox1.Text; + this.Text = "Véletlen választó program"; + button4.Text = "Választás"; + választásokSzáma = 0; + label1.Text = "0"; + label2.Text = ""; + + if (textBox1.Text != "") + { + listBox1.Items.Add(újElem); + textBox1.Text = ""; + } + else + { + MessageBox.Show("Írja be a hozzáadni kívánt elemet a szövegdobozba!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void button2_Click(object sender, EventArgs e) + { + if (listBox1.SelectedIndex != -1 && listBox1.Items.Count != 0) + { + this.Text = "Véletlen választó program"; + listBox1.Items.RemoveAt(listBox1.SelectedIndex); + button4.Text = "Választás"; + választásokSzáma = 0; + label1.Text = "0"; + label2.Text = ""; + } + else if (listBox1.SelectedIndex == -1) + { + MessageBox.Show("Jelölje meg az eltávolítani kívánt elemet!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else if (listBox1.Items.Count == 0) + { + MessageBox.Show("Adjon hozzá elemeket a listához!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void button3_Click(object sender, EventArgs e) + { + if (listBox1.Items.Count != 0) + { + this.Text = "Véletlen választó program"; + listBox1.Items.Clear(); + button4.Enabled = true; + button4.Text = "Választás"; + választásokSzáma = 0; + label1.Text = "0"; + label2.Text = ""; + } + else + { + MessageBox.Show("Adjon hozzá elemeket a listához!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void button4_Click(object sender, EventArgs e) + { + if (listBox1.Items.Count > 1) + { + véletlen = new Random(); + elemIndex = véletlen.Next(listBox1.Items.Count); + + if (választásokSzáma < 999) + { + választásokSzáma += 1; + label1.Text = Convert.ToString(választásokSzáma); + } + else + { + választásokSzáma = 999; + label1.Text = "999"; + button4.Enabled = false; + } + + label2.Visible = true; + label2.Text = listBox1.Items[elemIndex].ToString(); + button4.Text = "Választás újra"; + } + else if (listBox1.Items.Count == 0) + { + MessageBox.Show("Adjon hozzá elemeket a listához!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else if (listBox1.Items.Count == 1) + { + MessageBox.Show("Adjon hozzá több elemet a listához!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void megnyitásToolStripMenuItem_Click(object sender, EventArgs e) + { + this.listBox1.Items.Clear(); + megnyitás = new OpenFileDialog(); + megnyitás.Filter = "Szöveges dokumentum|*.txt"; + megnyitás.Title = "Lista megnyitása"; + + try + { + megnyitás.ShowDialog(); + StreamReader Import = new StreamReader(megnyitás.FileName.ToString(), Encoding.Default); + + while (Import.Peek() >= 0) + { + listBox1.Items.Add(Convert.ToString(Import.ReadLine())); + } + + this.Text = "Véletlen választó program - Megnyitott fájl: " + megnyitás.SafeFileName; + button4.Text = "Választás"; + választásokSzáma = 0; + label1.Text = "0"; + label2.Text = ""; + } + catch (Exception kivétel) + { + MessageBox.Show(kivétel.Message, "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void mentésToolStripMenuItem_Click(object sender, EventArgs e) + { + fájlÚtvonal = @Application.StartupPath + "\\listák\\"; + Directory.CreateDirectory(Path.GetDirectoryName(fájlÚtvonal)); + fájlokSzáma = Directory.GetFiles(fájlÚtvonal, "*.txt", SearchOption.AllDirectories).Count(); + fájlAzonosító = fájlokSzáma + 1; + fájlNév = "lista" + fájlAzonosító + ".txt"; + + if (listBox1.Items.Count >= 1) + { + try + { + using (TextWriter szövegÍró = new StreamWriter(fájlÚtvonal + fájlNév)) + { + foreach (string újElem in listBox1.Items) + { + szövegÍró.WriteLine(újElem); + } + + MessageBox.Show("A fájl mentése sikeres volt.", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("A fájl útvonala: " + Path.GetFullPath(fájlÚtvonal + fájlNév), + "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + catch (Exception kivétel) + { + MessageBox.Show(Convert.ToString(kivétel), "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + else + { + MessageBox.Show("Adjon hozzá elemeket a listához!", "Véletlen választó program", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + } +} + diff --git "a/V\303\251letlenV\303\241laszt\303\263/Form1.resx" "b/V\303\251letlenV\303\241laszt\303\263/Form1.resx" new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Form1.resx" @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git "a/V\303\251letlenV\303\241laszt\303\263/Program.cs" "b/V\303\251letlenV\303\241laszt\303\263/Program.cs" new file mode 100644 index 0000000..9f6773d --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Program.cs" @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace VéletlenVálasztó +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git "a/V\303\251letlenV\303\241laszt\303\263/Properties/AssemblyInfo.cs" "b/V\303\251letlenV\303\241laszt\303\263/Properties/AssemblyInfo.cs" new file mode 100644 index 0000000..59e34be --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Properties/AssemblyInfo.cs" @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VéletlenVálasztó")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VéletlenVálasztó")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("90889d8a-e034-4d11-bce2-ce89d8d6563b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git "a/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.Designer.cs" "b/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.Designer.cs" new file mode 100644 index 0000000..aec7dd1 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.Designer.cs" @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace VéletlenVálasztó.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Veletlenvalaszto.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git "a/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.resx" "b/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.resx" new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Properties/Resources.resx" @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git "a/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.Designer.cs" "b/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.Designer.cs" new file mode 100644 index 0000000..22cd734 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.Designer.cs" @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace VéletlenVálasztó.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git "a/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.settings" "b/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.settings" new file mode 100644 index 0000000..3964565 --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/Properties/Settings.settings" @@ -0,0 +1,7 @@ + + + + + + + diff --git "a/V\303\251letlenV\303\241laszt\303\263/V\303\251letlenV\303\241laszt\303\263.csproj" "b/V\303\251letlenV\303\241laszt\303\263/V\303\251letlenV\303\241laszt\303\263.csproj" new file mode 100644 index 0000000..54fb37a --- /dev/null +++ "b/V\303\251letlenV\303\241laszt\303\263/V\303\251letlenV\303\241laszt\303\263.csproj" @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {328586CB-1298-422E-B103-B88DE056E192} + WinExe + Properties + Veletlenvalaszto + Veletlen-valaszto + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file