• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GUID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GUID的典型用法代码示例。如果您正苦于以下问题:C# GUID类的具体用法?C# GUID怎么用?C# GUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GUID类属于命名空间,在下文中一共展示了GUID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetupDiEnumDeviceInterfaces

 static extern bool SetupDiEnumDeviceInterfaces(
    IntPtr DeviceInfoSet,
    IntPtr DeviceInfoData,
    ref GUID lpHidGuid,
    UInt32 MemberIndex,
    ref SP_DEVICE_INTERFACE_DATA lpDeviceInterfaceData
 );
开发者ID:nguyenhunga5,项目名称:UavObject-.Net-Parser,代码行数:7,代码来源:Core.cs


示例2: Create

        /// <summary>
        /// Método para criar um objeto pessoa através do guid 
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="viewOnly">Se true, traz apenas os campos de base, como GUID, EGUID, Nome Fantasia e Razão Social</param>
        /// <returns></returns>
        public static IPessoa Create(GUID guid, bool viewOnly = true)
        {
            if(GUID.IsNullOrEmpty(guid)) return null;

            //recuperar o tipo de pessoa
            Connection connection = null;

            try
            {
                connection = DbContext.CreateConnection();

                DataReader dataReader = connection.ExecuteReader("SELECT TipoPessoa FROM cad_Pessoa WHERE GUID = @p1", new[] {
                    new Parameter{
                        ParameterName = "@p1",
                        Value = guid
                    }});

                if(dataReader.Read())
                    return Create(dataReader.GetEnum<TipoPessoa>(0), guid);
            }
            finally
            {
                connection.Close();
            }

            return null;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:33,代码来源:PessoaBase.CreateHelper.cs


示例3: ReadPayload

        public override int ReadPayload(MemoryStream stream,int length)
        {
            //Debug.Assert(length == GUID.GUID_LEN, "G2PacketQ2 supposed to read " + GUID.GUID_LEN + " but have to read " + length);

            guid = GUID.ReadGUID(stream);
            return (int)guid.bytes.Length;
        }
开发者ID:nikkolasg,项目名称:gnutella2,代码行数:7,代码来源:G2PacketQ2.cs


示例4: OnEnable

	void OnEnable()
	{	// This function is called when the object is loaded (used for similar reasons to MonoBehaviour.Reset)
		id = GUID.Create(id);
		if (attribDataFabs == null) attribDataFabs = new List<RPGAttributeData>(0);
		if (levelCurve == null) levelCurve = AnimationCurve.Linear(1, 1, maxXP, maxLevel);
		if (xpAttribId == null) xpAttribId = new GUID();
	}
开发者ID:voidserpent,项目名称:rpgbase,代码行数:7,代码来源:RPGActorClass.cs


示例5: Create

        /// <summary>
        /// Cria um item especial com base no GUID informado
        /// </summary>
        /// <param name="guid">GUID que deverá ser pesquisado</param>
        /// <returns>Item especial identificado</returns>
        public static Model.Cadastro.Item.Especial.IEspecial Create(GUID guid)
        {
            //se o GUID for inválido, não carregar
            if(GUID.IsNullOrEmpty(guid)) return null;

            //Buscar o tipo de item e se encontrar, criar.
            Connection connection = null;

            try
            {
                connection = DbContext.CreateConnection();

                DataReader dr = connection.ExecuteReader("SELECT Tipo FROM cad_ItemEsp WHERE GUID = @p1",
                    new Parameter[] {
                        new Parameter{
                            ParameterName = "@p1",
                            Value = guid
                        }
                    });

                if(dr.Read())
                {
                    return Create(dr.GetEnum<TipoItemEspecial>(0), guid);
                }
                else
                    throw new ArgumentException("Não foi encontrado nenhum item com o GUID informado");

            }
            finally
            {
                if(connection != null)
                    connection.Close();
            }
        }
开发者ID:njmube,项目名称:openposbr,代码行数:39,代码来源:EspecialBase.CreateHelper.cs


示例6: LanSKItem

 /// <summary>
 /// instancia o objeto
 /// </summary>
 public LanSKItem(GUID pai, GUID skPai, int tableHash)
     : this(pai, null, skPai, null, tableHash)
 {
     SKPai = skPai;
     ItemPai = pai;
     TableHash = tableHash;
 }
开发者ID:njmube,项目名称:openposbr,代码行数:10,代码来源:LanSKItem.cs


示例7: Create

        /// <summary>
        /// Cria o registro tipo R01 pelo GUID
        /// </summary>
        /// <param name="guid">GUID do registro tipo R01</param>
        /// <returns>Retorna o registro do tipo R01</returns>
        public static IRegistro01 Create(GUID guid)
        {
            IRegistro01 result = new Registro01();

            result.Populate(guid);

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:13,代码来源:Registro01.CreateHelper.cs


示例8: LanSK

 /// <summary>
 /// instancia o objeto
 /// </summary>
 public LanSK(GUID pai, GUID filho, int tableHash)
     : this(pai, filho, null, tableHash)
 {
     Pai = pai;
     Filho = filho;
     TableHash = Unimake.Convert.ToInt(tableHash);
     GUIDSK = Pai;
 }
开发者ID:njmube,项目名称:openposbr,代码行数:11,代码来源:LanSK.cs


示例9: Create

        /// <summary>
        /// Cria um novo objeto IBaixaForma de acordo com seu tipo e popula o o objeto
        /// </summary>
        /// <param name="tipo">Tipo que deverá ser criado</param>
        /// <param name="g">identificador que deverá ser carregado</param>
        /// <returns></returns>
        public static IBaixaForma Create(TipoBaixaForma tipo, GUID g)
        {
            IBaixaForma result = Create(tipo);

            if(result != null)
                result.Populate(g);

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:15,代码来源:BaixaFormaBase.CreateHelper.cs


示例10: Create

        /// <summary>
        /// Instancia um movimento com base no item informado.
        /// <para>Utilize quando tiver apenas o item, mas não tem o movimento.</para>
        /// </summary>
        /// <param name="item">item base que deverá ser detectado o tipo de movimento</param>
        /// <param name="guid">Identificador do movimento</param>
        /// <returns></returns>
        public static IMovimento Create(IItem item, GUID guid)
        {
            if (item is Model.Faturamento.Lancamento.Movimento.Item.VendaCF.IItem)
                return new Data.Faturamento.Lancamento.Movimento.PreVenda.PreVenda(guid);
            else if (item is Model.Faturamento.Lancamento.Movimento.Item.PreVenda.IItem)
                return new Data.Faturamento.Lancamento.Movimento.DAV.DAV(guid);
            else if (item is Model.Faturamento.Lancamento.Movimento.Item.DAV.IItem)
                return new Data.Faturamento.Lancamento.Movimento.DAV.DAV(guid);
            else if (item is Model.Faturamento.Lancamento.Movimento.Item.Conferencia.IItem)
                return new Data.Faturamento.Lancamento.Movimento.Conferencia.Conferencia(guid);

            throw new NotImplementedException("Tipo de item não implementado");
        }
开发者ID:njmube,项目名称:openposbr,代码行数:20,代码来源:MovimentoBase.CreateHelper.cs


示例11: Create

        /// <summary>
        /// Cria uma nova instancia de abertura ou fechamento de caixa com base no GUID informado
        /// </summary>
        /// <param name="guid">código do registro para criar a abertura ou fechamento de caixa</param>
        /// <returns></returns>
        public static AbreFechaCaixaBase Create(GUID guid)
        {
            AbreFechaCaixaBase result = null;

            //criar uma abertura de caixa, se o status do caixa for fechado, converter para fechamento
            result = new AbreCaixa(guid);

            //se o status for fechado, converter para um fechamento
            if(result.Status == Status.Fechado)
                result = new FechaCaixa(guid);

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:18,代码来源:AbreFechaCaixaBase.CreateHelper.cs


示例12: Create

        /// <summary>
        /// Retorna o objeto identificado pelo GUID passado como parametro
        /// </summary>
        /// <param name="guid">Identificador do registro </param>
        /// <param name="viewOnly">Carrega apenas os dados de base.</param>
        /// <returns>Retorna o objeto carregado do tipo ILancamento </returns>
        public static ILancamento Create(GUID guid, bool viewOnly = true)
        {
            Connection connection = null;
            ILancamento result = null;

            try
            {
                connection = DbContext.CreateConnection();
                Tipo tipo = Tipo.CupomFiscal;
                Unimake.Data.Generic.DataReader dr =
                    connection.ExecuteReader(string.Format(@"SELECT
                                                                GUID                  AS p_GUID               ,
                                                                EGUID                 AS p_EGUID              ,
                                                                DataHoraCadastro      AS p_DataHoraCadastro   ,
                                                                GUIDUsuarioCadastro   AS p_GUIDUsuarioCadastro,
                                                                GUIDempresa           AS p_GUIDempresa        ,
                                                                Excluido              AS p_Excluido           ,
                                                                Tipo                  AS p_Tipo               ,
                                                                Status                AS p_Status             ,
                                                                Descricao             AS p_Descricao          ,
                                                                StatusEnvio           AS p_StatusEnvio        ,
                                                                StatusBaixa           AS p_StatusBaixa
                                                             FROM fat_lan WHERE fat_Lan.GUID='{0}'",
                                             guid.ToString()));

                if (dr.Read())
                {
                    tipo = dr.GetValue<Tipo>("p_Tipo");

                    if (viewOnly)
                    {
                        result = Create(tipo) as ILancamento;
                        DbContext.Populate(result, dr);
                        result.Status = dr.GetValue<Status>("p_Status");
                        result.Descricao = dr.GetValue<string>("p_Descricao");
                        result.StatusEnvio = dr.GetValue<StatusEnvio>("p_StatusEnvio");
                        result.StatusBaixa = dr.GetValue<StatusBaixa>("p_StatusBaixa");
                    }
                    else
                    {
                        result = Create(guid, tipo) as ILancamento;
                    }
                }
            }
            finally
            {
                connection.Close();
            }

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:57,代码来源:LancamentoBase.CreateHelper.cs


示例13: Create

        public static Model.Cadastro.TabelaPreco.IItem Create(Model.Cadastro.TabelaPreco.ITabelaPreco tabelaPreco, GUID guid)
        {
            Data.Cadastro.TabelaPreco.Item result = new Data.Cadastro.TabelaPreco.Item();
            result.Parent = tabelaPreco;
            result.Item = Data.Cadastro.Item.Produto.Acabado.Create(guid);

            if (result.Item == null)
                return null;//Não encontrou o produto cadastrado

            Connection connection = null;

            try
            {
                connection = DbContext.CreateConnection();
                DataReader dr = connection.ExecuteReader(@"SELECT GUIDTabelaPreco,
                                                                  GUIDItem,
                                                                  Preco
                                                            FROM cad_TabelaPrecoItem
                                                            WHERE GUIDTabelaPreco = @p1 AND
                                                                  GUIDItem = @p2", new[] {
                         new Parameter {
                             ParameterName = "@p1",
                             Value = tabelaPreco.GUID
                         },
                         new Parameter {
                             ParameterName = "@p2",
                             Value = result.Item.GUID
                         }
                     });

                if (dr.Read())
                {
                    result.Preco = dr.GetDouble("Preco");
                }
            }
            finally
            {
                connection.Close();
            }

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:42,代码来源:ItemBase.CreateHelper.cs


示例14: G2SearchResults

        public G2SearchResults(SearchTransaction transaction, GUID guid)
        {
            SearchManager = G2SearchManager.Instance;
            ACKPacket = new List<G2PacketQA>();
            Transaction = transaction;
            SearchGUID = guid;
            TotalFiles = 0;
            SharedTotalFiles = 0;
            PeersBrowsed = new HashSet<Peer>();

            SearchedWord = transaction.Keywords[0].KeywordName;
            Buffer = new PacketBuffer();
            SearchRegrouping = new G2SearchResultRegrouping(transaction, 0, false);
            ContinueRegrouping = true;
            StartSearchTime = DateTime.Now;
            StopSearchTimer = new System.Timers.Timer((double)Settings.SEARCH_TIME_OUT_MS);
            StopSearchTimer.AutoReset = false;
            StopSearchTimer.Elapsed += new ElapsedEventHandler(SearchTimeOut);

            RegroupingThread = new Thread(new ThreadStart(SearchResultThread));
        }
开发者ID:nikkolasg,项目名称:gnutella2,代码行数:21,代码来源:G2SearchResults.cs


示例15: Create

        /// <summary>
        /// Cria um novo item e retorna de acordo com o tipo identificado e carrega o mesmo pelo GUID
        /// </summary>
        /// <param name="guid">GUID de identificação do item</param>
        /// <param name="movimento">Movimento pai para validar o tipo de item</param>
        /// <returns></returns>
        public static ItemBase Create(IMovimento movimento, GUID guid)
        {
            ItemBase result = null;

            if (movimento is Model.Faturamento.Lancamento.Movimento.PreVenda.IPreVenda)
                result = new Data.Faturamento.Lancamento.Movimento.Item.PreVenda.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.DAV.OS.IDAV)
                result = new Data.Faturamento.Lancamento.Movimento.Item.DAV.OS.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.DAV.IDAV)
                result = new Data.Faturamento.Lancamento.Movimento.Item.DAV.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.NFe.INFe)
                result = new Data.Faturamento.Lancamento.Movimento.Item.NFe.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.NFManual.INFManual)
                result = new Data.Faturamento.Lancamento.Movimento.Item.NFManual.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.Devolucao.IDevolucao)
                result = new Data.Faturamento.Lancamento.Movimento.Item.Devolucao.Item(guid);
            else if (movimento is Model.Faturamento.Lancamento.Movimento.Conferencia.IConferencia)
                result = new Data.Faturamento.Lancamento.Movimento.Item.Conferencia.Item();

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:27,代码来源:ItemBase.CreateHelper.cs


示例16: Create

        /// <summary>
        /// Retorna uma nova tabela de preços. Se o parâmetro viewOnly for true não retornará os itens da tabela
        /// </summary>
        /// <param name="guid">Identificador da tabela de preços</param>
        /// <param name="viewOnly">Se true, traz apenas os dados básicos da tabela</param>
        /// <returns></returns>
        public static ITabelaPreco Create(GUID guid, bool viewOnly = true)
        {
            Connection connection = null;
            ITabelaPreco result = new Data.Cadastro.TabelaPreco.TabelaPreco();

            try
            {
                connection = DbContext.CreateConnection();
                Command command = CommandFactory.PrepareSelect(result, new Where
                {
                    {
                        "GUID = @p1",
                        new Parameter {
                            ParameterName = "@p1",
                            Value = guid
                        }
                    },
                });

                DataReader dataReader = command.ExecuteReader();

                if(dataReader.Read())
                {
                    DbContext.Populate(result, dataReader);
                    result.Descricao = dataReader.GetValue<string>("p_Descricao");
                    result.Promocional = dataReader.GetValue<bool>("p_Promocional");
                    result.ValidadeInicial = dataReader.GetValue<DateTime>("p_ValidadeInicial");
                    result.ValidadeFinal = dataReader.GetValue<DateTime>("p_ValidadeFinal");
                }
            }
            finally
            {
                connection.Close();
            }

            return result;
        }
开发者ID:njmube,项目名称:openposbr,代码行数:43,代码来源:TabelaPrecoBase.CreateHelper.cs


示例17: InstallInfDriver

 /// <summary>
 /// Installs a driver using its INF file
 /// </summary>
 /// <param name="filePath">Relative or absolute INF file path</param>
 /// <param name="hardwareID">ComponentID</param>
 /// <returns></returns>
 public static bool InstallInfDriver(string filePath, string hardwareID, string description = "")
 {
     // TODO: Win10 got wrong bitness onetime (???)
     if (IntPtr.Size == 4 && Environment.Is64BitOperatingSystem)
     {
         MessageBox.Show("This process is 32-bit but the OS is 64-bit. Only 64-bit processes can install 64-bit direvers.",
             "Driver Setup", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2, MessageBoxOptions.ServiceNotification);
         return false;
     }
     filePath = Path.GetFullPath(filePath);
     GUID classGuid = new GUID();
     char[] className = new char[MAX_CLASS_NAME_LEN];
     uint requiredSize = 0;
     SP_DEVINFO_DATA deviceInfoData = new SP_DEVINFO_DATA();
     deviceInfoData.cbSize = (uint)Marshal.SizeOf(deviceInfoData);
     // Use the INF File to extract the Class GUID
     if (!SetupDiGetINFClass(filePath, ref classGuid, className, MAX_CLASS_NAME_LEN, ref requiredSize))
         return false;
     // Create the container for the to-be-created Device Information Element
     IntPtr deviceInfoSet = SetupDiCreateDeviceInfoList(ref classGuid, IntPtr.Zero);
     if (deviceInfoSet == Kernel32.INVALID_HANDLE_VALUE)
         return false;
     // Now create the element. Use the Class GUID and Name from the INF file
     if (!SetupDiCreateDeviceInfo(deviceInfoSet, new string(className), ref classGuid, description, IntPtr.Zero, DICD_GENERATE_ID, ref deviceInfoData))
         return false;
     // Add the HardwareID to the Device's HardwareID property
     if (!SetupDiSetDeviceRegistryProperty(deviceInfoSet, ref deviceInfoData, SPDRP_HARDWAREID, Encoding.Unicode.GetBytes(hardwareID), (uint)Encoding.Unicode.GetByteCount(hardwareID)))
         return false;
     // Transform the registry element into an actual devnode in the PnP HW tree
     if (!SetupDiCallClassInstaller(DI_FUNCTION.DIF_REGISTERDEVICE, deviceInfoSet, ref deviceInfoData))
         return false;
     SetupDiDestroyDeviceInfoList(deviceInfoSet);
     // Update the driver for the device we just created
     if (!Newdev.UpdateDriverForPlugAndPlayDevices(IntPtr.Zero, hardwareID, filePath, Newdev.INSTALLFLAG_FORCE, IntPtr.Zero))
         return false;
     return true;
 }
开发者ID:ddonny,项目名称:Network-Manager,代码行数:43,代码来源:Setupapi.cs


示例18: Gravar

        public override void Gravar()
        {
            Model.Cadastro.Veiculo.IVeiculo v = new OpenPOS.Data.Cadastro.Veiculo.Veiculo();
            AnoFabricacao a = new AnoFabricacao("06d24c3b-40cf-4bc0-a1f6-456fd9458c0a");
            v.AnoFabricacao = a;
            v.Placa = "ABC1234";
            v.Renavam = "12345678";
            GUIDVeiculo = v.Save();
            //DAV dav = new DAV();
            //dav.Veiculo = v;
            //dav.Itens.Add(new Item
            //{
            //    Quantidade = 10,
            //    ValorUnitarioBruto = 12.5,
            //    DescricaoNF = "Produto de teste um",
            //    Vendedor = new Vendedor("8c7aea3e-b28e-4664-8923-3327dfd462ad")
            //});

            //dav.Itens.Add(new Item
            //{
            //    Quantidade = 25,
            //    ValorUnitarioBruto = 15,
            //    DescricaoNF = "Produto de teste dois",
            //    Vendedor = new Vendedor("8c7aea3e-b28e-4664-8923-3327dfd462ad")
            //});

            //dav.Itens.Add(new Item
            //{
            //    Quantidade = 33,
            //    ValorUnitarioBruto = 17.5,
            //    DescricaoNF = "Produto de teste três",
            //    Vendedor = new Vendedor("8c7aea3e-b28e-4664-8923-3327dfd462ad")
            //});

            //GUID = dav.Save();
        }
开发者ID:njmube,项目名称:openposbr,代码行数:36,代码来源:VeiculoTest.cs


示例19: Log

 /// <summary>
 /// Construtor com parametro pelo GUID
 /// </summary>
 /// <param name="guid">GUID do movimento</param>
 public Log(GUID guid)
     : this()
 {
     Populate(guid);
 }
开发者ID:njmube,项目名称:openposbr,代码行数:9,代码来源:Log.cs


示例20: GrupoBase

 /// <summary>
 /// Instancia este objeto, inicia as variáveis e carrega o registro pelo GUID informado
 /// </summary>
 /// <param name="guid">identificador único do registro</param>
 public GrupoBase(GUID guid)
     : this()
 {
     Populate(guid);
 }
开发者ID:njmube,项目名称:openposbr,代码行数:9,代码来源:GrupoBase.cs



注:本文中的GUID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GUIManager类代码示例发布时间:2022-05-24
下一篇:
C# GUIContent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap