public void TestNoParameters()
        {
            var programParameters = new ProgramParameters();

            programParameters.Init(new string[] {});
            Assert.IsEmpty(programParameters.ToList());
        }
示例#2
0
        public void Process(string[] args)
        {
            _stopWatch = Stopwatch.StartNew();
            _log.Enter(this, args: args);

            ProgramParameters parameters = ValidateArgsAndExtractProgramParameters(args);

            if (parameters == null)
            {
                return;
            }

            var filePaths = _fileFinder.Find(parameters.InputFilePattern);

            if (!filePaths.Any())
            {
                return;
            }

            var finalStatistics = ProcessEachFileInParallel(parameters, filePaths);

            foreach (var statistic in finalStatistics)
            {
                _log.Info(statistic);
            }
            _log.Info($"Program completed in {_stopWatch.ElapsedMilliseconds}ms.");
        }
        public void TestBadParameters()
        {
            var programParameters = new ProgramParameters();
            var ex = Assert.Throws <Exception>(() => programParameters.Init(new[] { "abc" }));

            Assert.AreEqual("Bad program parameters: command is expected", ex.Message);
        }
示例#4
0
        static void Main(string[] args)
        {
            var time1 = DateTime.Now;

            Console.WriteLine("CurrentDirectory: " + Directory.GetCurrentDirectory());

            try
            {
                var rawParameters = new ProgramParameters();
                rawParameters.Init(args);
                var xmlParameter = rawParameters.FirstOrDefault(r => r.Command == "xml");
                if (xmlParameter == null)
                {
                    throw new Exception("-xml parameter should be provided");
                }
                foreach (var argument in xmlParameter.Arguments)
                {
                    if (!File.Exists(argument))
                    {
                        throw new Exception("Config file " + argument + "does not exist");
                    }
                    var dispatcher = new AnalyzerDispatcher(File.ReadAllText(argument));
                    dispatcher.Execute();
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            var time2 = DateTime.Now;

            Console.WriteLine("Time(sec): " + (time2 - time1));
            //Console.ReadLine();
        }
示例#5
0
        static int Main(string[] args)
        {
            ProgramParameters programParams = ParseParameters(args);

            if (!ValidateFilesExists(programParams.Files))
            {
                return(-2);
            }

            CompilerDriver driver = new CompilerDriver(programParams.Files, "Test.ll");
            CompileStatus  status = driver.CompileFiles();

            if (status.Success)
            {
                Console.WriteLine("Built successfully");
            }
            else
            {
                Console.WriteLine("Error building");
                Console.WriteLine(String.Join("\n",
                                              status.Errors.Select(e => String.Format("File: {0} Line:{1} Column:{2} {3}", e.ErrorSourceFile, e.ErrorLineNumber, e.ErrorPositionInLine, e.ErrorMessage))
                                              ));
            }

            Console.ReadLine();
            return(0);
        }
示例#6
0
 public void PlaySoundEffect()
 {
     if (ProgramParameters.Get_MusicEnable())
     {
         OnMoveSoundEffect.Play(0.5f, 0f, 0f);
     }
 }
示例#7
0
        public string MakeFromTrsx(string fileName, XElement trsxElement, ProgramParameters parameters)
        {
            _log.Enter(this);

            var intents           = new Dictionary <string, HashSet <EntityBasedUtterance> >();
            var allUtterances     = trsxElement.Descendants("sample");  // Utterances are named "samples" in Nuance
            var lines             = new List <string>();
            var reducedUtterances = allUtterances;
            var stats             = new FileStatistic {
                FileName = new FileInfo(fileName).Name, IgnoredIntents = new List <string>()
            };

            stats.UtteranceCount = trsxElement.Descendants("sample").Count();

            reducedUtterances = RemoveUtterancesForIgnoredIntents(parameters, reducedUtterances, stats);

            foreach (var utterance in reducedUtterances)
            {
                stats.ProcessedUtteranceCount += ExtractEntityBasedUtteranceFromXElement(intents, utterance);
            }
            stats.IntentCount = intents.Keys.Count();

            foreach (var key in intents.Keys)
            {
                stats.ResultingUtteranceCount += intents[key].Count();
            }
            stats.LinesWritten = _exceptionHandler.Get(() => WriteIntentsToLudownFile(parameters.DestinationFolderName, fileName, intents));

            return(_statisticsGenerator.Generate(stats));
        }
示例#8
0
        private void kayıtAyarlarıToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProgramParameters prgParamsPage = new ProgramParameters();
            DialogResult      dialogResult  = prgParamsPage.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
            }
        }
示例#9
0
        public static string CreateDefaultFileParam()
        {
            m_Param               = new ProgramParameters();
            m_Param.SVNPath       = @"Путь к папки со схемой проекта, например: С:\Projects\AIS_SN\AIS.SN.Database\1.Schema";
            m_Param.SnapshotPath  = @"Путь куда будут сохраняться снапшоты";
            m_Param.SVNCommandLog = @"TortoiseProc.exe /command:log /path:""{0}""";

            SaveProgramParameters();

            return(ProgramParametersFileName);
        }
示例#10
0
        public void TestOneSimpleParameter()
        {
            var programParameters = new ProgramParameters();

            programParameters.Init(new [] { "-abc" });
            var result = programParameters.ToList();

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("abc", result[0].Command);
            Assert.AreEqual(0, result[0].Arguments.Count);
        }
示例#11
0
        static ProgramParameters GetProgramParameters(string[] args)
        {
            Option[] options =
            {
                new Option("-R",     false),
                new Option("COLOR",  true),
                new Option("FORMAT", true),
            };

            Dictionary <string, ImageFormat> imageFormatTable
                = new Dictionary <string, ImageFormat>();

            imageFormatTable.Add("BMP", ImageFormat.Bmp);
            imageFormatTable.Add("PNG", ImageFormat.Png);
            imageFormatTable.Add("JPEG", ImageFormat.Jpeg);

            ProgramParameters param = new ProgramParameters();

            param.Options                = new ProgramOptions();
            param.Options.Recursive      = true;
            param.Options.Color          = 1;
            param.Options.ImageExtension = "PNG";
            OptionResult result = OptionParser.Parse(options, args);

            if (result.Options.ContainsKey("-R"))
            {
                param.Options.Recursive = false;
            }
            if (result.Options.ContainsKey("COLOR"))
            {
                param.Options.Color = Int32.Parse(result.Options["COLOR"]);
                if (param.Options.Color < 1 || param.Options.Color > 3)
                {
                    throw new FormatException("カラーは1から3の間を指定してください。");
                }
            }
            if (result.Options.ContainsKey("FORMAT"))
            {
                param.Options.ImageExtension = result.Options["FORMAT"];
                if (!imageFormatTable.ContainsKey(param.Options.ImageExtension))
                {
                    throw new FormatException("無効なファイル形式が指定されました。");
                }
            }
            param.Options.ImageFormat = imageFormatTable[param.Options.ImageExtension];
            if (result.Rest.Count == 0)
            {
                throw new FormatException("パスが指定されていません。");
            }
            param.FileNames = result.Rest;

            return(param);
        }
 public bool IsProgramNameExists(string programName, int resourceID)
 {
     try
     {
         var param = ProgramParameters.GetProgramNameParameter(projectDBManager, programName, resourceID);
         return(Convert.ToBoolean(projectDBManager.GetScalarValue("SELECT project.is_program_name_exists(@program_name, @resource_id)", CommandType.Text, param.ToArray())));
     }
     catch (Exception isProgramNameExistsException)
     {
         throw new Exception(ExceptionMessages.IS_PROGRAM_NAME_EXISTS_DATA_ACCESS_ERROR_MSG, isProgramNameExistsException);
     }
 }
示例#13
0
        public static void ReloadProgramParameters()
        {
            var serializer = new XmlSerializer(typeof(ProgramParameters));

            using (var fp = File.OpenRead(ProgramParametersFileName))
            {
                m_Param = (ProgramParameters)serializer.Deserialize(fp);
            }
            if (string.IsNullOrEmpty(m_Param.SVNCommandLog))
            {
                m_Param.SVNCommandLog = @"TortoiseProc.exe /command:log /path:""{0}""";
            }
        }
示例#14
0
         static void Main(string[] args)
         {
             string result = string.Empty;
  
             StringConverter stringConverter = new StringConverterClass();
  
             // Define an AS400 system and connect to it
             AS400System system = new AS400System();
             system.Define("AS400");
             system.UserID = "USERNAME";
             system.Password = "******";
             system.IPAddress = "127.0.0.1";
             system.Connect(cwbcoServiceEnum.cwbcoServiceRemoteCmd);
  
             // Check the connection
             if (system.IsConnected(cwbcoServiceEnum.cwbcoServiceRemoteCmd) == 1)
             {
                 // Create a program object and link to a system                
                 cwbx.Program program = new cwbx.Program();
                 program.LibraryName = "LIBRARY";
                 program.ProgramName = "RPGPROG";
                 program.system = system;
  
                 // Sample parameter data
                 char chrValue = '1';
 				string strValue1 = "ABC";
 				string strValue2 = "DEF";
 				string outp = "";
  
                 // Create a collection of parameters associated with the program
                 ProgramParameters parameters = new ProgramParameters();
                 
 				parameters.Append("P1", cwbrcParameterTypeEnum.cwbrcInput, 1);
 				parameters["P1"].Value = chrValue;
 				
 				parameters.Append("P2"), cwbrcParameterTypeEnum.cwbrcInput, 3);
 				parameters["P2"].Value = strValue1;
 				
 				parameters.Append("P3"), cwbrcParameterTypeEnum.cwbrcInput, 3);
 				parameters["P3"].Value = strValue1;
 				
                 parameters.Append("P4", cwbrcParameterTypeEnum.cwbrcOutput, 3);
                 
  
                 outp = stringConverter.FromBytes(parameters["P4"].Value);
             }
  
             system.Disconnect(cwbcoServiceEnum.cwbcoServiceAll);
             Console.WriteLine(result);
             Console.ReadKey();
         }
示例#15
0
        public OpenSubtitlesService(
            ILogger <OpenSubtitlesService> logger,
            ProgramParameters programParameters,
            IOptions <SubtitleDownloaderSettings> options,
            IOpenSubtitlesApi openSubtitlesApi,
            WebClient webClient)
        {
            this.logger            = logger;
            this.programParameters = programParameters;
            this.openSubtitlesApi  = openSubtitlesApi;
            this.webClient         = webClient;

            Settings = options.Value;
        }
 public int CreateProgram(Program program)
 {
     try
     {
         int programID  = 0;
         var parameters = ProgramParameters.GetCreateProgramParameters(projectDBManager, program);
         programID = projectDBManager.Insert("CALL project.create_program(@program_name,@created_by,@resource_id,@program_id)", CommandType.Text, parameters.ToArray(), out programID);
         return(programID);
     }
     catch (Exception createProgramException)
     {
         throw new Exception(ExceptionMessages.CREATE_PROGRAM_DATA_ACCESS_ERROR_MSG, createProgramException);
     }
 }
示例#17
0
        public void TestOneParameterWithArguments()
        {
            var programParameters = new ProgramParameters();

            programParameters.Init(new [] { "-abc", "first", "second", "third" });
            var result = programParameters.ToList();

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("abc", result[0].Command);
            Assert.AreEqual(3, result[0].Arguments.Count);
            Assert.AreEqual("first", result[0].Arguments[0]);
            Assert.AreEqual("second", result[0].Arguments[1]);
            Assert.AreEqual("third", result[0].Arguments[2]);
        }
示例#18
0
        private static void ApplyConfigTransformationIfAvailable(ProgramParameters inputParameters)
        {
            using (ZipFile zippedXapFile = ZipFile.Read(inputParameters.XapLocation))
            {

                if (!zippedXapFile.ContainsEntry(SILVERLIGHT_CONFIG_FILE))
                    ExitAsNoChangePossible();

                if (!zippedXapFile.ContainsEntry(
                    GetSilverlightEnvironmentTransformFile(inputParameters.TargetEnvironment)))
                    ExitAsNoChangeAvailable(inputParameters.TargetEnvironment);

                PerformTransformation(zippedXapFile, inputParameters);
            }
        }
示例#19
0
        private static IEnumerable <XElement> RemoveUtterancesForIgnoredIntents(ProgramParameters parameters, IEnumerable <XElement> reducedUtterances, FileStatistic stats)
        {
            if (parameters.IgnoredIntents != null && parameters.IgnoredIntents.Any())
            {
                foreach (var ignoredIntent in parameters.IgnoredIntents)
                {
                    stats.IgnoredIntentCount++;
                    stats.IgnoredUtteranceCount += reducedUtterances.Count(s => !s.Attribute("intentref").Value.StartsWith(ignoredIntent));
                    stats.IgnoredIntents.Add(ignoredIntent);

                    reducedUtterances = reducedUtterances.Where(s => !s.Attribute("intentref").Value.StartsWith(ignoredIntent));
                }
            }

            return(reducedUtterances);
        }
示例#20
0
        public void Init(ProgramParameters parameters)
        {
            foreach (var parameter in parameters)
            {
                switch (parameter.Command)
                {
                case "d":
                    SetDirectory(parameter.Arguments);
                    break;

                case "s":
                    SetCommand(parameter.Arguments);
                    break;
                }
            }
        }
示例#21
0
        private ConcurrentBag <string> ProcessEachFileInParallel(ProgramParameters parameters, System.Collections.Generic.IEnumerable <string> filePaths)
        {
            var _statisticsBag = new ConcurrentBag <string>();

            Parallel.ForEach(filePaths, filePath =>
            {
                switch (parameters.FileType.ToLower())
                {
                case "trsx": _statisticsBag.Add(ProcessTrsxModel(filePath, parameters)); break;

                default: _log.Warning($"Unrecognized file format: '{filePath}'"); break;
                }
                ;
            });
            return(_statisticsBag);
        }
示例#22
0
        private static ProgramParameters ParseParameters(string[] args)
        {
            ProgramParameters programParams = new ProgramParameters { Files = new List<string>(args), OutputFile = "outputFile.exe"};
            if (programParams.Files.Count == 0)
            {
                string testFileName = @"..\..\StandardLibrary\CoreLibrary.cleps";
                string testFileName2 = @"..\..\SampleCode\TestProgram.cleps";

                if (File.Exists(testFileName) && File.Exists(testFileName2))
                {
                    programParams.Files.Add(testFileName);
                    programParams.Files.Add(testFileName2);
                }
            }

            return programParams;
        }
示例#23
0
        static private void ChceckTimerObjects()
        {
            for (int i = ObjectToDraw.Count - 1; i >= 0; i--)
            {
                if (ObjectToDraw[i] is Fire fire1)
                {
                    fire1.ShorterTimeToEndFire();
                    if (fire1.GetTimeToEndFire() <= 0)
                    {
                        ObjectToDraw.Remove(ObjectToDraw[i]);
                    }
                }
                else if (ObjectToDraw[i] is Powerups powerups1)
                {
                    if (powerups1.GetIndestructible() <= 0)
                    {
                        powerups1.SetNextTexture(PowerupsTextures[powerups1.GetTypePowerups() - 1].Count);
                    }
                    else
                    {
                        powerups1.IndestructibleDecrement();
                    }
                }
                else if (ObjectToDraw[i] is Bomb bomb1)
                {
                    bomb1.ShortenTheTimer();
                    if (bomb1.GetTimer() % ((int)(bomb1.GetMaxTime() / (BombTextures.Count)) + 1) == 0 && bomb1.GetMaxTime() != bomb1.GetTimer())
                    {
                        bomb1.SetNextTexture();
                    }
                    if (bomb1.CheckDestroyTimer())
                    {
                        DestroyBomb(i, bomb1);
                        if (ProgramParameters.Get_MusicEnable())
                        {
                            BombDestroy.Play(0.5f, 0f, 0f);
                        }
                    }
                }
            }

            foreach (Character Character1 in Player)
            {
                Character1.ShortenTheDelay();//Player shorten time to put bomb
            }
        }
示例#24
0
 static private void TryPickPowerUp(ref List <Powerups> powerups)
 {
     foreach (Character character1 in Player)
     {
         for (int i = powerups.Count - 1; i >= 0; i--)
         {
             if (powerups[i].ChceckColision(character1.GetPosX(), character1.GetPosY()))
             {
                 Powerups powerup1 = (Powerups)powerups[i];
                 powerup1.AddPower(character1);
                 powerups.Remove(powerups[i]);
                 if (ProgramParameters.Get_MusicEnable())
                 {
                     PowerupsPick.Play(0.5f, 0f, 0f);
                 }
             }
         }
     }
 }
示例#25
0
        private static ProgramParameters ParseParameters(string[] args)
        {
            ProgramParameters programParams = new ProgramParameters {
                Files = new List <string>(args), OutputFile = "outputFile.exe"
            };

            if (programParams.Files.Count == 0)
            {
                string testFileName  = @"..\..\StandardLibrary\CoreLibrary.cleps";
                string testFileName2 = @"..\..\SampleCode\TestProgram.cleps";

                if (File.Exists(testFileName) && File.Exists(testFileName2))
                {
                    programParams.Files.Add(testFileName);
                    programParams.Files.Add(testFileName2);
                }
            }

            return(programParams);
        }
示例#26
0
        public void Call(string programName, string libraryName, ProgramParameters parameters)
        {
            if (system.IsConnected(cwbcoServiceEnum.cwbcoServiceRemoteCmd) == 0)
            {
                Connect();
            }

            program.ProgramName = programName;
            program.LibraryName = libraryName;
            Parameters          = parameters;

            try
            {
                program.Call(Parameters);
            }
            catch (Exception ex)
            {
                ThrowCustomException(ex);
            }
        }
 public IEnumerable <Program> GetPrograms(int resourceID, int programID = 0, bool listAllPrograms = true)
 {
     try
     {
         var            parameters = ProgramParameters.GetProgramParameters(projectDBManager, programID, resourceID, listAllPrograms);
         DataTable      dtProject  = projectDBManager.GetDataTable("SELECT * FROM project.get_program_list(@program_id,@resource_id,@list_all_programs)", CommandType.Text, parameters.ToArray());
         List <Program> programs   = dtProject.AsEnumerable()
                                     .Select(x => new Program()
         {
             ID         = x.Field <int>("programid"),
             Name       = x.Field <string>("programname"),
             CreatedBy  = x.Field <string>("createdby"),
             ResourceID = x.Field <int>("resourceid")
         }).ToList();
         return(programs);
     }
     catch (Exception getProgramsException)
     {
         throw new Exception(ExceptionMessages.GET_PROGRAMS_DATA_ACCESS_ERROR_MSG, getProgramsException);
     }
 }
        public ProgramParameters Extract(params string[] args)
        {
            if (!_argumentValidator.IsValid(args))
            {
                return(null);
            }

            var result = new ProgramParameters();

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].Equals("-h", StringComparison.InvariantCultureIgnoreCase) || args[i].Equals("--help", StringComparison.InvariantCultureIgnoreCase))
                {
                    result.DisplayHelp = true;
                    return(result);
                }

                if (args[i].Equals("-i", StringComparison.InvariantCultureIgnoreCase) || args[i].Equals("--inputPattern", StringComparison.InvariantCultureIgnoreCase))
                {
                    result.FileType         = Path.GetFileName(args[i + 1]).Split('.')[1];
                    result.InputFilePattern = args[++i];
                    continue;
                }

                if (args[i].Equals("-o", StringComparison.InvariantCultureIgnoreCase) || args[i].Equals("--outputFolder", StringComparison.InvariantCultureIgnoreCase))
                {
                    result.DestinationFolderName = args[++i];
                    continue;
                }

                if (args[i].Equals("-f", StringComparison.InvariantCulture) || args[i].Equals("--filter", StringComparison.InvariantCultureIgnoreCase))
                {
                    result.IgnoredIntents = new List <string>(args[++i].Split(',').Select(s => s.Trim()));
                    continue;
                }
            }
            return(result);
        }
示例#29
0
        public void TestSeveralParameterWithArguments()
        {
            var programParameters = new ProgramParameters();

            programParameters.Init(new [] { "-abc", "first", "-d", "one more", "second", "-e", "-fg" });
            var result = programParameters.ToList();

            Assert.AreEqual(4, result.Count);

            Assert.AreEqual("abc", result[0].Command);
            Assert.AreEqual(1, result[0].Arguments.Count);
            Assert.AreEqual("first", result[0].Arguments[0]);

            Assert.AreEqual("d", result[1].Command);
            Assert.AreEqual(2, result[1].Arguments.Count);
            Assert.AreEqual("one more", result[1].Arguments[0]);
            Assert.AreEqual("second", result[1].Arguments[1]);

            Assert.AreEqual("e", result[2].Command);
            Assert.AreEqual(0, result[2].Arguments.Count);

            Assert.AreEqual("fg", result[3].Command);
            Assert.AreEqual(0, result[3].Arguments.Count);
        }
示例#30
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                System.Console.WriteLine("コマンドラインの書式:");
                System.Console.WriteLine(programName + " [/-R] [/COLOR[:]1-3] [/FORMAT[:]出力形式名] [ドライブ:][パス]ファイル名");
                System.Console.WriteLine("  /-R     ディレクトリを指定したとき、サブディレクトリをスキャンしません。");
                System.Console.WriteLine("  /COLOR[:]1-3");
                System.Console.WriteLine("          可能なとき、指定したインデックスのパレットで出力します。既定値は1です。");
                System.Console.WriteLine("  /FORMAT[:]出力形式");
                System.Console.WriteLine("          出力ファイルの形式を指定します。");
                System.Console.WriteLine("          形式には BMP, JPEG, PNG を指定することが出来ます。");
                return;
            }
            try
            {
                ProgramParameters param = GetProgramParameters(args);

                foreach (string fileName in param.FileNames)
                {
                    FileAttributes attr = File.GetAttributes(fileName);
                    if ((attr & FileAttributes.Directory) != 0)
                    {
                        ProcessCV2Directory(fileName, param.Options);
                    }
                    else
                    {
                        ProcessCV2(fileName, param.Options);
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.Error.Write(programName + " : " + e.Message);
            }
        }
示例#31
0
        private static void PerformTransformation(ZipFile zippedXapFile, ProgramParameters inputParameters)
        {
            RemoveTemporarySilverlightConfigFile();

            string silverlightEnvironmentTransformFile =
                GetSilverlightEnvironmentTransformFile(inputParameters.TargetEnvironment);

            RemoveTemporarySilverlightTransformFile(silverlightEnvironmentTransformFile);

            ExecuteTransformationOnArchive(
                zippedXapFile, inputParameters.TargetEnvironment, silverlightEnvironmentTransformFile);

            RemoveTemporarySilverlightConfigFile();
            RemoveTemporarySilverlightTransformFile(silverlightEnvironmentTransformFile);
        }
示例#32
0
 /// <summary>
 /// Sets program parameters
 /// </summary>
 /// <param name="Program">program to set parameter on.</param>
 /// <param name="pname">Name of parameter to set.</param>
 /// <param name="value">new value of parameter.</param>
 public static void ProgramParameteri(uint Program, ProgramParameters pname, int value)
 {
     Delegates.glProgramParameteri(Program, pname, value);
 }
示例#33
0
        private static void GenerateDataFilesForUnsupportedColumns(List <AdditionalTable> columnsToCheck,
                                                                   ProgramParameters parameters)
        {
            using (var conn = new SqlConnection(GetSourceDatabaseConnectionString(parameters)))
            {
                conn.Open();
                foreach (var table in columnsToCheck)
                {
                    var baseSql =
                        $@"SELECT
                            [S].{table.PrimaryKeyColumn}
                        FROM
                            [{parameters.DestinationDatabase}].{table.Name} [T]
                            INNER JOIN [{parameters.SourceDatabase}].{table.Name} [S] ON [T].{table.PrimaryKeyColumn} = [S].{table.PrimaryKeyColumn} ";

                    foreach (var column in table.AdditionalColumns)
                    {
                        string whereClause;
                        switch (column.DataType)
                        {
                        case SqlDbType.Xml:
                            whereClause = $"CAST([T].{column.Name} as varbinary(max)) != CAST([S].{column.Name} as varbinary(max))";
                            break;

                        default:
                            throw new Exception("Datatype is not implemented");
                        }

                        List <int> primaryKeys;
                        using (var sql = new SqlCommand($"{baseSql} WHERE {whereClause}", conn))
                            using (var reader = sql.ExecuteReader())
                                primaryKeys = reader.Select(r => r.GetInt32(0)).ToList();

                        if (primaryKeys == null || primaryKeys.Count == 0)
                        {
                            continue;
                        }

                        foreach (var primaryKey in primaryKeys)
                        {
                            using (var sql = new SqlCommand($"SELECT {column.Name} FROM {table.Name} WHERE {table.PrimaryKeyColumn} = {primaryKey}", conn))
                            {
                                var columnValue = sql.ExecuteScalar();

                                var directory = $"{table.Name.Replace("[","").Replace("]","").Replace(".","/")}_{table.PrimaryKeyColumn}/{column.Name}_{column.DataType}";
                                var fileName  = $"{directory}/{primaryKey}.data";
                                if (Directory.Exists(directory) == false)
                                {
                                    Directory.CreateDirectory(directory);
                                }

                                switch (column.DataType)
                                {
                                case SqlDbType.Xml:
                                case SqlDbType.VarChar:
                                case SqlDbType.NVarChar:
                                    File.WriteAllText(fileName, (string)columnValue);
                                    break;

                                default:
                                    throw new Exception("Datatype is not implemented");
                                }
                            }
                        }
                    }
                }
            }
        }
示例#34
0
 /// <summary>
 /// Sets program parameters
 /// </summary>
 /// <param name="Program">program to set parameter on.</param>
 /// <param name="pname">Name of parameter to set.</param>
 /// <param name="value">new value of parameter.</param>
 public static void ProgramParameteri(uint Program, ProgramParameters pname, int value)
 {
     Delegates.glProgramParameteri(Program, pname, value);
 }