Exemplo n.º 1
0
 public void MergeFrom(DB2LS_ExecRet other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.Result != 0)
     {
         Result = other.Result;
     }
     if (other.Row != 0)
     {
         Row = other.Row;
     }
     if (other.Id != 0)
     {
         Id = other.Id;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (Result != 0)
            {
                hash ^= Result.GetHashCode();
            }
            if (Row != 0)
            {
                hash ^= Row.GetHashCode();
            }
            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 3
0
        ///<Summary>
        /// ConvertHtmlToXps to convert html file to xps
        ///</Summary>
        public Response ConvertHtmlToXps(string[] fileNames, string folderName)
        {
            return(ProcessTask_(fileNames, (inFiles, outPath, zipOutFolder) =>
            {
                Aspose.Html.Rendering.Xps.XpsRenderingOptions xps_options = new Aspose.Html.Rendering.Xps.XpsRenderingOptions();
                if (Opts.HasCustomParameter("pageSize"))
                {
                    var sz = OptionHelper.getPageSizeByName(Opts.GetCustomParameter("pageSize"));
                    if (sz != null)
                    {
                        xps_options.PageSetup.AnyPage.Size = sz;
                    }
                }
                Dictionary <string, string> customParams = null;
                if (Opts.HasCustomParameter("mdTheme"))
                {
                    var csstheme = Opts.GetCustomParameter("mdTheme");
                    customParams = new Dictionary <string, string> {
                        { "cssTheme", csstheme }
                    };
                }
                SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(Opts.FileName);
                ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.XPS, customParams);

                helper.Export(inFiles, outPath, xps_options);
            }));
        }
Exemplo n.º 4
0
        public static ShaderRunner Create(Opts opts)
        {
            var runner = new ShaderRunner();

            runner.opts = opts;
            return(runner);
        }
Exemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (SortType != 0)
            {
                hash ^= SortType.GetHashCode();
            }
            if (From != 0)
            {
                hash ^= From.GetHashCode();
            }
            if (Count != 0)
            {
                hash ^= Count.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 6
0
 public void MergeFrom(CS2DB_QueryRanking other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.SortType != 0)
     {
         SortType = other.SortType;
     }
     if (other.From != 0)
     {
         From = other.From;
     }
     if (other.Count != 0)
     {
         Count = other.Count;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 7
0
 public void MergeFrom(CS2DB_BuyChampion other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.Result != 0)
     {
         Result = other.Result;
     }
     if (other.Ukey != 0)
     {
         Ukey = other.Ukey;
     }
     if (other.Money != 0)
     {
         Money = other.Money;
     }
     if (other.Diamoned != 0)
     {
         Diamoned = other.Diamoned;
     }
     cids_.Add(other.cids_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 8
0
 public void MergeFrom(CS2BS_BattleInfo other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.MapID != 0)
     {
         MapID = other.MapID;
     }
     if (other.ConnTimeout != 0)
     {
         ConnTimeout = other.ConnTimeout;
     }
     teamInfos_.Add(other.teamInfos_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 9
0
        /// <summary>
        /// try convert
        /// </summary>
        /// <param name="binder"></param>CustomTypeConverters
        /// <param name="result"></param>
        /// <returns></returns>
        public override bool TryConvert(ConvertBinder binder, out object result)
        {
            //Null means null.
            if (Str == null)
            {
                throw new InvalidOperationException("Runtime assert failed; Str cannot be null"); //This cannot happen.
            }

            //attempt using a custom converter if destination type doesn't have a specific TypeCode, and we appear to have an appropriate converter
            if (Type.GetTypeCode(binder.Type) == TypeCode.Object)
            {
                var ctc = FindCustomConverter(binder.Type);
                if (ctc != null)
                {
                    //yeah, we can use custom type converter
                    result = ctc.ConvertFromString(Str);
                    return(true);
                }
            }

            //Special case for emptystr if so configured!
            if (Opts.HasFlag(DynamicStringOptions.EmptyStringMeansDefault) && Str == String.Empty && !typeof(string).IsAssignableFrom(binder.Type))
            {
                result = GetDefaultValue(binder.Type);
                return(true);
            }

            //Typical case where we use Convert.ChangeType
            result = Convert.ChangeType(Str, binder.Type);
            return(true);
        }
Exemplo n.º 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (Result != 0)
            {
                hash ^= Result.GetHashCode();
            }
            if (Ukey != 0)
            {
                hash ^= Ukey.GetHashCode();
            }
            if (Money != 0)
            {
                hash ^= Money.GetHashCode();
            }
            if (Diamoned != 0)
            {
                hash ^= Diamoned.GetHashCode();
            }
            hash ^= cids_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 11
0
	public static void Main(string[] args) {
		Opts options = new Opts();
		options.ProcessArgs(args);
		
		if (options.RemainingArguments.Length < 2) {
			options.DoHelp();
			return;
		}
		
		Application.Init ();
		
		Window win = new Window("NDiff");
		win.DeleteEvent += new DeleteEventHandler(Window_Delete);
		win.SetDefaultSize(800, 600);
		
		DiffWidget.Options dopts = new DiffWidget.Options();
		dopts.SideBySide = options.sidebyside;

		if (options.RemainingArguments.Length == 2) {
			dopts.LeftName = options.RemainingArguments[0];
			dopts.RightName = options.RemainingArguments[1];
			Diff diff = new Diff(options.RemainingArguments[0], options.RemainingArguments[1], options.caseinsensitive, true);
			win.Add(new DiffWidget(diff, dopts));
		} else {
			Diff[] diffs = new Diff[options.RemainingArguments.Length-1];
			for (int i = 0; i < options.RemainingArguments.Length-1; i++)
				diffs[i] = new Diff(options.RemainingArguments[0], options.RemainingArguments[i+1], options.caseinsensitive, true);
			Merge merge = new Merge(diffs);
			win.Add(new DiffWidget(merge, dopts));
		}		

		win.ShowAll();
		Application.Run();
	}
Exemplo n.º 12
0
 public void MergeFrom(LS2GC_AskLoginRet other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.Result != 0)
     {
         Result = other.Result;
     }
     if (other.SessionID != 0UL)
     {
         SessionID = other.SessionID;
     }
     gsInfos_.Add(other.gsInfos_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 13
0
	public static int Main (string[] args) 
	{
		Opts opts = new Opts();

		if (args.Length == 0) {
			opts.DoHelp ();
			return 1;
		}
		
		opts.ProcessArgs (args);
		Assembly assm = opts.assembly == null ? null : LoadAssembly (opts.assembly);

		if (opts.path == null || !Directory.Exists (opts.path) || assm == null) {
			Console.WriteLine ("Valid path and assembly options are required.");
			opts.DoHelp ();
			return 1;
		}

		string version = opts.version == null ? assm.GetName ().Version.ToString () : opts.version;
		AssemblyInfo base_info = opts.base_assembly == null ? null : new AssemblyInfo (LoadAssembly (opts.base_assembly));
		AssemblyInfo info = new AssemblyInfo (assm);

		Versionator v = new Versionator (base_info, info, opts.path, version);
		v.Versionate ();

		return 0;
	}
Exemplo n.º 14
0
 ///<Summary>
 /// ConvertHtmlToPdf to convert html file to pdf
 ///</Summary>
 public Response ConvertHtmlToPdf(string[] fileNames, string folderName)
 {
     return(ProcessTask_(fileNames, (inFiles, outPath, zipOutFolder) =>
     {
         Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();
         if (Opts.HasCustomParameter("ownerPassword") || Opts.HasCustomParameter("userPassword"))
         {
             var userPw = Opts.GetCustomParameter("userPassword");
             var ownerPw = Opts.GetCustomParameter("ownerPassword");
             if (!(string.IsNullOrEmpty(userPw) && string.IsNullOrEmpty(ownerPw)))
             {
                 pdf_options.Encryption = new Aspose.Html.Rendering.Pdf.Encryption.PdfEncryptionInfo(
                     userPw,
                     ownerPw,
                     (Aspose.Html.Rendering.Pdf.Encryption.PdfPermissions) 0xF3C,
                     Aspose.Html.Rendering.Pdf.Encryption.PdfEncryptionAlgorithm.RC4_128
                     );
             }
         }
         Dictionary <string, string> customParams = null;
         if (Opts.HasCustomParameter("mdTheme"))
         {
             var csstheme = Opts.GetCustomParameter("mdTheme");
             customParams = new Dictionary <string, string> {
                 { "cssTheme", csstheme }
             };
         }
         SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(Opts.FileName);
         ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.PDF, customParams);
         helper.Export(inFiles, outPath, pdf_options);
     }));
 }
Exemplo n.º 15
0
        public static int Main(string[] args)
        {
            Opts opts = new Opts();

            if (args.Length == 0)
            {
                opts.DoHelp();
                return(1);
            }

            opts.ProcessArgs(args);
            Assembly assm = opts.assembly == null ? null : LoadAssembly(opts.assembly);

            if (opts.path == null || !Directory.Exists(opts.path) || assm == null)
            {
                Console.WriteLine("Valid path and assembly options are required.");
                opts.DoHelp();
                return(1);
            }

            string version = opts.version == null?assm.GetName().Version.ToString() : opts.version;

            AssemblyInfo base_info = opts.base_assembly == null ? null : new AssemblyInfo(LoadAssembly(opts.base_assembly));
            AssemblyInfo info      = new AssemblyInfo(assm);

            Versionator v = new Versionator(base_info, info, opts.path, version);

            v.Versionate();

            return(0);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Triggers an entity to resolve
 /// (generally there is a ResolveEntityCmd command listening
 /// for this notification)
 /// </summary>
 /// <param name="dto">Dto.</param>
 /// <param name="opts">Opts.</param>
 public static int RequestResolve(
     string key,
     bool forceResolve = false,
     Opts opts         = Opts.RequireReceiver
     )
 {
     return(RequestResolve(NewResolveRequest(key, forceResolve)));
 }
Exemplo n.º 17
0
 public static int RequestResolve(
     ResolveRequestDTO req,
     Opts opts = Opts.RequireReceiver
     )
 {
     N.Send(RESOLVE_REQUESTED, req, opts);
     return(req.resolveRequestId);
 }
Exemplo n.º 18
0
        static int Main(string[] args)
        {
            var opts = new Opts();

            try
            {
                opts.Parse(args);
                if (opts.Help)
                {
                    //TODO: Usage should go to the log4net appenders in this case
                    opts.PrintUsage();
                    return(0);
                }
                if (opts.Version)
                {
                    //TODO: Usage should go to the log4net appenders in this case
                    System.Console.WriteLine(GetVersionString());
                    return(0);
                }
                if (string.IsNullOrEmpty(opts.Script) || opts.Script.Trim() == "")
                {
                    throw new GetOptException("Most specify a script!");
                }
                if (!File.Exists(opts.Script))
                {
                    //TODO: GetOptException needs a constuctor that takes an inner exception.
                    throw new GetOptException(string.Format("Script {0} not found.", opts.Script));
                }
                if (!string.IsNullOrEmpty(opts.Log4NetConfigFile) && opts.Log4NetConfigFile.Trim() != "")
                {
                    if (!File.Exists(opts.Log4NetConfigFile))
                    {
                        //TODO: GetOptException needs a constuctor that takes an inner exception.
                        throw new GetOptException(string.Format("Log4net config file {0} not found.", opts.Log4NetConfigFile));
                    }
                    opts.Log4NetConfigType = Log4NetConfigType.Custom;
                }
            }
            catch (GetOptException ex)
            {
                System.Console.WriteLine("--> {0}", ex.Message);
                System.Console.WriteLine();
                opts.PrintUsage();
                return(2);
            }

            var results = AppDomainPoshRunner.RunScriptInNewAppDomain(opts.ToADPRConfig());

            foreach (var result in results)
            {
                System.Console.WriteLine(result);
            }
            // TODO: Get the state from the PSHost
            // TODO if parent is console.exe present the press any key to continue prompt.

            return(0);
        }
Exemplo n.º 19
0
 /// <summary>
 /// 设置进度条改变、进度信息改变、窗口关闭、执行结束、执行中止、执行异常事件的事件处理
 /// </summary>
 /// <param name="formCtrl">执行操作的窗体</param>
 /// <param name="messageCtrl">显示进度信息的控件,可为null</param>
 /// <param name="progressBarCtrl">DevExpress进度条,可为null</param>
 /// <param name="changeViews">改变界面显示状态的委托,bool值参数代表开始批量操作(true)还是结束批量操作(false)</param>
 public void BindEvent(Form formCtrl, Control messageCtrl, ProgressBarControl progressBarCtrl, Action <bool> changeViews)
 {
     FormCtrl              = formCtrl;
     MessageCtrl           = messageCtrl;
     ProgressBarCtrl       = progressBarCtrl;
     ChangeViews           = changeViews;
     FormCtrl.FormClosing -= OptForm_Closing;
     FormCtrl.FormClosing += OptForm_Closing;
     Opts.ForEach(opt => BindEventByOneOpt(opt, true));
 }
Exemplo n.º 20
0
        static int Main(string[] args)
        {
            var opts = new Opts();
            try
            {
                opts.Parse(args);
                if (opts.Help)
                {
                    //TODO: Usage should go to the log4net appenders in this case
                    opts.PrintUsage();
                    return 0;
                }
                if (opts.Version)
                {
                    //TODO: Usage should go to the log4net appenders in this case
                    System.Console.WriteLine(GetVersionString());
                    return 0;
                }
                if (string.IsNullOrEmpty(opts.Script) || opts.Script.Trim() == "")
                {
                    throw new GetOptException("Most specify a script!");
                }
                if (!File.Exists(opts.Script))
                {
                    //TODO: GetOptException needs a constuctor that takes an inner exception.
                    throw new GetOptException(string.Format("Script {0} not found.", opts.Script));
                }
                if (!string.IsNullOrEmpty(opts.Log4NetConfigFile) && opts.Log4NetConfigFile.Trim() != "")
                {
                    if (!File.Exists(opts.Log4NetConfigFile))
                    {
                        //TODO: GetOptException needs a constuctor that takes an inner exception.
                        throw new GetOptException(string.Format("Log4net config file {0} not found.", opts.Log4NetConfigFile));
                    }
                    opts.Log4NetConfigType = Log4NetConfigType.Custom;
                }
            }
            catch (GetOptException ex)
            {
                System.Console.WriteLine("--> {0}", ex.Message);
                System.Console.WriteLine();
                opts.PrintUsage();
                return 2;
            }

            var results =  AppDomainPoshRunner.RunScriptInNewAppDomain(opts.ToADPRConfig());
            foreach (var result in results)
            {
                System.Console.WriteLine(result);
            }
            // TODO: Get the state from the PSHost
            // TODO if parent is console.exe present the press any key to continue prompt.

            return 0;
        }
Exemplo n.º 21
0
 /// <summary>
 /// 设置进度条改变、进度信息改变、窗口关闭、执行结束、执行中止、执行异常事件的事件处理
 /// </summary>
 /// <param name="optForm">操作窗体</param>
 /// <param name="progressBar">DevExpress进度条,可为null</param>
 /// <param name="gridView">显示进度信息的GridView控件</param>
 /// <param name="dataTable">存储进度信息DataTable</param>
 /// <param name="changeViews">改变界面显示状态的委托,bool值参数代表开始批量操作(true)还是结束批量操作(false)</param>
 public void BindEvent(Form optForm, ProgressBarControl progressBar, GridView gridView, DataTable dataTable, Action <bool> changeViews)
 {
     FormCtrl              = optForm;
     ProgressBarCtrl       = progressBar;
     GridView              = gridView;
     ProDataTable          = dataTable;
     DataTableColumnCount  = dataTable.Columns.Count;
     ChangeViews           = changeViews;
     FormCtrl.FormClosing += OptForm_Closing;
     Opts.ForEach(opt => BindEventByOneOpt(opt, true));
 }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            Console.WriteLine("GetOptNet test program");
            Console.WriteLine("Copyright for this test program is disclaimed. Public domain");
            Console.WriteLine();

            Opts opts = new Opts();
            try
            {
                opts.Parse(args);
                Console.WriteLine("Printing Input");
                Console.WriteLine("Str: " + opts.Str);
                Console.WriteLine("Flag: " + opts.Flag);
                Console.WriteLine("Required: " + opts.Required);
                Console.WriteLine("Counter: " + opts.Counter);
                Console.WriteLine("Validated prop: " + opts.Prop);
                Console.WriteLine("SomeInt: " + opts.SomeInt);
                Console.WriteLine("SomeDouble: " + opts.SomeDouble);
                Console.WriteLine("DefaultFalse: " + opts.defaultFalse);
                Console.WriteLine("DefaultTrue: " + opts.defaultTrue);

                foreach (int p in opts.Arr)
                {
                    Console.WriteLine("Arr: {0}", p);
                }

                foreach (string p in opts.Multi)
                {
                    Console.WriteLine("Multi: {0}", p);
                }

                foreach (string p in opts.Parameters)
                {
                    Console.WriteLine("Param: {0}", p);
                }

                foreach (string p in opts.RequiredTwo)
                {
                    Console.WriteLine("Required Two: {0}", p);
                }

                Console.WriteLine();
                opts.PrintUsage();
            }
            catch (GetOptException ex)
            {
                Console.WriteLine("Unfortunatly there is a problem, sir");
                Console.WriteLine("--> {0}", ex.Message);
                Console.WriteLine();
                opts.PrintUsage();
            }
        }
Exemplo n.º 23
0
        private void Start()
        {
            if (Program.ReaderXP.State == RFState.IDLE)
            {
                Clear();
                m_opt = Opts.TAG_SEARCH;

                Program.ReaderXP.SetOperationMode(Program.appSetting.Cfg_continuous_mode ? RadioOperationMode.CONTINUOUS : RadioOperationMode.NONCONTINUOUS);
                Program.ReaderXP.SetTagGroup(Program.appSetting.tagGroup);
                Program.ReaderXP.SetSingulationAlgorithmParms(Program.appSetting.Singulation, Program.appSetting.SingulationAlg);

                if (Program.appSetting.tagGroup.selected == Selected.ALL)
                {
                    Program.ReaderXP.Options.TagInventory.flags = SelectFlags.ZERO;
                }
                else
                {
                    Program.ReaderXP.Options.TagInventory.flags = SelectFlags.SELECT;

                    Program.ReaderXP.Options.TagGeneralSelected.flags = SelectMaskFlags.ENABLE_TOGGLE;
                    switch (Program.appSetting.MaskBank)
                    {
                    case 0:
                        Program.ReaderXP.Options.TagGeneralSelected.bank          = MemoryBank.EPC;
                        Program.ReaderXP.Options.TagGeneralSelected.epcMask       = new S_MASK(Program.appSetting.Mask);
                        Program.ReaderXP.Options.TagGeneralSelected.epcMaskOffset = Program.appSetting.MaskOffset;
                        Program.ReaderXP.Options.TagGeneralSelected.epcMaskLength = Program.appSetting.MaskBitLength;
                        break;

                    case 1:
                        Program.ReaderXP.Options.TagGeneralSelected.bank          = MemoryBank.EPC;
                        Program.ReaderXP.Options.TagGeneralSelected.flags        |= SelectMaskFlags.ENABLE_PC_MASK;
                        Program.ReaderXP.Options.TagGeneralSelected.epcMask       = new S_MASK(Program.appSetting.Mask);
                        Program.ReaderXP.Options.TagGeneralSelected.epcMaskOffset = Program.appSetting.MaskOffset;
                        Program.ReaderXP.Options.TagGeneralSelected.epcMaskLength = Program.appSetting.MaskBitLength;
                        break;

                    case 2:
                    case 3:
                        Program.ReaderXP.Options.TagGeneralSelected.bank       = (MemoryBank)Program.appSetting.MaskBank;
                        Program.ReaderXP.Options.TagGeneralSelected.Mask       = CSLibrary.Text.HexEncoding.ToBytes(Program.appSetting.Mask);
                        Program.ReaderXP.Options.TagGeneralSelected.MaskOffset = Program.appSetting.MaskOffset;
                        Program.ReaderXP.Options.TagGeneralSelected.MaskLength = Program.appSetting.MaskBitLength;
                        break;
                    }
                    Program.ReaderXP.StartOperation(Operation.TAG_GENERALSELECTED, true);
                }

                Program.ReaderXP.StartOperation(Operation.TAG_INVENTORY, false);
            }
        }
Exemplo n.º 24
0
        //public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped <ITokenService, TokenService>();
            services.AddScoped <IProductRepository, ProductRepository>();
            services.AddScoped <IBasketRepository, BasketRepository>();
            services.AddScoped(typeof(IGenericRepository <>), (typeof(GenericRepository <>)));
            services.AddAutoMapper(typeof(MappingProfiles));
            services.AddControllers();
            services.AddDbContext <StoreContext>(x => x.UseSqlite(_Configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext <AppIdentityDbContext>(x => x.UseSqlite(_Configuration.GetConnectionString("IdentityConnection")));

            services.AddSingleton <IConnectionMultiplexer>(c => {
                var configuration = ConfigurationOptions.Parse(_Configuration.GetConnectionString("Redis"), true);

                return(ConnectionMultiplexer.Connect(configuration));
            });

            services.AddCors(Opts => {
                Opts.AddPolicy("CorsPolicy", policy => {
                    policy.AllowAnyHeader().AllowAnyMethod().WithOrigins("https://localhost:4200");
                });
            });
            services.AddIdentityService(_Configuration);
            services.AddSwaggerGen(c => {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "MyShop API", Version = "V1"
                });
                var securitySchema = new OpenApiSecurityScheme
                {
                    Description = "JWT Auth Bearer Scheme",
                    Name        = "Authorization",
                    In          = ParameterLocation.Header,
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "bearer",
                    Reference   = new OpenApiReference
                    {
                        Type = ReferenceType.SecurityScheme,
                        Id   = "Bearer"
                    }
                };

                c.AddSecurityDefinition("Bearer", securitySchema);
                var securityRequirement = new OpenApiSecurityRequirement {
                    { securitySchema, new[] { "Bearer" } }
                };
                c.AddSecurityRequirement(securityRequirement);
            });
        }
Exemplo n.º 25
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            hash ^= gsInfos_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 26
0
 public void MergeFrom(GS2GC_LoginRet other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     if (other.Result != 0)
     {
         Result = other.Result;
     }
     if (other.GcState != 0)
     {
         GcState = other.GcState;
     }
     if (other.userInfo_ != null)
     {
         if (userInfo_ == null)
         {
             userInfo_ = new global::Protos.G_UserInfo();
         }
         UserInfo.MergeFrom(other.UserInfo);
     }
     if (other.GcNID != 0UL)
     {
         GcNID = other.GcNID;
     }
     if (other.BsIP.Length != 0)
     {
         BsIP = other.BsIP;
     }
     if (other.BsPort != 0)
     {
         BsPort = other.BsPort;
     }
     if (other.Defs.Length != 0)
     {
         Defs = other.Defs;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 27
0
        static void Main(string[] args)
        {
            Console.WriteLine("GetOptNet test program");
            Console.WriteLine("Copyright for this test program is disclaimed. Public domain");
            Console.WriteLine();

            Opts opts = new Opts();

            try
            {
                opts.Parse(args);
                Console.WriteLine("Printing Input");
                Console.WriteLine("Str: " + opts.Str);
                Console.WriteLine("Flag: " + opts.Flag);
                Console.WriteLine("Counter: " + opts.Counter);
                Console.WriteLine("Validated prop: " + opts.Prop);
                Console.WriteLine("SomeInt: " + opts.SomeInt);
                Console.WriteLine("SomeDouble: " + opts.SomeDouble);
                Console.WriteLine("DefaultFalse: " + opts.defaultFalse);
                Console.WriteLine("DefaultTrue: " + opts.defaultTrue);

                foreach (int p in opts.Arr)
                {
                    Console.WriteLine("Arr: {0}", p);
                }


                foreach (string p in opts.Multi)
                {
                    Console.WriteLine("Multi: {0}", p);
                }

                foreach (string p in opts.Parameters)
                {
                    Console.WriteLine("Param: {0}", p);
                }
                Console.WriteLine();
                opts.PrintUsage();
            }
            catch (GetOptException ex)
            {
                Console.WriteLine("Unfortunatly there is a problem, sir");
                Console.WriteLine("--> {0}", ex.Message);
                Console.WriteLine();
                opts.PrintUsage();
            }
        }
Exemplo n.º 28
0
 public void MergeFrom(LS2GC_GSInfo other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     gsInfos_.Add(other.gsInfos_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 29
0
 public void MergeFrom(CS2DB_UpdateRank other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     gains_.Add(other.gains_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 30
0
 public void MergeFrom(DB2CS_QueryRankingRet other)
 {
     if (other == null)
     {
         return;
     }
     if (other.opts_ != null)
     {
         if (opts_ == null)
         {
             opts_ = new global::Protos.MsgOpts();
         }
         Opts.MergeFrom(other.Opts);
     }
     rankingInfos_.Add(other.rankingInfos_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Exemplo n.º 31
0
	public static void Main(string[] args) {
		Opts opts = new Opts();
		opts.ProcessArgs(args);
		
		if (opts.left == null || opts.right == null) {
			Console.Error.WriteLine("The --left and --right arguments are required.");
			return;
		}
		
		IList file1, file2;
		
		if (opts.method == "lines") {
			file1 = LoadFileLines(opts.left);
			file2 = LoadFileLines(opts.right);
		} else if (opts.method == "chars") {
			file1 = LoadFileChars(opts.left);
			file2 = LoadFileChars(opts.right);
		} else {
			Console.Error.WriteLine("The method option must be either lines or chars.");
			return;
		}
		
		Diff diff = new Diff(file1, file2, 
			!opts.caseinsensitive ? null : CaseInsensitiveComparer.Default,
			!opts.caseinsensitive ? null : CaseInsensitiveHashCodeProvider.Default);
		
		if (!opts.interactive) {
			UnifiedDiff.WriteUnifiedDiff(diff, Console.Out);
		} else {
			foreach (Diff.Hunk hunk in diff) {
				if (hunk.Same) {
					WriteBlock(hunk.Left, opts);
				} else {
					Console.Error.WriteLine(hunk);
					Console.Error.Write("Enter 'r' to reject, or hit enter to accept. ");
					Console.Error.WriteLine();
					string choice = Console.In.ReadLine();
					if (choice == "r")
						WriteBlock(hunk.Left, opts);
					else
						WriteBlock(hunk.Right, opts);
				}
			}
		}
	}
Exemplo n.º 32
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (Gsid != 0)
            {
                hash ^= Gsid.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 33
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (SessionID != 0UL)
            {
                hash ^= SessionID.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 34
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 35
0
        private void SetupQueryParameters(string outputType)
        {
            Opts.SetupCustomQueryParameters(Request);
            string opt = "";

            Opts.MergeMultiple = false;
            if (mergeableTypes.Contains(outputType.ToLower().Replace(".", "")))
            {
                if ((opt = Opts.GetCustomParameter("mergeMultiple")) != null)
                {
                    bool bMerge;
                    if (bool.TryParse(opt, out bMerge))
                    {
                        Opts.MergeMultiple = bMerge;
                    }
                }
            }
        }
        private void btn_writeAllbank_Click(object sender, EventArgs e)
        {
            if (Program.ReaderCE.State == RFState.IDLE)
            {
                if (!(m_writeAllBank.WriteAccPwd |
                    m_writeAllBank.WriteEPC |
                    m_writeAllBank.WriteKillPwd |
                    m_writeAllBank.WritePC |
                    m_writeAllBank.WriteUser))
                {
                    //All unchecked
                    MessageBox.Show("Please check at least one item to write", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
                    return;
                }

                m_opt = Opts.TAG_WRITE;

                m_cancel_write_all_bank = false;

                btn_writeallbank.Enabled = false;

                //Device.MelodyPlay(RingTone.T2, BuzzerVolume.HIGH);

                Program.ReaderCE.Options.TagSelected.flags = SelectMaskFlags.DISABLE_ALL;
                //Comment:If enable PC lock, please make sure you are not using Higgs3 Tag. Otherwise, write will fail
                Program.ReaderCE.Options.TagSelected.epcMask = new S_MASK(/*m_record.pc.ToString() +*/ m_record.epc.ToString());
                Program.ReaderCE.Options.TagSelected.epcMaskLength = (uint)Program.ReaderCE.Options.TagSelected.epcMask.Length * 8;

                if (Program.ReaderCE.StartOperation(Operation.TAG_SELECTED, true) != Result.OK)
                {
                    MessageBox.Show("Selected tag failed");
                    return;
                }


                //if access bank is checked, read it.
                if (!m_cancel_write_all_bank && m_writeAllBank.WriteAccPwd)
                {
                    lb_WriteInfo.Text = "Start writing access pwd";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagWriteAccPwd.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagWriteAccPwd.accessPassword = m_writeAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagWriteAccPwd.password = m_writeAllBank.AccPwd;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_WRITE_ACC_PWD, true) == Result.OK)
                    {
                        m_writeAllBank.IconAcc = WriteAllBank.WriteState.OK;
                    }
                    else
                    {
                        //Write failed
                        m_writeAllBank.IconAcc = WriteAllBank.WriteState.FAILED;
                    }

                }
                //if kill bank is checked, read it.
                if (!m_cancel_write_all_bank && m_writeAllBank.WriteKillPwd)
                {
                    lb_WriteInfo.Text = "Start writing kill pwd";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagWriteKillPwd.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagWriteKillPwd.accessPassword = m_writeAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagWriteKillPwd.password = m_writeAllBank.KillPwd;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_WRITE_KILL_PWD, true) == Result.OK)
                    {
                        m_writeAllBank.IconKill = WriteAllBank.WriteState.OK;
                    }
                    else
                    {
                        //Write failed
                        m_writeAllBank.IconKill = WriteAllBank.WriteState.FAILED;
                    }
                }

                //if user bank is checked, read it.
                if (!m_cancel_write_all_bank && m_writeAllBank.WriteUser)
                {
                    lb_WriteInfo.Text = "Start writing user memory";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagWriteUser.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagWriteUser.accessPassword = m_writeAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagWriteUser.offset = m_writeAllBank.OffsetUser;
                    Program.ReaderCE.Options.TagWriteUser.count = m_writeAllBank.WordUser;
                    Program.ReaderCE.Options.TagWriteUser.pData = Hex.ToUshorts(m_writeAllBank.User);

                    if (Program.ReaderCE.StartOperation(Operation.TAG_WRITE_USER, true) == Result.OK)
                    {
                        m_writeAllBank.IconUser = WriteAllBank.WriteState.OK;
                    }
                    else
                    {
                        //Write failed
                        m_writeAllBank.IconUser = WriteAllBank.WriteState.FAILED;
                    }

                }

                if (!m_cancel_write_all_bank && m_writeAllBank.WritePC)
                {
                    lb_WriteInfo.Text = "Start writing PC";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagWritePC.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagWritePC.accessPassword = m_writeAllBank.AccessPwd;
                    
                    Program.ReaderCE.Options.TagWritePC.pc = Hex.ToUshort(m_writeAllBank.pc);

                    if (Program.ReaderCE.StartOperation(Operation.TAG_WRITE_PC, true) == Result.OK)
                    {
                        m_writeAllBank.IconPc = WriteAllBank.WriteState.OK;
                        m_tagTable.Items[nTable1.CurrentRowIndex].pc = m_record.pc = new S_PC(m_writeAllBank.pc);
                    }
                    else
                    {
                        //Write failed
                        m_writeAllBank.IconPc = WriteAllBank.WriteState.FAILED;
                    }
                }
                //Write EPC must put in last order to prevent it get lost
                if (!m_cancel_write_all_bank && m_writeAllBank.WriteEPC)
                {
                    lb_WriteInfo.Text = "Start writing EPC";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagWriteEPC.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagWriteEPC.accessPassword = m_writeAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagWriteEPC.offset = 0;
                    Program.ReaderCE.Options.TagWriteEPC.count = Hex.GetWordCount(m_writeAllBank.epc);
                    Program.ReaderCE.Options.TagWriteEPC.epc = new S_EPC(m_writeAllBank.epc);

                    if (Program.ReaderCE.StartOperation(Operation.TAG_WRITE_EPC, true) == Result.OK)
                    {
                        //EPC Changed 
                        m_writeAllBank.IconEpc = WriteAllBank.WriteState.OK;
                        m_tagTable.Items[nTable1.CurrentRowIndex].epc = m_record.epc = new S_EPC(m_writeAllBank.epc);
                    }
                    else
                    {
                        //Write failed
                        m_writeAllBank.IconEpc = WriteAllBank.WriteState.FAILED;
                    }
                }
                lb_WriteInfo.Text = "Write done!!!";
                //Device.MelodyPlay(RingTone.T1, BuzzerVolume.HIGH);
                Application.DoEvents();
                btn_writeallbank.Enabled = true;
            }
            else
            {
                MessageBox.Show("Reader is busy now, please try later.");
            }
        }
        private void btn_readallbank_Click(object sender, EventArgs e)
        {

            if (Program.ReaderCE.State == RFState.IDLE)
            {
                m_readAllBank.Clear();

                m_opt = Opts.TAG_READ;

                m_cancel_read_all_bank = false;

                btn_readallbank.Text = "Stop";
                btn_readallbank.BackColor = Color.Red;

                //Device.MelodyPlay(RingTone.T2, BuzzerVolume.HIGH);

                Program.ReaderCE.Options.TagSelected.flags = SelectMaskFlags.DISABLE_ALL;
                //Comment:If enable PC lock, please make sure you are not using Higgs3 Tag. Otherwise, read will fail
                Program.ReaderCE.Options.TagSelected.epcMask = new S_MASK(/*m_record.pc.ToString() + */m_record.epc.ToString());
                Program.ReaderCE.Options.TagSelected.epcMaskLength = (uint)Program.ReaderCE.Options.TagSelected.epcMask.Length * 8;
                if (Program.ReaderCE.StartOperation(Operation.TAG_SELECTED, true) != Result.OK)
                {
                    MessageBox.Show("Selected tag failed");
                    return;
                }
                if (m_readAllBank.ReadPc && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading PC";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagReadPC.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadPC.retryCount = m_retry_cnt;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_PC, true) == Result.OK)
                    {
                        m_readAllBank.IconPc = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconPc = ReadAllBank.ReadState.FAILED;
                    }

                }
                if (m_readAllBank.ReadEpc && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading EPC";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagReadEPC.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadEPC.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagReadEPC.count = 6;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_EPC, true) == Result.OK)
                    {
                        m_readAllBank.IconEpc = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconEpc = ReadAllBank.ReadState.FAILED;
                    }

                }

                //if access bank is checked, read it.
                if (m_readAllBank.ReadAccPwd && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading access pwd";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagReadAccPwd.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadAccPwd.retryCount = m_retry_cnt;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_ACC_PWD, true) == Result.OK)
                    {
                        m_readAllBank.IconAcc = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconAcc = ReadAllBank.ReadState.FAILED;
                    }
                    
                }
                //if kill bank is checked, read it.
                if (m_readAllBank.ReadKillPwd && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading kill pwd";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagReadKillPwd.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadKillPwd.retryCount = m_retry_cnt;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_KILL_PWD, true) == Result.OK)
                    {
                        m_readAllBank.IconKill = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconKill = ReadAllBank.ReadState.FAILED;
                    }
                }
                //if tid bank is checked, read it.
                if (m_readAllBank.ReadTid && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading TID";
                    Application.DoEvents();

                    Program.ReaderCE.Options.TagReadTid.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadTid.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagReadTid.offset = m_readAllBank.OffsetTid;
                    Program.ReaderCE.Options.TagReadTid.count = m_readAllBank.WordTid;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_TID, true) == Result.OK)
                    {
                        m_readAllBank.IconTid = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconTid = ReadAllBank.ReadState.FAILED;
                    }
                }
                //if user bank is checked, read it.
                if (m_readAllBank.ReadUserBank && !m_cancel_read_all_bank)
                {
                    lb_ReadInfo.Text = "Start reading user memory";
                    Application.DoEvents();
    
                    Program.ReaderCE.Options.TagReadUser.accessPassword = m_readAllBank.AccessPwd;
                    Program.ReaderCE.Options.TagReadUser.retryCount = m_retry_cnt;
                    Program.ReaderCE.Options.TagReadUser.offset = m_readAllBank.OffsetUser;
                    Program.ReaderCE.Options.TagReadUser.count = m_readAllBank.WordUser;

                    if (Program.ReaderCE.StartOperation(Operation.TAG_READ_USER, true) == Result.OK)
                    {
                        m_readAllBank.IconUser = ReadAllBank.ReadState.OK;
                    }
                    else
                    {
                        //Read failed
                        m_readAllBank.IconUser = ReadAllBank.ReadState.FAILED;
                    }
                }

                lb_ReadInfo.Text = "Read done!!!";
                //Device.MelodyPlay(RingTone.T1, BuzzerVolume.HIGH);
                btn_readallbank.Text = "Read";
                btn_readallbank.BackColor = Color.FromArgb(0, 192, 0);
                Application.DoEvents();
                m_read_done = true;
            }
            else
            {
                MessageBox.Show("Reader is busy now, please try later.");
            }
        }
Exemplo n.º 38
0
    public static void Main(string[] args)
    {
        System.Net.ServicePointManager.Expect100Continue = false;

        Opts opts = new Opts();
        opts.ProcessArgs(args);

        if (opts.RemainingArguments.Length != 1) {
            opts.DoHelp();
            return;
        }

        string baseuri = "query://query/#";

        QueryResultSink qs;
        if (opts.format == "simple")
            qs = new PrintQuerySink();
        else if (opts.format == "html")
            qs = new HTMLQuerySink(Console.Out);
        else if (opts.format == "xml")
            qs = new SparqlXmlQuerySink(Console.Out);
        else if (opts.format == "lubm")
            qs = new LUBMReferenceAnswerOutputQuerySink();
        else if (opts.format == "csv")
            qs = new CSVQuerySink();
        else {
            Console.Error.WriteLine("Invalid output format.");
            return;
        }

        Query query;

        MemoryStore queryModel = null;
        #if !DOTNET2
        System.Collections.ICollection queryModelVars = null;
        #else
        System.Collections.Generic.ICollection<Variable> queryModelVars = null;
        #endif

        Store model = Store.Create(opts.RemainingArguments[0]);

        if (opts.type == "rsquary") {
            RdfReader queryparser = RdfReader.Create("n3", "-");
            queryparser.BaseUri = baseuri;
            queryModel = new MemoryStore(queryparser);
            queryModelVars = queryparser.Variables;
            query = new GraphMatch(queryModel);
        } else if (opts.type == "sparql" && model.DataSources.Count == 1 && model.DataSources[0] is SemWeb.Remote.SparqlSource) {
            string querystring = Console.In.ReadToEnd();
            ((SemWeb.Remote.SparqlSource)model.DataSources[0]).RunSparqlQuery(querystring, Console.Out);
            return;
        } else if (opts.type == "sparql") {
            string querystring = Console.In.ReadToEnd();
            query = new SparqlEngine(querystring);
        } else {
            throw new Exception("Invalid query format: " + opts.type);
        }

        if (opts.limit > 0)
            query.ReturnLimit = opts.limit;

        //Console.Error.WriteLine(query.GetExplanation());

        if (query is SparqlEngine && ((SparqlEngine)query).Type != SparqlEngine.QueryType.Select) {
            SparqlEngine sparql = (SparqlEngine)query;
            sparql.Run(model, Console.Out);
        } else if (model is QueryableSource && queryModel != null) {
            SemWeb.Query.QueryOptions qopts = new SemWeb.Query.QueryOptions();
            qopts.DistinguishedVariables = queryModelVars;

            // Replace bnodes in the query with Variables
            int bnodectr = 0;
            foreach (Entity e in queryModel.GetEntities()) {
                if (e is BNode && !(e is Variable)) {
                    BNode b = (BNode)e;
                    queryModel.Replace(e, new Variable(b.LocalName != null ? b.LocalName : "bnodevar" + (++bnodectr)));
                }
            }

            model.Query(queryModel.ToArray(), qopts, qs);
        } else {
            query.Run(model, qs);
        }

        if (qs is IDisposable)
            ((IDisposable)qs).Dispose();
    }
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Program.ReaderCE.State != RFState.IDLE)
            {
                Program.ReaderCE.StopOperation(true);
            }

            m_opt = (Opts)tc_readAndWrite.SelectedIndex;

            switch ((Opts)tc_readAndWrite.SelectedIndex)
            {
                case Opts.TAG_SEARCH:
                    ChangeBtnState(false);
                    break;
                case Opts.TAG_READ:

                    if (nTable1.CurrentRowIndex == -1)
                    {
                        MessageBox.Show("Please choose a tag first or input a tag ID");
                        tc_readAndWrite.SelectedIndex = 0;
                    }
                    else
                    {
                        m_readAllBank.pc = m_record.pc.ToString();
                        m_readAllBank.epc = m_record.epc.ToString();
                    }
                    break;
                case Opts.TAG_WRITE:
                    if (nTable1.CurrentRowIndex == -1)
                    {
                        MessageBox.Show("Please choose a tag first or input a tag ID");
                        tc_readAndWrite.SelectedIndex = 0;
                    }
                    else if (!m_read_done)
                    {
                        MessageBox.Show("Please read a tag first");
                        tc_readAndWrite.SelectedIndex = 1;
                    }
                    else
                    {
                        m_writeAllBank.pc = m_record.pc.ToString();
                        m_writeAllBank.epc = m_record.epc.ToString();
                        m_writeAllBank.UpdateAccPwd(m_readAllBank.AccPwd);
                        m_writeAllBank.UpdateKillPwd(m_readAllBank.KillPwd);
                        m_writeAllBank.UpdateUserBank(m_readAllBank.UserMem);
                        m_writeAllBank.OffsetUser = m_readAllBank.OffsetUser;
                        m_writeAllBank.WordUser = m_readAllBank.WordUser;
                    }
                    break;
                case Opts.TAG_EXIT:
                    this.Close();
                    break;
            }
        }
        /// <summary>
        /// init GetOptNet and start parsing
        /// </summary>
        private void ReadCommandLineArguments()
        {
            opts = new Opts();

            String[] args = Environment.GetCommandLineArgs();

            //Delete the first entry and move the whole array a bit
            //The first entry is the exe name and path. This confuses GetOptNet
            List<String> argsList = args.ToList();
            argsList.RemoveAt(0);

            try
            {
                opts.Parse(argsList);
            }
            catch (Exception ex)
            {

                string title = "Command Line Parsing Error";
                string message = "One of your command line arguments cannot be parsed! Please check software start parameters." +
                                 "\nInstallDirChangers will open with default settings\n\nInformations for the tech savvy and developers:\n\n"
                                 + ex;

                if(opts != null && opts.Quiet)
                    System.Windows.MessageBox.Show(message, title, MessageBoxButton.OK);
                else
                    Console.WriteLine("E: " + message);
            }
        }
Exemplo n.º 41
0
	private static void WriteBlock(Range range, Opts opts) {
		foreach (object item in range) {
			Console.Out.Write(item);
			if (opts.method == "lines") Console.Out.WriteLine();
		}
	}
        private void Start()
        {
            if (Program.ReaderCE.State == RFState.IDLE)
            {
                Clear();
                m_opt = Opts.TAG_SEARCH;

                Program.ReaderCE.SetOperationMode(Program.appSetting.Cfg_continuous_mode ? RadioOperationMode.CONTINUOUS : RadioOperationMode.NONCONTINUOUS);
                Program.ReaderCE.SetTagGroup(Program.appSetting.tagGroup);
                Program.ReaderCE.SetSingulationAlgorithmParms(Program.appSetting.Singulation, Program.appSetting.SingulationAlg);

                Program.ReaderCE.StartOperation(Operation.TAG_INVENTORY, false);
            }
        }
Exemplo n.º 43
0
    public static void Main(string[] args)
    {
        try {

        Opts opts = new Opts();
        opts.ProcessArgs(args);

        if (opts.RemainingArguments.Length == 0 && opts.@out == "n3:-") {
            opts.DoHelp();
            return;
        }

        if (!(opts.@out == "xml:-" || opts.@out == "n3:-"))
            opts.stats = true;

        StatementSink storage = Store.CreateForOutput(opts.@out);
        if (storage is RdfWriter && opts.outbaseuri != null)
            ((RdfWriter)storage).BaseUri = opts.outbaseuri;

        Entity meta = null;
        if (opts.meta != null)
            meta = new Entity(opts.meta);

        if (opts.clear) {
            if (!(storage is ModifiableSource)) {
                Console.Error.WriteLine("The --clear option cannot be used with this type of output method.  Ignoring --clear.");
            } else {
                try {
                    if (meta == null)
                        ((ModifiableSource)storage).Clear();
                    else
                        ((ModifiableSource)storage).Remove(new Statement(null, null, null, meta));
                } catch (Exception e) {
                    Console.Error.WriteLine("The --clear option was not successful: " + e.Message);
                }
            }
        }

        DateTime start_time = DateTime.Now;

        MultiRdfParser multiparser = new MultiRdfParser(opts.RemainingArguments, opts.@in, meta, opts.baseuri, !opts.stats);

        if (opts.buffer > 0) {
            CircularStatementBuffer buffer = new CircularStatementBuffer(opts.buffer);
            buffer.BeginReading(multiparser);
            buffer.BeginWriting(storage);
            buffer.Wait();
        } else if (storage is ModifiableSource) {
            ((ModifiableSource)storage).Import(multiparser);
        } else {
            //if (!opts.makelean) {
                multiparser.Select(storage);
            /*} else {
                MemoryStore st = new MemoryStore(multiparser);
                StatementSink removed = null;
                if (opts.leanprogress)
                    removed = new N3Writer(Console.Out);
                if (opts.leanagainst != null) {
                    StatementSource against = Store.CreateForInput(opts.leanagainst);
                    if (!(against is SelectableSource))
                        against = new MemoryStore(against);
                    Lean.MakeLean(st, (SelectableSource)against, removed);
                } else if (storage is SelectableSource) {
                    Lean.MakeLean(st, (SelectableSource)storage, removed);
                } else {
                    Lean.MakeLean(st, null, removed);
                }
                st.Select(storage);
            }*/
        }

        if (storage is IDisposable) ((IDisposable)storage).Dispose();

        TimeSpan alltime = DateTime.Now - start_time;
        if (opts.stats)
            Console.Error.WriteLine("Total Time: {0}m{1}s, {2} statements, {3} st/sec", (int)alltime.TotalMinutes, (int)alltime.Seconds, totalStatementsRead, alltime.TotalSeconds == 0 ? "?" : ((int)(totalStatementsRead/alltime.TotalSeconds)).ToString());

        } catch (Exception exc) {
            Console.Error.WriteLine(exc);
        }
    }
Exemplo n.º 44
0
    public static void Main(string[] args)
    {
        Opts opts = new Opts();
        opts.ProcessArgs(args);
        if (opts.RemainingArguments.Length != 2 && opts.RemainingArguments.Length != 3) {
            opts.DoHelp();
            return;
        }

        string datasource, rootentity, stylesheetfile;
        if (opts.RemainingArguments.Length == 2) {
            datasource = opts.RemainingArguments[0];
            rootentity = null;
            stylesheetfile = opts.RemainingArguments[1];
        } else {
            datasource = opts.RemainingArguments[0];
            rootentity = opts.RemainingArguments[1];
            stylesheetfile = opts.RemainingArguments[2];
        }

        XsltArgumentList xsltargs = new XsltArgumentList();

        if (opts.param != null)
        foreach (string p in opts.param) {
            int eq = p.IndexOf('=');
            if (eq == -1) {
                Console.Error.WriteLine("Param arguments must be name=value.");
                return;
            }
            string n = p.Substring(0, eq);
            string v = p.Substring(eq+1);
            xsltargs.AddParam(n, "", v);
        }

        XmlDocument sty = new XmlDocument();
        sty.PreserveWhitespace = true;
        sty.Load(stylesheetfile);

        XslTransform t = new XslTransform();
        t.Load(sty, null, null);

        NamespaceManager nsmgr = new NamespaceManager();

        // Scan xmlsn: attributes in the stylesheet node.
        // For all namespaces of the form assembly://assemblyname/TypeName, load in
        // the methods of that type as extension functions in that namespace.
        // And add xmlns declarations to nsmgr.
        foreach (XmlAttribute a in sty.DocumentElement.Attributes) {
            if (!a.Name.StartsWith("xmlns:")) continue;

            nsmgr.AddNamespace(a.Value, a.Name.Substring(6));

            System.Uri uri = new System.Uri(a.Value);
            if (uri.Scheme != "assembly") continue;
            System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(uri.Host);
            System.Type ty = assembly.GetType(uri.AbsolutePath.Substring(1));
            if (ty == null) {
                Console.Error.WriteLine("Type not found: " + uri);
                return;
            }
            object obj = ty.GetConstructor(new Type[0]).Invoke(new Type[0]);
            xsltargs.AddExtensionObject(a.Value, obj);
        }

        StatementSource source = Store.CreateForInput(datasource);
        Store model;
        if (source is Store) model = (Store)source;
        else model = new MemoryStore(source);

        XPathNavigator nav;
        if (rootentity != null)
            nav = new XPathSemWebNavigator(rootentity, model, nsmgr);
        else
            nav = new XPathSemWebNavigator(model, nsmgr);

        t.Transform(nav, xsltargs, Console.Out, null);
    }