Example #1
0
        public static string CreateNewProfile(bool disablePrivateProfile)
        {
            var profileList = GetProfileList(ProfileItemPrivacyType.Public.ToString());

loop:
            var it = new ProfileEditor();

            if (it.ShowDialog() != true)
            {
                return(null);
            }
            var profileName     = it.GetProfileName();
            var mainProcessName = it.GetMainProcessName();

            if (profileList.ContainsKey(profileName))
            {
                MessageBox.Show(LanguageManager.GetPhrase(Phrases.SettingsMessageProfileNameIsAlreadyExist),
                                LanguageManager.GetPhrase(Phrases.MessageBoxErrorHeader),
                                MessageBoxButton.OK, MessageBoxImage.Error);
                goto loop;
            }
            Clear();
            _currentProfileName         = profileName;
            _mainSimulatorProcess       = mainProcessName;
            _currentProfilePath         = GenerateProfileFileName();
            _currentPersonalProfilePath = _currentProfilePath.Replace(@"\" + ProfileFolder + @"\", @"\" + ProfileAssignmentsFolder + @"\") + "p";
            _currentProfileId           = GlobalId.GetNew();
            Save(disablePrivateProfile);
            return(profileName);
        }
Example #2
0
        public Guid StoreFormula(string formulaText, Guid ownerId)
        {
            formulaText = ReplaceVariableTextWithId(formulaText);
            var id = GlobalId.GetNew();

            _formulaDictionary.Add(id, new FormulaContainer(formulaText, ownerId));
            return(id);
        }
Example #3
0
        public void StoreVariableFormula(string formulaText, Guid ownerId, Guid variableId, int connectorId)
        {
            var formulaId = FindVariableFormulaId(ownerId, variableId, connectorId);

            if (formulaId == Guid.Empty)
            {
                formulaId = GlobalId.GetNew();
            }
            formulaText = ReplaceVariableTextWithId(formulaText);
            _formulaDictionary[formulaId] = (new FormulaContainer(formulaText, ownerId, variableId, connectorId));
        }
Example #4
0
        /// <summary>
        /// Загрузка профиля
        /// </summary>
        /// <param name="profilePath">Путь к профилю</param>
        /// <param name="profileItemPrivacyType"></param>
        /// <returns>Успешно ли прошла загрузка</returns>
        public static bool Load(string profilePath, ProfileItemPrivacyType profileItemPrivacyType)
        {
            if (profileItemPrivacyType == ProfileItemPrivacyType.Public)
            {
                Clear();
            }
            // костыль для FS9
            var xp         = new XPathDocument(profilePath);
            var nav        = xp.CreateNavigator();
            var navPointer = nav.Select("/" + ProfileHeader);

            navPointer.MoveNext();
            if (profileItemPrivacyType == ProfileItemPrivacyType.Public)
            {
                _currentProfileName = navPointer.Current.GetAttribute("Name", navPointer.Current.NamespaceURI);
            }
            if (!Guid.TryParse(navPointer.Current.GetAttribute("Id", navPointer.Current.NamespaceURI), out _currentProfileId))
            {
                _currentProfileId = GlobalId.GetNew();
            }
            if (profileItemPrivacyType == ProfileItemPrivacyType.Public)
            {
                _currentProfilePath = profilePath;
            }
            else
            {
                _currentPersonalProfilePath = profilePath;
            }
            navPointer = nav.Select("/" + ProfileHeader + "/Panels/Panel");
            while (navPointer.MoveNext())
            {
                var panel = Panel.Load(navPointer.Current);
                panel.SetPrivacyType(profileItemPrivacyType);
                PanelStorage.StorePanel(panel);
            }

            navPointer = nav.Select("/" + ProfileHeader + "/Variables");
            navPointer.MoveNext();
            _mainSimulatorProcess = navPointer.Current.GetAttribute("ProcessToManage", navPointer.Current.NamespaceURI);
            VariableStorage.Load(nav, ProfileHeader, profileItemPrivacyType);

            AccessDescriptor.Load(nav, ProfileHeader, profileItemPrivacyType);
            return(true);
        }
Example #5
0
 protected DescriptorBase()
 {
     Id = GlobalId.GetNew();
     CalculatorE.RegisterTokenizer(CalculatorVariableAccessAddonE.VariableTokenizer);
     CalculatorE.RegisterPreprocessor(CalculatorVariableAccessAddonE.VariablePreprocessor);
 }
Example #6
0
 protected VariableBase()
 {
     Id      = GlobalId.GetNew();
     PanelId = Guid.Empty;
 }
Example #7
0
 /// <summary>
 /// Конструктор, вызываемый при создании новой панели
 /// </summary>
 public Panel()
 {
     Id = GlobalId.GetNew();
 }