private void OnSampleLoaded(string filename) { if (OnFileLoaded != null) { OnFileLoaded.Invoke(this, filename); } }
private void FileLoaded( string title, string thumbUrl, double duration, double volumeLevel, bool isMuted) { OnFileLoaded?.Invoke(title, thumbUrl, duration, volumeLevel, isMuted); }
void WindowTick(int ID) { GUI.color = Color.red; if (GUI.Button(new Rect(285, 5, 10, 10), "")) { Open = false; } GUI.color = Color.white; bool OfferOpenAll = this.OfferOpenAll && Location != "Drives"; int Top = -20, ListHeight = (Folders.Length + Files.Count + (OfferOpenAll ? 2 : 0) + (TreeTop ? 0 : 2) + (Files.Count > 0 ? 1 : 0)) * 20, ButtonWidth = ListHeight > 375 ? 272 : 290; TextAnchor OldAlign = GUI.skin.button.alignment; GUI.skin.button.alignment = TextAnchor.MiddleLeft; PickerScroll = GUI.BeginScrollView(new Rect(5, 20, 290, 375), PickerScroll, new Rect(0, 0, ButtonWidth, ListHeight)); if (!TreeTop && GUI.Button(new Rect(0, Top += 20, ButtonWidth, 20), "Top")) { CacheFolder("\\"); } if (!TreeTop && GUI.Button(new Rect(0, Top += 20, ButtonWidth, 20), "Up")) { CacheFolder(Location.Length == 3 ? "\\" : Directory.GetParent(FullLocation).FullName); } for (int i = 0; i < Folders.Length; i++) { if (GUI.Button(new Rect(0, Top += 20, ButtonWidth, 20), Folders[i].Name)) { CacheFolder(Folders[i].FullName); } } if (OfferOpenAll && GUI.Button(new Rect(0, Top += 40, ButtonWidth, 20), "Open all files")) { IEnumerator <FileInfo> Enumerator = Files.GetEnumerator(); while (Enumerator.MoveNext()) { OnFileLoaded?.Invoke(Enumerator.Current); } Open = false; } Top += 20; IEnumerator <FileInfo> Enumer = Files.GetEnumerator(); while (Enumer.MoveNext()) { FileInfo CurFile = Enumer.Current; if (GUI.Button(new Rect(0, Top += 20, ButtonWidth, 20), CurFile.Name)) { OnFileLoaded?.Invoke(CurFile); Open = false; } } GUI.skin.button.alignment = OldAlign; GUI.EndScrollView(); GUI.DragWindow(); }
private Synchronization LoadUnTreatedFiles(Synchronization currentSynchronization) { int folderTreated = 0; foreach (FolderToWatch folderPath in AutoRenamerConfig.Instance.FoldersToWatch) { folderTreated++; if (!Directory.Exists(folderPath.Source)) { log.Error($"The watched source directory '{folderPath.Source}' does not exist"); continue; } if (!Directory.Exists(folderPath.Source)) { log.Error($"The destination directory '{folderPath.Destination}' does not exist"); continue; } log.Debug($"Listing the files from '{folderPath.Source}'"); var files = Directory.GetFiles(folderPath.Source, "*", folderPath.IncludeSubdirectories? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); OnFolderLoading?.Invoke(this, new FolderLoadingEventArgs(folderPath.Source, AutoRenamerConfig.Instance.FoldersToWatch.Count, folderTreated, files.Length)); foreach (var file in files) { var entry = currentSynchronization.StatusList.FirstOrDefault(status => status.SourceFile == file); if (entry == null) { currentSynchronization.StatusList.Add(new StatusDetail() { SourceFile = file, Status = StatusEnum.NotSynched, DestinationFolder = folderPath.Destination, ReChecked = true }); } else { entry.ReChecked = true; } OnFileLoaded?.Invoke(this, new FileLoadedEventArgs(file)); } OnFolderLoaded?.Invoke(this, new FolderLoadedEventArgs(folderPath.Source, AutoRenamerConfig.Instance.FoldersToWatch.Count, folderTreated)); } //Mark all the files who haven't been recheck as SourceFileStillExist = false because we didn't have found it foreach (var statusDetail in currentSynchronization.StatusList) { statusDetail.SourceFileStillExist = statusDetail.ReChecked; } return(currentSynchronization); }
public void Run(string srcFilePath, string dstFilePath) { XDocument src = XDocument.Load(srcFilePath); OnFileLoaded?.Invoke(src.Root.Descendants().Count()); XDocument dst = Run(src); var xamlString = dst.ToString().ToXamlString(); File.WriteAllText(dstFilePath, xamlString); OnCompleted?.Invoke(); }
/// <summary> /// /// </summary> private void LoadFile() { var path = Path.Combine(Path.GetDirectoryName(MainForm.Instance.FilePath), FileName); if (!System.IO.File.Exists(path)) { path = FileIO.OpenFile(ApplicationSettings.HSDFileFilter, FileName); } if (path != null) { var file = new HSDRawFile(path); if (file.Roots.Find(s => Symbols.Contains(s.Name)) != null) { File = file; FilePath = path; LoadedLabel.Image = Properties.Resources.ts_check; ImportButton.Visible = false; OnFileLoaded.Invoke(this, null); } } }
public static SaveFile Load() { if (File.Exists(filePath)) { string dataFromJson = File.ReadAllText(filePath); try { saveFile = JsonUtility.FromJson <SaveFile>(dataFromJson); } catch { Debug.Log("File could not be loaded!"); } } else { Debug.Log("No file to load!"); } OnFileLoaded?.Invoke(saveFile); return(saveFile); }