public static DataTable ReadXmlDecrypted(DataTable table, string filePath) { if (UFile.Exists(filePath)) { table.ReadXml(filePath); } return(table); }
private string GetUserImage(string filePath) { string imagetype = ""; if (UFile.Exists(filePath + ".bmp")) { imagetype = ".bmp"; } else if (UFile.Exists(filePath + ".jpeg")) { imagetype = ".jpeg"; } else if (UFile.Exists(filePath + ".jpg")) { imagetype = ".jpg"; } else if (UFile.Exists(filePath + ".gif")) { imagetype = ".gif"; } else { return(string.Empty); } byte[] UserImageBytes = UImage.GetImageBytes(filePath + imagetype); //UserImageType = System.IO.Path.GetExtension(filePath); DataTable userImageTable = new DataTable("UserImageTable"); DataColumn nameColumn; nameColumn = new DataColumn(); nameColumn.DataType = System.Type.GetType("System.String"); nameColumn.ColumnName = "ImageName"; userImageTable.Columns.Add(nameColumn); DataColumn imageColumn; imageColumn = new DataColumn(); imageColumn.DataType = System.Type.GetType("System.Byte[]"); imageColumn.ColumnName = "ImageBytes"; userImageTable.Columns.Add(imageColumn); DataColumn typeColumn; typeColumn = new DataColumn(); typeColumn.DataType = System.Type.GetType("System.String"); typeColumn.ColumnName = "ImageType"; userImageTable.Columns.Add(typeColumn); DataRow dr = userImageTable.NewRow(); dr["ImageName"] = "UserImage"; dr["ImageBytes"] = UserImageBytes; dr["ImageType"] = imagetype; userImageTable.Rows.Add(dr); return(UData.ToString(userImageTable)); }
public static DataTable ReadXml(DataTable table, string filePath) { if (UFile.Exists(filePath)) { MemoryStream memoryStream = InfinityStreamsManager.ReadStreamFromFile(filePath); table.ReadXml(memoryStream); memoryStream.Close(); } return(table); }
public void Load() { if (UFile.Exists(Ap.FileBoardTheme)) { System.IO.MemoryStream memoryStream = InfinityStreamsManager.ReadStreamFromFile(Ap.FileBoardTheme); BoardThemeDataSet.ReadXml(memoryStream); memoryStream.Close(); } PiecesThemeData = BoardThemeDataSet.Tables["PiecesThemeData"]; ColorSchemeData = BoardThemeDataSet.Tables["ColorSchemeData"]; KvBoardTheme = new Kv(BoardThemeDataSet.Tables["Kv"]); }
private string ReadAllText(string path) { if (UFile.Exists(path)) { return(File.ReadAllText(path)); } else { toolStripStatusLabel1.Text = "File does not exists\n\n" + path; } return(""); }
public static void PlaySound(SoundFileNameE soundFileID) { if (Ap.Options.DoMultimediaBoardSounds) { player.SoundLocation = GetSounfFilePath(soundFileID); if (UFile.Exists(player.SoundLocation)) { Thread th = new Thread(Play); th.Start(); } } }
public static byte[] GetImageBytes(string filePath) { if (!UFile.Exists(filePath)) { return(null); } FileStream fs = new FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] image = new byte[fs.Length]; fs.Read(image, 0, Convert.ToInt32(fs.Length)); fs.Close(); return(image); }
public void Load(string xsdPath, string xmlPath) { try { LoadXsd(xsdPath); if (UFile.Exists(xmlPath)) { DataTable.ReadXml(xmlPath); } } catch (Exception ex) { throw ex; } }
public static bool LoadLastGame(Game game, GameType gameType) { if (!string.IsNullOrEmpty(Ap.Options.CurrentGameGuid) && UFile.Exists(Ap.Options.CurrentGameDatabaseFilePath)) { if (game.LoadGame(Ap.Options.CurrentGameGuid)) { return(true); } } game.ResetCurrentGame(); //game.NewGame(GameMode.HumanVsEngine, GameType.Blitz); game.NewGame(GameMode.HumanVsEngine, gameType); return(true); }
public void Load() { if (UFile.Exists(Ap.FilePiecesTheme)) { PiecesThemeData.Rows.Clear(); System.IO.MemoryStream memoryStream = InfinityStreamsManager.ReadStreamFromFile(Ap.FilePiecesTheme); PiecesThemeData.ReadXml(memoryStream); memoryStream.Close(); } if (UFile.Exists(Ap.FileColorScheme)) { ColorSchemeData.Rows.Clear(); System.IO.MemoryStream memoryStream = InfinityStreamsManager.ReadStreamFromFile(Ap.FileColorScheme); ColorSchemeData.ReadXml(memoryStream); memoryStream.Close(); } }
public static DataSet LoadDataSet3(string xsdPath, string xmlPath) { DataSet dataset = null; try { dataset = LoadXsd2(xsdPath); if (UFile.Exists(xmlPath)) { dataset.ReadXml(xmlPath); } } catch (Exception ex) { throw ex; } return(dataset); }
public static DataTable LoadDataTable5(string xmlPath) { DataTable table = null; try { if (UFile.Exists(xmlPath)) { string content = InfinityStreamsManager.ReadFromFile(xmlPath); table = UData.LoadDataTable(content, content); } } catch (Exception ex) { throw ex; } return(table); }
public static DataTable LoadDataTable4(DataTable table, string xmlPath) { try { if (UFile.Exists(xmlPath)) { MemoryStream memoryStream = InfinityStreamsManager.ReadStreamFromFile(xmlPath); table.ReadXml(memoryStream); memoryStream.Close(); } } catch (Exception ex) { throw ex; } return(table); }
public static bool UrlExists(string url) { return(UFile.Exists(UWeb.MapPath(url))); }