public VoiceMailEntry(WebVoiceMailControl owner, InfoFile info) { mOwner = owner; InitializeComponent(); Dock = DockStyle.Top; this.progressBar.EndWaiting(); this.progressBar.Enabled = false; this.progressBar.Visible = false; mFileInfo = info; lFrom.Text = mFileInfo.From; DateTime dateTime = new DateTime(1970, 1, 1); dateTime = dateTime.AddSeconds(mFileInfo.Time); lDate.Text = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); tbTagIt.Text = mFileInfo.Tags; //Setup Color Scheme mCached = mFileInfo.Cached; if (mCached) { mFileInfo.FileName = Path.GetFileName(mFileInfo.FileName); } this.Name = mFileInfo.FileName; this.toolTip.SetToolTip(this.lFrom, mFileInfo.From); this.toolTip.SetToolTip(this.pMailImage, mFileInfo.Location.ToString()); ResetButtonDesign(); }
public static UniqueId GetUniqueId(Guid guid, InfoFile infoFile) { return(new UniqueId { Id = guid.ToString(), IdType = IdTypeEnum.UUID, SourceType = IdSourceTypeEnum.URI, Source = infoFile.NamePlugin + " " + infoFile.VersionPlugin }); }
private void Window_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; this.pathC = files[0]; this.file = GetInfoFile(files[0]); Refresh(); } }
/// <summary> /// Создает объект типа InfoFile /// </summary> /// <param name="file">Путь к файлу</param> /// <returns>Возвращает объект типа InfoFile</returns> public InfoFile CreateInfoFile(string file) { FileInfo fi = new FileInfo(file); if (!fi.Exists) { return(null); } InfoFile info = new InfoFile(fi.Directory.FullName, fi.Name, fi.Length); return(info); }
public void Save(string fileName) { InfoFile = InfoFile ?? new IniFile(); InfoSection = InfoFile.AddSection("info"); ProjectSection = InfoFile.AddSection("project"); InfoSection["time"] = "" + Utils.t2i(time); InfoSection["Date"] = "" + Utils.DateTimeString(time); InfoSection["FilesCount"] = "" + FilesCount; InfoSection["AddedFilesCount"] = "" + AddedFilesCount; InfoSection["TotalSize"] = "" + TotalSize; InfoSection["TotalSizeAdded"] = "" + TotalSizeAdded; InfoSection["LogFile"] = LogFile; InfoFile.Save(fileName); path = fileName; }
private InfoFile GetInfoFile(string pathC) { if (!Dic.ContainsKey(pathC)) { Dic.Add(pathC, "InfoFolder\\" + DateTime.Now.Ticks.ToString()); SaveDic(); InfoFile file = new InfoFile(new FileInfo(pathC)); file.Serialize(new FileInfo(Dic[pathC])); return(file); } else { return(InfoFile.Parse(Dic[pathC])); } }
public void WriteFileInfo(string path, InfoFile infoFile) { if (infoFile == null) { return; } string fullpath = Path.Combine(path, "infoFiles.xml"); mutexWriteObj.WaitOne(); XDocument xdoc; XElement root = new XElement("InfoFiles"); // создаем элемент XElement infoFileElem = new XElement("InfoFile"); //XElement idElem = new XElement("id", infoFile.id); XElement nameElem = new XElement("Name", infoFile.Name); XElement lengthElem = new XElement("Length", infoFile.Length.ToString()); //infoFileElem.Add(idElem); infoFileElem.Add(nameElem); infoFileElem.Add(lengthElem); FileInfo fileInf = new FileInfo(fullpath); if (!fileInf.Exists) { xdoc = new XDocument(); root.Add(infoFileElem); xdoc.Add(root); } else { xdoc = XDocument.Load(fullpath); xdoc.Root.Add(infoFileElem); } infoFile.GetInfoAboutFile(); try { xdoc.Save(fullpath); } catch (Exception) { Console.WriteLine($"\t* * * * * Нет доступа к папке по пути {path} * * * * *"); } mutexWriteObj.ReleaseMutex(); }
private void button2_Click(object sender, EventArgs e) { FileInfo info = new FileInfo("testinfo"); FileStream writer = info.Create(); byte[] buffer = InfoFile.TEST_VALUE.Serialize(); writer.Write(buffer, 0, buffer.Length); writer.Close(); InfoFile infoFile2 = InfoFile.Parse(info.FullName); MessageBox.Show("My First Test Text\n" + (infoFile2.HasInfo("My First Test Text") ? infoFile2.GetInfo("My First Test Text").ToString() : "Null")); dynamic pic = infoFile2.GetInfo("FirstPic"); pictureBox1.Image = pic.ToImage(); MessageBox.Show(infoFile2.GetInfo("My First Test Text").Metadata[BaseInfoType.UPDATE_TIME].ToString()); MessageBox.Show(infoFile2.GetInfo("Test Collection").ToString()); }
private void Window_Initialized(object sender, EventArgs e) { Init(); string command = Environment.CommandLine; MessageBox.Show(command); string[] para = command.Split('\"'); if (para.Length > 3) { pathC = para[3]; FileInfo info = new FileInfo(pathC); file = GetInfoFile(pathC); //MessageBox.Show(info.Length.ToString()); Refresh(); } else { this.file = InfoFile.TEST_VALUE; Refresh(); } }
void ProcessFiles(List <InfoFile> list, String dir, InfoFile.LocationType type) { try { string[] XMLFile = Directory.GetFiles(dir, "*.xml"); foreach (string file in XMLFile) { FileStream fs = null; try { try { XmlSerializer des = new XmlSerializer(typeof(InfoFile)); fs = File.OpenRead(file); InfoFile infoFile = (InfoFile)des.Deserialize(fs); fs.Close(); fs = null; if (File.Exists(dir + infoFile.FileName)) { infoFile.Cached = true; } infoFile.Location = type; list.Add(infoFile); } catch { } } catch (Exception) { continue; } } } catch { } }
internal override ICommand Parse(string userInput) { string[] inputArguments = SplitInputArguments(userInput); string commandName = $"{inputArguments[0]} {inputArguments[1]}".ToLower(); List <string> commandOptions = ParseCommandOptions(inputArguments); ICommand parsedCommand; switch (commandName) { case SupportedCommandConstants.FileDelete: parsedCommand = new DeleteFile(_fileService, commandOptions); break; case SupportedCommandConstants.FileDownload: parsedCommand = new DownloadFile(_fileService, commandOptions); break; case SupportedCommandConstants.FileInfo: parsedCommand = new InfoFile(_fileService, commandOptions); break; case SupportedCommandConstants.FileMove: parsedCommand = new MoveFile(_fileService, commandOptions); break; case SupportedCommandConstants.FileUpload: parsedCommand = new UploadFile(_fileService, commandOptions); break; case SupportedCommandConstants.UserInfo: parsedCommand = new InfoUser(_fileService); break; default: throw new Exception("Non-existent command!"); } return(parsedCommand); }
public MapPreviewPanel(HaloMap Map) { InitializeComponent(); label1.Text = Map.Map_Header.internalName; if (AppSettings.Settings.MapInfo_Folder != "") { string[] files = Directory.GetFiles(AppSettings.Settings.MapInfo_Folder); foreach (string str in files) { try { FileStream stream = new FileStream(str, FileMode.Open); InfoFile file = new InfoFile(stream); stream.Close(); if (file.MapFileName == Map.Map_Header.internalName) { label1.Text = file.EnglishName; richTextBox1.Text = file.EnglishDescription; if (AppSettings.Settings.Images_Folder != "") { string path = AppSettings.Settings.Images_Folder + @"\" + file.MapImageFileName + ".blf"; if (File.Exists(path)) { stream = new FileStream(path, FileMode.Open); BLFImageFile file2 = new BLFImageFile(stream); stream.Close(); pictureBox1.Image = file2.BLFImage; } } break; } } catch { } } } }
private void clear(object sender, System.Windows.RoutedEventArgs e) { // AccountNmaeTxt.Items.Clear();??? PwdTxt.Clear(); string appStartPath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); StringBuilder builder = new StringBuilder(); builder.Append(appStartPath); builder.Append("\\LoginFile\\"); builder.Append("\\XML\\"); System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(builder.ToString()); if (!directoryInfo.Exists) { return; } builder.Append("LoginInfoXml.xml"); this.fullFilePath = builder.ToString(); if (InfoFile.Exists) { InfoFile.Delete(); } listUserInfo.Clear(); this.AccountNmaeTxt.ItemsSource = listUserInfo; }
public static List <InfoFile> eseguoControlloDate(string[] filesLocal, string[] filesServer) { List <InfoFile> fileDaAggiornare = new List <InfoFile>(); List <InfoFile> filesLocalInfo = analyzeFiles(filesLocal); List <InfoFile> filesServerInfo = analyzeFiles(filesServer); if (filesLocalInfo.Count > 0) { IOrderedEnumerable <InfoFile> fileLocalMostRecent = filesLocalInfo.OrderByDescending(f => f.dataLastEdit); lastUpdateLocal = fileLocalMostRecent.First().dataLastEdit; } if (filesServerInfo.Count > 0) { IOrderedEnumerable <InfoFile> fileServerMostRecent = filesServerInfo.OrderByDescending(f => f.dataLastEdit); lastUpdateServer = fileServerMostRecent.First().dataLastEdit; } if (filesLocal.Length > 0 && filesServer.Length > 0) { foreach (InfoFile fs in filesServerInfo) { InfoFile fileLocal = filesLocalInfo.Find(fl => fl.nomeFile == fs.nomeFile); if (fs.dataLastEdit > fileLocal.dataLastEdit) { InfoFile toReplace = new InfoFile(fs.dataLastEdit, fs.extension, fs.nomeFile, fs.path, fileLocal.path); fileDaAggiornare.Add(toReplace); } } } return(fileDaAggiornare); }
void MessageListUpdate(MailService.FileInfo[] list) { int newInboxFiles = 0; int newArchiveFiles = 0; foreach (MailService.FileInfo info in list) { try { //File was not in our local list, so add it if (pEmailEntries.Controls.ContainsKey(info.FileName) == false) { if (info.Location == MailService.LocationType.INBOX) ++newInboxFiles; else if (info.Location == MailService.LocationType.ARCHIVE) ++newArchiveFiles; String newFileInfoName = this.BasePath + info.Location.ToString() + @"\" + info.FileName + ".xml"; ; String tempFileInfoName = Path.GetTempFileName(); XmlSerializer ser = new XmlSerializer(typeof(InfoFile)); FileStream fs = File.OpenWrite(tempFileInfoName); InfoFile infoFile = new InfoFile(info); infoFile.Cached = File.Exists(mBaseDirectory + info.Location.ToString() + @"\" + info.FileName); ser.Serialize(fs, infoFile); fs.Close(); //Now move files if (File.Exists(newFileInfoName)) File.Delete(newFileInfoName); File.Move(tempFileInfoName, newFileInfoName); pEmailEntries.Controls.Add(new VoiceMailEntry(this, infoFile)); } else { //Check for a message which may have moved from Inbox to Archive VoiceMailEntry entry = (VoiceMailEntry)pEmailEntries.Controls[info.FileName]; if ((MailService.LocationType)entry.Info.Location != info.Location && info.Location == MailService.LocationType.ARCHIVE) entry.ArchiveLocal(); } } catch { } } if (newInboxFiles > 0 || newArchiveFiles > 0) OnNewMailEvent(this, newInboxFiles, newArchiveFiles); }
void ProcessFiles(List<InfoFile> list, String dir, InfoFile.LocationType type) { try { string[] XMLFile = Directory.GetFiles(dir, "*.xml"); foreach (string file in XMLFile) { FileStream fs = null; try { try { XmlSerializer des = new XmlSerializer(typeof(InfoFile)); fs = File.OpenRead(file); InfoFile infoFile = (InfoFile)des.Deserialize(fs); fs.Close(); fs = null; if (File.Exists(dir + infoFile.FileName)) infoFile.Cached = true; infoFile.Location = type; list.Add(infoFile); } catch { } } catch (Exception) { continue; } } } catch { } }
void MessageListUpdate(MailService.FileInfo[] list) { int newInboxFiles = 0; int newArchiveFiles = 0; foreach (MailService.FileInfo info in list) { try { //File was not in our local list, so add it if (pEmailEntries.Controls.ContainsKey(info.FileName) == false) { if (info.Location == MailService.LocationType.INBOX) { ++newInboxFiles; } else if (info.Location == MailService.LocationType.ARCHIVE) { ++newArchiveFiles; } String newFileInfoName = this.BasePath + info.Location.ToString() + @"\" + info.FileName + ".xml";; String tempFileInfoName = Path.GetTempFileName(); XmlSerializer ser = new XmlSerializer(typeof(InfoFile)); FileStream fs = File.OpenWrite(tempFileInfoName); InfoFile infoFile = new InfoFile(info); infoFile.Cached = File.Exists(mBaseDirectory + info.Location.ToString() + @"\" + info.FileName); ser.Serialize(fs, infoFile); fs.Close(); //Now move files if (File.Exists(newFileInfoName)) { File.Delete(newFileInfoName); } File.Move(tempFileInfoName, newFileInfoName); pEmailEntries.Controls.Add(new VoiceMailEntry(this, infoFile)); } else { //Check for a message which may have moved from Inbox to Archive VoiceMailEntry entry = (VoiceMailEntry)pEmailEntries.Controls[info.FileName]; if ((MailService.LocationType)entry.Info.Location != info.Location && info.Location == MailService.LocationType.ARCHIVE) { entry.ArchiveLocal(); } } } catch { } } if (newInboxFiles > 0 || newArchiveFiles > 0) { OnNewMailEvent(this, newInboxFiles, newArchiveFiles); } }
public VoiceMailEntry() { InitializeComponent(); Dock = DockStyle.Top; mFileInfo = new InfoFile(); }
public SkinIniLoader(String SkinName) { _skinIniFile = GetSkinIni(SkinName); }
/// <summary> /// Потокозащищенная запись объектов в xml /// </summary> /// <param name="infoFile">Объект для записи</param> private static void WriteFileInfo(InfoFile infoFile) { mutexObj.WaitOne(); new Thread(() => writeInfo.WriteFileInfo(CurentFolderPath, infoFile)).Start(); mutexObj.ReleaseMutex(); }