Пример #1
0
        public static int GenerateTumbler(int userid, string username, string key)
        {
            string hUserID = MyLib.IntToHex(userid).ToUpper();
            string s       = hUserID + key + username + key;

            return(ProcessInput(s));
        }
Пример #2
0
        // 130501
        //public static string csExportSelected(this GridControl grid, string DirectoryPath, string _filename)
        //{
        //    try
        //    {
        //        string filename = MyLib.GetSaveFileName(DirectoryPath, "xls", "Excel | *.xls", "Save Grid To Excel",
        //                                                _filename);
        //        if (filename != string.Empty)
        //        {
        //            if (File.Exists(filename))
        //            {
        //                File.Delete(filename);
        //            }
        //            //            string.Format("Got Here {0}", filename).csTell();

        //            grid.ExportToXls(filename);
        //            return Path.GetDirectoryName(filename);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        string msg = "valid";
        //        if (grid == null) msg = "null";
        //        msg = string.Format("Message: {0} Directory: {1} FileName: {2}", ex.Message, msg, DirectoryPath,
        //                            _filename);
        //        msg.csTell();
        //    }
        //    "File Not Saved".csTell();
        //    return DirectoryPath;
        //}

        public static string csExport(this GridControl grid, string DirectoryPath, string _filename)
        {
            try
            {
                string filename = MyLib.GetSaveFileName(DirectoryPath, "xls", "Excel | *.xls", "Save Grid To Excel",
                                                        _filename);
                if (filename != string.Empty)
                {
                    if (File.Exists(filename))
                    {
                        File.Delete(filename);
                    }
                    //            string.Format("Got Here {0}", filename).csTell();
                    grid.ExportToXls(filename);
                    return(Path.GetDirectoryName(filename));
                }
            }
            catch (Exception ex)
            {
                string msg = "valid";
                if (grid == null)
                {
                    msg = "null";
                }
                msg = string.Format("Message: {0} Directory: {1} FileName: {2}", ex.Message, msg, DirectoryPath,
                                    _filename);
                msg.csTell();
            }
            "File Not Saved".csTell();
            return(DirectoryPath);
        }
Пример #3
0
        public static string DateToHex(DateTime d)
        {
            TimeSpan ts   = d - mjcDate;
            int      days = ts.Days;

            return(MyLib.IntToHex(days));
        }
Пример #4
0
        public static string csGridToXLS(this GridControl grid, string folder, string fileName)
        {
            var temp = MyLib.GetSaveFileName(folder
                                             , "xls"
                                             , "xls"
                                             , "Save Grid"
                                             , fileName);

            grid.ExportToXls(temp);
            return(Path.GetDirectoryName(temp));
        }
Пример #5
0
        public static void csLoadSpellCheckDictionaries(this SpellChecker sc, string currentDirectory = "")
        {
            //    new DevExpress.XtraSpellChecker.FormShowingEventHandler
            //sc.SpellingFormShowing += new DevExpress.XtraSpellChecker.SpellingFormShowingEventHandler(spellChecker1_SpellingFormShowing);
            //sc.OptionsFormShowing += new DevExpress.XtraSpellChecker.FormShowingEventHandler(spellChecker1_OptionsFormShowing);
            //sc.CheckCompleteFormShowing += new DevExpress.XtraSpellChecker.FormShowingEventHandler(spellChecker1_CheckCompleteFormShowing);
            sc.SpellingFormShowing      += spellChecker1_SpellingFormShowing;
            sc.OptionsFormShowing       += spellChecker1_OptionsFormShowing;
            sc.CheckCompleteFormShowing += spellChecker1_CheckCompleteFormShowing;
            if (string.IsNullOrEmpty(currentDirectory))
            {
                currentDirectory = MyLib.GetRelativeFolder() + @"\Spelling";
            }
            SpellCheckerOpenOfficeDictionary openOfficeDictionaryEnglish = new SpellCheckerOpenOfficeDictionary();
            string filename = currentDirectory + @"\en_US.dic";

            if (!File.Exists(filename))
            {
                "Bad Name".csTell();
            }
            openOfficeDictionaryEnglish.DictionaryPath = filename;

            filename = currentDirectory + @"\en_US.aff";
            if (!File.Exists(filename))
            {
                "Bad Name".csTell();
            }
            openOfficeDictionaryEnglish.GrammarPath = filename;

            openOfficeDictionaryEnglish.Culture = new CultureInfo("en-US");
            sc.Dictionaries.Add(openOfficeDictionaryEnglish);

            SpellCheckerCustomDictionary customDictionary = new SpellCheckerCustomDictionary();

            filename = currentDirectory + @"\EnglishAlphabet.txt";
            if (!File.Exists(filename))
            {
                "Bad Name".csTell();
            }
            customDictionary.AlphabetPath = filename;

            customDictionary.Culture = CultureInfo.InvariantCulture;
            sc.Dictionaries.Add(customDictionary);

            sc.Culture        = CultureInfo.InvariantCulture;
            sc.SpellCheckMode = SpellCheckMode.AsYouType;
        }
        public static string csSaveChartImageToFile(this ChartControl c, string path, string chartName = null)
        {
            if (string.IsNullOrEmpty(chartName))
            {
                ChartElement[] t = c.Titles.ToArray();
                if (t.Length > 0)
                {
                    foreach (ChartElement chartElement in t)
                    {
                        chartName += (chartElement + " ");
                    }
                }
            }
            chartName = chartName.Replace("\r\n", " ").Replace("/", "-").Replace(":", "_").Trim();
            // strip out the html
            int loc = chartName.IndexOf('<');

            while (loc > -1)
            {
                // find closing angle bracket
                int floc = chartName.IndexOf('>');
                if (floc > loc)
                {
                    chartName = chartName.Substring(0, loc) + " " + chartName.Substring(floc + 1);
                    loc       = chartName.IndexOf('<');
                }
                else
                {
                    break;
                }
            }
            chartName = chartName.Replace('<', '-').Replace('>', '-');
            var temp = MyLib.GetSaveFileName(path
                                             , "png"
                                             , "png"
                                             , "Save Chart Image"
                                             , chartName);

            if (string.IsNullOrEmpty(temp))
            {
                return(path);
            }
            c.ExportToImage(temp, ImageFormat.Png);
            return(Path.GetDirectoryName(temp));
        }
Пример #7
0
        public static DateTime HexToDate(string UserId)
        {
            int days = MyLib.HexToInt(UserId);

            return(mjcDate.AddDays(days));
        }
Пример #8
0
 public TReEventTypetration(string Userid_HEX, int Key, string Name)
 {
     USERID = MyLib.HexToInt(Userid_HEX);
     KEY    = Key;
     NAME   = Name;
 }
Пример #9
0
 public TReEventTypetration(string Userid_HEX, string Key_DD, string Name)
 {
     USERID = MyLib.HexToInt(Userid_HEX);
     KEY    = TCipher.DottedToInt(Key_DD);
     NAME   = Name;
 }
Пример #10
0
        public void Plot()
        {
            string link = string.Format(mapUrlFormatString, MAPSIZE.Height, MAPSIZE.Width, ZOOM);

            foreach (var m in MARKERS)
            {
                var s =
                    string.Format("&markers=color:{0}%7Clabel:{1}%7C{2}", m.COLOR.ToString(), m.MARKER, m.POINT).csPlusSub
                        ();
                if ((link.Length + s.Length) < linkLimit)
                {
                    link = link + s;
                }
            }
            foreach (var p in PATHS)
            {
                string s = string.Empty;
                // Now Create Path
                string spath = string.Format("&path=color:{0}%7Cweight:{1}", p.PATH_COLOR, p.WEIGHT);
                foreach (var point in p.POINTS)
                {
                    if (point.LATITUDE < 20 || point.LONGITUDE > -30)
                    {
                        s     = string.Empty;
                        spath = string.Empty;
                        break;
                    }
                    spath += string.Format("%7C{0}", point);
                }
                //        logwriter.WriteToLogDate(spath);
                s += spath;
                if (link.Length + s.Length > linkLimit)
                {
                    //             logwriter.WriteToLogDate("////////////// Exceeded the line length /////////////////////////////////");
                    break;
                }
                else
                {
                    link += s;
                }
            }
            //  logwriter.WriteToLogDate(link);
            //   link.Length.ToString().csTell();
            string webstring = WebString.Replace("::FILENAME::", link);

            webstring = webstring.Replace("::DESCRIPTION::", DESCRIPTION.ToString());
            webstring = webstring.Replace("::TITLE::", "Map");
            //    logwriter.WriteToLogDate(webstring);
            //     logwriter.Publish();
            //     logwriter.Dispose();
            //  link.Length.csTell();
            const string fn = "287B5866-0D9D-4D59-A360-0D3113ABBC20.html";

            File.Delete(fn);
            StreamWriter writer = new StreamWriter(fn);

            writer.Write(webstring);
            writer.Flush();
            writer.Close();
            MyLib.RunExternal(fn);
            //   webstring.csTell();
        }