Esempio n. 1
0
        //打开文件
        public void Open(string file)
        {
            if (file.IndexOf('\n') > -1)
            {
                OpenScript(file);
                return;
            }
            if (string.IsNullOrEmpty(file) || !File.Exists(file))
            {
                return;
            }
            //添加历史
            history.AddHistory(file);
            //检查是否已经打开
            if (FindEditForm(file, true))
            {
                return;
            }
            //检查可用的
            if (FindEditForm(file, false))
            {
                return;
            }

            if (YGOUtil.IsScript(file))
            {
                OpenScript(file);
            }
            else if (YGOUtil.IsDataBase(file))
            {
                OpenDataBase(file);
            }
        }
Esempio n. 2
0
        protected void LoadHistory(Stream inputStream)
        {
            StreamReader  reader = new StreamReader(inputStream);
            StringBuilder line   = new StringBuilder();
            int           c;

            do
            {
                while ((c = reader.Read()) >= 0 && c != '\n')
                {
                    char ch = (char)c;
                    if (ch == '\r')
                    {
                        continue;
                    }

                    if (ch == '\\')
                    {
                        line.Append((char)reader.Read());
                    }
                    else
                    {
                        line.Append(ch);
                    }
                }
                if (line.Length > 0)
                {
                    History.AddHistory(line.ToString());
                    line.Length = 0;
                }
            } while (c >= 0);
            reader.Close();
        }
Esempio n. 3
0
        private void StoreHistoryLine()
        {
            string line = historyLine.ToString().Trim();

            if (!line.Equals(String.Empty) &&
                !line.Equals(previousHistoryLine))
            {
                History.AddHistory(line);
                previousHistoryLine = line;
            }
        }