private void _ReadTextFile() { if (m_iIndex == 0) { m_btnPrev.Visibility = Rsc.Collapsed; } else { m_btnPrev.Visibility = Rsc.Visible; } if (m_iIndex >= (m_aPathes.Count - 1)) { m_btnNext.Visibility = Rsc.Collapsed; } else { m_btnNext.Visibility = Rsc.Visible; } m_btnShare.Visibility = Rsc.ConditionalVisibility(m_aPathes.Count > 0); if (m_aPathes.Count == 0) { m_AppFrame.StatusText = "0 of 0"; m_txtPath.Text = ""; m_aLines.Clear(); return; } m_AppFrame.StatusText = (m_iIndex + 1).ToString() + " of " + m_aPathes.Count.ToString(); m_sPath_TEMP = m_aPathes[m_iIndex]; m_txtPath.Text = m_sPath_TEMP; RscStore store = new RscStore(); bool bNotExist = false; m_sContent_TEMP = store.ReadTextFile(m_sPath_TEMP, "", out bNotExist); if (m_sContent_TEMP.Length == 0) { return; } m_aLines.Clear(); m_AppFrame.StartTimer("load", LayoutRoot, 1, 0, false); }
private void SaveAuthResult(RscGoogleAuthResult auth) { Deployment.Current.Dispatcher.BeginInvoke(() => { //ATT: Logged ON!!! m_btnLogOut.Visibility = Rsc.Visible; RscStore store = new RscStore(); store.CreateFolderPath(csSecretsFolder); store.WriteXmlDataFile(csSecretsFolder + "\\" + "AUTH.xml", auth, true); }); }
public static void WriteDWORD(HKEY hk, string sPath, string sName, int iValue) { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); store.CreateFolderPath(strFullPath); strFullPath += "\\" + sName + ".DWORD"; store.WriteTextFile(strFullPath, iValue.ToString(), true); }
public static void WriteString(HKEY hk, string sPath, string sName, string sValue) { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); store.CreateFolderPath(strFullPath); strFullPath += "\\" + sName + ".String"; store.WriteTextFile(strFullPath, sValue, true); }
private ImageSource LoadThumbnail(string sPath, int iCX, int iCY) { RscStore store = new RscStore(); System.IO.Stream stream = store.GetReaderStream(sPath); System.Windows.Media.Imaging.WriteableBitmap wbmp = Microsoft.Phone.PictureDecoder.DecodeJpeg(stream, iCX, iCY); stream.Close(); return(wbmp); }
public static RscGoogleAuthResult LoadAuthResult(out bool bNotExists) { bNotExists = false; RscGoogleAuthResult auth; RscStore store = new RscStore(); store.CreateFolderPath(AppLogic.csSecretsFolder); auth = store.ReadXmlDataFile <RscGoogleAuthResult>(AppLogic.csSecretsFolder + "\\" + "AUTH.xml", null, out bNotExists); return(auth); }
public static void DeleteValue(HKEY hk, string sPath, string sName) { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); //MUST NOT!!! //store.CreateFolderPath( strFullPath ); strFullPath += "\\" + sName + ".DWORD"; store.DeleteFile(strFullPath); }
// // // protected void DoAck(TreeLbItem ti) { if (MessageBoxResult.OK != MessageBox.Show("Do you really want to acknowledge message?\n\n(press Back to Cancel)")) { return; } if (m_sUserIDlast.Length == 0) { return; } string sPath = AppLogic.csSecretsFolder + "\\" + m_sUserIDlast; RscStore store = new RscStore(); sPath += "\\Threads"; if (!store.FolderExists(sPath)) { return; } MyThread2 th = new MyThread2(); th = store.ReadXmlDataFile(sPath + "\\" + ti.sID + "\\" + ti.sHistoryID + ".xml", th); if (th.ID.Length == 0) { return; //FAIL!!! } th.DateAcked = DateTime.Now; store.WriteXmlDataFile(sPath + "\\" + ti.sID + "\\" + ti.sHistoryID + ".xml", th, true); ti.BtnCustom1Visibility = Rsc.Collapsed; ti.DetailsOfTitle = TreeLbItemThread.DecorateSnippet(th); ti.ClearCustomBackColor(); int iCount_NonAckAll = 0; iCount_NonAckAll = store.ReadXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll); iCount_NonAckAll = Math.Max(0, iCount_NonAckAll - 1); store.WriteXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll, true); int iCountAll = 0; iCountAll = store.ReadXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll); UpdateSumItem(iCount_NonAckAll, iCountAll); m_AppFrame.StatusText = ""; //To refresh mem info... }
public RscPageArgsRet GetOutput( ) { string strPath = RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_OUT" + ".txt"; bool bNotExist = false; RscStore store = new RscStore(); string strOutput = store.ReadTextFile(strPath, "", out bNotExist); RscPageArgsRet OutPut = new RscPageArgsRet(this); OutPut.FromString(strOutput); return(OutPut); }
public static string ReadString(HKEY hk, string sPath, string sName, string sDefaultValue = "") { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); //MUST NOT!!! //store.CreateFolderPath( strFullPath ); strFullPath += "\\" + sName + ".String"; bool bNotExist = false; return(store.ReadTextFile(strFullPath, sDefaultValue, out bNotExist)); }
private void CopyImage(int iPos) { if (m_a.Count == 0) { return; } int iY = (iPos / m_a[0].m_a.Count); int iX = iPos % m_a[0].m_a.Count; //m_AppFrame.SetStatusText( iY.ToString() + " | " + iX.ToString() ); ThemeImg thi = m_a[iY].m_a[iX]; if (!thi.Checked) { return; } if (thi.FullPath.Length == 0) { return; } //m_AppFrame.SetStatusText( thi.FullPath ); RscStore store = new RscStore(); string sPath; sPath = m_strThemeFolder + "\\" + "Current" + "\\" + thi.Image + ".png"; if (store.FileExists(sPath)) { store.DeleteFile(sPath); } sPath = m_strThemeFolder + "\\" + "Current" + "\\" + thi.Image + ".jpg"; if (store.FileExists(sPath)) { store.DeleteFile(sPath); } string sPathTrg = thi.FullPath; sPathTrg = sPathTrg.Replace("\\" + thi.Name + "\\", "\\" + "Current" + "\\"); store.CopyFile(thi.FullPath, sPathTrg); }
private void DoPlay() { if (m_siInPlayer == null) { return; } //m_txtSnd.Text = m_siInPlayer.FileTitle; int idx = m_sounds.IndexOf(m_siInPlayer); // // // RscStore store = new RscStore(); store.CreateFolderPath("A:\\System\\AudioPlaybackAgent"); store.WriteTextFile("A:\\System\\AudioPlaybackAgent\\CurrentTrack.txt", idx.ToString(), true); // // // bool bErr = true; try { BackgroundAudioPlayer.Instance.Play(); bErr = false; } catch (Exception /*e*/) { //FIX: App closed, Music stoped, App started + last loaded, Play FAILS!!! //MessageBox.Show( e.Message ); } if (bErr) { try { //FIX: App closed, Music stoped, App started + last loaded, Play FAILS!!! BackgroundAudioPlayer.Instance.Close(); } catch (Exception /*e*/) { } } }
public NoteEditor() { InitializeComponent(); RscStore store = new RscStore(); store.CreateFolderPath(csDocFolder); btnSend.Click += new System.Windows.RoutedEventHandler(btnSend_Click); btnNew.Click += new System.Windows.RoutedEventHandler(btnNew_Click); lbTit.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lbTit_SelectionChanged); btnLoad.Click += new System.Windows.RoutedEventHandler(btnLoad_Click); btnSave.Click += new System.Windows.RoutedEventHandler(btnSave_Click); btnDel.Click += new System.Windows.RoutedEventHandler(btnDel_Click); txtNot.TextChanged += new System.Windows.Controls.TextChangedEventHandler(txtNot_TextChanged); txtTit.TextChanged += new System.Windows.Controls.TextChangedEventHandler(txtTit_TextChanged); }
private void cam_CaptureImageAvailable(object sender, Microsoft.Devices.ContentReadyEventArgs e) { if (m_sFnDtNext.Length == 0) { DateTime dNow = DateTime.Now; m_sFnDtNext = dNow.Year.ToString() + RscUtils.pad60(dNow.Month) + RscUtils.pad60(dNow.Day) + "_" + RscUtils.pad60(dNow.Hour) + RscUtils.pad60(dNow.Minute) + RscUtils.pad60(dNow.Second); } if (m_bSaveToMediaLibrary) { MediaLibrary media = new MediaLibrary(); media.SavePicture(m_sFnDtNext, e.ImageStream); e.ImageStream.Seek(0, System.IO.SeekOrigin.Begin); } else { RscStore store = new RscStore(); string fName = RscKnownFolders.GetMediaPath("DCIM") + "\\" + m_sFnDtNext + ".jpg"; int iCnt = 0; for (;;) { if (!store.FileExists(fName)) { break; } iCnt++; fName = RscKnownFolders.GetMediaPath("DCIM") + "\\" + m_sFnDtNext + "_" + iCnt.ToString() + ".jpg"; } System.IO.Stream stream = store.CreateFile(fName); // Initialize the buffer for 4KB disk pages. byte[] readBuffer = new byte[4096]; int bytesRead = -1; // Copy the thumbnail to the local folder. while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0) { stream.Write(readBuffer, 0, bytesRead); } stream.Close(); } }
private void m_btnDownloadFile_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } if (m_bLastFileIsFolder) { return; } if (m_lLastFileSize < 0) { return; } if (m_ftpc.WorkingDirectory.Length == 0) { return; } string sPath = m_ftpc.WorkingDirectory; sPath += m_sLastFile; RscStore store = new RscStore(); string sLocalPath = "A:\\FTP"; if (!store.FolderExists(sLocalPath)) { store.CreateFolder(sLocalPath); } sLocalPath += "\\" + m_sLastFile; if (store.FileExists(sLocalPath)) { store.DeleteFile(sLocalPath); } System.IO.Stream stream = store.CreateFile(sLocalPath); RscFtpClientCommand cmd = RscFtpClientCommand.DownloadBin(sPath, m_lLastFileSize, "", null, stream); _SendAutoPASV(cmd); }
public RscPageArgsRet GetInput(string strPageName) { m_strPageName = strPageName; string strPath = RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_IN" + ".txt"; bool bNotExist = false; RscStore store = new RscStore(); string strInput = store.ReadTextFile(strPath, "", out bNotExist); if (bNotExist) { return(null); } RscPageArgsRet InPut = new RscPageArgsRet(this); InPut.FromString(strInput); return(InPut); }
private void doRefresh() { spFiles.Children.Clear(); sEml = ""; RscStore store = new RscStore(); string[] fles = RscSort.OrderBy(store.GetFileNames(csDocFolder, "*.txt")); foreach (string sFle in fles) { bool bTmp; string sTx = store.ReadTextFile(csDocFolder + "\\" + sFle, "", out bTmp); if (sTx.Length > 0) { addDate(csDocFolder + "\\" + sFle, sTx, RscStore.FileNameOfPath(sFle)); } } }
public static bool MarkedOpenExternal(string sDomain) { RscStore store = new RscStore(); string sFolder = "A:\\Internet\\UserAgents"; if (!store.FolderExists(sFolder)) { return(false); } if (!store.FileExists(sFolder + "\\" + sDomain + "_OpenExternal" + ".txt")) { return(false); } return(true); }
private ImageSource LoadThumbnail(string sPath, int iCX, int iCY) { RscStore store = new RscStore(); try { System.IO.Stream stream = store.GetReaderStream(sPath, false); System.Windows.Media.Imaging.WriteableBitmap wbmp = Microsoft.Phone.PictureDecoder.DecodeJpeg(stream, iCX, iCY); return(wbmp); } catch (Exception) { return(m_isDummy); } }
private void RenderText(string text, int width, int height, double fontsize, string imagepath, Brush backColor, Brush brFore) { WriteableBitmap b = new WriteableBitmap(width, height); var canvas = new Grid(); canvas.Width = b.PixelWidth; canvas.Height = b.PixelHeight; var background = new Canvas(); background.Height = b.PixelHeight; background.Width = b.PixelWidth; //SolidColorBrush backColor = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"]); //SolidColorBrush backColor = new SolidColorBrush( Colors.Black ); background.Background = backColor; var textBlock = new TextBlock(); textBlock.Text = text; textBlock.FontWeight = FontWeights.Bold; textBlock.TextAlignment = TextAlignment.Left; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.VerticalAlignment = VerticalAlignment.Stretch; textBlock.Margin = new Thickness(35); textBlock.Width = b.PixelWidth - textBlock.Margin.Left * 2; textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Foreground = brFore; //new SolidColorBrush(Colors.White); //color of the text on the Tile textBlock.FontSize = fontsize; canvas.Children.Add(textBlock); b.Render(background, null); b.Render(canvas, null); b.Invalidate(); //Draw bitmap RscStore store = new RscStore(); System.IO.Stream stream = store.CreateFile(imagepath); b.SaveJpeg(stream, b.PixelWidth, b.PixelHeight, 0, 100); stream.Close(); }
private void Play(BackgroundAudioPlayer player) { ReadPlaylist(); if (m_iCurrentTrack >= m_aTracks.Count) { return; } try { RscStore store = new RscStore(); string strAlbArt = "System/Theme/Current/Ico001_SoundPlayer.jpg"; if (store.FileExists("A:\\System\\Theme\\Current\\Ico001_SoundPlayer.png")) { strAlbArt = "System/Theme/Current/Ico001_SoundPlayer.png"; } string sPath = m_aTracks[m_iCurrentTrack].Path; Uri uri; if (sPath.ToLower()[0] == 'a' && sPath.ToLower()[1] == ':') { //Iso Store... uri = new Uri(sPath.Substring(3), UriKind.Relative); } else { uri = new Uri("file:///" + sPath, UriKind.Absolute); } var audioTrack = new AudioTrack(uri, m_aTracks[m_iCurrentTrack].Title, "N/A", m_aTracks[m_iCurrentTrack].Album, new Uri(strAlbArt, UriKind.Relative), m_iCurrentTrack.ToString(), EnabledPlayerControls.All); player.Track = audioTrack; } catch (Exception e) { RscStore.AddSysEvent(e); } }
private void AddSavedNote() { RscStore store = new RscStore(); if (store.FileExists(m_sAppPath)) { string sInf = ""; sInf += "\r\n"; sInf += "\r\n"; sInf += "Picture stored in app storage:\r\n" + m_sAppPath; m_txtInfo.Text += sInf; m_btnSave.Visibility = Rsc.Collapsed; } else { m_btnSave.Visibility = Rsc.Visible; } }
private RscGoogleAuthResult LoadAuthResult() { RscGoogleAuthResult auth; RscStore store = new RscStore(); store.CreateFolderPath(csSecretsFolder); bool bNotExists; auth = store.ReadXmlDataFile <RscGoogleAuthResult>(csSecretsFolder + "\\" + "AUTH.xml", null, out bNotExists); if (!bNotExists) { //ATT: Logged ON!!! m_btnLogOut.Visibility = Rsc.Visible; } return(auth); }
public static string[] GetKeys(HKEY hk, string sPath, string sFilter = "") { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); if (!store.FolderExists(strFullPath)) { return new String[] {} } ; if (sFilter.Length == 0) { sFilter = "*.*"; } return(store.GetFolderNames(strFullPath, sFilter)); }
public static string GetMediaPath(string strSysFolder, string strSysSubFolder = "", bool bCreate = true) { string strPath = ""; RscStore store = new RscStore(); strPath = strPath + "A:\\Media"; if (!store.FolderExists(strPath)) { if (bCreate) { store.CreateFolder(strPath); } } strPath = strPath + "\\"; strPath = strPath + strSysFolder; if (!store.FolderExists(strPath)) { if (bCreate) { store.CreateFolder(strPath); } } //strPath = strPath + "\\"; if (strSysSubFolder.Length > 0) { strPath = strPath + "\\"; strPath = strPath + strSysSubFolder; if (!store.FolderExists(strPath)) { if (bCreate) { store.CreateFolder(strPath); } } //strPath = strPath + "\\"; } return(strPath); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { m_bInThisApp = true; if (!m_bFirstLoad) { return; } m_bFirstLoad = false; RscPageArgsRetManager appArgsMgr = new RscPageArgsRetManager(); m_AppInput = appArgsMgr.GetInput("RscViewer_HexaV10"); if (m_AppInput != null) { m_AppFrame.AppTitle = m_AppInput.CallerAppTitle; m_AppFrame.AppIconRes = m_AppInput.CallerAppIconRes; if (m_stream != null) { m_stream.Close(); m_stream = null; } m_lPos = 0; m_sPath = m_AppInput.GetData(0); //appArgsMgr.Vipe(); RscStore store = new RscStore(); try { m_stream = store.GetReaderStream(m_sPath); } catch (Exception ex) { MessageBox.Show(ex.Message); m_stream = null; } _ShowDump(); } }
public static void MarkOpenExternal(string sDomain, bool bMark) { RscStore store = new RscStore(); string sFolder = "A:\\Internet\\UserAgents"; store.CreateFolderPath(sFolder); if (bMark) { store.WriteTextFile(sFolder + "\\" + sDomain + "_OpenExternal" + ".txt", "", true); } else { if (store.FileExists(sFolder + "\\" + sDomain + "_OpenExternal" + ".txt")) { store.DeleteFile(sFolder + "\\" + sDomain + "_OpenExternal" + ".txt"); } } }
public static int ReadDWORD(HKEY hk, string sPath, string sName, int iDefaultValue = 0) { string strFullPath = GetFullPath(hk, sPath); RscStore store = new RscStore(); //MUST NOT!!! //store.CreateFolderPath( strFullPath ); strFullPath += "\\" + sName + ".DWORD"; bool bNotExist = false; string sValue = store.ReadTextFile(strFullPath, iDefaultValue.ToString(), out bNotExist); int iValue = iDefaultValue; Int32.TryParse(sValue, out iValue); return(iValue); }
private void PlayNext(BackgroundAudioPlayer player) { ReadPlaylist(); m_iCurrentTrack++; if (m_iCurrentTrack >= m_aTracks.Count) { m_iCurrentTrack = 0; } if (m_iCurrentTrack >= m_aTracks.Count) { return; } RscStore store = new RscStore(); store.CreateFolderPath("A:\\System\\AudioPlaybackAgent"); store.WriteTextFile("A:\\System\\AudioPlaybackAgent\\CurrentTrack.txt", m_iCurrentTrack.ToString(), true); Play(player); }
public static void OnNavigatedTo_ExitOnBack(IDictionary <string, string> QueryString) { IDictionary <string, string> pars = QueryString; if (!pars.ContainsKey("ExitOnBack")) { return; } if (pars["ExitOnBack"] != "True") { return; } string sPathNotExitOnBack = RscKnownFolders.GetTempPath("Launcher") + "\\" + "NotExitOnBack.txt"; RscStore store = new RscStore(); store.DeleteFile(sPathNotExitOnBack); }