コード例 #1
0
ファイル: ServiceMobile.cs プロジェクト: BInny1/mobileservice
    public List <CarsInfo.PackagesInfo> GetPackageDetailsByUID(string UID, string AuthenticationID, string CustomerID, string SessionID)
    {
        List <CarsInfo.PackagesInfo> objPackagesInfo = new List <CarsInfo.PackagesInfo>();

        MobileBL objMobileBL = new MobileBL();

        try
        {
            if (CustomerID.Trim() != "")
            {
                DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("GetPackageDetailsByUID", CustomerID, AuthenticationID, UID);
            }
            bool bnew = objMobileBL.CheckMobileAuthorizeUSer(SessionID, Convert.ToInt32(UID));
            if (bnew)
            {
                if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
                {
                    objPackagesInfo = (List <CarsInfo.PackagesInfo>)objMobileBL.GetPackageDetailsBYUID(UID);
                }
            }
            else
            {
                PackagesInfo objPack = new PackagesInfo();
                objPack.AASuccess = "Session timed out";
                objPackagesInfo.Add(objPack);
            }
        }
        catch (Exception ex)
        {
        }

        return(objPackagesInfo);
    }
コード例 #2
0
 public override void Configure(string src, string dst, PackagesInfo pi)
 {
     foreach (var copyPath in pi.NugetInfo.CopyPaths)
     {
         var s    = copyPath.Src.StartsWith("/") ? copyPath.Src.Substring(1) : copyPath.Src;
         var d    = copyPath.Dst.StartsWith("/") ? copyPath.Dst.Substring(1) : copyPath.Dst;
         var src1 = Path.Combine(src, s);
         var dst1 = Path.Combine(dst, d);
         Io.CreateDirIfNotExist(dst1);
         var files    = GetFiles(src1);
         var copyList = CreateCopyList(src1, dst1, files);
         FilesToCopy.AddRange(copyList);
     }
 }
コード例 #3
0
ファイル: SlnxHandler.cs プロジェクト: igiona/slnlauncher
        public SlnxHandler(string fName, SlnXType userSettings, IFileWriter writer, ILogger logger, string debugPackageId, bool offlineMode)
        {
            _logger      = logger;
            _fileWriter  = writer;
            _offlineMode = offlineMode;
            if (!string.IsNullOrEmpty(debugPackageId))
            {
                userSettings = null; //Ignore use settings in case of an import via <debug package.../>
            }
            _slnxPath = Path.GetFullPath(fName);
            Assert(File.Exists(_slnxPath), "The provided SlnX file '{0}' is not a file or it doesn't exists", _slnxPath);
            _slnxDirectory           = Path.GetDirectoryName(_slnxPath);
            _slnxFile                = Path.GetFileName(fName);
            _slnxName                = Path.GetFileNameWithoutExtension(fName);
            _specialSlnxKeys["slnx"] = _slnxDirectory;
            _slnx = ReadSlnx(fName);

            AppendSpecialKeys(false);
            ExtendDictionary(_environmentVariables, _slnx.env, true);
            ExtendDictionary(_packageBundles, _slnx.bundle, true);

            TryApplyUserEnvironmentValues(userSettings); //Eventually apply user settings

            SetAll(_environmentVariables);               // to allow import having env variable in the path

            ExpandAll(_environmentVariables);            // to allow import having env variable with special keys in the path

            ReadImports(_environmentVariables, _packageBundles, _packagesInfo);

            TryApplyUserEnvironmentValues(userSettings); //re-Apply, to override value from the imports

            ExpandAll(_environmentVariables);            // to apply imports & user env vars

            string enforcedContainer = null;

            if (!string.IsNullOrEmpty(debugPackageId))
            {
                enforcedContainer = $"_DEBUG/{debugPackageId}";
            }

            if (offlineMode)
            {
                _offlineCache = new Uri(PackagesPath);
                _logger.Info($"Offline mode for {SlnxName}, using {PackagesPath} as package source.");
            }
            ExtendList(_packagesInfo, _slnx.package, _offlineCache);
            _projects = FindProjects(_slnx.project, ProjectsSearchPath, _slnx.skip, enforcedContainer);

            if (string.IsNullOrEmpty(debugPackageId)) //Main SlnX
            {
                EvalueteDebugPackages(_slnx.debug);
                EvalueteDebugPackages(userSettings?.debug);

                //Read debug SlnX
                foreach (var item in _packagesToDebug)
                {
                    var debugSourcePakckage = PackagesInfo.Where(x => x.Identity.Id.Equals(item.Key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                    Assert(debugSourcePakckage != default(NuGetPackageInfo), $"The package {item.Key} is marked for debug, but it is not present as nuget package in the main SlnX file.");

                    var slnxItem = new SlnxHandler(item.Value, _fileWriter, _logger, offlineMode, item.Key);
                    _debugSlnxItems[debugSourcePakckage] = slnxItem;
                    _packagesInfo.Remove(debugSourcePakckage);

                    foreach (var candidate in slnxItem.Packages)
                    {
                        if (_packagesToDebug.ContainsKey(candidate.Identity.Id))
                        {
                            //This package is under debug, no version check needed.
                            continue;
                        }

                        var known = Packages.Where(x => x.Identity.Id.Equals(candidate.Identity.Id, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                        if (known == default(NuGetPackage))
                        {
                            _logger?.Warn($"The package {candidate} required by the SlnX {item.Key} selected for debug, is not present in the current SlnX file {_slnxName}{SlnxExtension}");
                        }
                        else
                        {
                            Assert(known.Identity.MinVersion == candidate.Identity.MinVersion &&
                                   known.TargetFramework == candidate.TargetFramework &&
                                   known.PackageType == candidate.PackageType,
                                   $"The package {candidate} required by the SlnX {item.Key} selected for debug, does not match the already known one {known}");
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: PanNiebieski/ConsoleTask
        /// <summary>
        /// CheckFile
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        /// <exception cref="DirectoryNotFoundException"></exception>
        /// <exception cref="FileNotFoundException"></exception>
        /// <exception cref="IOException"></exception>
        /// <exception cref="PathTooLongException"></exception>
        /// <exception cref="System.Security.SecurityException"></exception>
        /// <exception cref="UnauthorizedAccessException"></exception>
        public static List <PackagesInfo> ReadFile(string fileName)
        {
            var  lines   = File.ReadLines(fileName);
            bool isDigit = false;
            List <PackagesInfo> listOfPackagesToInstallInThisConfigFile =
                new List <PackagesInfo>();

            PackagesInfo packagesToInstall = null;

            int helperNumberToCheckHowManyLinesIExecutedAboutDepenedencies = 0;

            foreach (var line in lines)
            {
                if (line.Length > 0)
                {
                    isDigit = Char.IsDigit(line[0]);
                    if (isDigit)
                    {
                        packagesToInstall = new PackagesInfo();
                        packagesToInstall.NumberPackagesToInstall = int.Parse(line[0].ToString());
                        continue;
                    }

                    if (packagesToInstall != null)
                    {
                        helperNumberToCheckHowManyLinesIExecutedAboutDepenedencies++;
                        Package p = new Package();

                        string[] arrayString = line.Split(",");

                        p.PackagedName = arrayString[0];
                        p.Version      = arrayString[1];
                        packagesToInstall.Packages.Add(p);

                        bool flag = true;


                        Package dep = null;
                        for (int i = 2; i < arrayString.Length; i++)
                        {
                            if (flag)
                            {
                                dep = new Package();
                                dep.PackagedName = arrayString[i];
                                flag             = false;
                            }
                            else
                            {
                                dep.Version = arrayString[i];
                                p.Dependencies.Add(dep);
                                dep  = null;
                                flag = true;
                            }
                        }



                        if (helperNumberToCheckHowManyLinesIExecutedAboutDepenedencies == packagesToInstall.NumberPackagesToInstall)
                        {
                            listOfPackagesToInstallInThisConfigFile.Add(packagesToInstall);
                            packagesToInstall = null;
                            helperNumberToCheckHowManyLinesIExecutedAboutDepenedencies = 0;
                        }
                    }
                }
                else
                {
                    continue;
                    //throw new Exception("Empty Line in config file");
                }
            }

            return(listOfPackagesToInstallInThisConfigFile);
        }