public static void CleanUpShellTileData( )
        {
            string sStFldr    = RscKnownFolders.GetTempPath("ShellTiles", "");
            string sStCntFldr = RscKnownFolders.GetTempPath("ShellTiles", "Content");
            string sScFldr    = "A:\\Shared\\ShellContent";

            RscStore store = new RscStore();

            string[] fles = store.GetFileNames(sStFldr, "*.txt");

            foreach (string fle in fles)
            {
                string sGd = RscStore.FileNameOfPath(fle);

                ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("IcoGd=" + sGd));
                if (TileToFind != null)
                {
                    continue;
                }

                store.DeleteFile(sStFldr + "\\" + sGd + ".txt");
                store.DeleteFile(sStCntFldr + "\\" + sGd + ".txt");

                if (store.FolderExists(sScFldr))
                {
                    store.DeleteFile(sScFldr + "\\" + sGd + ".jpg");
                    store.DeleteFile(sScFldr + "\\" + sGd + ".png");
                }
            }
        }
        public void Vipe()
        {
            RscStore store = new RscStore();

            store.DeleteFile(RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_IN" + ".txt");
            store.DeleteFile(RscKnownFolders.GetTempPath("PageArgsRet") + "\\" + m_strPageName + "_OUT" + ".txt");
        }
        private void btnDel_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"))
            {
                store.DeleteFile(csDocFolder + "\\" + sTitle + ".txt");
            }
            else
            {
                alert("Title does not exist!");
                return;
            }

            doNew();

            doRefresh();
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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.");
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        private void ClearAllSound( )
        {
            //MUST NOT!!!

            /*
             * Ressive.MediaEx.RscMediaEx.StopMusic();
             */
            BackgroundAudioPlayer.Instance.Close();

            m_sounds.Clear();

            // //
            //

            RscStore store = new RscStore();

            store.CreateFolderPath("A:\\System\\AudioPlaybackAgent");
            store.DeleteFile("A:\\System\\AudioPlaybackAgent\\Playlist.txt");
            store.DeleteFile("A:\\System\\AudioPlaybackAgent\\CurrentTrack.txt");

            //
            // //
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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 m_btnDelete_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (m_aPathes.Count == 0)
            {
                return;
            }

            if (MessageBoxResult.OK == MessageBox.Show("Do you really want to delete file?\n\n(Press Back to Cancel...)"))
            {
                RscStore store = new RscStore();

                store.DeleteFile(m_aPathes[m_iIndex]);

                m_aPathes.RemoveAt(m_iIndex);
                if (m_iIndex >= m_aPathes.Count)
                {
                    m_iIndex = Math.Max(0, m_iIndex - 1);
                }

                _ReadTextFile();
            }
        }
Esempio n. 12
0
        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>";
            }
        }
Esempio n. 13
0
        private void m_btnLogOut_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (MessageBoxResult.OK != MessageBox.Show("Do you really want to log out\nand to delete all saved response files (.json)\nand browser chache?\n\n(Press Back to Cancel...)"))
            {
                return;
            }

            // //
            //

            logGrid.Visibility = Rsc.Collapsed;

            m_aTI.CollapseAll(true);

            //
            // //
            //

            m_gAuth.Logout();

            RscStore store = new RscStore();

            store.CreateFolderPath(csSecretsFolder);
            //Otherwise able to logon on next run...
            store.DeleteFile(csSecretsFolder + "\\" + "AUTH.xml");

            //
            // //
            //

            //NOTE: Deleting all IE folders WILL NOT force the user to reenter eMail + Pw!!!

            string sIeCacheFolders = ";" + RscStore_IsoStore.Get_IE_Cache_FolderList(';');

            sIeCacheFolders = sIeCacheFolders.Replace(";", ";A:\\");

            //
            // //
            //

            if (m_sUserIDlast.Length > 0)
            {
                RscPageArgsRet appInput = new RscPageArgsRet(m_AppArgs,
                                                             m_AppFrame.AppTitle, m_AppFrame.AppIconRes, "LogOut");

                appInput.SetData(0, csSecretsFolder + "\\" + m_sUserIDlast + sIeCacheFolders);
                appInput.SetData(1, "*.*");
                appInput.SetData(2, "recurse");
                //appInput.SetData( 2, "" );

                appInput.SetData(3, "showHidden");
                //appInput.SetData( 3, "" );

                appInput.SetData(4, "AutoDelete");

                appInput.SetInput("RscViewer_FindFilesV12");

                this.NavigationService.Navigate(appInput.GetNavigateUri(csViewersAssy));
            }

            //
            // //
        }
Esempio n. 14
0
        private void m_ftpc_ServerDataReceivedSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            if (!e.ServerData.ParseOk)
            {
                _Log("20", "<DATA ERROR> " + e.ClientCommand.ToString( ), false);
            }
            else
            {
                switch (e.ClientCommand.Command)
                {
                case "LIST":
                {
                    prsBarData.Visibility = Rsc.Collapsed;

                    int iCount;
                    RscFtpServerDataItemFileInfo fi;

                    iCount = e.ServerData.Count;

                    if (iCount == 0)
                    {
                        _Log("20", e.ClientCommand.Command + " returned 0 item.", false, true);
                    }
                    else
                    {
                        for (int i = 0; i < iCount; i++)
                        {
                            fi = (RscFtpServerDataItemFileInfo)e.ServerData.GetItem(i);

                            _Log("20", fi.GetItemTitle( ), false, true, fi);
                        }
                    }

                    break;
                }

                case "RETR":
                {
                    prsBarData.Visibility = Rsc.Collapsed;

                    _Log("20", e.ClientCommand.Command + " returned " +
                         e.ClientCommand.DataSize.ToString() + " bytes.", false, true);

                    if (e.ClientCommand.HasMemStream)
                    {
                        string sPath = e.ClientCommand.Arg1;
                        int    iPos  = sPath.LastIndexOf(m_ftpc.BackSlashInPath);
                        string sFn   = sPath;
                        if (iPos >= 0)
                        {
                            sFn = sPath.Substring(iPos + m_ftpc.BackSlashInPath.Length);
                        }

                        _Log("20", e.ClientCommand.Command + " saving local file '" +
                             sFn + "'.", false, true);

                        RscStore store = new RscStore();

                        string sLocalPath = "A:\\FTP";
                        if (!store.FolderExists(sLocalPath))
                        {
                            store.CreateFolder(sLocalPath);
                        }
                        sLocalPath += "\\" + sFn;
                        if (store.FileExists(sLocalPath))
                        {
                            store.DeleteFile(sLocalPath);
                        }

                        System.IO.Stream stream = store.CreateFile(sLocalPath);
                        e.ServerData.MemStream.WriteTo(stream);
                        e.ServerData.MemStream.Close();
                        stream.Close();
                    }

                    break;
                }
                }
            }
        }
Esempio n. 15
0
        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 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);
        }
        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");
        }
        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;
            }
        }
Esempio n. 20
0
        private void CopyImage(int iPos)
        {
            if (m_a.Count == 0)
            {
                return;
            }

            int iY = (iPos / m_iCX);             // + 1;
            int iX = iPos % m_iCX;

            //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);

            if (iY == 0)
            {
                int iPos2 = thi.FullPath.LastIndexOf('\\');
                if (iPos2 >= 0)
                {
                    string sSrc = thi.FullPath.Substring(0, iPos2 + 1);
                    sSrc += "ThemeColors.xml";

                    if (store.FileExists(sSrc))
                    {
                        string sTrg = sSrc.Replace("\\" + thi.Name + "\\", "\\" + "Current" + "\\");

                        if (store.FileExists(sTrg))
                        {
                            store.DeleteFile(sTrg);
                        }

                        store.CopyFile(sSrc, sTrg);
                    }
                }
            }
        }
        private void m_AppFrame_OnTimer_Sub1(object sender, RscAppFrameTimerEventArgs e)
        {
            switch (e.Reason)
            {
            case "copy move files_Cancel":
            {
                m_AppFrame.SetStatusText("User canceled operation!", StatusColoring.Error);
                break;
            }

            case "copy move files":
            {
                int iRootLen = m_txtRootFldr.Text.Length;

                if (e.Pos == 0)
                {
                    foreach (RscFileItemDesc itFldr in m_folders)
                    {
                        string sPart = itFldr.Path.Substring(iRootLen);
                        if (sPart.Length > 0)
                        {
                            string sNewFolder = m_sCopyMoveDest;
                            if (iRootLen == 0)
                            {
                                sNewFolder += "\\";
                            }
                            sNewFolder += sPart;

                            try
                            {
                                RscStore store = new RscStore();
                                store.CreateFolder(sNewFolder);
                            }
                            catch (Exception /*exc*/)
                            {
                                m_AppFrame.SetStatusText("ERR: Unable to copy folder stru near: " + sNewFolder, StatusColoring.Error);
                                e.Completed = true;
                                return;
                            }
                        }
                    }

                    e.Max = 1;
                }
                else
                {
                    RscFileItemDesc it = m_files[e.Pos - 1];

                    string sErr = "";
                    try
                    {
                        string sCopyMoveTo = m_sCopyMoveDest;
                        if (iRootLen == 0)
                        {
                            sCopyMoveTo += "\\";
                        }
                        sCopyMoveTo += it.Path.Substring(iRootLen);

                        RscStore store = new RscStore();

                        if (m_sCopyMove == "move")
                        {
                            store.MoveFileForce(it.Path, sCopyMoveTo);
                        }
                        else
                        {
                            store.CopyFileForce(it.Path, sCopyMoveTo);
                        }
                    }
                    catch (Exception exc)
                    {
                        sErr = "Unable to " + m_sCopyMove + " file.\r\n" + exc.Message;
                    }

                    if (sErr.Length == 0)
                    {
                        m_files.RemoveAt(e.Pos - 1);

                        if ((e.Pos - 1) < m_files.Count)
                        {
                            int iPos = e.Pos;
                            e.Pos = iPos;                                     //Denie subsys to increment...
                        }
                        else
                        {
                            e.Completed = true;
                        }
                    }
                    else
                    {
                        it.LastError = sErr;

                        //ReQuery...
                        lbFiles.ItemsSource = null;
                        lbFiles.ItemsSource = m_files;

                        if ((e.Pos - 1) < (m_files.Count - 1))
                        {
                            e.Max++;
                        }
                        else
                        {
                            e.Completed = true;
                        }
                    }

                    if (e.Completed)
                    {
                        if (m_sCopyMove == "move")
                        {
                            if (m_files.Count == 0)                                      //Otherwise error occured...
                            {
                                if (chbRecurse.IsChecked.Value)                          //Otherwise no sub-tree deletion...
                                {
                                    int iIdx = (m_folders.Count - 1) + 1;
                                    for (;;)
                                    {
                                        iIdx--;
                                        if (iIdx < 0)
                                        {
                                            break;
                                        }

                                        try
                                        {
                                            if (m_folders[iIdx].Path.Substring(iRootLen).Length > 0)
                                            {
                                                RscStore store = new RscStore();
                                                store.DeleteFolder(m_folders[iIdx].Path);
                                            }

                                            m_folders.RemoveAt(iIdx);
                                        }
                                        catch (Exception /*exc*/)
                                        {
                                        }
                                    }
                                }
                            }

                            if (m_files.Count == 0)
                            {
                                m_AppFrame.SetStatusText("Move succeeded!", StatusColoring.Success);
                            }
                            else
                            {
                                m_AppFrame.SetStatusText("Move failed for some item(s)!", StatusColoring.Error);
                            }
                        }
                        else
                        {
                            if (m_files.Count == 0)
                            {
                                m_AppFrame.SetStatusText("Copy succeeded!", StatusColoring.Success);
                            }
                            else
                            {
                                m_AppFrame.SetStatusText("Copy failed for some item(s)!", StatusColoring.Error);
                            }
                        }

                        //Causes exception...
                        //ListFiles();

                        ActionPanel.Visibility = Rsc.Collapsed;
                    }
                }

                break;
            }

            case "delete files_Cancel":
            {
                m_AppFrame.SetStatusText("User canceled operation!", StatusColoring.Error);
                break;
            }

            case "delete files":
            {
                if (e.Pos >= m_files.Count)
                {
                    e.Completed = true;
                }
                else
                {
                    RscFileItemDesc it = m_files[e.Pos];

                    string sErr = "";
                    try
                    {
                        RscStore store = new RscStore();
                        store.DeleteFile(it.Path);
                    }
                    catch (Exception exc)
                    {
                        sErr = "Unable to delete file.\r\n" + exc.Message;
                    }

                    if (sErr.Length == 0)
                    {
                        m_files.RemoveAt(e.Pos);

                        if (e.Pos < m_files.Count)
                        {
                            int iPos = e.Pos;
                            e.Pos = iPos;                                     //Denie subsys to increment...
                        }
                        else
                        {
                            e.Completed = true;
                        }
                    }
                    else
                    {
                        it.LastError = sErr;

                        //ReQuery...
                        lbFiles.ItemsSource = null;
                        lbFiles.ItemsSource = m_files;

                        if (e.Pos < (m_files.Count - 1))
                        {
                            e.Max++;
                        }
                        else
                        {
                            e.Completed = true;
                        }
                    }
                }

                if (e.Completed)
                {
                    if (m_files.Count == 0)                              //Otherwise error occured...
                    {
                        if (chbRecurse.IsChecked.Value)                  //Otherwise no sub-tree deletion...
                        {
                            int iIdx = (m_folders.Count - 1) + 1;
                            for (;;)
                            {
                                iIdx--;
                                if (iIdx < 0)
                                {
                                    break;
                                }

                                try
                                {
                                    if (m_folders[iIdx].Path.Length > 0)
                                    {
                                        RscStore store = new RscStore();
                                        store.DeleteFolder(m_folders[iIdx].Path);
                                    }

                                    m_folders.RemoveAt(iIdx);
                                }
                                catch (Exception /*exc*/)
                                {
                                }
                            }
                        }
                    }

                    if (m_files.Count == 0)
                    {
                        m_AppFrame.SetStatusText("Delete succeeded!", StatusColoring.Success);

                        // //
                        //

                        if (m_sAutoOperation.Length > 0)
                        {
                            if (m_iAutoOpPath + 1 < m_asAutoOpPathes.Length)
                            {
                                m_iAutoOpPath++;
                                m_txtRootFldr.Text = m_asAutoOpPathes[m_iAutoOpPath];
                                m_AppFrame.AutoClick(m_btnCycle, new System.Windows.RoutedEventHandler(m_btnCycle_Click));
                            }
                            else
                            {
                                PrepareExit();
                                NavigationService.GoBack();
                            }
                        }

                        //
                        // //
                    }
                    else
                    {
                        m_AppFrame.SetStatusText("Delete failed for some item(s)!", StatusColoring.Error);
                    }

                    //Causes exception...
                    //ListFiles();

                    ActionPanel.Visibility = Rsc.Collapsed;
                }

                break;
            }
            }
        }