private void BuildList() { // // // m_strThemeFolder = RscKnownFolders.GetSystemPath("Theme"); RscStore store = new RscStore(); string[] fldrs = RscSort.OrderBy(store.GetFolderNames(m_strThemeFolder, "*.*")); string sFldrs = "Default"; foreach (string fldr in fldrs) { switch (fldr) { case "Current": case "Default": //Special folders... break; default: { string sPathPre = m_strThemeFolder + "\\" + fldr + "\\" + "Theme"; bool bFullTheme = false; //There are WallPaper only folders!!! if (store.FileExists(sPathPre + ".png")) { bFullTheme = true; } if (store.FileExists(sPathPre + ".jpg")) { bFullTheme = true; } if (bFullTheme) { sFldrs += "|" + fldr; } break; } } } fldrs = sFldrs.Split('|'); // // // // var listOfImageResources = new StringBuilder(); //var asm = Assembly.GetExecutingAssembly(); //MessageBox.Show( asm.FullName ); // // NOT WORKS: //var asm = Assembly.LoadFrom("RscLib.dll"); //var asm = Assembly.Load("Microsoft.Phone.Media.Extended, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e"); var asm = Assembly.Load("Lib_Rsc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); var mrn = asm.GetManifestResourceNames(); foreach (var resource in mrn) { var rm = new ResourceManager(resource.Replace(".resources", ""), asm); try { var NOT_USED = rm.GetStream("app.xaml"); // without getting a stream, next statement doesn't work - bug? var rs = rm.GetResourceSet(Thread.CurrentThread.CurrentUICulture, false, true); var enumerator = rs.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Key.ToString().StartsWith("images/")) { listOfImageResources.AppendLine( RscEncode.UrlEncodingToString(enumerator.Key.ToString()) ); } } } catch (MissingManifestResourceException) { // Ignore any other embedded resources (they won't contain app.xaml) } } string str = listOfImageResources.ToString(); string [] astrDelims = new String [1]; astrDelims[0] = "\r\n"; string [] astrKeys = RscSort.OrderBy(str.Split(astrDelims, StringSplitOptions.RemoveEmptyEntries)); // // // // int iCount = astrKeys.Length; for (int i = -1; i < iCount; i++) { string sImage; if (i == -1) { sImage = "Theme"; } else { string sTmp = astrKeys[i]; int iPos1 = sTmp.LastIndexOf('/'); if (iPos1 < 0) { iPos1 = -1; } int iPos2 = sTmp.LastIndexOf('.'); if (iPos2 < 0) { iPos2 = sTmp.Length; } sImage = sTmp.Substring(iPos1 + 1, iPos2 - (iPos1 + 1)); } string [] astrFldrLst; string sName; int iPos; Theme thm = new Theme(); m_a.Add(thm); foreach (string fldr in fldrs) { ThemeImg thmimg = new ThemeImg(fldr, sImage); thm.m_a.Add(thmimg); string sPath; sPath = m_strThemeFolder + "\\" + thmimg.Name + "\\" + thmimg.Image + ".png"; if (store.FileExists(sPath)) { astrFldrLst = store.GetFileNames(m_strThemeFolder + "\\" + thmimg.Name, thmimg.Image + ".png"); sName = ""; if (astrFldrLst.Length == 1) { sName = astrFldrLst[0]; } if (sName.Length > 0) { iPos = sName.LastIndexOf('.'); if (iPos >= 0) { //FIX: Orig value of thmimg.Image (Key) is LOWERCASE!!! thmimg.Image = sName.Substring(0, iPos); sPath = m_strThemeFolder + "\\" + thmimg.Name + "\\" + sName; } } thmimg.FullPath = sPath; } else { sPath = m_strThemeFolder + "\\" + thmimg.Name + "\\" + thmimg.Image + ".jpg"; if (store.FileExists(sPath)) { astrFldrLst = store.GetFileNames(m_strThemeFolder + "\\" + thmimg.Name, thmimg.Image + ".jpg"); sName = ""; if (astrFldrLst.Length == 1) { sName = astrFldrLst[0]; } if (sName.Length > 0) { iPos = sName.LastIndexOf('.'); if (iPos >= 0) { //FIX: Orig value of thmimg.Image (Key) is LOWERCASE!!! thmimg.Image = sName.Substring(0, iPos); sPath = m_strThemeFolder + "\\" + thmimg.Name + "\\" + sName; } } thmimg.FullPath = sPath; } else { thmimg.FullPath = ""; //Not found... } } } } // // // // if (m_a.Count == 0) { m_iCX = 0; } else { m_iCX = m_a[0].m_a.Count; } // // // }
private void _ShowDump() { if (m_lPos == 0) { m_btnPrev.Visibility = Rsc.Collapsed; } else { m_btnPrev.Visibility = Rsc.Visible; } long lLen = 0; if (m_stream != null) { lLen = m_stream.Length; } if ((m_lPos + (clLn * clCb)) >= (lLen - 1)) { m_btnNext.Visibility = Rsc.Collapsed; } else { m_btnNext.Visibility = Rsc.Visible; } /* * m_btnShare.Visibility = Rsc.ConditionalVisibility( m_lPos > 0 ); */ if (m_stream == null) { m_AppFrame.StatusText = "0 to 0"; m_txtPath.Text = ""; m_txtContent.Text = ""; return; } m_AppFrame.StatusText = m_lPos.ToString() + " to " + (Math.Min(m_stream.Length - 1, (m_lPos + (clLn * clCb)) - 1)).ToString() + "\n" + "of " + (m_stream.Length - 1).ToString() + " (" + RscUtils.toMBstr(m_stream.Length - 1, false) + ")"; m_txtPath.Text = m_sPath; string sContent = ""; try { m_stream.Seek(m_lPos, System.IO.SeekOrigin.Begin); long lChk = m_lPos - 1; for (long li = 0; li < clLn; li++) { sContent += "\n "; string sAsc = ""; bool bBreak = false; for (long lj = 0; lj < clCb; lj++) { lChk++; if (lChk >= m_stream.Length) { for (long lj2 = lj; lj2 < clCb; lj2++) { sContent += " __"; } bBreak = true; break; } if (lj == 4) { sContent += " "; } int y = m_stream.ReadByte(); sContent += " " + RscEncode.IntToHexaString(y, 2); if ((y < 32) || (y >= 128)) { sAsc += "."; } else { sAsc += ((char)y); } } sContent += " " + sAsc; if (bBreak) { break; } } m_txtContent.Text = sContent; } catch (Exception e) { m_txtContent.Text = "ERROR: " + e.Message; } }