예제 #1
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     if (FileList != null)
     {
         FileList.Clear();
     }
 }
예제 #2
0
 private void Button_Clear_Clicked(object sender, RoutedEventArgs e)
 {
     FileList.Clear();
     FileListTemp.Clear();
     treeview_nodes.Clear();
     treeview.ItemSources = null;
 }
예제 #3
0
        public async Task PrepareFileList()
        {
            if (FileListLoaded)
            {
                return;
            }
            List <File> list = Model.GetFileList(CourseId);

            FileList.Clear();
            foreach (File file in list)
            {
                FileList.Add(new FileVM(file));
            }

            string id = CourseId;

            if (await Model.RefFileList(CourseId) == MainModel.UpdateResult.Success)
            {
                if (id == CourseId)
                {
                    FileList.Clear();
                    foreach (File file in list)
                    {
                        FileList.Add(new FileVM(file));
                    }
                }
            }
            FileListLoaded = true;
            RaisePropertyChanged("FileList");
        }
예제 #4
0
        private void Crawl()
        {   //pick relevant files to display
            //if properly set
            if (this.selectedFilePath.Length > rootFileLength && this.selectedFilePath.Substring(this.selectedFilePath.Length - rootFileLength) == "database.xml")
            {
                List <string> result = new List <string>();

                //crawl through "StreamingAssets/", get all file paths (caveat, does not return files in root folder)
                DirCrawl(this.selectedFilePath.Substring(0, this.selectedFilePath.Length - rootFileLength), result);

                /* operating assumption: root database.xml is list of DB.xml files to compile to RAM during game start
                 * therefore, relevant default xmls are those included there, and relevant non-default xmls must be
                 * added there. Same applies to eventModules.xml and terrains.xml. I'm going to assume alternativeDatabase
                 * is for temporary EA compatibility and ignore it (to my peril).
                 *
                 * terrains points to filenames in "Terrain Sources/", eventModules contains actual paths to event files
                 * (eg. "Modules/Death.xml") along with some XDEBUGs pulled from IDK where. database.xml has DATA nodes
                 * with 'name' tags of files in "DataBase/", and PROTOTYPE nodes with "name" tags in "DataBase/(Prototype/)".
                 * I'm going to assume we're only modding actual xmls, and ignore protos for now
                 */

                FileList.Clear();
                foreach (string x in result)
                {                                                                             //actually, dir list, but W/E
                    FileList.Add(x.Remove(0, this.selectedFilePath.Length - rootFileLength)); //add paths truncated to root
                }
            }
            else
            {
                MessageBox.Show("Please select database.xml");
            }
        }
예제 #5
0
        /// <summary>
        /// Loads .cache files from given mods and dlc folder
        /// </summary>
        /// <param name="mods"></param>
        /// <param name="dlc"></param>
        public override void LoadModsArchives(string mods, string dlc)
        {
            // this is slow
            Archives.Clear();
            Items.Clear();
            FileList.Clear();

            if (!Directory.Exists(mods))
                Directory.CreateDirectory(mods);
            var modsdirs = new List<string>(Directory.GetDirectories(mods));
            modsdirs.Sort(new AlphanumComparator<string>());
            var modbundles = modsdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Texture)).ToList();
            foreach (var file in modbundles)
            {
                LoadModArchive(file);
            }

            if (Directory.Exists(dlc))
            {
                var dlcdirs = new List<string>(Directory.GetDirectories(dlc));
                dlcdirs.Sort(new AlphanumComparator<string>());

                var tmp = dlcdirs.Where(_ => !VanillaDlClist.Contains(new DirectoryInfo(_).Name)).ToList();
                foreach (var file in tmp
                    .SelectMany(dir => Directory.GetFiles(dir ?? "", "*.cache", SearchOption.AllDirectories)
                        .OrderBy(k => k)
                        .Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Texture)))
                {
                    LoadModArchive(file);
                }
            }
            RebuildRootNode();
        }
예제 #6
0
    /// <summary>
    /// 读取服务端更新日志记录
    /// </summary>
    /// <param name="logUrl"></param>
    public void ReadUpdateLog(string logUrl)
    {
        try
        {
            System.Net.WebClient wc = new System.Net.WebClient();
            wc.Encoding = Encoding.UTF8;
            string      xmlStr = wc.DownloadString(logUrl);
            XmlDocument xml    = new XmlDocument();
            xml.LoadXml(xmlStr.Trim());
            XmlNode items = xml.SelectSingleNode("Items");//查找
            if (items != null)
            {
                this.StartFile     = items.Attributes["StartFile"].Value;
                this.Version       = items.Attributes["Version"].Value;
                this.Description   = items.Attributes["Description"].Value;
                this.UpdateTime    = DateTime.Parse(items.Attributes["UpdateTime"].Value);
                this.VersionNumber = ParseVersionNumber(this.Version);

                JadeFile jf;
                FileList.Clear();
                foreach (XmlNode item in items.ChildNodes)
                {
                    jf = new JadeFile {
                        FileName = item.Attributes["FileName"].Value, Url = item.Attributes["Url"].Value
                    };
                    FileList.Add(jf);
                }
            }
        }
        catch (Exception ex)
        {
            Comm.AddLog("读取版本信息", ex);
        }
    }
예제 #7
0
        internal async Task <bool> OpenFolder()
        {
            folder = await StorageService.RequestFolderAsync(new StorageDialogSettings());

            if (folder != null)
            {
                var items = (await folder.GetItemsAsync()).ToArray();
                FileList.Clear();
                FileList.AddRange(items.OfType <IStorageFile>()
                                  .Where(i => i.FileType == ".cco")
                                  .Select(f => f.GetNameWithoutExtension())
                                  .ToArray());
                if (await folder.ContainsItemAsync("Microcode.mco"))
                {
                    var mFile = await folder.GetFileAsync("Microcode.mco");

                    Configuration.MicrocodeFile = await mFile.ReadTextAsync();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #8
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (DestinationLocation != null)
                    {
                        DestinationLocation.Clear();
                    }
                    if (SourceLocation != null)
                    {
                        SourceLocation.Clear();
                    }
                    FileList.Clear();
                    FileList = null;
                    ArchiveMemoryStream.Dispose();
                    if (File.Exists(WorkingArchive))
                    {
                        File.Delete(WorkingArchive);
                    }
                }

                disposedValue = true;
            }
        }
예제 #9
0
 private void ClearFileListExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     if (MessageBox.Show("Remove all files?", Title, MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No) == MessageBoxResult.Yes)
     {
         FileList.Clear();
     }
 }
예제 #10
0
 private void Button_Clear_Clicked(object sender, RoutedEventArgs e)
 {
     FileList.Clear();
     FileListTemp.Clear();
     ID3v1_TagList.Clear();
     ID3v2_TagList.Clear();
     LastPath = "";
 }
예제 #11
0
 private void ClearFileList()
 {
     if (FileList != null)
     {
         FileList.Clear();
     }
     Count = 0;
 }
예제 #12
0
        private void UpdateData()
        {
            FilePath = this.model.FilePath;

            FileList.Clear();
            FileList.AddRange(this.model.FileList);

            SelectedFile = FileList.FirstOrDefault();
        }
예제 #13
0
        //Обработчик нажатия на кнопку [Обработать]
        private void Proceed_Click(object sender, RoutedEventArgs e)
        {
            //Если не выбран ни один файл, показываем сообщение и выходим из процедуры
            if (_files.Count == 0)
            {
                MessageBox.Show("No files have been selected", "Warning", MessageBoxButton.OK,
                                MessageBoxImage.Exclamation);
                return;
            }

            Proceed.IsEnabled = false;
            //Если не вышли на предыдущем шаге, то заполняем данные из полей на форме для формирования заголовка
            var headerData = new HeaderData
            {
                ClientField       = Client.Text,
                DateField         = Date.Text,
                DdEngineerField   = DdEngineer.Text,
                FieldPadWellField = FieldPadWell.Text,
                LocationField     = Location.Text
            };

            //Экземпляр класса Client запускает всю логику приложения, дальнейшая работа проходит в нём, можно смело открывать
            //файл Client.cs

            var client = new Client {
                Header = headerData, SessionStartTime = ApplicationPropetries.GetApplicationSessionStratTime()
            };

            foreach (var file in _files)
            {
                client.Run(file);
            }

            var files = Directory.GetFiles($@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\work", "*.xlsx");

            if (files.Length != 0)
            {
                XlsxCombiner.SessionStartTime = ApplicationPropetries.GetApplicationSessionStratTime();
                XlsxCombiner.CombineXlsxFilesFromWorkDir(files);
                MessageBox.Show("Task completed", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                XlsxTotalFishingDiagramOpener.ShowTotalDiagram(XlsxCombiner.CombinedFile);
            }
            else
            {
                MessageBox.Show("Finished. No files were processed", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }

            Proceed.IsEnabled = true;
            FileList.Clear();
            _files.Clear();

            foreach (var file in files)
            {
                File.Delete(file);
            }
        }
예제 #14
0
        protected virtual void refreshFileList()
        {
            FileList.Clear();
            foreach (var item in _directoryInformation.GetFiles())
            {
                
                FileList.Add(item.Name);

            }
        }
예제 #15
0
 /// <summary>
 /// 获取指定目录下的所有文件
 /// </summary>
 public List <FileInfo> GetAllFileInfos()
 {
     if (string.IsNullOrEmpty(Path))
     {
         return(null);
     }
     //清空原有的数据
     FileList.Clear();
     _Getallfiles(Path);
     return(FileList.Count == 0 ? null : FileList);
 }
예제 #16
0
        /**
         * Initialize the photo viewer page
         */
        internal async Task InitViewerAsync()
        {
            FileList.Clear();

            IReadOnlyList <StorageFile> files = await KnownFolders.SavedPictures.GetFilesAsync();

            foreach (StorageFile file in files)
            {
                PhotoFile newPhotoFile = await PhotoFile.GeneratePhotoFile(file);

                FileList.Add(newPhotoFile);
            }
        }
예제 #17
0
 private void FileListUpdate(object sender)
 {
     FileList.Clear();
     try
     {
         foreach (FileInfo f in ((Models.Directory)sender).DirectoryInfo.GetFiles())
         {
             FileList.Add(new FileListItem(f));
         }
     }
     catch
     {
     }
 }
예제 #18
0
        /// <summary>
        /// 清空播放列表
        /// </summary>
        public void ClearPlayList()
        {
            FileList.Clear();//首先从内存中清除

            //删除本地保存的文件
            if (File.Exists("newList.obj"))
            {
                File.Delete("newList.obj");
            }
            if (File.Exists("playIndex.obj"))
            {
                File.Delete("playIndex.obj");
            }
        }
예제 #19
0
        protected override async Task GetFileListByUUID(string uuid)
        {
            {
                IEnumerable <FileMetaData[]> GetFileList()
                {
                    int currentPage = 0;
                    int totalPage;

                    do
                    {
                        GenericResult <FileListPage> x = fileSystem.GetDirectory(uuid, page: ++currentPage);
                        if (x.Success)
                        {
                            totalPage   = x.Result.TotalPage;
                            CurrentPath = x.Result.DictionaryInformation.Path;
                            CurrentUUID = x.Result.DictionaryInformation.UUID;

                            CreatePathArray(CurrentPath);
                            yield return(x.Result.List);
                        }
                        else
                        {
                            throw new DirectoryNotFoundException(x.Message);
                        }
                    } while (currentPage < totalPage);
                    yield break;
                }

                Application.Current.Dispatcher.Invoke(() => FileList.Clear());
                await Task.Run(() =>
                {
                    fileMetaDataEnumerator = GetFileList().GetEnumerator();
                    fileMetaDataEnumerator.MoveNext();
                });

                Application.Current.Dispatcher.Invoke(() =>
                {
                    foreach (FileMetaData a in fileMetaDataEnumerator.Current)
                    {
                        if (Mode == Mode.PathSelector && !a.Directory)
                        {
                            continue;
                        }
                        FileList.Add(new FileListItemViewModel(this, a));
                    }
                });
            }
        }
예제 #20
0
        private void refresh()
        {
            var rootDirectory = ActiveDirectory;

            if (!rootDirectory.Exists)
            {
                rootDirectory.Create();
            }

            FileList.Clear();
            var nonHiddenDirectories = rootDirectory.GetDirectories().Select(f => f)
                                       .Where(f => (f.Attributes & FileAttributes.Hidden) == 0);

            foreach (var directory in nonHiddenDirectories)
            {
                if (directory.IsAccessible())
                {
                    FileList.Add(new DirectoryListItem {
                        FileSystemItem = directory
                    });
                }
            }
            var visibleFiles = rootDirectory.GetFiles()
                               .Where(s => s.Extension == ".flex" || s.Extension == ".xaml")
                               .Select(f => f).Where(f => (f.Attributes & FileAttributes.Hidden) == 0);

            foreach (var file in visibleFiles)
            {
                if (file.IsAccessible())
                {
                    FileList.Add(new FileListItem {
                        FileSystemItem = file
                    });
                }
            }
            var isfound = false;

            foreach (var x in FileManagerSettings.Instance.Favorites)
            {
                if (x == ActiveDirectory.FullName)
                {
                    isfound = true;
                }
            }
            IsCurrentDirectoryFavorited = isfound;
            HasParentDirectory          = (ActiveDirectory.Parent != null && ActiveDirectory.Parent.Exists);
        }
예제 #21
0
        public void RemoveFiles(IList <NgenFileItem> files)
        {
            if (files.Count < 1)
            {
                FileList.Clear();
                return;
            }
            var itemsToRemove = new NgenFileItem[files.Count];

            for (var i = 0; i < files.Count; i++)
            {
                itemsToRemove[i] = files[i];
            }
            foreach (var item in itemsToRemove)
            {
                FileList.Remove(item);
            }
        }
예제 #22
0
 public void ChangeCourse(string courseId)
 {
     if (courseId == CourseId)
     {
         return;
     }
     CourseId   = courseId;
     Course     = (Model.GetCourseList()).Find(c => c.Id == courseId);
     CourseName = Course.Name;
     NoticeList.Clear();
     NoticeListLoaded = false;
     FileList.Clear();
     FileListLoaded = false;
     WorkList.Clear();
     WorkListLoaded = false;
     UpdateNumbers();
     RaisePropertyChanged("CourseName");
 }
예제 #23
0
        public bool LoadFileListFile()
        {
            // Make the file if it doesn't exist
            if (!File.Exists(FileListFile))
            {
                File.WriteAllLines(FileListFile, new string[] { HEADER });
            }

            // Read the file from disk
            string[] lines;
            try
            {
                lines = File.ReadAllLines(FileListFile);
            }
            catch
            {
                return(false);
            }
            FileList.Clear();
            if (lines.Length < 2)
            {
                return(true);
            }

            FileScan entry;

            string[] tokens;
            for (int i = 1; i < lines.Length; i++)
            {
                tokens                   = lines[i].Split(',');
                entry                    = new FileScan();
                entry.FileName           = tokens[0];
                entry.TimeOfLastAccess   = DateTime.Parse(tokens[1]);
                entry.Hash               = tokens[2];
                entry.Bytes              = long.Parse(tokens[3]);
                entry.ProcessedBytes     = long.Parse(tokens[4]);
                entry.TimeOfModification = DateTime.Parse(tokens[5]);
                entry.DataStartTime      = DateTime.Parse(tokens[6]);
                entry.DataEndTime        = DateTime.Parse(tokens[7]);
                FileList.Add(entry);
            }
            return(true);
        }
예제 #24
0
 public void LoadList3(List <CourseFile> list)
 {
     try
     {
         if (!isUnload)
         {
             FileList.Clear();
         }
         foreach (var item in list)
         {
             if (!isUnload)
             {
                 FileList.Add(item);
             }
         }
     }
     catch (Exception)
     {
     }
 }
예제 #25
0
        public void Drop(IDropInfo dropInfo)
        {
            FileList.Clear();

            var files = ((DataObject)dropInfo.Data).GetFileDropList().Cast <string>()
                        .Where(fname => fname.EndsWith(".zip", ".rar")).ToList();

            if (files.Count == 0)
            {
                return;
            }

            foreach (var file in files)
            {
                FileList.Add(file);
            }

            ImageData = null;
            ImgFileList.Clear();
        }
예제 #26
0
        public override bool OnUnloaded(bool forceExit)
        {
            bool exit;

            var analyze = CurrentControl as Analyze;

            if (analyze != null)
            {
                exit = forceExit ||
                       MessageBox.Show(Application.Current.MainWindow,
                                       "Scanning is currently in progress. Would you like to cancel?", Utils.ProductName,
                                       MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;

                if (!exit)
                {
                    return(false);
                }

                analyze.CancelAnalyze();

                return(true);
            }

            if (!(CurrentControl is Results))
            {
                return(true);
            }

            exit = forceExit ||
                   MessageBox.Show(Application.Current.MainWindow,
                                   "Scanning results will be reset. Would you like to continue?", Utils.ProductName,
                                   MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;

            if (!exit)
            {
                return(false);
            }

            FileList.Clear();
            return(true);
        }
예제 #27
0
 private void Compile()
 {
     try
     {
         if (FileList.Count > 0 && FileList.First() == "THEA 2 MOD COMPILER")
         {
             MessageBox.Show("Scan for mods before compiling");
         }
         else
         {
             List <string> modDirs = FileList.ToList();
             FileList.Clear();
             FileList.Add("reading files");
             List <string> Log = DB.ParseData(modDirs, selectedFilePath.Remove(selectedFilePath.Length - rootFileLength), StrictParameterFollow, UsePrototypeInference, AttemptMerge);
             Log.ForEach(FileList.Add);
         }
     }
     catch
     {
         MessageBox.Show("error in Compile");
     }
 }
예제 #28
0
        private void Send_Click(object sender, RoutedEventArgs e)
        {
            Button s = (Button)sender;

            if (FileList.Count == 0)
            {
                MessageBox.Show("Add File before Click Send", "Warning");
                return;
            }
            if (s.Content.Equals("Send"))
            {
                if (send_list.Count == 0)
                {
                    MessageBox.Show("Select Someone before Click Send", "Warning");
                    return;
                }
                s.Content = "Cancel";

                foreach (ToSend ip in send_list)
                {
                    ip.send = s;
                    ip.Send(FileList.ToList());
                    ip.listSend = send_list;
                }
                if (Properties.Settings.Default.DropFile)
                {
                    FileList.Clear();
                }
            }
            else
            {
                s.Content = "Send";
                foreach (ToSend ip in send_list)
                {
                    ip.Cancel();
                }
            }
        }
예제 #29
0
 private void Clear_Click(object sender, EventArgs e)
 {
     FileList.Clear();
 }
예제 #30
0
 public override void CanClose(Action <bool> callback)
 {
     SelectedFiles.Clear();
     FileList.Clear();
     base.CanClose(callback);
 }