Exemplo n.º 1
0
        internal static int AddExtension(Extensions form, ExtensionObjectList extensionObjectList, int newExtensionIdentity)
        {
            TreeView extensionTreeView = form.extensionTreeView;

            if (newExtensionIdentity < extensionTreeView.Nodes.Count)
            {
                newExtensionIdentity = extensionTreeView.Nodes.Count;
            }

            newExtensionIdentity++;
            String description = String.Format("{0} ({1})", LanguageUtil.GetCurrentLanguageString("New", className), newExtensionIdentity);

            while (CheckIdentityExists(form, extensionObjectList, description))
            {
                newExtensionIdentity++;
                description = String.Format("{0} ({1})", LanguageUtil.GetCurrentLanguageString("New", className), newExtensionIdentity);
            }

            ExtensionObject extensionObject = new ExtensionObject(description, String.Empty, false);

            extensionObjectList.Add(extensionObject);

            extensionTreeView.Focus();
            extensionTreeView.Nodes.Add(description);
            extensionTreeView.SelectedNode = extensionTreeView.Nodes[extensionTreeView.Nodes.Count - 1];

            return(newExtensionIdentity);
        }
Exemplo n.º 2
0
        private static ExtensionObjectList LoadExtensionsListPrivate(Extensions form, bool suppressMessageBox)
        {
            TreeView extensionTreeView = form.extensionTreeView;

            ExtensionObjectList extensionObjectList = new ExtensionObjectList();

            String fileContent = FileUtil.ReadToEndWithStandardEncoding(Path.Combine(ConstantUtil.ApplicationExecutionPath(), ConstantUtil.exFile));

            String[] separator           = { Environment.NewLine };
            String[] splittedFileContent = fileContent.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            if (splittedFileContent.Length > 0)
            {
                extensionTreeView.BeginUpdate();
            }

            foreach (String extensionString in splittedFileContent)
            {
                separator[0] = "|";
                String[] splittedExtensionContent = extensionString.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                if (splittedExtensionContent.Length != 3)
                {
                    if (!suppressMessageBox)
                    {
                        WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("Reading", className));
                    }
                    FileListManager.SaveFileList(ConstantUtil.exFile, ConstantUtil.defaultExtensionFileContent);
                    return(LoadExtensionsList(form));
                }

                extensionTreeView.Nodes.Add(splittedExtensionContent[0]); //Text document

                ExtensionObject extensionObject = new ExtensionObject(splittedExtensionContent[0], splittedExtensionContent[1], Convert.ToBoolean(splittedExtensionContent[2]));
                extensionObjectList.Add(extensionObject);
            }

            if (splittedFileContent.Length > 0)
            {
                extensionTreeView.EndUpdate();
            }

            extensionTreeView.Focus();
            extensionTreeView.SelectedNode = extensionTreeView.Nodes[0];

            return(extensionObjectList);
        }
Exemplo n.º 3
0
        internal static ExtensionObjectList GetExtensionObjectListFromExFile()
        {
            ExtensionObjectList extensionObjectList = new ExtensionObjectList();

            String fileContent = FileUtil.ReadToEndWithStandardEncoding(Path.Combine(ConstantUtil.ApplicationExecutionPath(), ConstantUtil.exFile));

            String[] separator           = { Environment.NewLine };
            String[] splittedFileContent = fileContent.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            foreach (String extensionString in splittedFileContent)
            {
                separator[0] = "|";
                String[] splittedExtensionContent = extensionString.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                ExtensionObject extensionObject = new ExtensionObject(splittedExtensionContent[0], splittedExtensionContent[1], Convert.ToBoolean(splittedExtensionContent[2]));
                extensionObjectList.Add(extensionObject);
            }

            return(extensionObjectList);
        }