Exemple #1
0
        private static void WriteLength()
        {
            int From = 1;
            int To   = 65510;

            Form  f   = new Form();
            Label lbl = new Label();

            lbl.AutoSize = true;
            lbl.Padding  = new Padding(0);
            lbl.Font     = new Font("굴림체", 10);
            f.Controls.Add(lbl);


            int OneOld = 0, OneCur = 0, OneFirst = 0;

            for (int i = From; i < To; i++)
            {
                string c = ((char)i).ToString();
                lbl.Text = c;
                int Width = lbl.Width;
                if (Width <= 12)
                {
                    OneOld = OneCur;
                    OneCur = i;

                    if ((OneOld + 1) < OneCur)
                    {
                        string Line = Width.ToString() + "," + c + "," + OneFirst.ToString() + "~" + OneOld.ToString();
                        CFile.AppendTextToFile("C:\\One.txt", Line);
                        Debug.WriteLine(Line);

                        OneFirst = OneCur;
                    }
                }
            }

            MessageBox.Show("완료");
        }
Exemple #2
0
        void tmr_Elapsed(object sender, ElapsedEventArgs e)
        {
            const char Delim = '─';

            if (this.mRunning)
            {
                return;
            }
            else
            {
                this.mRunning = true;
            }

            string LogFullPath      = GetLogFullPath();
            string LogFolderForSync = Path.GetDirectoryName(LogFullPath);

            try
            {
                CXmlConfig xc = GetXmlConfig();

                string[] aRootPathSrc = xc.GetSetting("RootPathSrc", "").Split(Delim);

                string[] aFtpHost = xc.GetSetting("FtpHost", "").Split(Delim);
                string[] aFtpId   = xc.GetSetting("FtpId", "").Split(Delim);

                string[] aFtpPassword = xc.GetSetting("FtpPassword", "").Split(Delim);
                for (int i = 0; i < aFtpPassword.Length; i++)
                {
                    aFtpPassword[i] = CEncrypt.DecryptPassword(aFtpPassword[i]);
                }

                string[] aFtpFolder = xc.GetSetting("FtpFolder", "").Split(Delim);

                string[] aSyncType = xc.GetSetting("SyncType", "").Split(Delim);

                string[] aMinifyJs = xc.GetSetting("MinifyJs", "").Split(Delim);

                string[] aFileNameToAppendParam = xc.GetSetting("FileNameToAppendParam", "").Split(Delim);

                string[]   asDateTimeAfter = xc.GetSetting("DateTimeAfter", "").Split(Delim);
                DateTime[] aDateTimeAfter  = new DateTime[asDateTimeAfter.Length];
                for (int i = 0; i < asDateTimeAfter.Length; i++)
                {
                    aDateTimeAfter[i] = CFindRep.IfNotDateTimeThen19000101(asDateTimeAfter[i]);
                }


                for (int i = 0; i < aRootPathSrc.Length; i++)
                {
                    CFtpInfoSync[] aFtpInfo = new CFtpInfoSync[]
                    {
                        new CFtpInfoSync()
                        {
                            Host     = aFtpHost[i],
                            UserId   = aFtpId[i],
                            Password = aFtpPassword[i],
                            Folder   = aFtpFolder[i]
                        }
                    };

                    CSyncFile sf = new CSyncFile(aRootPathSrc[i], aFtpInfo, CEnum.GetValueByName <SyncTypes>(aSyncType[i]), (aMinifyJs[i] == "1"), aFileNameToAppendParam, aDateTimeAfter[i], LogFolderForSync);
                    sf.DisallowedFolder = new string[] { LogFolderForSync };
                    sf.CopyAll();

                    aDateTimeAfter[i] = DateTime.Now;
                }


                for (int i = 0; i < aDateTimeAfter.Length; i++)
                {
                    asDateTimeAfter[i] = aDateTimeAfter[i].ToString(CConst.Format_yyyy_MM_dd_HH_mm_ss);
                }

                xc.SaveSetting("DateTimeAfter", string.Join(Delim.ToString(), asDateTimeAfter));
            }
            catch (Exception ex)
            {
                CFile.AppendTextToFile(LogFullPath, "Error " + DateTime.Now.ToString()
                                       + "\r\n" + ex.Message
                                       + "\r\n" + ex.StackTrace
                                       + "\r\n" + ex.Source);
            }

            this.mRunning = false;
        }
Exemple #3
0
        protected override void OnStop()
        {
            string FullPath = GetLogFullPath();

            CFile.AppendTextToFile(FullPath, "Stop " + DateTime.Now.ToString());
        }