コード例 #1
0
ファイル: frmGame.cs プロジェクト: MustafaGurses/FindCards
 public frmGame()
 {
     InitializeComponent();
     clearButton                     = new ClearButton();
     setPath                         = new SetPath();
     btn2                            = new List <Button>();
     BGWControlGame                  = new BackgroundWorker();
     BGWControlGame.DoWork          += BGWControlGame_DoWork;
     CheckForIllegalCrossThreadCalls = false;
     points                          = new List <Point>();
 }
コード例 #2
0
        public OperationResult <Set?> Load(List <ISource> filesSources)
        {
            var result = new OperationResult <Set?>(null);

            List <SetPath> setPaths = new();
            List <Entry>   entries  = new();

            foreach (ISource fileSource in filesSources)
            {
                var    setPath  = new SetPath(fileSource.Namespace, fileSource.Name);
                string contents = fileSource.GetContents().Trim();

                result.Merge(FileValidator.Validate(contents, fileSource.Name));
                if (!result.Result)
                {
                    continue;
                }

                List <string> lines = contents.Split("\n").Select(x => x.Trim()).ToList();
                List <Entry>  currentFileEntries = new();
                for (int i = 0; i < lines.Count; i++)
                {
                    string        line         = lines[i];
                    string[]      lineParts    = line.Split(';');
                    List <string> words        = lineParts[0].Split(',').Select(x => x.Trim()).ToList <string>();
                    List <string> translations = lineParts[1].Split(',').Select(x => x.Trim()).ToList <string>();
                    currentFileEntries.Add(new Entry(setPath, i + 1, words, translations));
                }
                if (currentFileEntries.Count > 0)
                {
                    setPaths.Add(setPath);
                    entries.AddRange(currentFileEntries);
                }
            }

            if (result.Result)
            {
                var set = new Set(setPaths, entries);
                result.Data = set;
            }

            return(result);
        }
コード例 #3
0
ファイル: Init.cs プロジェクト: MadsDocs/FIleWatcher
        public void _Init()
        {
            try
            {
                CreateHomeDir();
                Gatherer();

                if (!File.Exists(Classes.Statics.appdata + @"\FileWatcher\save"))
                {
                    SetPath path = new SetPath();
                    path.ShowDialog();
                }
                else
                {
                    log._wLogger("Logging aktiv... ");
                }

                if (File.Exists(Classes.Statics.appdata + @"\FileWatcher\config\App.config"))
                {
                    //Read the Settings
                    string toggleentries = FIleOperations.getAppSettings("showentries");
                    if (toggleentries == "true")
                    {
                        is_entriesenabled = true;
                    }
                    else
                    {
                        is_entriesenabled = false;
                    }

                    string togglestats = FIleOperations.getAppSettings("showstats");
                    if (togglestats == "True")
                    {
                        is_statsenabled = true;
                    }
                    else
                    {
                        is_statsenabled = false;
                    }
                }
                else if (File.Exists(@"D:\FileWatcher_BITBUCKET\FileWatcher\App.config"))
                {
                    //Read the Settings
                    string toggleentries = FIleOperations.getAppSettings("showentries");
                    if (toggleentries == "True")
                    {
                        is_entriesenabled = true;
                    }
                    else
                    {
                        is_entriesenabled = false;
                    }

                    string togglestats = FIleOperations.getAppSettings("showstats");
                    if (togglestats == "True")
                    {
                        is_statsenabled = true;
                    }
                    else
                    {
                        is_statsenabled = false;
                    }
                }
                else
                {
                    is_entriesenabled = true;
                    is_statsenabled   = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message);
            }
        }
コード例 #4
0
ファイル: Upload.xaml.cs プロジェクト: CalvertYang/WFTP
        private void lvwToUplpad_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            SetPath sp = new SetPath(400,200);
            string target_path = "";
            string target_real_path = "";
            if (lvwToUplpad.SelectedItems.Count > 0)
            {
                sp.ShowDialog();
                target_path = sp.Path;
                target_real_path = sp.RealPath;

                if (!String.IsNullOrEmpty(target_path))
                {
                    foreach (FileItem i in lvwToUplpad.SelectedItems)
                    {
                        i.TargetPath = target_path;
                        i.TargetRealPath = target_real_path;
                    }
                }
            }
        }
コード例 #5
0
ファイル: Upload.xaml.cs プロジェクト: CalvertYang/WFTP
        private void lvwToUplpad_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lvwToUplpad.SelectedItems.Count > 0)
            {
                SetPath sp = new SetPath(400, 500);
                string target_path = "";
                string target_real_path = "";
                sp.ShowDialog();
                target_path = sp.Path;
                target_real_path = sp.RealPath;
                if (!String.IsNullOrEmpty(target_path))
                {
                    int pathLevel = target_path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Count();
                    if (pathLevel == 5)
                    {
                        foreach (FileItem item in lvwToUplpad.SelectedItems)
                        {
                            item.TargetPath = target_path;
                            item.TargetRealPath = target_real_path;
                        }

                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
コード例 #6
0
ファイル: Upload.xaml.cs プロジェクト: CalvertYang/WFTP
        private void btnUp_Click(object sender, RoutedEventArgs e)
        {
            if (lvwTempList.SelectedItems.Count > 0)
            {
                SetPath sp = new SetPath(400, 500);
                string target_path = "";
                string target_real_path = "";
                sp.ShowDialog();
                target_path = sp.Path;
                target_real_path = sp.RealPath;

                if (!String.IsNullOrEmpty(target_path))
                {
                    int pathLevel = target_path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Count();
                    if (pathLevel == 5)
                    {
                        List<FileInfo> removeItems = new List<FileInfo>();
                        foreach (FileInfo i in lvwTempList.SelectedItems)
                        {
                            _dataTo.Add(new FileItem() { File = i, TargetPath = target_path, TargetRealPath = target_real_path, IsReplace = true });
                            removeItems.Add(i);
                        }

                        foreach (FileInfo f in removeItems)
                        {
                            _dataTmp.Remove(f);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
コード例 #7
0
 public void AskInputPath(string text)
 {
     Console.WriteLine(text);
     SetPath?.Invoke(this, new EventArgs());
 }