private void btnWebDog_Click(object sender, System.Windows.RoutedEventArgs e) { RscStore store = new RscStore(); store.DeleteFile(csDocFolder + "\\" + "WebDogUri.txt"); //To reset all File Dates!!! store.WriteTextFile(csDocFolder + "\\" + "WebDogUri.txt", host.UI.tbUri.Text.ToString(), true); alert("WebDog tile on Desktop configured successfuly!\n\nTile shows last download time.\nTo disable tile delete file isostore:\\Documents\\WebDogUri.txt."); }
public void SetOutput(RscPageArgsRet OutPut) { string strPath = RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_OUT" + ".txt"; RscStore store = new RscStore(); store.WriteTextFile(strPath, OutPut.ToString(), true); }
public void SetInput(RscPageArgsRet InPut, string strPageName) { m_strPageName = strPageName; string strPath = RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_IN" + ".txt"; RscStore store = new RscStore(); store.WriteTextFile(strPath, InPut.ToString(), true); }
public static void StoreUserAgentID(string sDomain, string sUaID) { RscStore store = new RscStore(); string sFolder = "A:\\Internet\\UserAgents"; store.CreateFolderPath(sFolder); store.WriteTextFile(sFolder + "\\" + sDomain + ".txt", sUaID, 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 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*/) { } } }
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 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"); } } }
private void imgReady() { host.UI.imgIcon.Visibility = System.Windows.Visibility.Visible; host.UI.btnSave.Visibility = System.Windows.Visibility.Visible; host.UI.lblSave.Visibility = System.Windows.Visibility.Visible; host.UI.btnWebDog.Visibility = System.Windows.Visibility.Visible; host.UI.lblWebDog.Visibility = System.Windows.Visibility.Visible; RscStore store = new RscStore(); bool bTmp; string sUri = store.ReadTextFile(csDocFolder + "\\" + "WebDogUri.txt", "", out bTmp); if (sUri == host.UI.tbUri.Text.ToString()) { //Refresh file date... store.WriteTextFile(csDocFolder + "\\" + "WebDogUri.txt", sUri, true); } }
private void btnSave_Click(object sender, System.Windows.RoutedEventArgs e) { string sTitle = host.UI.txtTit.Text; if (sTitle == "") { alert("No title!"); return; } RscStore store = new RscStore(); if (store.FileExists(csDocFolder + "\\" + sTitle + ".txt")) { if (sTitle == sLstLoadTitle) { //NOP... } else { alert("Title already exists!"); return; } } string sVal = txDateText(); store.WriteTextFile(csDocFolder + "\\" + sTitle + ".txt", sVal, true); sLstLoadTitle = ""; host.UI.btnSave.Visibility = System.Windows.Visibility.Collapsed; host.UI.lblSave.Visibility = System.Windows.Visibility.Collapsed; host.UI.btnSend.Visibility = System.Windows.Visibility.Visible; host.UI.lblSend.Visibility = System.Windows.Visibility.Visible; host.UI.btnDel.Visibility = System.Windows.Visibility.Visible; host.UI.lblDel.Visibility = System.Windows.Visibility.Visible; doRefresh(); }
public static bool VersionUpgrade(string sUserIDlast, bool bChkOnly) { RscStore store = new RscStore(); string sFolder = AppLogic.csSecretsFolder + "\\" + sUserIDlast + "\\" + "Threads"; int iOldVer = 0; if (!store.FolderExists(sFolder)) { if (bChkOnly) { return(true); //NOTHING stored yet... } store.CreateFolderPath(sFolder); } string sVersion = store.ReadTextFile(sFolder + "\\" + "Version.txt", "0"); if (sVersion == ciCurrentVersion.ToString()) { return(true); } if (bChkOnly) { return(false); } if (!Int32.TryParse(sVersion, out iOldVer)) { iOldVer = 0; } // // // int iVer = iOldVer; for (;;) { if (iVer >= ciCurrentVersion) { break; } switch (iVer) { case 0: case 100: case 101: { string [] asIDs = store.GetFolderNames(sFolder, "*.*"); int iSubCntr = 0; for (int i = 0; i < asIDs.Length; i++) { string sIdOrder = ""; sIdOrder = store.ReadTextFile(sFolder + "\\" + asIDs[i] + "\\" + "IdOrder" + ".txt", sIdOrder); string [] asIdOrders = sIdOrder.Split('|'); iSubCntr += asIdOrders.Length; string sId = asIdOrders[asIdOrders.Length - 1]; MyThread2 th = new MyThread2(); th = store.ReadXmlDataFile(sFolder + "\\" + asIDs[i] + "\\" + sId + ".xml", th); if (th.ID.Length == 0) { return(false); //FAIL!!! } string sTmp = ""; sTmp += th.DateSaved.Year.ToString(); sTmp += RscUtils.pad60(th.DateSaved.Month); sTmp += RscUtils.pad60(th.DateSaved.Day); sTmp += "_"; sTmp += RscUtils.pad60(th.DateSaved.Hour); sTmp += RscUtils.pad60(th.DateSaved.Minute); sTmp += RscUtils.pad60(th.DateSaved.Second); sTmp += "_"; int iMs = th.DateSaved.Millisecond; if (iMs < 10) { sTmp += "00"; } else { if (iMs < 100) { sTmp += "0"; } } sTmp += iMs.ToString(); asIDs[i] = sTmp + "|" + asIDs[i]; } asIDs = RscSort.OrderBy(asIDs, true); /* * StringBuilder sb = new StringBuilder(); */ string sRes = ""; foreach (string sID in asIDs) { /* * sb.AppendLine( sID ); */ if (sRes.Length > 0) { sRes += "|"; } sRes += sID.Substring(20); } /* * sb.Append( "\r\n" ); * sb.Append( "Cntr: " + asIDs.Length.ToString() + "\r\n" ); * sb.Append( "Sub-Cntr: " + iSubCntr.ToString() + "\r\n" ); * store.WriteTextFile( "A:\\GMail.txt", sb.ToString(), true ); */ store.WriteTextFile(sFolder + "\\" + "IdOrder" + ".txt", sRes, true); iVer = 102; break; } //Denie endless loop... default: iVer = ciCurrentVersion; break; } store.WriteTextFile(sFolder + "\\" + "Version.txt", iVer.ToString(), true); } // // // return(true); }
private void Calc() { cntout.Text = "..."; cntout2.Text = "..."; cntout3.Text = "..."; try { int iY = Int32.Parse(dtin_y.Text); int iM = Int32.Parse(dtin_m.Text); int iD = Int32.Parse(dtin_d.Text); DateTime dtNow = DateTime.Now; DateTime d1 = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day); DateTime d2 = new DateTime(iY, iM, iD); TimeSpan ts = d2 - d1; int iDays = Math.Max(1, (int)Math.Round(ts.TotalDays, 0)); double dAmo = 0; if (amo.Text.Length > 0) { dAmo = double.Parse(amo.Text); } string sPath = "A:\\Documents\\PerDay"; RscStore store = new RscStore(); store.CreateFolderPath(sPath); if (dAmo != 0) { int iRes = (int)Math.Round(dAmo / iDays, 0); cntout.Text = iRes.ToString(); if (unt.Text.Length > 0) { cntout.Text += " " + unt.Text; } cntout2.Text = Math.Max(0, (int)Math.Round(ts.TotalDays, 0)).ToString(); //// // string sInf = ""; switch (d2.DayOfWeek) { case DayOfWeek.Monday: sInf += "Hétfő"; break; case DayOfWeek.Tuesday: sInf += "Kedd"; break; case DayOfWeek.Wednesday: sInf += "Szerda"; break; case DayOfWeek.Thursday: sInf += "Csütörtök"; break; case DayOfWeek.Friday: sInf += "Péntek"; break; case DayOfWeek.Saturday: sInf += "Szombat"; break; case DayOfWeek.Sunday: sInf += "Vasárnap"; break; } sInf += ", " + RscUtils.pad60(RscUtils.WeekOfYearHU(d2)) + ". hét"; cntout3.Text = sInf; // //// string sCnt = iY.ToString() + "|" + iM.ToString() + "|" + iD.ToString() + "|" + dAmo.ToString() + "|" + unt.Text; store.WriteTextFile(sPath + "\\" + "Default.txt", sCnt, true); } else { cntout.Text = ""; store.DeleteFile(sPath + "\\" + "Default.txt"); } } catch (Exception) { cntout.Text = "<error>"; } }
private void btnEx_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_tags == null) { return; } switch (m_tags.GetType().ToString()) { case "Ressive.Formats.RscTextTags_VCF": { RscStore store = new RscStore(); store.CreateFolderPath("A:\\Desktop\\Contacts\\tn"); string sPath = "A:\\Desktop\\Contacts\\" + ((RscTextTags_VCF)m_tags).Name + ".txt"; string sPathTn = "A:\\Desktop\\Contacts\\tn\\" + ((RscTextTags_VCF)m_tags).Name + ".txt.jpg"; if (store.FileExists(sPath)) { store.DeleteFile(sPath); store.DeleteFile(sPathTn); btnEx.Content = "Add to Desktop"; BtnGridEx.Background = new SolidColorBrush(Colors.Green); } else { try { store.WriteTextFile(sPath, m_aPathes[m_iIndex], true); if (((RscTextTags_VCF)m_tags).PhotoPresent && ((RscTextTags_VCF)m_tags).PhotoIsBase64 && ((RscTextTags_VCF)m_tags).PhotoIs("JPEG")) { string sBase64 = ((RscTextTags_VCF)m_tags).PhotoData; //RscFs.WriteTextFile( "vcf.photo.txt", sBase64, true ); byte [] ayImage = Convert.FromBase64String(sBase64); if (store.FileExists(sPathTn)) { store.DeleteFile(sPathTn); } if (ayImage != null) { if (ayImage.Length > 0) { System.IO.Stream stream = store.CreateFile(sPathTn); stream.Write(ayImage, 0, ayImage.Length); stream.Close(); } } } } catch (Exception) { MessageBox.Show("ERROR: Unable to create Desktop icon for Contact!"); return; } btnEx.Content = "Remove from Desktop"; BtnGridEx.Background = new SolidColorBrush(Colors.Red); } MessageBox.Show("NOTE: To take into effect, restart application!"); break; } default: MessageBox.Show("No action defined!"); break; } }
private SoundInfo AddSound(string sPath) { string sExt = "N/A"; string sTitle = "N/A"; string sFolder = ""; int iPosDot = sPath.LastIndexOf('.'); if (iPosDot >= 0) { sExt = sPath.Substring(iPosDot + 1); } else { iPosDot = sPath.Length; sExt = "<NONE>"; } int iPosBs = sPath.LastIndexOf('\\'); if (iPosBs >= 0) { if (iPosBs < 0) { iPosBs = -1; } sTitle = sPath.Substring(iPosBs + 1, (iPosDot - iPosBs) - 1); if (iPosBs > 0) { sFolder = sPath.Substring(0, iPosBs); } } SoundInfo snd = new SoundInfo(); snd.Path = sPath; snd.FileType = "\r\n" + sExt.ToUpper(); snd.FileTitle = sTitle; snd.sFolder = sFolder; snd.SoundState = MediaElementState.Closed; snd.Parent = m_sounds; m_sounds.Add(snd); // // // RscStore store = new RscStore(); store.CreateFolderPath("A:\\System\\AudioPlaybackAgent"); bool bPlNotExist; string sPl = store.ReadTextFile("A:\\System\\AudioPlaybackAgent\\Playlist.txt", "", out bPlNotExist); if (sPl.Length > 0) { sPl += "\r\n"; } sPl += sFolder + "|" + sTitle + "|" + sPath; store.WriteTextFile("A:\\System\\AudioPlaybackAgent\\Playlist.txt", sPl, true); if (bPlNotExist) { store.WriteTextFile("A:\\System\\AudioPlaybackAgent\\CurrentTrack.txt", "0", true); } // // // return(snd); }
private void DoLoad(TreeLbItem ti, string sContent, string sID, string sDetails, bool bSaveJSon) { string sErr = ""; RscJSonItem jsonRoot = null; /* * jsonRoot = new RscJSonItem(); * jsonRoot.ID = response.ResponseUri.ToString(); * jsonRoot.Name = "IRestResponse<Object>"; * jsonRoot.AddProperty( "Response Status", response.ResponseStatus.ToString() ); * jsonRoot.AddProperty( "Response Uri", response.ResponseUri.ToString() ); * jsonRoot.AddProperty( "Content Length", response.ContentLength.ToString() ); */ jsonRoot = RscJSon.FromResponseContetn(jsonRoot, sContent, out sErr, sID, sDetails); if (sErr.Length > 0) { LogError(sErr); } if (jsonRoot != null) { // // // string sErrorCode = ""; if (jsonRoot.ChildCount > 0) { if (jsonRoot.GetChild(0).Name == "error") { //For example: Required Scope not specified while LogOn!!! sErrorCode = jsonRoot.GetChildPropertyValue(0, "code"); string sErrorMessage = jsonRoot.GetChildPropertyValue(0, "message"); LogError("Error response:\ncode: " + sErrorCode + "\nmessage: " + sErrorMessage); } } // // // //Show Error JSon!!! //if( sErrorCode.Length == 0 ) { //Try to load result as is... GoogleRequest gr = GoogleUtils.GoogleRequestFromUrl(jsonRoot.ID); switch (gr) { case GoogleRequest.UserInfo: case GoogleRequest.GMail_Messages: case GoogleRequest.GMail_Message_Details: case GoogleRequest.GMail_Labels: case GoogleRequest.GMail_Threads: case GoogleRequest.GMail_History: case GoogleRequest.GMail_Drafts: { ti.SetResponse(jsonRoot); RscStore store = new RscStore(); if (gr == GoogleRequest.UserInfo) { string sUserID = jsonRoot.GetPropertyValue("id"); if (m_sUserIDlast.Length == 0 || m_sUserIDlast != sUserID) { if (sUserID.Length > 0) { m_sUserIDlast = sUserID; store.WriteTextFile(csSecretsFolder + "\\" + "UserIDlast.txt", m_sUserIDlast, true); AddRootContainers(); } } } string sPath = ""; string sFn = ""; if (m_sUserIDlast.Length > 0) { sPath = csSecretsFolder + "\\" + m_sUserIDlast; sFn = Uri2FileName(jsonRoot.ID); } if (bSaveJSon) { if (m_sUserIDlast.Length > 0) { store.CreateFolderPath(sPath); store.WriteTextFile(sPath + "\\" + sFn + ".json", sContent, true); m_btnCleanUp.Visibility = Rsc.Visible; } } if (sErr.Length == 0) { if (sFn.Length > 0) { if (bSaveJSon) { m_AppFrame.StatusText = "Downloaded to " + sPath + "\\" + sFn + ".json"; } else { m_AppFrame.StatusText = "Loaded from " + sPath + "\\" + sFn + ".json"; } } else { if (bSaveJSon) { m_AppFrame.StatusText = "Downloaded..."; } else { m_AppFrame.StatusText = "Loaded..."; } } } break; } default: { //Unexpected... LogError(jsonRoot.ToDecoratedString()); break; } } } } }
public void DoUpdate(bool bCalledByAgent, object oAgentParam) { RscStore.AddSysEvent(DateTime.Now.ToString(), false, "ShellTiles_DoUpdate"); var tiles = ShellTile.ActiveTiles; string sDbg = ""; string sStCntFldr = RscKnownFolders.GetTempPath("ShellTiles", "Content"); foreach (ShellTile tile in tiles) { if (sDbg.Length > 0) { sDbg += "\r\n"; } sDbg += tile.NavigationUri.OriginalString; try { StandardTileData updatedData = new StandardTileData(); int iPos = tile.NavigationUri.OriginalString.IndexOf("IcoId="); if (iPos < 0) { continue; } iPos += 6; string sIcoId = tile.NavigationUri.OriginalString.Substring(iPos); iPos = tile.NavigationUri.OriginalString.IndexOf("IcoGd="); if (iPos < 0) { continue; } iPos += 6; int iPos2 = tile.NavigationUri.OriginalString.IndexOf('&', iPos); if (iPos2 < 0) { continue; } iPos2--; string sIcoGd = tile.NavigationUri.OriginalString.Substring(iPos, (iPos2 - iPos) + 1); /* * DateTime dNow = DateTime.Now; * string sTm = RscUtils.pad60(dNow.Hour) + * ":" + RscUtils.pad60(dNow.Minute); // + ":" + RscUtils.pad60(dNow.Second); * * updatedData.Title = RscUtils.pad60(dNow.Day) + ". " + sTm; */ Brush brBk = null; Brush brFore = null; double dFontSize = 0; string sErr = ""; string sNotiTitle = ""; string sNotiContent = ""; string sNotiSound = ""; string sInfoToChngChk = ""; string sInfo = GetInfo(true, sIcoId, out brBk, out brFore, out dFontSize, out sErr, out sNotiTitle, out sNotiContent, out sNotiSound, bCalledByAgent, oAgentParam, out sInfoToChngChk); if (sInfo == "") { sInfo = "\n\n(N/A)"; } if (brBk == null) { brBk = new SolidColorBrush(Color.FromArgb(255, 32, 32, 32)); //Colors.Black ); } if (brFore == null) { brFore = new SolidColorBrush(Colors.White); } if (dFontSize > 0) { dFontSize = cdFontSize - cdFontSize_SmDiff; } else { dFontSize = cdFontSize; } if (sInfoToChngChk.Length == 0) { sInfoToChngChk = sInfo; } if (sErr.Length > 0) { sDbg += "\r\nERROR: " + sErr; } RscStore store = new RscStore(); // // // string sInfoToChngChk_Old = store.ReadTextFile(sStCntFldr + "\\" + sIcoGd + ".txt", ""); if (sInfoToChngChk_Old.CompareTo(sInfoToChngChk) != 0) { if (sNotiTitle.Length > 0 && sNotiContent.Length > 0) { string sUriSnd = sNotiSound; if (sUriSnd.Length == 0) { sUriSnd = /*"/Lib_Rsc;component/" +*/ "Media/empty.mp3"; } ShellToast_Wp80U3.ShowToast(sNotiTitle, sNotiContent, new Uri(sUriSnd, UriKind.Relative)); } store.WriteTextFile(sStCntFldr + "\\" + sIcoGd + ".txt", sInfoToChngChk, true); } // // // // string sInfo_Old = store.ReadTextFile(sStCntFldr + "\\" + sIcoGd + "(full).txt", ""); if (sInfo_Old.CompareTo(sInfo) == 0) { sDbg += " " + sIcoId + "|" + sIcoGd + " (NO UPDATE, NO CHANGE)"; continue; //No change!!! } string sTileImgPath = "A:\\Shared\\ShellContent"; store.CreateFolderPath(sTileImgPath); sTileImgPath += "\\" + sIcoGd + ".jpg"; store.DeleteFile(sTileImgPath); RenderText(sInfo, sTileImgPath, brBk, brFore, dFontSize); string sImgUriFinal = "isostore:/" + sTileImgPath.Substring(3).Replace('\\', '/'); updatedData.BackgroundImage = new Uri(sImgUriFinal, UriKind.Absolute); tile.Update(updatedData); sDbg += " " + sIcoId + "|" + sIcoGd + " (Updated)"; store.WriteTextFile(sStCntFldr + "\\" + sIcoGd + "(full).txt", sInfo, true); // // // } catch (Exception e) { sDbg += "\r\nERROR: " + e.Message + "\r\n" + e.StackTrace; } } RscStore.AddSysEvent(sDbg, false, "ShellTiles_DoUpdate_List"); }
public void Create(string sPageNavTo, string sPageArgs, string sImage, string sStatus, string sIcoId = "") { RscStore store = new RscStore(); Guid gd = Guid.NewGuid(); string gdStr = gd.ToString(); string sPageUri = "/MainPage.xaml" + "?IcoGd=" + gdStr; if (sIcoId.Length > 0) { sPageUri += "&IcoId=" + sIcoId; } if (sIcoId.Length == 0) { string sStFldr = RscKnownFolders.GetTempPath("ShellTiles", ""); store.WriteTextFile(sStFldr + "\\" + gdStr + ".txt", sPageNavTo + "\r\n" + sPageArgs, true); } else { //To make it enumerable... string sStFldr = RscKnownFolders.GetTempPath("ShellTiles", ""); store.WriteTextFile(sStFldr + "\\" + gdStr + ".txt", sIcoId, true); } string sImageUri = sImage; string sImgUriFinal = sImageUri; if (sImageUri.Length > 0) { string sTileImg = gdStr; if (sImageUri.IndexOf("isostore:\\") >= 0) { sImageUri = sImageUri.Substring(10); sTileImg += RscStore.ExtensionOfPath(sImageUri); } else { sImageUri = sImageUri.Replace("Images/", "A:\\System\\Theme\\Current\\"); sImageUri = sImageUri.Replace(".jpg", ".png"); if (!store.FileExists(sImageUri)) { sImageUri = sImageUri.Replace(".png", ".jpg"); sTileImg += ".jpg"; } else { sTileImg += ".png"; } } string sTileImgPath = "A:\\Shared\\ShellContent"; store.CreateFolderPath(sTileImgPath); sTileImgPath += "\\" + sTileImg; store.CopyFileForce(sImageUri, sTileImgPath); sImgUriFinal = "isostore:/" + sTileImgPath.Substring(3).Replace('\\', '/'); } string sTitle = sStatus; if (sIcoId.Length > 0) { sTitle = ""; Brush brBk = null; Brush brFore = null; double dFontSize = 0; string sErr = ""; string sNotiTitle = ""; string sNotiContent = ""; string sNotiSound = ""; string sInfoToChngChk = ""; string sInfo = GetInfo(true, sIcoId, out brBk, out brFore, out dFontSize, out sErr, out sNotiTitle, out sNotiContent, out sNotiSound, false, null, out sInfoToChngChk); if (sInfo == "") { sInfo = "\n\n(N/A)"; } if (brBk == null) { brBk = new SolidColorBrush(Color.FromArgb(255, 32, 32, 32)); //Colors.Black ); } if (brFore == null) { brFore = new SolidColorBrush(Colors.White); } if (dFontSize > 0) { dFontSize = cdFontSize - cdFontSize_SmDiff; } else { dFontSize = cdFontSize; } if (sInfoToChngChk.Length == 0) { sInfoToChngChk = sInfo; } //To update only if info has changed... string sStCntFldr = RscKnownFolders.GetTempPath("ShellTiles", "Content"); store.WriteTextFile(sStCntFldr + "\\" + gdStr + ".txt", sInfo, true); string sTileImgPath = "A:\\Shared\\ShellContent"; store.CreateFolderPath(sTileImgPath); sTileImgPath += "\\" + gdStr + ".jpg"; store.DeleteFile(sTileImgPath); RenderText(sInfo, sTileImgPath, brBk, brFore, dFontSize); sImgUriFinal = "isostore:/" + sTileImgPath.Substring(3).Replace('\\', '/'); } //MessageBox.Show( "Title: " + sTitle + "\r\n" + "NavTo: " + sPageUri + "\r\n" + "Image: " + sImageUri ); StandardTileData initialData = new StandardTileData(); { if (sImgUriFinal.Length > 0) { initialData.BackgroundImage = new Uri(sImgUriFinal, UriKind.Absolute); } if (sTitle.Length > 0) { initialData.Title = sTitle; } } ShellTile.Create(new Uri(sPageUri, UriKind.Relative), initialData); }
private void mySave() { RscStore store = new RscStore(); System.IO.Stream stream = null; string fName = host.UI.isoName.Text; if (fName == "") { return; } fName = ImgFolderPath() + fName; // // // fName += ".ico"; if (store.FileExists(fName)) { store.DeleteFile(fName); } //Save original .ICO if (m_memIco != null) { stream = store.CreateFile(fName); m_memIco.WriteTo(stream); stream.Close(); } // // // // //Save ico uri as IE bookmark... store.WriteTextFile(fName + ".ilnk", uIco.ToString(), true); // // // // //Lg { string sIco = fName + ".jpg"; System.Windows.Media.Imaging.WriteableBitmap wbmp = new System.Windows.Media. Imaging.WriteableBitmap( host.UI.imgIcon, new System.Windows.Media.MatrixTransform()); if (store.FileExists(sIco)) { store.DeleteFile(sIco); } stream = store.CreateFile(sIco); System.Windows.Media.Imaging. Extensions.SaveJpeg(wbmp, stream, wbmp.PixelWidth, wbmp.PixelHeight, 0, 100); stream.Close(); host.UI.isoImg.Source = wbmp; host.UI.isoImg.Visibility = System.Windows.Visibility.Visible; } //Lg { string sIco = fName + ".sm.jpg"; System.Windows.Media.Imaging.WriteableBitmap wbmp = new System.Windows.Media. Imaging.WriteableBitmap( host.UI.imgIconSm, new System.Windows.Media.MatrixTransform()); if (store.FileExists(sIco)) { store.DeleteFile(sIco); } stream = store.CreateFile(sIco); System.Windows.Media.Imaging. Extensions.SaveJpeg(wbmp, stream, wbmp.PixelWidth, wbmp.PixelHeight, 0, 100); stream.Close(); host.UI.isoImgSm.Source = wbmp; host.UI.isoImgSm.Visibility = System.Windows.Visibility.Visible; } // // // }
private void SaveImage(bool bThumbnail) { RscStore store = new RscStore(); string sFolder = m_sAppFolder; if (bThumbnail) { sFolder += "\\" + "tn"; if (!store.FolderExists(sFolder)) { store.CreateFolder(sFolder); } } string sPreExt = ""; if (bThumbnail) { sPreExt = ".tn"; } string sFName = m_sPicFileName; string sFExt = ""; int iPos = sFName.LastIndexOf('.'); if (iPos >= 0) { sFExt = sFName.Substring(iPos); sFName = sFName.Substring(0, iPos); } string sPath = sFolder + "\\" + sFName + sPreExt + sFExt; /* * iCnt = 0; * for(;;) * { * if( !store.FileExists(sPath) ) break; * iCnt++; * sPath = sFolder + "\\" + sFName + "_" + iCnt.ToString() + sPreExt + sFExt; * } */ System.IO.Stream strmSrc; if (bThumbnail) { strmSrc = m_pic.GetThumbnail(); } else { strmSrc = m_pic.GetImage(); } if (store.FileExists(sPath)) { store.DeleteFile(sPath); } System.IO.Stream stream = store.CreateFile(sPath); // Initialize the buffer for 4KB disk pages. byte[] readBuffer = new byte[4096]; int bytesRead = -1; // Copy the image/thumbnail to the local folder. while ((bytesRead = strmSrc.Read(readBuffer, 0, readBuffer.Length)) > 0) { stream.Write(readBuffer, 0, bytesRead); } stream.Close(); strmSrc.Close(); if (!bThumbnail) { store.WriteTextFile(sFolder + "\\" + sFName + sPreExt + sFExt + ".inf", m_sInf, true); } }
public static int SaveThreadData(bool bCalledByAgent, string sPath, RscJSonItem jsonThreads) { RscJSonItem json = jsonThreads.GetChildByName("threads"); if (json == null) { return(-200); } RscStore store = new RscStore(); bool bFirstRun = false; sPath += "\\Threads"; if (!store.FolderExists(sPath)) { bFirstRun = true; store.CreateFolderPath(sPath); store.WriteTextFile(sPath + "\\" + "Version.txt", ciCurrentVersion.ToString(), true); } string sThreadIdOrder_OLD = ""; sThreadIdOrder_OLD = store.ReadTextFile(sPath + "\\" + "IdOrder" + ".txt", sThreadIdOrder_OLD); sThreadIdOrder_OLD += "|"; //ATTENTION!!! 1 of 2 string sThreadIdOrder_NEW = ""; int iJustAdded = 0; int iThCnt = json.ChildCount; for (int iTh = 0; iTh < iThCnt; iTh++) { RscJSonItem jsonTh = json.GetChild(iTh); string sID = jsonTh.GetPropertyValue("id"); string sHistoryID = jsonTh.GetPropertyValue("historyId"); string sSnippet = jsonTh.GetPropertyValue("snippet"); //, true ); if (sID.Length == 0 || sHistoryID.Length == 0 || sSnippet.Length == 0) { continue; } store.CreateFolderPath(sPath + "\\" + sID); if (store.FileExists(sPath + "\\" + sID + "\\" + sHistoryID + ".xml")) { //Threads arrives in reverse order, so... break; } else { sThreadIdOrder_OLD = sThreadIdOrder_OLD.Replace(sID + "|", ""); //Removing ID if (sThreadIdOrder_NEW.Length > 0) { sThreadIdOrder_NEW += "|"; } sThreadIdOrder_NEW += sID; //Adding ID string sIdOrder = ""; sIdOrder = store.ReadTextFile(sPath + "\\" + sID + "\\" + "IdOrder" + ".txt", ""); iJustAdded++; MyThread2 th = new MyThread2(); th.ID = sID; th.HistoryID = sHistoryID; th.Snippet = sSnippet; if (bFirstRun) { th.DateAcked = DateTime.Now; } store.WriteXmlDataFile(sPath + "\\" + sID + "\\" + sHistoryID + ".xml", th, true); if (sIdOrder.Length > 0) { sIdOrder = "|" + sIdOrder; } sIdOrder = sHistoryID + sIdOrder; store.WriteTextFile(sPath + "\\" + sID + "\\" + "IdOrder" + ".txt", sIdOrder, true); } } if (sThreadIdOrder_OLD.Length > 0) { //ATTENTION!!! 2 of 2 sThreadIdOrder_OLD = sThreadIdOrder_OLD.Substring(0, sThreadIdOrder_OLD.Length - 1); } if (sThreadIdOrder_NEW.Length > 0 && sThreadIdOrder_OLD.Length > 0) { sThreadIdOrder_NEW += "|"; } sThreadIdOrder_NEW += sThreadIdOrder_OLD; store.WriteTextFile(sPath + "\\" + "IdOrder" + ".txt", sThreadIdOrder_NEW, true); int iCountAll = 0; iCountAll = store.ReadXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll); iCountAll += iJustAdded; store.WriteXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll, true); int iCount_NonAckAll = 0; iCount_NonAckAll = store.ReadXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll); if (!bFirstRun) { iCount_NonAckAll += iJustAdded; } store.WriteXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll, true); int iCount_NEW = 0; iCount_NEW = store.ReadXmlDataFile(sPath + "\\" + "Count_NEW" + ".xml", iCount_NEW); if (bCalledByAgent) { iCount_NEW += iJustAdded; } else if (bFirstRun) { iCount_NEW = 0; } else { iCount_NEW = 0; } store.WriteXmlDataFile(sPath + "\\" + "Count_NEW" + ".xml", iCount_NEW, true); return(iJustAdded); }