Esempio n. 1
0
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        public TestMarket()
        {
            InitializeComponent();

            // Set application information - do this before hubs are instantiated.
            string  basePath = FilesIO.GetPathToDirName(System.IO.Directory.GetCurrentDirectory(), "Ambre", true);
            AppInfo info     = AppInfo.GetInstance();

            info.BasePath     = basePath;
            info.LogDirectory = string.Format("{0}{1}", info.LogDirectory, Misty.Lib.Utilities.FilesIO.GetTodaysLogDirAndClean(info.LogPath));


            // Instantiate the API.
            //m_TTServices = TTApiService.GetInstance();
            //m_TTServices.ServiceStateChanged += new EventHandler(TTServices_ServiceStateChanged);


            // Instantiate hubs
            //  but do not Connect until the user name/pw has been authenticated.
            m_Market = new Markets.MarketTTAPI();
            m_Market.Start();
            //m_Market.MarketStatusChanged += new EventHandler<MistyLib.MarketHubs.MarketStatusChangedEventArg>(Market_MarketStatusChanged);
            //m_Market.FoundServiceResource += new EventHandler<MarketFoundServiceResource>(Market_MarketFoundServiceResource);
            m_Market.MarketStatusChanged += new EventHandler(Market_MarketStatusChanged);
            m_Market.FoundResource       += new EventHandler(Market_MarketFoundServiceResource);

            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Interval = 1000;
        }
Esempio n. 2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- SplitCorpus -->
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private string[] SplitCorpus()
        {
            string[] line = null;
            string   doc  = FilesIO.GetStringFromFile(CorpusPath, ""); line = doc.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            return(line);
        }
Esempio n. 3
0
        // ----------------------------------------------------------------------------------------
        /// <!-- FixImport -->
        /// <summary>
        ///
        /// </summary>
        /// <param name="oldPath"></param>
        /// <param name="newPath"></param>
        private static void FixImport(string oldPath, string newPath)
        {
            string oldSchema = FilesIO.GetStringFromFile(oldPath, "");
            string newSchema = FixImport(oldSchema);

            newSchema = Regex.Replace(newSchema, "encoding=\"utf-16\"", "encoding=\"utf-8\"");
            FilesIO.WriteStringToFile(newPath, newSchema, false);
        }
Esempio n. 4
0
 // ----------------------------------------------------------------------------------------
 //  Constructor
 // ----------------------------------------------------------------------------------------
 public LibraryInfo_cs(string libPath, string filePattern)
 {
     LibraryPath = libPath;
     FileFilter  = filePattern;
     FilePaths   = FilesIO.GetFileList(LibraryPath, FileFilter);
     Classes     = new List <ClassInfo>();
     foreach (string filePath in FilePaths)
     {
         ClassInfo.AddTo(Classes, LoadClassInfo_cs(filePath));
     }
 }
Esempio n. 5
0
        private void CopyFileOrDir()
        {
            if (focusedPanel == leftPanel)
            {
                FilesIO.Copy(selectedFile_Left, leftPanel.Path, rightPanel.Path);

                rightPanel.getDirContent(rightPanel.Path);
                onPropertyChanged(nameof(Directory_Right));
            }
            if (focusedPanel == rightPanel)
            {
                FilesIO.Copy(selectedFile_Right, rightPanel.Path, leftPanel.Path);

                leftPanel.getDirContent(leftPanel.Path);
                onPropertyChanged(nameof(Directory_Left));
            }
        }
Esempio n. 6
0
        /* Вызывает окно сохранения списка и проверяет сохранён ли файл */
        internal static bool SaveList(Window sender, bool saved, List <Human> users)
        {
            Console.WriteLine(sender.ToString() + ": Сохранить список");
            SaveFileDialog save_file_dialog = new SaveFileDialog();

            save_file_dialog.Filter = "List files (*.json)|*.json|All files (*.*)|*.*";
            save_file_dialog.ShowDialog();

            if (save_file_dialog.FileName.Count() != 0)
            {
                saved        = true;
                sender.Title = Path.GetFileNameWithoutExtension(save_file_dialog.FileName);

                FilesIO.SaveHumans(save_file_dialog.FileName, users);

                Console.WriteLine(sender.ToString() + ": Сохранён список: " + save_file_dialog.FileName);
                return(true);
            }
            else
            {
                Console.WriteLine(sender.ToString() + ": Отмена сохранения");
                return(false);
            }
        }
Esempio n. 7
0
        /* Загружает список */
        internal static void LoadList(Window sender, bool saved = true)
        {
            Console.WriteLine(sender.ToString() + ": Загрузить список");
            OpenFileDialog open_file_dialog = new OpenFileDialog();

            open_file_dialog.Filter = "List files (*.json)|*.json|All files (*.*)|*.*";
            open_file_dialog.ShowDialog();
            if (open_file_dialog.FileName != "")
            {
                if (sender != App.Current.MainWindow)
                {
                    sender.Close();
                }
                if (saved)
                {
                    App.Current.MainWindow.Hide();

                    List <Human> users = FilesIO.LoadHumans(open_file_dialog.FileName);

                    Console.WriteLine(sender.ToString() + ": Загружен список: " + open_file_dialog.FileName);
                    new Search(System.IO.Path.GetFileNameWithoutExtension(open_file_dialog.FileName), users).Show();
                }
            }
        }
Esempio n. 8
0
 public static XmlSchemaSet SchemaSet(string tempFilePath, string simpleSchema)
 {
     FilesIO.WriteStringToFile(tempFilePath, simpleSchema, false);  return(SchemaSet(tempFilePath));
 }
Esempio n. 9
0
        // -----------------------------------------------------------------------------------
        /// <!-- LoadClassInfo_cs -->
        /// <summary>
        ///      Parses the class and method info out of a .cs file
        /// </summary>
        /// <param name="filePath">path of cs file to load class info from</param>
        /// <returns></returns>
        /// <remarks>include modules</remarks>
        private List <ClassInfo> LoadClassInfo_cs(string filePath)
        {
            string str1 = FilesIO.LoadStringFromFile(filePath, "");

            if (Regex.IsMatch(filePath, "Test.aspx.cs$"))
            {
                Pause();
            }


            // --------------------------------------------------------------------------
            //  Extract a list of inported/used namespaces
            // --------------------------------------------------------------------------
            string importStr = Regex.Replace(str1, "^using ", "* ", RegexOptions.Multiline);

            importStr = Regex.Replace(importStr, "^[^*].*$", "", RegexOptions.Multiline);
            importStr = Regex.Replace(importStr, "^[*] ", "", RegexOptions.Multiline);
            string[] imp = importStr.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);


            // --------------------------------------------------------------------------
            //  Preprocess the file body
            // --------------------------------------------------------------------------
            string str10 = Preprocess_cs(str1);


            List <ClassInfo> classList = new List <ClassInfo>();


            //// --------------------------------------------------------------------------
            ////  Parse out nested classes
            //// --------------------------------------------------------------------------
            //string classSegment = "";
            //while ((Regex.IsMatch(str10, "[`][^'`]+[`][^'`]+['][^'`]+[']", RegexOptions.Singleline)))
            //{
            //    classSegment     = Regex.Replace(str10       , "^.*[`][^'`]+[`]([^'`]+)['][^'`]+['].*$", "$1"   , RegexOptions.Singleline);
            //    string className = Regex.Replace(classSegment, "^(Class|Module) +([^ (]+)[ (].*$"      , "$1 $2", RegexOptions.Singleline);
            //    string classBody = Regex.Replace(classSegment, "^(Class|Module) +([^ (]+)"             , ""     , RegexOptions.Singleline);
            //    classList.Add(new ClassInfo(className, filePath));
            //    classList[classList.Count - 1].Method = GetMethodList(classBody);
            //    str10 = Regex.Replace(str10, "^(.*[`][^'`]+)[`][^'`]+[']([^'`]+['].*)$", "$1 $2", RegexOptions.Singleline);
            //}


            // --------------------------------------------------------------------------
            //  Parse out the classes and modules
            // --------------------------------------------------------------------------
            string str  = str10;
            string last = str + "hi world";

            while ((str.Length > 0 && str.Length < last.Length))
            {
                string className = Regex.Replace(str, "^`(class) +([^ (]+)[ (].*$", "$1 $2", RegexOptions.Singleline);
                if (Regex.IsMatch(className, "^class SqlAccessMasterProviderBase"))
                {
                    Pause();
                }
                if (className.Length < 255)
                {
                    classList.Add(new ClassInfo(className, filePath));
                    string classBody = GetClassBody_cs(str);
                    classList[classList.Count - 1].Method = GetMethodList_cs(classBody);
                }
                else
                {
                    Pause();
                }
                last = str;
                str  = Regex.Replace(str, "^`[^`]*", "");
            }


            return(classList);
        }