Наследование: System.Collections.IList, System.Collections.ICollection, System.Collections.IEnumerable
		internal AddinRegistry (string registryPath, string startupDirectory)
		{
			basePath = Util.GetFullPath (registryPath);
			database = new AddinDatabase (this);
			addinDirs = new StringCollection ();
			addinDirs.Add (Path.Combine (basePath, "addins"));
		}
Пример #2
0
 public static StringCollection GetAllDeleteFiles(string path, StringCollection sc)
 {
     if (sc == null)
     {
         sc = new StringCollection();
     }
     string[] fileList = Directory.GetFileSystemEntries(path);
     // 遍历所有的文件和目录
     foreach (string file in fileList)
     {
         // 先当作目录处理,如果存在这个目录就递归获取该目录下面的文件
         if (Directory.Exists(file))
         {
             GetAllDeleteFiles(file, sc);
         }
         else
         {
             // 如果是文件,仅取图片文件
             if (file.Contains("_s_mobile_"))
             {
                 sc.Add(file);
             }
         }
     }
     return sc;
 }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Iterating over string array");
            var rainbowColors = new[] { "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet" };
            foreach (var rainbowColor in rainbowColors)
            {
                Console.WriteLine(rainbowColor);
            }

            Console.WriteLine();

            Console.WriteLine("Iterating over specialized collection - StringCollection");
            var cities = new StringCollection { "Pune", "London", "New York", "Mumbai" };
            foreach (var city in cities)
            {
                Console.WriteLine(city);
            }

            Console.WriteLine();

            Console.WriteLine("Iterating over generic collection - List<T>");
            var weekdays = new List<string>() { "Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun" };
            foreach (var weekday in weekdays)
            {
                Console.WriteLine(weekday);
            }

            Console.ReadLine();
        }
Пример #4
0
        public override void Run(KExplorerNode folder)
        {
            StringCollection paths = new StringCollection();

            paths.Add( folder.DirInfo.FullName );
            Clipboard.SetFileDropList(paths);
        }
        /// <summary>
        /// Parses the parameters portion of the message.
        /// </summary>
        protected override void ParseParameters( StringCollection parameters )
        {
            base.ParseParameters( parameters );
            this.Users.Clear();
            String[] userInfo = parameters[ parameters.Count - 1 ].Split( ' ' );
            foreach ( String info in userInfo )
            {
                String nick = info.Substring( 0, info.IndexOf( "=", StringComparison.Ordinal ) );
                Boolean oper = false;
                if ( nick.EndsWith( "*", StringComparison.Ordinal ) )
                {
                    oper = true;
                    nick = nick.Substring( 0, nick.Length - 1 );
                }
                String away = info.Substring( info.IndexOf( "=", StringComparison.Ordinal ) + 1, 1 );
                String standardHost = info.Substring( info.IndexOf( away, StringComparison.Ordinal ) );

                User user = new User();
                user.Parse( standardHost );
                user.Nick = nick;
                user.IrcOperator = oper;
                user.OnlineStatus = ( away == "+" ) ? UserOnlineStatus.Away : UserOnlineStatus.Online;

                this.Users.Add( user );
            }
        }
 private static bool CheckFileNameUsingPaths(string fileName, StringCollection paths, out string fullFileName)
 {
     fullFileName = null;
     string str = fileName.Trim(new char[] { '"' });
     FileInfo info = new FileInfo(str);
     if (str.Length != info.Name.Length)
     {
         if (info.Exists)
         {
             fullFileName = info.FullName;
         }
         return info.Exists;
     }
     using (StringEnumerator enumerator = paths.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             string str3 = enumerator.Current + Path.DirectorySeparatorChar + str;
             FileInfo info2 = new FileInfo(str3);
             if (info2.Exists)
             {
                 fullFileName = str3;
                 return true;
             }
         }
     }
     return false;
 }
        private static string CleanWordHtml(string html)
        {
            StringCollection sc = new StringCollection();

            // get rid of unnecessary tag spans (comments and title)
            sc.Add(@"<!--(\w|\W)+?-->");
            sc.Add(@"<title>(\w|\W)+?</title>");

            // Get rid of classes and styles
            sc.Add(@"\s?class=\w+");
            sc.Add(@"\s+style='[^']+'");

            // Get rid of unnecessary tags
            sc.Add(
                @"<(meta|link|/?o:|/?style|/?div|/?st\d|/?head|/?html|body|/?body|/?span|!\[)[^>]*?>");

            // Get rid of empty paragraph tags
            sc.Add(@"(<[^>]+>)+&nbsp;(</\w+>)+");

            // remove bizarre v: element attached to <img> tag
            sc.Add(@"\s+v:\w+=""[^""]+""");

            // remove extra lines
            sc.Add(@"(\n\r){2,}");
            foreach (string s in sc)
            {
                html = Regex.Replace(html, s, string.Empty, RegexOptions.IgnoreCase);
            }

            return html;
        }
Пример #8
0
 public static StringCollection GetSectionNames(
     String filename)
 {
     StringCollection sections = new StringCollection();
     byte[] buffer = new byte[32768];
     int bufLen = 0;
     bufLen = GetPrivateProfileSectionNames(buffer,
         buffer.GetUpperBound(0), filename);
     if (bufLen > 0)
     {
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < bufLen; i++)
         {
             if (buffer[i] != 0)
             {
                 sb.Append((char)buffer[i]);
             }
             else
             {
                 if (sb.Length > 0)
                 {
                     sections.Add(sb.ToString());
                     sb = new StringBuilder();
                 }
             }
         }
     }
     return sections;
 }
Пример #9
0
        public void ClipboardFetchFilesItemTest()
        {
            string file1 = Path.GetTempFileName();
            string file2 = Path.GetTempFileName();

            var dummyFiles = new StringCollection();

            dummyFiles.Add(file1);
            dummyFiles.Add(file2);

            Clipboard.Clear();
            Clipboard.SetFileDropList(dummyFiles);

            StringCollection copiedList = Clipboard.GetFileDropList();
            Assert.AreEqual(copiedList.Count, dummyFiles.Count);

            var factory = new ClipboardFileFactory();

            var item = factory.CreateNewClipboardItem(IntPtr.Zero) as ClipboardFileCollection;
            Assert.IsNotNull(item);

            Assert.AreEqual(item.Paths.Count(), 2);

            List<string> localList = item.Paths.ToList();

            for (int i = 0; i < localList.Count; i++)
            {
                Assert.AreEqual(localList[i], dummyFiles[i]);
            }

            File.Delete(file1);
            File.Delete(file2);
        }
Пример #10
0
        ///<summary>
        ///</summary>
        public PeekrPop2006()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Source Queues
            mqServerName.Items.Clear();
            queueName.Items.Clear();

            // Target Queues
            targetServerCombo.Items.Clear();
            targetQueueCombo.Items.Clear();
            targetQueue2.Items.Clear();

            // Source Machine Names
            StringCollection sc = new StringCollection ();
            sc.Add ("VDC3APP0006");
            sc.Add ("localhost");

            foreach (string s in sc)
            {
                mqServerName.Items.Add (s);
                targetServerCombo.Items.Add (s);
            }
        }
Пример #11
0
        /// <summary>
        /// http://weblogs.asp.net/jgalloway/archive/2005/09/27/426087.aspx
        /// </summary>
        public static List<string> SplitCamelCase(this string source)
        {
            if (source == null)
                return new List<string> { }; //Return empty array.

            if (source.Length == 0)
                return new List<string> { "" };

            StringCollection words = new StringCollection();
            int wordStartIndex = 0;

            char[] letters = source.ToCharArray();
            // Skip the first letter. we don't care what case it is.
            for (int i = 1; i < letters.Length; i++)
            {
                if (char.IsUpper(letters[i]))
                {
                    //Grab everything before the current index.
                    words.Add(new String(letters, wordStartIndex, i - wordStartIndex));
                    wordStartIndex = i;
                }
            }

            //We need to have the last word.
            words.Add(new String(letters, wordStartIndex, letters.Length - wordStartIndex));

            //Copy to a string array.
            string[] wordArray = new string[words.Count];
            words.CopyTo(wordArray, 0);

            List<string> stringList = new List<string>();
            stringList.AddRange(wordArray);
            return stringList;
        }
Пример #12
0
        public static StringCollection FindPlugin(string pluginName)
        {
            StringCollection namespaces = new StringCollection();
            try
            {
                HxRegistryWalkerClass registryWalker = new HxRegistryWalkerClass();
                IHxRegNamespaceList help2Namespaces = registryWalker.get_RegisteredNamespaceList("");

                foreach (IHxRegNamespace currentNamespace in help2Namespaces)
                {
                    IHxRegPlugInList p =
                        (IHxRegPlugInList)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespacePlugInList);
                    foreach (IHxRegPlugIn plugin in p)
                    {
                        string currentName = (string)plugin.GetProperty(HxRegPlugInPropId.HxRegPlugInName);
                        if (string.Compare(currentName, pluginName) == 0)
                        {
                            namespaces.Add(currentNamespace.Name);
                            break;
                        }
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException)
            {
            }
            return namespaces;
        }
Пример #13
0
 public CDEntry(StringCollection data)
 {
     if (!Parse(data))
     {
         throw new Exception("Unable to Parse CDEntry.");
     }
 }
Пример #14
0
        /// <summary>
        /// Parse the configuratione and decide whether to update
        /// </summary>
        /// <param name="curDateTime"></param>
        /// <param name="workTimes"> there may be one ore more lines as in the following
        /// - Line 0 : 8:00;23:59;Mon,Tue,Wed,Thu,Fri
        /// - Line 1 : 8:00;12:00;Sat
        /// </param>
        /// <returns></returns>
        public static bool IsWorktime(DateTime curDateTime,StringCollection workTimeRules)
        {
            string[] list;
            DateTime dt = common.Consts.constNullDate;
            
            //Empty  means ALL
            if (workTimeRules.Count == 0) return true;

            for (int idx = 0; idx < workTimeRules.Count; idx++)
            {
                //"Start time" ;  "End Time" ; "Dow,,Dow"
                list = common.system.String2List(workTimeRules[idx], ";");
                if (list.Length != 3)
                {
                    commonClass.SysLibs.WriteSysLog(common.SysSeverityLevel.Error,"SRV001", "Invalid config : " + workTimeRules[idx]);
                    return false;
                }
                //Start date
                if (common.dateTimeLibs.StringToDateTime(list[0], out dt))
                {
                    if (curDateTime < dt) continue;
                }
                //End date
                if (common.dateTimeLibs.StringToDateTime(list[1], out dt))
                {
                    if (curDateTime > dt) continue;
                }
                //dayOfWeek
                string[] dow = common.system.String2List(list[2]);
                if (dow.Length > 0 && !dow.Contains(curDateTime.DayOfWeek.ToString().Substring(0, 3))) continue;
                return true;
            }
            return false;
        }
Пример #15
0
 public CFileFound(string in_Hash, string in_Name, uint in_Size, uint in_Avaibility, string in_codec,string in_length,uint in_bitrate, bool in_complete, uint in_ip, ushort in_port)
 {
     this.Hash=in_Hash;
     this.Name=in_Name;
     this.Size=in_Size;
     this.Avaibility=in_Avaibility;
     Codec=in_codec;
     BitRate=in_bitrate;
     Length=in_length;
     Complete=in_complete;
     this.OtherNames=new StringCollection();
     this.OtherNames.Add(Name);
     CElement element=CKernel.FilesList[CKernel.StringToHash(in_Hash)];
     if (element==null)
         ResultState=Types.Constants.SearchResultState.New;
     else if (element.File.FileStatus==Protocol.FileState.Complete)
         ResultState=Types.Constants.SearchResultState.AlreadyDownloaded;
     else
         ResultState=Types.Constants.SearchResultState.AlreadyDownloading;
     if ((in_ip>Protocol.LowIDLimit)&&(in_port>0)&&(in_port<ushort.MaxValue))
     {
         Sources=new Hashtable();
         Sources.Add(in_ip,in_port);
         //Debug.WriteLine(in_ip.ToString()+":"+in_port.ToString());
         if ((element!=null)&&(element.File.FileStatus==Protocol.FileState.Ready))
             CKernel.ClientsList.AddClientToFile(in_ip,in_port,0,0,element.File.FileHash);
     }
 }
Пример #16
0
 internal static void AddFile(StringCollection files)
 {
     SelectedItem selectedItem = VSIHelper.DTE2.SelectedItems.Item(1);
     ProjectItems projectItems = null;
     if (selectedItem.Project != null && selectedItem.ProjectItem == null)
     {
         projectItems = selectedItem.Project.ProjectItems;
     }
     if (selectedItem.Project == null && selectedItem.ProjectItem != null)
     {
         projectItems = selectedItem.ProjectItem.ProjectItems;
     }
     if (projectItems != null)
     {
         ProjectItem lastItem = null;
         foreach (var file in files)
         {
             try
             {
                 lastItem = projectItems.AddFromFileCopy(file);
             }
             catch { }
         }
         if (lastItem != null)
         {
             VSIHelper.DTE2.ItemOperations.OpenFile(lastItem.get_FileNames(1), EnvDTE.Constants.vsViewKindPrimary);
         }
     }
 }
 public DesignColumn()
 {
     this.namingPropNames = new StringCollection();
     this.dataColumn = new System.Data.DataColumn();
     this.designTable = null;
     this.namingPropNames.Add("typedName");
 }
Пример #18
0
        public static string[] SplitUpperCase(this string source)
        {
            if (source == null)
                return new string[] {}; //Return empty array.

            if (source.Length == 0)
                return new[] {""};

            var words = new StringCollection();
            int wordStartIndex = 0;

            char[] letters = source.ToCharArray();
            char previousChar = char.MinValue;
            // Skip the first letter. we don't care what case it is.
            for (int i = 1; i < letters.Length; i++)
            {
                if (char.IsUpper(letters[i]) && !char.IsWhiteSpace(previousChar))
                {
                    //Grab everything before the current index.
                    words.Add(new String(letters, wordStartIndex, i - wordStartIndex));
                    wordStartIndex = i;
                }
                previousChar = letters[i];
            }
            //We need to have the last word.
            words.Add(new String(letters, wordStartIndex, letters.Length - wordStartIndex));

            //Copy to a string array.
            var wordArray = new string[words.Count];
            words.CopyTo(wordArray, 0);
            return wordArray;
        }
Пример #19
0
        /// http://jeanne.wankuma.com/tips/csharp/directory/getfilesmostdeep.html
        /// ---------------------------------------------------------------------------------------
        /// <summary>
        ///     指定した検索パターンに一致するファイルを最下層まで検索しすべて返します。</summary>
        /// <param name="stRootPath">
        ///     検索を開始する最上層のディレクトリへのパス。</param>
        /// <param name="stPattern">
        ///     パス内のファイル名と対応させる検索文字列。</param>
        /// <returns>
        ///     検索パターンに一致したすべてのファイルパス。</returns>
        /// ---------------------------------------------------------------------------------------
        public static string[] GetFilesMostDeep(string stRootPath, string stPattern)
        {
            // ファイルリスト取得開始をデバッグ出力
            Debug.Print(DateTime.Now + " Started to get files recursivery.");

            StringCollection hStringCollection = new StringCollection();

            // このディレクトリ内のすべてのファイルを検索する
            foreach (string stFilePath in Directory.GetFiles(stRootPath, stPattern))
            {
                hStringCollection.Add(stFilePath);
                Debug.Print(DateTime.Now + " Found image file, Filename = " + stFilePath);
            }

            // このディレクトリ内のすべてのサブディレクトリを検索する (再帰)
            foreach (string stDirPath in Directory.GetDirectories(stRootPath))
            {
                string[] stFilePathes = GetFilesMostDeep(stDirPath, stPattern);

                // 条件に合致したファイルがあった場合は、ArrayList に加える
                if (stFilePathes != null)
                {
                    hStringCollection.AddRange(stFilePathes);
                }
            }

            // StringCollection を 1 次元の String 配列にして返す
            string[] stReturns = new string[hStringCollection.Count];
            hStringCollection.CopyTo(stReturns, 0);

            // ファイルリスト取得終了をデバッグ出力
            Debug.Print(DateTime.Now + " Finished to get files recursivery.");

            return stReturns;
        }
Пример #20
0
        //read brain file from disc
        protected StringCollection readBrainFile()
        {
            StringCollection sc = new StringCollection();
            if(File.Exists(filePath))
            {
               	FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
               	StreamReader rs = new StreamReader(fs);
               	string line;
               	while ((line = rs.ReadLine()) != null)
                {
               		sc.Add(line);
               	}
               	rs.Close();
               	fs.Close();
            }
            else
            {
                MessageBox.Show("No mind file found, creating new one");
                FileStream cs = File.Create(filePath);
                cs.Close();
                FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
               	StreamReader rs = new StreamReader(fs);
               	string line;
               	while ((line = rs.ReadLine()) != null)
                {
               		sc.Add(line);
               	}
               	rs.Close();
               	fs.Close();

            }
            return sc;
        }
 /// <summary>
 /// Receives the old name and the not valid names list
 /// </summary>
 /// <param name="displaySetName"></param>
 /// <param name="notValidNames"></param>
 public void Initialize(string displaySetName, StringCollection notValidNames)
 {
     mName = displaySetName;
     mNotValidNames = notValidNames;
     ApplyMultilanguage();
     LoadValues();
 }
Пример #22
0
        /// <summary>
        ///   Converts the given object to a StringCollection.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
        /// <param name="culture">The CultureInfo to use as the current culture.</param>
        /// <param name="value">The object to convert.</param>
        /// <returns>A StringCollection converted from value.</returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string valueAsStr = value as string;
            if (valueAsStr != null)
            {
                string str = valueAsStr.Trim();
                if (str.Length == 0)
                {
                    return null;
                }

                char ch = ',';
                if (culture != null)
                {
                    ch = culture.TextInfo.ListSeparator[0];
                }
                string[] strings = str.Split(ch);
                StringCollection stringCollection = new StringCollection();
                foreach (string s in strings)
                {
                    stringCollection.Add(s);
                }

                return stringCollection;
            }

            return base.ConvertFrom(context, culture, value);
        }
Пример #23
0
        /// <summary>
        /// Generate statistics file
        /// </summary>
        /// <returns></returns>
        public StringCollection generate()
        {                                
            #region delete all older files (of the same type) for this questionnaire to clean temp-Directory
            try
            {
                foreach (string file in Directory.GetFiles(pathtotempdir, "RFG_report_statistic_*"))
                {
                    File.Delete(file);
                }                
            }
            catch (Exception ex)
            {
                string dummy = ex.ToString();
            }
            #endregion
            
            int statistics_records = -1;
            List<string> files_names = new List<string>();
            statistics_records = ReportingFacade.Format(from, until, ordering, row_number, pathtotempdir,Company_Code, ref files_names);                   

            StringCollection retvals = new StringCollection();
            retvals.Add(statistics_records.ToString());
            foreach (String file in files_names)
                retvals.Add(file);
            return retvals;
        }
 public void AsEnumerable_NonEmptyCollectionShouldReturnNonEmptyResult()
 {
     var collection = new StringCollection { "foo", "bar" };
     Assert.That(collection.AsEnumerable().Count(), Is.EqualTo(2));
     Assert.That(collection.AsEnumerable().First(), Is.EqualTo("foo"));
     Assert.That(collection.AsEnumerable().Last(), Is.EqualTo("bar"));
 }
 protected override void AddNicks( StringCollection nicks )
 {
     foreach ( String nick in nicks )
     {
         AddNick( nick );
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="StatusStripExtender"/> class.
        /// </summary>
        public StatusStripExtender()
        {
            _timer = new Timer { Enabled = false, Interval = _statusDefaultDuration };
            _timer.Tick += _timer_Tick;

            _toolTipList = new StringCollection();
        }
Пример #27
0
		protected void Page_Load(object sender, EventArgs e)
		{
			// Initialise data table to hold test results
			m_results.Columns.Add("test");
			m_results.Columns.Add("result");
            m_results.Columns.Add("time");
			m_results.Columns.Add("message");
			m_results.Columns.Add("class");

			// Initialise controls
			lblResult.Text = "";
			ltlStats.Text = "";

			// Initialise NUnit
			CoreExtensions.Host.InitializeService();

			// Find tests in current assembly
			TestPackage package = new TestPackage(Assembly.GetExecutingAssembly().Location);
			m_testSuite = new TestSuiteBuilder().Build(package);

			if (!IsPostBack)
			{
				// Display category filters
				StringCollection coll = new StringCollection();
				GetCategories((TestSuite)m_testSuite, coll);
				string[] cats = new string[coll.Count];
				coll.CopyTo(cats, 0);
				Array.Sort(cats);
				cblCategories.DataSource = cats;
				cblCategories.DataBind();
			}
		}
Пример #28
0
 public static StringCollection GetAllFiles(string path, StringCollection sc)
 {
     if (sc == null)
     {
         sc = new StringCollection();
     }
     string[] fileList = Directory.GetFileSystemEntries(path);
     // 遍历所有的文件和目录
     foreach (string file in fileList)
     {
         // 先当作目录处理,如果存在这个目录就递归获取该目录下面的文件
         if (Directory.Exists(file))
         {
             //string pathName = System.IO.Path.GetFileName(file).ToLower();
             GetAllFiles(file, sc);
         }
         else
         {
             // 如果是文件,仅取图片文件
             if (file.Contains("_s_mobile_"))
             {
                 continue;
             }
             string fileExtension = GetFileExtension(file);
             if (!String.IsNullOrEmpty(fileExtension))
             {
                 if (ContainString(fileExtension.ToLower(), ".jpg", ".jpeg", ".png", ".gif", ".bmp"))
                 {
                     sc.Add(file);
                 }
             }
         }
     }
     return sc;
 }
Пример #29
0
 /// <summary>
 /// Instantiate a new Insignia class.
 /// </summary>
 private Insignia()
 {
     this.invalidArgs = new StringCollection();
     this.messageHandler = new ConsoleMessageHandler("INSG", "Insignia.exe");
     this.showLogo = true;
     this.tidy = true;
 }
Пример #30
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void ExecuteTask()
		{
			string oldDir = Directory.GetCurrentDirectory();
			string baseDir = CopyFileSet.BaseDirectory.FullName;
			try
			{
				Directory.SetCurrentDirectory(baseDir);
				foreach (string filename in CopyFileSet.FileNames)
				{
					StringCollection asmNames = new StringCollection();
					m_assemblyNamesCollection.Add(asmNames);
					ProcessAssembly(filename);
					m_currentAssemblyCollection++;
				}

				// Create directory if not present
				if (!Directory.Exists(ToDirectory))
				{
					Directory.CreateDirectory(ToDirectory);
					Log(Level.Verbose, "Created directory: {0}", ToDirectory);
				}

				CountAssemblyReferencesAndReloadFileList();
				BuildAssemblyFileLists();
			}
			finally
			{
				Directory.SetCurrentDirectory(oldDir);
			}
		}
Пример #31
0
 SwapClipboardFileDropList(
     System.Collections.Specialized.StringCollection replacementList)
 {
     System.Collections.Specialized.StringCollection returnList = null;
     if (Clipboard.ContainsFileDropList())
     {
         returnList = Clipboard.GetFileDropList();
         Clipboard.SetFileDropList(replacementList);
     }
     return(returnList);
 }
Пример #32
0
    public void CreatDB(string dataFileDir)
    {
        ServerConnection c = new ServerConnection(".", "sa", "hudongsoft");
        Server           s = new Server(c);

        //s.AttachDatabase(
        //Database db = new Database(s, DataBaseName);
        //db.Create();
        System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
        sc.Add(dataFileDir + @"\HdHouse.mdf");
        sc.Add(dataFileDir + @"\HdHouse_log.ldf");
        s.AttachDatabase(publicationDatabase, sc);
    }
Пример #33
0
 //Modified the code to add preview functionality for Softroll by Radha S - Start
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             if (Request["preview"].ToString() == "original")
             {
                 item = QDEUtils.GetItemIdFromRequest();
                 long itemId = item.Id;
                 template = item.Templates;
                 funLoadContent();
             }
             if (Request["preview"].ToString() == "softroll")
             {
                 item = QDEUtils.GetItemIdFromRequest();
                 Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Crystal_DB"].ConnectionString);
                 DataSet  ds    = new DataSet();
                 ds = dbObj.RunSQLReturnDataSet("select NodeOID,ItemId,IsRoll from Items where NodeOID in(select NodeOID  from Items where ItemId =" + item.Id + ")");
                 if (ds.Tables[0].Rows.Count > 1)
                 {
                     DataRow[] dr1 = ds.Tables[0].Select("IsRoll = true");
                     for (int drVal = 0; drVal < dr1.Length; drVal++)
                     {
                         long itemId = Convert.ToInt64(dr1[drVal]["ItemId"].ToString());
                         item = QDEUtils.GetItemIdFromRequest(itemId);
                     }
                     itemSoftroll = QDEUtils.GetItemIdFromRequest();
                     if (item.Templates.Count >= 0)
                     {
                         template = itemSoftroll.Templates;
                     }
                     funLoadContent();
                 }
                 else
                 {
                     ClientScript.RegisterClientScriptBlock(GetType(), "Preview", "<script> alert('This Item is not a Softroll Item, Preview Not Available'); window.close();</script>", false);
                     tblPreview.Visible = false;
                     pnlMsg.Visible     = false;
                 }
             }
             //Modified the code to add preview functionality for Softroll by Radha S - End
         }
         catch
         {
             UITools.DenyAccess(DenyMode.Popup);
         }
     }
 }
Пример #34
0
    /// <summary>
    /// Retrieves the IP addresses from the web.config
    /// and adds them to a StringCollection.
    /// </summary>
    /// <returns>A StringCollection of IP addresses.</returns>
    private static System.Collections.Specialized.StringCollection FillBlockedIps()
    {
        System.Collections.Specialized.StringCollection scIPcollection = new System.Collections.Specialized.StringCollection();
        //Dim strRaw As String = ConfigurationManager.AppSettings.Get("blockip")
        string strRaw = "44.0.234.122, 23.4.9.231";

        strRaw = strRaw.Replace(",", ";");
        strRaw = strRaw.Replace(" ", ";");

        foreach (string strIP in strRaw.Split(";"))
        {
            scIPcollection.Add(strIP.Trim());
        }

        return(scIPcollection);
    }
Пример #35
0
    public static void Main(string[] args)
    {
        WqlEventQuery query = new WqlEventQuery();

        query.EventClassName      = "__InstanceCreationEvent";
        query.Condition           = "TargetInstance ISA 'Win32_NTLogEvent'";
        query.GroupWithinInterval = new TimeSpan(0, 0, 10);
        System.Collections.Specialized.StringCollection collection =
            new System.Collections.Specialized.StringCollection();
        collection.Add("TargetInstance.SourceName");
        query.GroupByPropertyList = collection;
        query.HavingCondition     = "NumberOfEvents > 25";

        Console.WriteLine(query.QueryString);
        return;
    }
Пример #36
0
        void Copy_AddFolder()
        {
            // HTodo  :复制的文件路径
            string text = System.Windows.Clipboard.GetText();

            if (!string.IsNullOrEmpty(text))
            {
                if (Directory.Exists(text))
                {
                    FileBindModel f = new FileBindModel(Directory.CreateDirectory(text));
                    this.BkSource.Add(f);
                }

                if (File.Exists(text))
                {
                    FileInfo      file = new FileInfo(text);
                    FileBindModel f    = new FileBindModel(file);

                    this.BkSource.Add(f);
                }
            }


            // HTodo  :复制的文件
            System.Collections.Specialized.StringCollection list = System.Windows.Clipboard.GetFileDropList();

            foreach (var item in list)
            {
                if (Directory.Exists(item))
                {
                    FileBindModel f = new FileBindModel(Directory.CreateDirectory(item));
                    this.BkSource.Add(f);
                }

                if (File.Exists(item))
                {
                    FileInfo      file = new FileInfo(item);
                    FileBindModel f    = new FileBindModel(file);

                    this.BkSource.Add(f);
                }
            }

            this.RefreshUI();

            this.SaveToFile();
        }
Пример #37
0
 private void Load()
 {
     _windowTop       = Properties.Settings.Default.WindowTop;
     _windowLeft      = Properties.Settings.Default.WindowLeft;
     _windowHeight    = Properties.Settings.Default.WindowHeight;
     _windowWidth     = Properties.Settings.Default.WindowWidth;
     _windowState     = Properties.Settings.Default.WindowState;
     _workingFolder   = Properties.Settings.Default.WorkingFolder;
     _fontSize        = Properties.Settings.Default.FontSize;
     _fontFamily      = Properties.Settings.Default.FontFamily;
     _favoriteFolders = Properties.Settings.Default.FavoriteFolders;
     if (_favoriteFolders == null)
     {
         _favoriteFolders = new StringCollection();
     }
     _showStatusbar = Properties.Settings.Default.ShowStatusbar;
 }
Пример #38
0
        public static TemplateList GetAll()
        {
            HyperCatalog.WebServices.DAMWS.DAMWebService templateRepository = HCPage.WSDam;
            Business.Debug.Trace("WEBUI", "DAM uri = " + templateRepository.Url, DebugSeverity.Low);
            XmlDocument xmlTemplates = new XmlDocument();

            xmlTemplates.LoadXml(templateRepository.ResourceGetAll("Templates"));
            XmlNodeList childNodes = xmlTemplates.DocumentElement.ChildNodes;

            System.Collections.Specialized.StringCollection templates = new System.Collections.Specialized.StringCollection();
            TemplateList tList = new TemplateList();

            foreach (XmlNode n in childNodes)
            {
                tList.Add(new Template(n.Attributes["name"].InnerText));
            }
            return(tList);
        }
Пример #39
0
        private void SaveSettings()
        {
            StringCollection stringCollection = new StringCollection();

            foreach (var item in _OutputWindowList)
            {
                stringCollection.Add(Convert.ToString(item));
            }

            //Saves all settings from the current session for retrieval later.
            Properties.Settings.Default.Angle1       = _Settings.Angle1;
            Properties.Settings.Default.Angle2       = _Settings.Angle2;
            Properties.Settings.Default.Angle3       = _Settings.Angle3;
            Properties.Settings.Default.Angle4       = _Settings.Angle4;
            Properties.Settings.Default.CurrentAngle = _Settings.CurrentAngle;
            Properties.Settings.Default.FixedDecimal = _Settings.FixedDecimals;
            Properties.Settings.Default.OutputWindowStringCollection = stringCollection;
            Properties.Settings.Default.Save();
        }
Пример #40
0
        public static void LearnStringCollection()
        {
            Console.WriteLine("From LearnStringCollection Method");
            System.Collections.Specialized.StringCollection strCollection
                = new System.Collections.Specialized.StringCollection();
            String[] arString = new String[] { "ATUL", "THERAN" };
            strCollection.AddRange(arString);
            strCollection.Add("atul");      //Adding same in another case
            strCollection.Add("THERAN");    //Adding duplicate

            foreach (var item in strCollection)
            {
                Console.WriteLine(item);
            }
            for (int i = 0; i < strCollection.Count; i++)
            {
                Console.WriteLine($"Value at index # {i} is {strCollection[i]}");
            }
        }
Пример #41
0
        /// <summary>
        /// Sets the groupinginfo GroupPres for a variable
        /// </summary>
        /// <param name="groupingInfoGroupPres">names of the groupingInfo</param>
        /// <param name="variablecode">name of the variable that has the given grouping</param>
        /// <param name="meta"></param>
        /// <remarks></remarks>
        private void SetGroupingInfoGroupPres(string variablecode, System.Collections.Specialized.StringCollection groupingInfoGroupPres, PCAxis.Paxiom.PXMeta meta)
        {
            Variable paxiomVariable;

            paxiomVariable = FindVariable(meta, variablecode);
            if (paxiomVariable == null)
            {
                log.Debug("SetGroupingInfoNames: Can't find variablecode:\"" + variablecode + "\"");
                return;
            }
            log.Debug("SetGroupingInfoNames: for variablecode:\"" + variablecode + "\"");

            if (paxiomVariable.Groupings.Count != groupingInfoGroupPres.Count)
            {
                throw new ApplicationException("Number of names differ from number of value sets");
            }

            PCAxis.Paxiom.GroupingIncludesType aggregationType;


            for (int i = 0; i < groupingInfoGroupPres.Count; i++)
            {
                log.Debug("groupingInfoGroupPres[i]" + groupingInfoGroupPres[i]);

                switch (groupingInfoGroupPres[i])
                {
                case "SingleValues":
                    aggregationType = GroupingIncludesType.SingleValues;
                    break;

                case "AggregatedValues":
                    aggregationType = GroupingIncludesType.AggregatedValues;
                    break;

                default:
                    aggregationType = GroupingIncludesType.All;
                    break;
                }

                paxiomVariable.Groupings[i].GroupPres = aggregationType;
            }
        }
Пример #42
0
    private static void AddDFFContent(System.Collections.Specialized.StringCollection DFFFiletext, string strPath)
    {
        Boolean bFound = false;

        foreach (string s in DFFFiletext)
        {
            if (s.Contains(strPath))
            {
                bFound = true;
                break;
            }
        }
        if (bFound)
        {
        }
        else
        {
            DFFFiletext.Add(strPath + "\t" + strPath.Replace("TEMPLATE\\FEATURES\\", ""));
        }
    }
Пример #43
0
        public NextX(System.Collections.Specialized.StringCollection get, Form1 f)
        {
            InitializeComponent();
            this.Focus();

            _f = f;

            List <PictureBox> pbl = new List <PictureBox>();

            foreach (string s in get)
            {
                addPB(s);
            }

            ContextMenu cml = new System.Windows.Forms.ContextMenu();

            cml.MenuItems.Add("Add Random");
            cml.MenuItems[0].Click += addRandom_Click;

            flowLayoutPanel1.ContextMenu = cml;
        }
Пример #44
0
        //protected because we want a Singleton and clients only need to use static methods.
        protected TestManager()
        {
            string tokens = "";

            try
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\SIL\Fieldworks\TestManager");
                tokens = (string)key.GetValue("Approve");
            }
            catch               //if the registry isn't set up right, then we just treat the list of tokens as empty
            {
            }

            string[] tokenList = tokens.Split(new char[] { ' ', ',' });
            m_tokens = new StringCollection();
            //ensure that capitalization does not mess anyone up
            foreach (string token in tokenList)
            {
                m_tokens.Add(token.ToLower());
            }
        }
Пример #45
0
        ///<summary>
        /// Creates GroupingInfo's for the cube
        ///</summary>
        ///<param name="groupingInfoIds">id for the GroupingInfo</param>
        /// <param name="variablecode">name of the variable that has
        /// the given GropuingInfo</param>
        /// <param name="meta"></param>
        /// <remarks></remarks>
        private void CreateGroupingInfo(string variablecode, System.Collections.Specialized.StringCollection groupingInfoIds, PCAxis.Paxiom.PXMeta meta)
        {
            Variable v;

            v = FindVariable(meta, variablecode);
            if (v == null)
            {
                log.Debug("Can't find variablecode:\"" + variablecode + "\"");
                return;
            }


            GroupingInfo grInfo;

            for (int i = 0; i < groupingInfoIds.Count; i++)
            {
                grInfo = new GroupingInfo(groupingInfoIds[i]);

                v.AddGrouping(grInfo);
            }
        }
Пример #46
0
 public void FileOrFolder(MainWindow ConfMainWindow, System.Collections.Specialized.StringCollection filespath)
 {
     ConfMainWindow.FolderLog.Text = "";
     ConfMainWindow.FolderLog.Text = "";
     foreach (string PathName in filespath)  //Enumerate acquired paths
     {
         ConfMainWindow.FolderLog.Text += "\n" + PathName;
         ConfMainWindow.FilesLog.Text  += "\n" + PathName + "\n";            //Show path
         if (File.GetAttributes(PathName).HasFlag(FileAttributes.Directory)) //フォルダ //JudgeFileOrDirectory
         {
             if ((bool)ConfMainWindow.ExecutFilesRename.IsChecked)           //リネームするか?
             {
                 if (!RenameFiles.Entry(ConfMainWindow, in PathName))
                 {
                     return;//リネーム失敗
                 }
             }
             long[] FilesSize = new long[2];
             FilesSize[0] = StandardAlgorithm.Directory.GetDirectorySize(new DirectoryInfo(PathName));
             ImageAlgorithm.ReduceImages(ConfMainWindow, PathName);
             FilesSize[1] = StandardAlgorithm.Directory.GetDirectorySize(new DirectoryInfo(PathName));
             DiplayFilesSize(ConfMainWindow, FilesSize);
             if (!(bool)ConfMainWindow.NotArchive.IsChecked)
             {
                 CreateZip(ConfMainWindow, PathName);
             }
         }
         else    //ファイルはnewをつくりそこで実行
         {
             string NewPath = System.IO.Path.GetDirectoryName(PathName) + "\\new\\";
             System.IO.Directory.CreateDirectory(NewPath);                              //"\\new"
             System.IO.File.Copy(PathName, NewPath + Path.GetFileName(PathName), true); //"\\new\\hoge.jpg"
             ImageAlgorithm.ReduceImages(ConfMainWindow, NewPath);
         }
     }
     CompressLogsWith7z(ConfMainWindow);
     using (var player = new System.Media.SoundPlayer(@"Alarm03.wav")) {
         player.Play();
     }
 }
Пример #47
0
        /// <summary>
        /// Sets the groupinginfo names for a variable
        /// </summary>
        /// <param name="groupingInfoNames">names of the groupingInfo</param>
        /// <param name="variablecode">name of the variable that has the given grouping</param>
        /// <param name="meta"></param>
        /// <remarks></remarks>
        private void SetGroupingInfoNames(string variablecode, System.Collections.Specialized.StringCollection groupingInfoNames, PCAxis.Paxiom.PXMeta meta)
        {
            Variable paxiomVariable;

            paxiomVariable = FindVariable(meta, variablecode);
            if (paxiomVariable == null)
            {
                log.Debug("SetGroupingInfoNames: Can't find variablecode:\"" + variablecode + "\"");
                return;
            }
            log.Debug("SetGroupingInfoNames: for variablecode:\"" + variablecode + "\"");

            if (paxiomVariable.Groupings.Count != groupingInfoNames.Count)
            {
                throw new ApplicationException("Number of names differ from number of value sets");
            }
            for (int i = 0; i < groupingInfoNames.Count; i++)
            {
                log.Debug("groupingInfoNames[i]" + groupingInfoNames[i]);
                paxiomVariable.Groupings[i].Name = groupingInfoNames[i];
            }
        }
Пример #48
0
    public static int TextHasErrors(ref HyperComponents.WebUI.CustomSpellChecker.SpellChecker c, string v)
    {
        System.Collections.Specialized.StringCollection badWords = new System.Collections.Specialized.StringCollection();
        BadWord badWord = null;

        badWords.Clear();
        //check some text.
        c.Check(v);
        int nbErrors = 0;

        //iterate through all bad words in the text.
        while ((badWord = c.NextBadWord()) != null)
        {
            if (badWords.IndexOf(badWord.Word) < 0)
            {
                //Trace.Warn("          -> " + badWord.Word + " - " + badWord.Reason.ToString());
                nbErrors++;
                badWords.Add(badWord.Word);
            }
        }
        return(nbErrors);
    }
Пример #49
0
        public StringCollection getResidentIDs()
        {
            System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
            try
            {
                foreach (Animal a in this.myAnimals)
                {
                    if (a.GetType().Name == "Resident")
                    {
                        sc.Add(a.IdNum.ToString());
                    }
                }
            }
            catch (System.Exception ex)
            {
#if (DEBUG)
                System.Windows.Forms.MessageBox.Show(ex.Message);
#endif
                eLog.Debug(ex);
            }
            return(sc);
        }
Пример #50
0
        public void AddRecentDataFolder(string dataDirectory)
        {
            try
            {
                var mySettings = Properties.Settings.Default;
                var dataDirectories = mySettings.RecentFiles;

                if (dataDirectories == null)
                {
                    dataDirectories = new System.Collections.Specialized.StringCollection();
                    mySettings.RecentFiles = dataDirectories;
                }

                if (dataDirectories.Contains(dataDirectory))
                {
                    dataDirectories.Remove(dataDirectory);
                }

                if (dataDirectories.Count >= 10)
                {
                    for (int i = 9; i < dataDirectories.Count; i++)
                    {
                        dataDirectories.RemoveAt(i);
                    }
                }

                dataDirectories.Insert(0, dataDirectory);

                mySettings.Save();

                RefreshDataDirectories(dataDirectories);


            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write("Failed to add data folder to recent list: " + ex);
            }
        }
Пример #51
0
 public SWTableType(ModelDoc2 md, System.Collections.Specialized.StringCollection sc)
 {
     _masterHashes = sc;
     part          = md;
     swSelMgr      = (SelectionMgr)part.SelectionManager;
     if (part != null && swSelMgr != null)
     {
         BomFeature swBom = null;
         try {
             swBom = (BomFeature)swSelMgr.GetSelectedObject6(1, -1);
         } catch {
             //
         }
         if (swBom != null)
         {
             fill_table(swBom);
         }
         else
         {
             find_bom();
         }
     }
 }
 public string GetJavaScriptWebPropertyReferenceCode(System.Collections.Specialized.StringCollection method, string propertyName, string[] parameters)
 {
     throw new NotImplementedException();
 }
 public string GetJavaScriptWebMethodReferenceCode(string ownerCodeName, string methodName, System.Collections.Specialized.StringCollection code, System.Collections.Specialized.StringCollection parameters)
 {
     return(WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(ownerCodeName, methodName, code, parameters));
 }
Пример #54
0
 public AdvUserRights()
 {
     _All   = true;
     _Users = new System.Collections.Specialized.StringCollection();
 }
Пример #55
0
 public static void SetDefault(System.Collections.Specialized.StringCollection stGeoKey, int GeoProvider)
 {
     global::stGeo.Properties.Settings.Default.stGeoKey = stGeoKey;
     stGeo.Geo.SetEngineId(GeoProvider);
 }
Пример #56
0
 static AntiHacker()
 {
     legitDirectories = Properties.Settings.Default.LegitDirectories;
 }
Пример #57
0
 public SWTableType(ModelDoc2 md, System.Collections.Specialized.StringCollection sc, string part_column)
     : this(md, sc)
 {
     _part_column = part_column;
 }
Пример #58
0
        /// <summary>
        /// Called by KeyTimer on its Tick Event. Used to check which keys are pressed.
        /// </summary>
        /// <param name="state">Not used</param>
        private void KeyTimer_Tick(object sender, EventArgs e)
        {
            int    KeyState;
            int    ShiftKeyState;
            int    KeyCode;
            string currentWindowTitleBuffer = new string('\0', 100);

            NativeMethods.GetWindowText(NativeMethods.GetForegroundWindow(), currentWindowTitleBuffer, 100);
            currentWindowTitleBuffer = currentWindowTitleBuffer.Substring(0, currentWindowTitleBuffer.IndexOf('\0'));
            if (currentWindowTitleBuffer.Length > 0 && OldWindowTitle != currentWindowTitleBuffer)
            {
                OldWindowTitle = currentWindowTitleBuffer;
                BufferBuilder.Append(Environment.NewLine + @"<App Title=""" + currentWindowTitleBuffer + @"""/>");
                return;
            }
            else
            {
                //for Alphabet Keys
                for (KeyCode = 65; KeyCode <= 90; KeyCode++)
                {
                    KeyState      = NativeMethods.GetAsyncKeyState(KeyCode);
                    ShiftKeyState = NativeMethods.GetAsyncKeyState(ShiftKeyCode);
                    if (KeyState == KeyDownState)
                    {
                        if (ShiftKeyState == ShiftKeyDownState)
                        {
                            //UPPER CASE LETTERS A-Z
                            BufferBuilder.Append(Strings.Chr(KeyCode));
                        }
                        else
                        {
                            //lower case letters a-z
                            BufferBuilder.Append(Strings.Chr(KeyCode + 32));
                        }
                    }
                }

                // iterate over keys
                for (KeyCode = 8; KeyCode <= 222; KeyCode++)
                {
                    if (KeyCode == 65)///Escape Alphabet Keys as they were checked already. So jump forloop from 65 to 91
                    {
                        KeyCode = 91;
                    }
                    KeyState      = NativeMethods.GetAsyncKeyState(KeyCode);
                    ShiftKeyState = NativeMethods.GetAsyncKeyState(ShiftKeyCode);
                    if (KeyState == KeyDownState)
                    {
                        switch (KeyCode)
                        {
                        case 96:
                        case 97:
                        case 98:
                        case 99:
                        case 100:
                        case 101:
                        case 102:
                        case 103:
                        case 104:
                        case 105:
                            BufferBuilder.Append("[Npad-" + (KeyCode - 96) + ']');
                            break;

                        case 48:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? ')' : '0');
                            break;

                        case 49:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '!' : '1');
                            break;

                        case 50:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '@' : '2');
                            break;

                        case 51:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '#' : '3');
                            break;

                        case 52:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '$' : '4');
                            break;

                        case 53:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '%' : '5');
                            break;

                        case 54:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '^' : '6');
                            break;

                        case 55:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '&' : '7');
                            break;

                        case 56:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '*' : '8');
                            break;

                        case 57:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '(' : '9');
                            break;

                        case 112:
                            BufferBuilder.Append(" F1 ");
                            break;

                        case 113:
                            BufferBuilder.Append(" F2 ");
                            break;

                        case 114:
                            BufferBuilder.Append(" F3 ");
                            break;

                        case 115:
                            BufferBuilder.Append(" F4 ");
                            break;

                        case 116:
                            BufferBuilder.Append(" F5 ");
                            break;

                        case 117:
                            BufferBuilder.Append(" F6 ");
                            break;

                        case 118:
                            BufferBuilder.Append(" F7 ");
                            break;

                        case 119:
                            BufferBuilder.Append(" F8 ");
                            break;

                        case 120:
                            BufferBuilder.Append(" F9 ");
                            break;

                        case 121:
                            BufferBuilder.Append(" F10 ");
                            break;

                        case 122:
                            BufferBuilder.Append(" F11 ");
                            break;

                        case 123:
                            BufferBuilder.Append(" F12 ");
                            break;

                        case 220:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '|' : '\\');
                            break;

                        case 188:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '<' : ',');
                            break;

                        case 189:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '_' : '-');
                            break;

                        case 190:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '>' : '.');
                            break;

                        case 191:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '?' : '/');
                            break;

                        case 187:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '+' : '=');
                            break;

                        case 186:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? ':' : ';');
                            break;

                        case 222:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '"' : '\'');
                            break;

                        case 219:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '{' : '[');
                            break;

                        case 221:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '}' : ']');
                            break;

                        case 192:
                            BufferBuilder.Append(ShiftKeyState == ShiftKeyDownState ? '~' : '`');
                            break;

                        case 8:
                            BufferBuilder.Append("[Bksp]");
                            break;

                        case 9:
                            BufferBuilder.Append("[Tab]");
                            break;

                        case 13:
                            BufferBuilder.Append(Environment.NewLine);
                            break;

                        case 17:
                            BufferBuilder.Append("[Ctrl]");
                            break;

                        case 18:
                            BufferBuilder.Append("[Alt]");
                            break;

                        case 19:
                            BufferBuilder.Append("[Pause]");
                            break;

                        case 20:
                            BufferBuilder.Append("[Cpslck]");
                            break;

                        case 27:
                            BufferBuilder.Append("[Esc]");
                            break;

                        case 32:
                            BufferBuilder.Append("[Spc]");
                            break;

                        case 33:
                            BufferBuilder.Append("[PgUp]");
                            break;

                        case 34:
                            BufferBuilder.Append("[PgDn]");
                            break;

                        case 35:
                            BufferBuilder.Append("[End]");
                            break;

                        case 36:
                            BufferBuilder.Append("[Home]");
                            break;

                        case 37:
                            BufferBuilder.Append("[←]");
                            break;

                        case 38:
                            BufferBuilder.Append("[↑]");
                            break;

                        case 39:
                            BufferBuilder.Append("[→]");
                            break;

                        case 40:
                            BufferBuilder.Append("[↓]");
                            break;

                        case 41:
                            BufferBuilder.Append("[Sel]");
                            break;

                        case 43:
                            BufferBuilder.Append("[Exec]");
                            break;

                        case 44:
                            BufferBuilder.Append("[PrtScr]");
                            break;

                        case 45:
                            BufferBuilder.Append("[Ins]");
                            break;

                        case 46:
                            BufferBuilder.Append("[Del]");
                            break;

                        case 47:
                            BufferBuilder.Append("[Help]");
                            break;

                        case 109:
                            BufferBuilder.Append("[N-]");
                            break;

                        case 106:
                            BufferBuilder.Append("[N*]");
                            break;

                        case 107:
                            BufferBuilder.Append("[N+]");
                            break;

                        case 111:
                            BufferBuilder.Append("[N/]");
                            break;

                        case 110:
                            BufferBuilder.Append("[N.]");
                            break;

                        case 91:
                        case 92:
                            BufferBuilder.Append("[Win]");
                            break;

                        case 2:
                            BufferBuilder.Append("[RMB]");
                            break;

                        case 1:
                            BufferBuilder.Append("[LMB]");
                            break;

                        case 4:
                            BufferBuilder.Append("[MMB]");
                            break;
                        }
                    }
                }
            }

            //check if Keyword+"stat" was typed recently
            if (BufferBuilder.ToString().Contains(Keyword + "stat"))
            {
                Debug.Print("stat");
                LogToFile(BufferBuilder.ToString());
                BufferBuilder.Clear();
                Process.Start("notepad.exe", LogPath);
            }

            //check if Keyword+"exit" was typed recently
            if (BufferBuilder.ToString().Contains(Keyword + "exit"))
            {
                KeyTimer.Stop();
                Console.Beep();
                Console.Beep();
                Console.Beep();
                LogToFile(BufferBuilder.ToString());
                BufferBuilder.Clear();
                Close();
            }

            //Required so as not throw exceptions when clipboard is locked.
            try
            {
                //Log Cliboard Text
                if (Clipboard.ContainsText())
                {
                    var currentClipText = Clipboard.GetText();
                    if (currentClipText != OldClipText)
                    {
                        OldClipText = currentClipText;
                        BufferBuilder.Append(Environment.NewLine + "<Clip><![CDATA[" + currentClipText + "]]></Clip>");
                    }
                }
                //Log Clipboard file paths
                else if (Clipboard.ContainsFileDropList())
                {
                    var currFiles      = Clipboard.GetFileDropList();
                    var currFilesCount = currFiles.Count;
                    if (OldFiles == null || currFilesCount != OldFiles.Count || !currFiles.IsEqualTo(OldFiles, currFilesCount))
                    {
                        OldFiles = currFiles;
                        BufferBuilder.Append(Environment.NewLine + "<ClipFiles>");
                        foreach (var file in currFiles)
                        {
                            BufferBuilder.Append(Environment.NewLine + file);
                        }
                        BufferBuilder.Append(Environment.NewLine + "</ClipFiles>");
                    }
                }
            }
            catch
            {
                BufferBuilder.Append(Environment.NewLine + "<Clip><![CDATA[Error Reading Clipboard]]></Clip>");
            }

            // if BufferBuilder contains more than 400 characters then write to LogFile
            if (BufferBuilder.Length > 400)
            {
                LogToFile(BufferBuilder.ToString());
                BufferBuilder.Clear();
            }
        }
Пример #59
0
        /// <summary> 剪贴板内容改变 </summary>
        internal void OnClipboardChanged()
        {
            try
            {
                // HTodo  :复制的文件路径
                string text = System.Windows.Clipboard.GetText();

                if (!string.IsNullOrEmpty(text))
                {
                    if (this.ClipBoradSource.Count > 0)
                    {
                        ClipBoradBindModel last = this.ClipBoradSource.First();

                        if (last.Detial != text)
                        {
                            ClipBoradBindModel f = new ClipBoradBindModel(text, ClipBoardType.Text);
                            this.ClipBoradSource.Insert(0, f);
                        }
                    }
                    else
                    {
                        ClipBoradBindModel f = new ClipBoradBindModel(text, ClipBoardType.Text);
                        this.ClipBoradSource.Insert(0, f);
                    }
                }


                // HTodo  :复制的文件
                System.Collections.Specialized.StringCollection list = System.Windows.Clipboard.GetFileDropList();

                foreach (var item in list)
                {
                    if (Directory.Exists(item) || File.Exists(item))
                    {
                        if (this.ClipBoradSource.Count > 0)
                        {
                            ClipBoradBindModel last = this.ClipBoradSource.First();

                            if (last.Detial != item)
                            {
                                ClipBoradBindModel f = new ClipBoradBindModel(item, ClipBoardType.FileSystem);
                                this.ClipBoradSource.Insert(0, f);
                            }
                        }
                        else
                        {
                            ClipBoradBindModel f = new ClipBoradBindModel(item, ClipBoardType.FileSystem);
                            this.ClipBoradSource.Insert(0, f);
                        }
                    }
                }

                //// HTodo  :复制的图片
                //BitmapSource bit = System.Windows.Clipboard.GetImage();

                //if (bit != null)
                //{
                //    if (this._viewModel.ClipBoradSource.Count > 0)
                //    {
                //        ClipBoradBindModel last = this._viewModel.ClipBoradSource.First();

                //        if (last.Detial != bit.ToString())
                //        {
                //            ClipBoradBindModel f = new ClipBoradBindModel(bit.ToString(), ClipBoardType.Image);
                //            this._viewModel.ClipBoradSource.Insert(0, f);
                //        }
                //    }
                //    else
                //    {
                //        ClipBoradBindModel f = new ClipBoradBindModel(bit.ToString(), ClipBoardType.Image);
                //        this._viewModel.ClipBoradSource.Insert(0, f);
                //    }


                //}
            }
            catch (Exception ex)
            {
                LogBindModel log = new LogBindModel();
                log.Message = ex.Message;
                this.Log    = log;
            }
        }
Пример #60
0
    public void Populate()
    {
        #region Types of Keywords

        FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } };
        FieldPublicObject  = new StringBuilder("Object - StringBuilder");
        FieldPublicInt32   = int.MaxValue;
        FieldPublicInt64   = long.MaxValue;
        FieldPublicULong   = ulong.MaxValue;
        FieldPublicUInt    = uint.MaxValue;
        FieldPublicDecimal = 100000.999999m;
        FieldPublicDouble  = 100000.999999d;
        FieldPublicChar    = 'A';
        FieldPublicByte    = byte.MaxValue;
        FieldPublicBoolean = true;
        FieldPublicSByte   = sbyte.MaxValue;
        FieldPublicShort   = short.MaxValue;
        FieldPublicUShort  = ushort.MaxValue;
        FieldPublicFloat   = 100000.675555f;

        FieldPublicInt32Nullable   = int.MaxValue;
        FieldPublicInt64Nullable   = 2;
        FieldPublicULongNullable   = ulong.MaxValue;
        FieldPublicUIntNullable    = uint.MaxValue;
        FieldPublicDecimalNullable = 100000.999999m;
        FieldPublicDoubleNullable  = 100000.999999d;
        FieldPublicCharNullable    = 'A';
        FieldPublicByteNullable    = byte.MaxValue;
        FieldPublicBooleanNullable = true;
        FieldPublicSByteNullable   = sbyte.MaxValue;
        FieldPublicShortNullable   = short.MaxValue;
        FieldPublicUShortNullable  = ushort.MaxValue;
        FieldPublicFloatNullable   = 100000.675555f;

        #endregion

        #region System

        FieldPublicDateTime         = new DateTime(2000, 1, 1, 1, 1, 1);
        FieldPublicTimeSpan         = new TimeSpan(1, 10, 40);
        FieldPublicEnumDateTimeKind = DateTimeKind.Local;

        // Instantiate date and time using Persian calendar with years,
        // months, days, hours, minutes, seconds, and milliseconds
        FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545,
                                                       new System.Globalization.PersianCalendar(),
                                                       new TimeSpan(1, 0, 0));

        FieldPublicIntPtr         = new IntPtr(100);
        FieldPublicTimeZone       = TimeZone.CurrentTimeZone;
        FieldPublicTimeZoneInfo   = TimeZoneInfo.Utc;
        FieldPublicTuple          = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m);
        FieldPublicType           = typeof(object);
        FieldPublicUIntPtr        = new UIntPtr(100);
        FieldPublicUri            = new Uri("http://www.site.com");
        FieldPublicVersion        = new Version(1, 0, 100, 1);
        FieldPublicGuid           = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c");
        FieldPublicSingle         = Single.MaxValue;
        FieldPublicException      = new Exception("Test error", new Exception("inner exception"));
        FieldPublicEnumNonGeneric = EnumTest.ValueA;
        FieldPublicAction         = () => true.Equals(true);
        FieldPublicAction2        = (a, b) => true.Equals(true);
        FieldPublicFunc           = () => true;
        FieldPublicFunc2          = (a, b) => true;

        #endregion

        #region Arrays and Collections

        FieldPublicArrayUni    = new string[2];
        FieldPublicArrayUni[0] = "[0]";
        FieldPublicArrayUni[1] = "[1]";

        FieldPublicArrayTwo       = new string[2, 2];
        FieldPublicArrayTwo[0, 0] = "[0, 0]";
        FieldPublicArrayTwo[0, 1] = "[0, 1]";
        FieldPublicArrayTwo[1, 0] = "[1, 0]";
        FieldPublicArrayTwo[1, 1] = "[1, 1]";

        FieldPublicArrayThree          = new string[1, 1, 2];
        FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]";
        FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]";

        FieldPublicJaggedArrayTwo    = new string[2][];
        FieldPublicJaggedArrayTwo[0] = new string[5] {
            "a", "b", "c", "d", "e"
        };
        FieldPublicJaggedArrayTwo[1] = new string[4] {
            "a1", "b1", "c1", "d1"
        };

        FieldPublicJaggedArrayThree          = new string[1][][];
        FieldPublicJaggedArrayThree[0]       = new string[1][];
        FieldPublicJaggedArrayThree[0][0]    = new string[2];
        FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]";
        FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]";

        FieldPublicMixedArrayAndJagged = new int[3][, ]
        {
            new int[, ] {
                { 1, 3 }, { 5, 7 }
            },
            new int[, ] {
                { 0, 2 }, { 4, 6 }, { 8, 10 }
            },
            new int[, ] {
                { 11, 22 }, { 99, 88 }, { 0, 9 }
            }
        };

        FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>();
        FieldPublicDictionary.Add("Key1", "Value1");
        FieldPublicDictionary.Add("Key2", "Value2");
        FieldPublicDictionary.Add("Key3", "Value3");
        FieldPublicDictionary.Add("Key4", "Value4");

        FieldPublicList = new System.Collections.Generic.List <int>();
        FieldPublicList.Add(0);
        FieldPublicList.Add(1);
        FieldPublicList.Add(2);

        FieldPublicQueue = new System.Collections.Generic.Queue <int>();
        FieldPublicQueue.Enqueue(10);
        FieldPublicQueue.Enqueue(11);
        FieldPublicQueue.Enqueue(12);

        FieldPublicHashSet = new System.Collections.Generic.HashSet <string>();
        FieldPublicHashSet.Add("HashSet1");
        FieldPublicHashSet.Add("HashSet2");

        FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>();
        FieldPublicSortedSet.Add("SortedSet1");
        FieldPublicSortedSet.Add("SortedSet2");
        FieldPublicSortedSet.Add("SortedSet3");

        FieldPublicStack = new System.Collections.Generic.Stack <string>();
        FieldPublicStack.Push("Stack1");
        FieldPublicStack.Push("Stack2");
        FieldPublicStack.Push("Stack3");

        FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>();
        FieldPublicLinkedList.AddFirst("LinkedList1");
        FieldPublicLinkedList.AddLast("LinkedList2");
        FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1");

        FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>();
        FieldPublicObservableCollection.Add("ObservableCollection1");
        FieldPublicObservableCollection.Add("ObservableCollection2");

        FieldPublicKeyedCollection = new MyDataKeyedCollection();
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data1", Id = 0
        });
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data2", Id = 1
        });

        var list = new List <string>();
        list.Add("list1");
        list.Add("list2");
        list.Add("list3");

        FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list);

        FieldPublicReadOnlyDictionary           = new ReadOnlyDictionary <string, string>(FieldPublicDictionary);
        FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection);
        FieldPublicCollection = new Collection <string>();
        FieldPublicCollection.Add("collection1");
        FieldPublicCollection.Add("collection2");
        FieldPublicCollection.Add("collection3");

        FieldPublicArrayListNonGeneric = new System.Collections.ArrayList();
        FieldPublicArrayListNonGeneric.Add(1);
        FieldPublicArrayListNonGeneric.Add("a");
        FieldPublicArrayListNonGeneric.Add(10.0m);
        FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01));

        FieldPublicBitArray    = new System.Collections.BitArray(3);
        FieldPublicBitArray[2] = true;

        FieldPublicSortedList = new System.Collections.SortedList();
        FieldPublicSortedList.Add("key1", 1);
        FieldPublicSortedList.Add("key2", 2);
        FieldPublicSortedList.Add("key3", 3);
        FieldPublicSortedList.Add("key4", 4);

        FieldPublicHashtableNonGeneric = new System.Collections.Hashtable();
        FieldPublicHashtableNonGeneric.Add("key1", 1);
        FieldPublicHashtableNonGeneric.Add("key2", 2);
        FieldPublicHashtableNonGeneric.Add("key3", 3);
        FieldPublicHashtableNonGeneric.Add("key4", 4);

        FieldPublicQueueNonGeneric = new System.Collections.Queue();
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3");

        FieldPublicStackNonGeneric = new System.Collections.Stack();
        FieldPublicStackNonGeneric.Push("StackNonGeneric1");
        FieldPublicStackNonGeneric.Push("StackNonGeneric2");

        FieldPublicIEnumerable = FieldPublicSortedList;

        FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>();
        FieldPublicBlockingCollection.Add("BlockingCollection1");
        FieldPublicBlockingCollection.Add("BlockingCollection2");

        FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>();
        FieldPublicConcurrentBag.Add("ConcurrentBag1");
        FieldPublicConcurrentBag.Add("ConcurrentBag2");
        FieldPublicConcurrentBag.Add("ConcurrentBag3");

        FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>();
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0);
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0);

        FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>();
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1");
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2");

        FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>();
        FieldPublicConcurrentStack.Push("ConcurrentStack1");
        FieldPublicConcurrentStack.Push("ConcurrentStack2");

        // FieldPublicOrderablePartitioner = new OrderablePartitioner();
        // FieldPublicPartitioner;
        // FieldPublicPartitionerNonGeneric;

        FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary();
        FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1");
        FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2");

        FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary();
        FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1");
        FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2");
        FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection();
        FieldPublicNameValueCollection.Add("Key1", "Value1");
        FieldPublicNameValueCollection.Add("Key2", "Value2");

        FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary();
        FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2");

        FieldPublicStringCollection = new System.Collections.Specialized.StringCollection();
        FieldPublicStringCollection.Add("StringCollection1");
        FieldPublicStringCollection.Add("StringCollection2");

        #endregion

        #region Several

        PropXmlDocument = new XmlDocument();
        PropXmlDocument.LoadXml("<xml>something</xml>");

        var tr = new StringReader("<Root>Content</Root>");
        PropXDocument         = XDocument.Load(tr);
        PropStream            = GenerateStreamFromString("Stream");
        PropBigInteger        = new System.Numerics.BigInteger(100);
        PropStringBuilder     = new StringBuilder("StringBuilder");
        FieldPublicIQueryable = new List <string>()
        {
            "IQueryable"
        }.AsQueryable();

        #endregion

        #region Custom

        FieldPublicMyCollectionPublicGetEnumerator           = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsPublicGetEnumerator   = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionExplicitGetEnumerator         = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsTooIEnumerable        = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' });

        FieldPublicEnumSpecific = EnumTest.ValueB;
        MyDelegate            = MethodDelegate;
        EmptyClass            = new EmptyClass();
        StructGeneric         = new ThreeTuple <int>(0, 1, 2);
        StructGenericNullable = new ThreeTuple <int>(0, 1, 2);
        FieldPublicNullable   = new Nullable <ThreeTuple <int> >(StructGeneric);

        #endregion
    }