Ejemplo n.º 1
0
        // pridani noveho zdroje (otevre dialog pro vyber zdroje, pote ho otevre a vrati handle (index) )
        /// <summary>
        /// Creating new data source.
        /// Creates and openes source and returns handle on it.
        /// <b>notice: </b>when IceGridNode is not set as system service and some other FEplugin data source is already opened,
        /// then new data source can not be created.
        /// </summary>
        /// <param name="PersistID">Perzist ID of new source (path to Ferda project (.xfp) file)</param>
        /// <returns>Handle to newly created and opened data source.</returns>
        public static Int32 NewSource(string PersistID)
        {
            DirManager.SetHomeLMRA_dir(); // due to relative paths of pesist IDs

            // tries to create an instance of CFEsource class
            CFEsource NS;

            try
            {
                // controll if the file with FE project exists
                if (!File.Exists(PersistID))
                {
//#if (DEBUG)
//                    MessageBox.Show("aktualni adresar" + Directory.GetCurrentDirectory());
//#endif
                    throw new FE_error("FEP005", "Perzist ID: " + PersistID + "\n\nReason: project can't be loaded, file can't be found on given path");
                }

                // test, if IceGridNode is set as system service. If not and some other source is opened, new source can not be created.
                if (FEplugin_globals.IceConfig_initialized)
                {
                    if (FEplugin_globals.IceConfig.ProjectManagerOptions.IceGridAsService == false && OpenSrcCount >= 1)
                    {
                        throw new FE_error("FEP006");
                    }
                }

                NS = new CFEsource(PersistID);
                int index = sources.Add(NS);
                SrcCount++;
                OpenSrcCount++;
                return(index);
            }
            catch (FE_error e)
            {
                FE_err_msg.show_err_msg(e);
                return(-1);
            }
            catch (System.Exception e)
            {
                FE_error err = new FE_error("FEP005", "Reason: " + e.Message);
                FE_err_msg.show_err_msg(err);
                return(-1);
            }
            finally
            {
                DirManager.SetHomePrevious_dir();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Finding all boxes with given box type in Ferda Archive (all boxes Ferda data source)
        /// </summary>
        /// <param name="Source">data source</param>
        /// <param name="ID">type of searched boxes (string identifier)</param>
        /// <returns>Array of all found boxes</returns>
        public static IBoxModule[] ListBoxesWithID(CFEsource Source, string ID)
        {
            ArrayList MyBoxes = new ArrayList();

            foreach (IBoxModule box in Source.PM.Archive.Boxes)
            {
                //Console.WriteLine(box.MadeInCreator.Identifier.ToString());
                if (box.MadeInCreator.Identifier == ID)
                {
                    MyBoxes.Add(box);
                }
            }
            IBoxModule[] resultArray = (IBoxModule[])MyBoxes.ToArray(typeof(IBoxModule));
            return(resultArray);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Finding all boxes with given list of box types in Ferda Archive (all boxes Ferda data source)
        /// </summary>
        /// <param name="Source">data source</param>
        /// <param name="ID">list with types of searched boxes (string identifiers)</param>
        /// <returns>Array of all found boxes</returns>
        public static IBoxModule[] ListBoxesWithID(CFEsource Source, string[] ID)
        {
            ArrayList MyBoxes = new ArrayList();

            foreach (IBoxModule box in Source.PM.Archive.Boxes)
            {
                foreach (string boxtype in ID)
                {
                    if (box.MadeInCreator.Identifier == boxtype)
                    {
                        MyBoxes.Add(box);
                    }
                }
            }
            IBoxModule[] resultArray = (IBoxModule[])MyBoxes.ToArray(typeof(IBoxModule));
            return(resultArray);
        }
 /// <summary>
 /// Finding all boxes with given box type in Ferda Archive (all boxes Ferda data source)
 /// </summary>
 /// <param name="Source">data source</param>
 /// <param name="ID">type of searched boxes (string identifier)</param>
 /// <returns>Array of all found boxes</returns>
 public static IBoxModule[] ListBoxesWithID(CFEsource Source, string ID)
 {
     ArrayList MyBoxes = new ArrayList();
     foreach (IBoxModule box in Source.PM.Archive.Boxes)
     {
         //Console.WriteLine(box.MadeInCreator.Identifier.ToString());
         if (box.MadeInCreator.Identifier == ID)
             MyBoxes.Add(box);
     }
     IBoxModule[] resultArray = (IBoxModule[])MyBoxes.ToArray(typeof(IBoxModule));
     return resultArray;
 }
 /// <summary>
 /// Finding all boxes with given list of box types in Ferda Archive (all boxes Ferda data source)
 /// </summary>
 /// <param name="Source">data source</param>
 /// <param name="ID">list with types of searched boxes (string identifiers)</param>
 /// <returns>Array of all found boxes</returns>
 public static IBoxModule[] ListBoxesWithID(CFEsource Source, string[] ID)
 {
     ArrayList MyBoxes = new ArrayList();
     foreach (IBoxModule box in Source.PM.Archive.Boxes)
     {
         foreach (string boxtype in ID)
         {
             if (box.MadeInCreator.Identifier == boxtype)
                 MyBoxes.Add(box);
         }
     }
     IBoxModule[] resultArray = (IBoxModule[])MyBoxes.ToArray(typeof(IBoxModule));
     return resultArray;
 }
        // pridani noveho zdroje (otevre dialog pro vyber zdroje, pote ho otevre a vrati handle (index) )
        /// <summary>
        /// Creating new data source.
        /// Creates and openes source and returns handle on it.
        /// <b>notice: </b>when IceGridNode is not set as system service and some other FEplugin data source is already opened,
        /// then new data source can not be created.
        /// </summary>
        /// <param name="PersistID">Perzist ID of new source (path to Ferda project (.xfp) file)</param>
        /// <returns>Handle to newly created and opened data source.</returns>
        public static Int32 NewSource(string PersistID)
        {
            DirManager.SetHomeLMRA_dir(); // due to relative paths of pesist IDs

            // tries to create an instance of CFEsource class
            CFEsource NS;
            try
            {
                // controll if the file with FE project exists
                if (!File.Exists(PersistID))
                {
            //#if (DEBUG)
            //                    MessageBox.Show("aktualni adresar" + Directory.GetCurrentDirectory());
            //#endif
                    throw new FE_error("FEP005", "Perzist ID: " + PersistID + "\n\nReason: project can't be loaded, file can't be found on given path");
                }

                // test, if IceGridNode is set as system service. If not and some other source is opened, new source can not be created.
                if (FEplugin_globals.IceConfig_initialized)
                {
                    if (FEplugin_globals.IceConfig.ProjectManagerOptions.IceGridAsService == false && OpenSrcCount >= 1)
                    {
                        throw new FE_error("FEP006");
                    }
                }

                NS = new CFEsource(PersistID);
                int index = sources.Add(NS);
                SrcCount++;
                OpenSrcCount++;
                return index;
            }
            catch (FE_error e)
            {
                FE_err_msg.show_err_msg(e);
                return -1;
            }
            catch (System.Exception e)
            {
                FE_error err = new FE_error("FEP005", "Reason: " + e.Message);
                FE_err_msg.show_err_msg(err);
                return -1;
            }
            finally
            {
                DirManager.SetHomePrevious_dir();
            }
        }