public void SafingService_SafeFile_IsTrue() { //arrange var XML = new XMLSerialization(); var safe = new SafingService(); var mdi = new MetadataItem(); var adding = new AddingClass(); var file = new FileMove(); var Benutzer = "Adrian"; var Bezeichnung = "Test"; var Stichwoerter = "Test2"; DateTime Erfassungsdatum = DateTime.Now; var filepath = @"C:\Users\addik\Desktop\test1\testen.docx"; var IsRemoveEnabled = false; var SelectedTypItem = "Verträge"; DateTime?Valutadata = DateTime.Now; Guid guid = Guid.NewGuid(); //act mdi = adding.createMetadataItem(Benutzer, Bezeichnung, Stichwoerter, Erfassungsdatum, filepath, IsRemoveEnabled, SelectedTypItem, Valutadata, guid); safe.SafeFile(file, mdi); var result = File.Exists($@"{mdi.SavePath}\{mdi.XMLFileName}"); //Assert Assert.IsTrue(result); }
public void CopyFile_IfIsRemoveFileEnabledTrue_IsTrue() { MetadataItem mdi = new MetadataItem(); mdi._benutzer = "Adrian"; mdi._bezeichnung = "hh"; mdi._erfassungsdatum = DateTime.Now; mdi._filePath = @"C:\Users\addik\Desktop\test1\testenmitdel.docx"; mdi._valutaDatum = DateTime.Now; mdi.SavePath = @"C:\Users\addik\Desktop\test2"; mdi.FileName = "testenmitdel.docx"; mdi.XMLFileName = "Metadata.xml"; mdi._isRemoveFileEnabled = true; FileMove filemove = new FileMove(); if (File.Exists(@"C:\Users\addik\Desktop\test2\testenmitdel.docx")) { File.Delete(@"C:\Users\addik\Desktop\test2\testenmitdel.docx"); } //arrange bool happend = File.Exists(@"C:\Users\addik\Desktop\test1\testenmitdel.docx"); filemove.CopyFile(mdi); bool deleted = !File.Exists(@"C:\Users\addik\Desktop\test1\testenmitdel.docx"); //Assert Assert.True(happend && deleted); }
private void OnCmdOeffnen() { // TODO: Add your Code here ButtonAction act = new ButtonAction(); var file = new FileMove(); if (SelectedMetadataItem != null) { string path = $@"{SelectedMetadataItem.SavePath}\{SelectedMetadataItem.FileName}"; act.OpenFile(file, path); } }
private void sortSelect_button_Click(object sender, RoutedEventArgs e) //ファイル移動ボタン { int selectedIndex = files_listview.SelectedIndex; if (selectedIndex < 0) { AleartWindow aleartWindow = new AleartWindow { windowName = "Aleart", aleartDetail = "Please select arbitrary file." }; aleartWindow.ShowDialog(); return; } FileMove fileMove = new FileMove(); fileMove.maxIndex = NKernel.fileName.Count - 1; fileMove.selectedIndex = selectedIndex; fileMove.ShowDialog(); if (fileMove.trueClose) //ウィンドウが正しく閉じられた場合 { int toMoveIndex = fileMove.moveNum; if (toMoveIndex < selectedIndex) { for (int i = selectedIndex; i > toMoveIndex - 1; i--) { RenameFile(i - 1, "wav", false); RenameFile(i - 1, "txt", false); } File.Move(NKernel.observeDirectory + @"\" + NKernel.fileName[selectedIndex] + ".wav", NKernel.observeDirectory + @"\" + toMoveIndex.ToString("000") + NKernel.fileName[selectedIndex].Remove(0, 3) + ".wav"); File.Move(NKernel.observeDirectory + @"\" + NKernel.fileName[selectedIndex] + ".txt", NKernel.observeDirectory + @"\" + toMoveIndex.ToString("000") + NKernel.fileName[selectedIndex].Remove(0, 3) + ".txt"); } else if (toMoveIndex > selectedIndex) { for (int i = selectedIndex; i < toMoveIndex - 1; i++) { RenameFile(i + 1, "wav", true); RenameFile(i + 1, "txt", true); } File.Move(NKernel.observeDirectory + @"\" + NKernel.fileName[selectedIndex] + ".wav", NKernel.observeDirectory + @"\" + toMoveIndex.ToString("000") + NKernel.fileName[selectedIndex].Remove(0, 3) + ".wav"); File.Move(NKernel.observeDirectory + @"\" + NKernel.fileName[selectedIndex] + ".txt", NKernel.observeDirectory + @"\" + toMoveIndex.ToString("000") + NKernel.fileName[selectedIndex].Remove(0, 3) + ".txt"); } NKernel.fileName.Clear(); List_init(); } }
public SearchViewModel() { TypItems = ComboBoxItems.Typ; CmdSuchen = new DelegateCommand(OnCmdSuchen); CmdReset = new DelegateCommand(OnCmdReset); CmdOeffnen = new DelegateCommand(OnCmdOeffnen, OnCanCmdOeffnen); lib = new SearchingLibraries(); lib.GetAllFiles(); FilteredMetadataItems = lib.metadataItemsList; file = new FileMove(); }
public void FileMove_OpenFileWrongPath_IsFalse() { //arrange FileMove file = new FileMove(); var path = $@"C:\Users\addik\Desktop\test1\testen2.docx"; var check = false; //act file.OpenFile(path); check = file.OperationHasHappend; //Assert Assert.IsFalse(check); }
public void tStart() { Utils.SB.Append(UnityUtil.PersistentPath); Utils.SB.Append(DownloadCachePath); Utils.SB.Append("/"); Utils.SB.Append(DownloadOverFileName); string path = Utils.SB.ToString(); Utils.ClearSB(); if (!FileHelper.BeFileExist(path)) { LogMgr.I("CopyRes", "tStart", "下载中目录不存在下载完成标志,掠过资源覆盖阶段,直接进入updateComplete"); //没有下载完成标识文件,不需要复制过程, UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.updateComplete); return; } //NTODO 这里需要返回进度,另外要最后再移动resVer //有下载完成标识,准备开始移动覆盖文件 Utils.SB.Append(UnityUtil.PersistentPath); Utils.SB.Append(DownloadCachePath); string _srcPath = Utils.SB.ToString(); Utils.ClearSB(); Listener <float> progressCB = (progress) => { //发出进度事件 float progress1 = progress * 0.9f; LogMgr.I("CopyRes", "tStart", "移动文件夹进度:" + progress + " 整体copy进度:" + progress1, BeShowLog); ntools.Messenger.Broadcast <float>("updateLoadingProgress", progress1); }; Listener onComplete = () => { LogMgr.I("CopyRes", "tStart", "移动文件夹完毕", BeShowLog); ntools.Messenger.Broadcast <float>("updateLoadingProgress", 0.9f); ProcessResVer(); }; List <string> ignroeFileList = new List <string>(); ignroeFileList.Add("resVer.txt"); LogMgr.I("CopyRes", "tStart", "移动srcPath:" + _srcPath + " 到目标路径:" + UnityUtil.PersistentPath, BeShowLog); FileMove.GetIns().MoveFoldersFiles(_srcPath, UnityUtil.PersistentPath, progressCB, onComplete, ignroeFileList); }
public void InitPlayerMoves() { fileMoves[0] = new FileMove(PlayerID.PLAYER0, this); fileMoves[1] = new FileMove(PlayerID.PLAYER1, this); playerMoves[0] = Move.CreateMove(moveType0, PlayerID.PLAYER0, this); playerMoves[1] = Move.CreateMove(moveType1, PlayerID.PLAYER1, this); moves = playerMoves; if (loadFromFile) { StartReadingFromFile(); } }
private void OnCmdSpeichern() { AddingClass adden = new AddingClass(); _Guid = Guid.NewGuid(); guid = _Guid.ToString(); // TODO: Add your Code here if (adden.CheckRequiredFields(Bezeichnung, TypItems, ValutaDatum)) { MetadataItem mdi = adden.createMetadataItem(Benutzer, Bezeichnung, Stichwoerter, Erfassungsdatum, _filePath, IsRemoveFileEnabled, SelectedTypItem, ValutaDatum, _Guid); FileMove filemove = new FileMove(); SafingService safe = new SafingService(); safe.SafeFile(filemove, mdi); } _navigateBack(); }
public ucSplash() { InitializeComponent(); logs.log("*****Program Started*****"); FileMove.moveToAppData(); }
public static extern bool SetFilePointerEx( SafeFileHandle File, long DistanceToMove, IntPtr NewFilePointer = default, FileMove MoveMethod = default);