示例#1
0
        public string GetStarterForLastVersion(int platformType, bool thinClient = false)
        {
            string result = "";

            platformInfo platform = GetPlatform(platformType);

            if (platform != null)
            {
                result = platform.starter;

                platformVersion lastVersion = GetLastVersion(platformType);

                if (lastVersion != null)
                {
                    if (thinClient)
                    {
                        result = lastVersion.thinStarter;
                    }
                    else
                    {
                        result = lastVersion.defaultStarter;
                    }
                }
            }

            return(result);
        }
示例#2
0
        public string GetStarter(int platformType, string platformVer = "", bool thinClient = false)
        {
            string result = "";

            platformInfo platform = GetPlatform(platformType);

            if (platform != null)
            {
                result = platform.starter;

                if (!String.IsNullOrEmpty(platformVer))
                {
                    platformVersion version = platform.versions.GetVersion(platformVer);

                    if (version != null)
                    {
                        if (thinClient)
                        {
                            result = version.thinStarter;
                        }
                        else
                        {
                            result = version.defaultStarter;
                        }
                    }
                }
            }

            return(result);
        }
示例#3
0
        private void LoadPlatformFromPath7(string folder)
        {
            string[] folders = new string[3];
            folders[0] = "1Cv77";
            folders[1] = "1Cv77S";
            folders[2] = "1Cv77.ADM";

            foreach (string subfolder in folders)
            {
                if (Directory.Exists(folder + subfolder))
                {
                    if (Directory.Exists(folder + subfolder + @"\bin"))
                    {
                        string[] startFiles = new string[3];
                        startFiles[0] = "1cv7s.exe";
                        startFiles[1] = "1cv7.exe";
                        startFiles[2] = "1cv7l.exe";

                        foreach (string startFile in startFiles)
                        {
                            if (File.Exists(folder + subfolder + @"\bin\" + startFile))
                            {
                                platformInfo platform = GetPlatform(77);
                                if (platform == null)
                                {
                                    platform = AddPlatform(77, folder + subfolder + @"\bin\" + startFile);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#4
0
        public List <string> GetPlatformVersions(int platformType)
        {
            List <string> result = new List <string>();

            platformInfo platform = GetPlatform(platformType);

            if (platform != null)
            {
                foreach (platformVersion version in platform.versions)
                {
                    result.Add(version.versionString);
                }
            }

            return(result);
        }
示例#5
0
        private platformInfo AddPlatform(int platformType, string starter)
        {
            if (File.Exists(starter))
            {
                platformInfo platform = new platformInfo();
                platform.platformType = platformType;
                platform.starter      = starter;

                Add(platform);

                return(platform);
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        private platformInfo GetPlatform(int platformType)
        {
            platformInfo result = null;

            int index = 0;

            while (index < List.Count && result == null)
            {
                platformInfo platform = (platformInfo)List[index];
                if (platform.platformType == platformType)
                {
                    result = platform;
                }
                index++;
            }

            return(result);
        }
示例#7
0
        private void LoadPlatformFromPath8(string folder, string subfolder, string platformTypeStr, int platformType)
        {
            if (Directory.Exists(folder + subfolder))
            {
                if (Directory.Exists(folder + subfolder + @"\common"))
                {
                    platformInfo platform = GetPlatform(platformType);
                    if (platform == null)
                    {
                        platform = AddPlatform(platformType, folder + subfolder + @"\common\1cestart.exe");
                    }

                    if (platform != null)
                    {
                        Regex RegExp = new Regex(@".*\\(?<version>(" + platformTypeStr + @"[.\d]*))$");

                        foreach (string childFolder in Directory.GetDirectories(folder + subfolder))
                        {
                            MatchCollection Matches = RegExp.Matches(childFolder);
                            if (Matches.Count > 0)
                            {
                                string stringVersion = Matches[0].Groups["version"].Value;
                                if (platform.versions.GetVersion(stringVersion) == null)
                                {
                                    platform.AddPlatformVersion(stringVersion, childFolder + @"\bin\");
                                }
                            }
                        }

                        RegExp = null;
                    }
                }
                else
                {
                    platformInfo platform = GetPlatform(platformType);
                    if (platform == null)
                    {
                        AddPlatform(platformType, folder + subfolder + @"\bin\1cv8.exe");
                    }
                }
            }
        }
示例#8
0
        private platformVersion GetLastVersion(int platformType)
        {
            platformVersion lastVersion = null;

            platformInfo platform = GetPlatform(platformType);

            if (platform != null)
            {
                int maxVersion = 0;

                foreach (platformVersion version in platform.versions)
                {
                    if (version.version > maxVersion)
                    {
                        maxVersion  = version.version;
                        lastVersion = version;
                    }
                }
            }

            return(lastVersion);
        }
示例#9
0
        private void LoadPlatformFromRegister(List <string> v8Folders, int platformType, string starterName, string commonTemplate, string binTemplate)
        {
            // 8.x common
            Regex  RegExp = new Regex(commonTemplate);
            string path   = null;

            foreach (string KeyValue in v8Folders)
            {
                path = KeyValue;

                if (RegExp.IsMatch(KeyValue))
                {
                    platformInfo platform = GetPlatform(platformType);

                    if (!path.EndsWith(@"\"))
                    {
                        path += @"\";
                    }

                    if (platform == null)
                    {
                        AddPlatform(platformType, path + starterName);
                    }
                    else
                    {
                        platform.starter = path + starterName;
                    }
                }
            }

            if (!String.IsNullOrEmpty(binTemplate))
            {
                // 8.x bin
                RegExp = new Regex(binTemplate);

                foreach (string KeyValue in v8Folders)
                {
                    path = KeyValue;

                    MatchCollection Matches = RegExp.Matches(KeyValue);
                    if (Matches.Count > 0)
                    {
                        if (!path.EndsWith(@"\"))
                        {
                            path += @"\";
                        }

                        platformInfo platform = GetPlatform(platformType);

                        if (platform != null)
                        {
                            string stringVersion = Matches[0].Groups["version"].Value;
                            if (platform.versions.GetVersion(stringVersion) == null)
                            {
                                platform.AddPlatformVersion(stringVersion, path);
                            }
                        }
                    }
                }
            }
            RegExp = null;
        }
示例#10
0
 private void Remove(platformInfo platform)
 {
     List.Remove(platform);
 }
示例#11
0
 private void Add(platformInfo platform)
 {
     List.Add(platform);
 }