public static Boolean deleteWriting(Writing writing)
 {
     if (writing == null)
     {
         return(false);
     }
     using (SqlConnection con = new SqlConnection(databaseConnectionStr))
     {
         con.Open();
         SqlCommand cmd = new SqlCommand("DELETE FROM Writings WHERE WritingId = " + writing.writingId.ToString() + ";");
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = con;
         try
         {
             cmd.ExecuteScalar();
         }
         catch (Exception e)
         {
             System.Windows.Forms.MessageBox.Show(e.ToString());
             con.Close();
             return(false);
         }
         con.Close();
         return(true);
     }
 }
Esempio n. 2
0
    private void Play(iSentence _sentence)
    {
        EffectManager.Play(_sentence.EffectList);
        page       = 0;
        stringList = stringarraynull;
        switch (_sentence.SentenceType)
        {
        case SentenceType.Spoken:
            Name.text = Writing.Get(_sentence.SpeakerID);
            break;

        case SentenceType.Psychic:
            Name.text = Writing.Get(100034) + Writing.Get(_sentence.SpeakerID) + Writing.Get(100035);
            break;

        case SentenceType.Aside:
            break;

        case SentenceType.Option:
            break;

        case SentenceType.AllIn:
            gameObject.SetActive(false);
            return;

        default:
            break;
        }

        string _s = Writing.Get(_sentence.DialogueID);

        stringList    = _s.SubPerCount(maxCountPerPage);
        Dialogue.text = System.Text.RegularExpressions.Regex.Unescape(stringList[page]);
    }
 public void WriteString_OnObject_OK()
 {
     var x = new Writing<object>();
     var y = x.AsVariant<IWriting<string>>();
     y.Set("something");
     x.Object.Should().Be.EqualTo("something");
 }
Esempio n. 4
0
        protected override bool PrivateAllow(SimDescription me)
        {
            if (!base.PrivateAllow(me))
            {
                return(false);
            }

            if (me.SkillManager == null)
            {
                return(false);
            }

            Writing skill = me.SkillManager.GetSkill <Writing>(SkillNames.Writing);

            if (skill == null)
            {
                return(false);
            }

            if (skill.WrittenBookDataList == null)
            {
                return(false);
            }

            return(skill.WrittenBookDataList.Count > 0);
        }
Esempio n. 5
0
        public Boolean Log(LoggerMessageType type,
                           String format,
                           params System.Object[] args)
        {
            if (!CheckMessageType(type))
            {
                return(false);
            }

            LogWritingEventArgs writingArgs = new LogWritingEventArgs(FullPath,
                                                                      type,
                                                                      String.Format(format, args));

            Writing?.Invoke(this, writingArgs);

            FileInfo outputFile = new FileInfo(FullPath);

            if (!outputFile.Directory.Exists)
            {
                outputFile.Directory.Create();
            }
            LogMessageTemplate messageTemplate = new LogMessageTemplate(_config.MessageTemplateText,
                                                                        writingArgs);

            lock (_lock)
            {
                File.AppendAllText(FullPath, messageTemplate.ToString());
            }
            Console.WriteLine(messageTemplate.ToString());

            return(true);
        }
        private void writing_Click(object sender, RoutedEventArgs e)
        {
            Writing Writing = new Writing();

            Writing.Show();
            this.Close();
        }
Esempio n. 7
0
        protected override ManagerStory.Story PrintFormattedStory(StoryProgressionObject manager, string text, string summaryKey, object[] parameters, string[] extended, ManagerStory.StoryLogging logging)
        {
            Writing skill = Sim.SkillManager.GetSkill <Writing>(SkillNames.Writing);

            WrittenBookData writing = skill.LastCompletedWriting;

            List <BookGeneralData> randomList           = new List <BookGeneralData>(BookData.BookGeneralDataList.Values);
            BookGeneralData        randomObjectFromList = RandomUtil.GetRandomObjectFromList(randomList);

            int genre   = RandomUtil.GetInt(1, Writing.kDialogsPerGenre);
            int quality = RandomUtil.GetInt(1, Writing.kDialogsPerQuality);

            text = Writing.LocalizeString(Sim.IsFemale, "Finished" + writing.Genre.ToString() + genre, new object[] { Sim, writing.NumPages, writing.Title, randomObjectFromList.Title });
            if (writing.Quality != Writing.WrittenBookQuality.Normal)
            {
                string str2 = Writing.LocalizeString(Sim.IsFemale, "Finished" + writing.Quality.ToString() + quality, new object[] { Sim, writing.NumPages, writing.Title });
                text = text + " " + str2;
            }

            string str3 = Writing.LocalizeString(Sim.IsFemale, "RoyaltyDetails", new object[] { Sim, Writing.kRoyaltyLength, writing.Royalty, SimClockUtils.GetText(Writing.kRoyaltyPayHour) });

            text = text + Common.NewLine + Common.NewLine + str3;

            if (extended == null)
            {
                extended = new string[] { writing.Title, EAText.GetNumberString(writing.Royalty) };
            }

            return(base.PrintFormattedStory(manager, text, summaryKey, parameters, extended, logging));
        }
        public ActionResult Introduction(FormCollection form)
        {
            int UserId = Convert.ToInt32(Session["Login"]);

            using (db = new GerardJennyEntities())
            {
                Writing write = new Writing();
                write.Description = form["texts"];
                write.UserId      = UserId;
                db.Writings.Add(write);
                db.SaveChanges();
                var num = from w in db.Writings
                          join u in db.Users
                          on w.UserId equals u.ID into bases
                          from sb in bases.DefaultIfEmpty()
                          orderby w.ContentID descending
                          select new ContentUser
                {
                    ContentID      = w.ContentID,
                    Description    = w.Description,
                    UserId         = w.UserId,
                    ID             = sb.ID,
                    Name           = sb.Name,
                    ProfilePicture = sb.ProfilePicture,
                };
                return(View(num.ToList()));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Modifie les propriétés du modèle de sorte à ce que le OData Binding soit effectué.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="line"> L'écriture comptable à exploiter. </param>
        /// <param name="existing"> L'objet Import contenant codes journaux, modes de réglement [...] connus. </param>
        private void SetOdataBindings(APIRepository repository, Writing line, Import existing)
        {
            // Bind code "journal"
            var journalId = existing.Codes[line.Code].Id;

            line.CodeBind = Tools.OdataBind(repository, "journaux", journalId);

            // Bind "compte général"
            if (!string.IsNullOrEmpty(line.Compte))
            {
                var accountId = existing.Comptes[line.Compte];
                line.CompteBind = Tools.OdataBind(repository, "comptes", accountId);
            }

            // Bind id "tiers": Recherche du numero.
            if (!string.IsNullOrEmpty(line.NumeroTiers))
            {
                var tiersId = existing.Comptes[line.NumeroTiers];
                line.NumeroTiersBind = Tools.OdataBind(repository, "tiers", tiersId);
            }

            // Bind id de "modeReglement" si il existe.
            if (!string.IsNullOrEmpty(line.ModeReglement))
            {
                var modeReglementId = existing.IntitulesModesReglement[line.ModeReglement];
                line.ModeReglementBind = Tools.OdataBind(repository, "modesReglement", modeReglementId);
            }
        }
Esempio n. 10
0
            void write(Log.MessageType messageType, string message, string details = null)
            {
                lock (this)
                {
                    Writing?.Invoke(Name, messageType, message, details);

                    switch (Level)
                    {
                    case Level.NONE:
                        return;

                    case Level.ERROR:
                        if (messageType < MessageType.ERROR)
                        {
                            return;
                        }
                        break;

                    case Level.WARNING:
                        if (messageType < MessageType.WARNING)
                        {
                            return;
                        }
                        break;

                    case Level.INFORM:
                        if (messageType < MessageType.INFORM)
                        {
                            return;
                        }
                        break;

                    case Level.ALL:
                        break;

                    default:
                        throw new Exception("Unknown option: " + Level);
                    }

                    if (MaxFileSize > 0)
                    {
                        FileInfo fi = new FileInfo(File);
                        if (fi.Exists && fi.Length > MaxFileSize)
                        {
                            fileCounter++;
                            SetFile();
                        }
                    }

                    if (logWriter == null)
                    {
                        Directory.CreateDirectory(PathRoutines.GetFileDir(File));
                        logWriter = new StreamWriter(File, true);
                    }

                    message = (messageType == MessageType.LOG ? "" : messageType.ToString() + ": ") + message + (string.IsNullOrWhiteSpace(details) ? "" : "\r\n\r\n" + details);
                    logWriter.WriteLine(DateTime.Now.ToString(Log.TimePattern) + message);
                    logWriter.Flush();
                }
            }
        public async Task <IActionResult> Edit(Writing writing, List <IFormFile> Material)
        {
            foreach (var item in Material)
            {
                if (item.Length > 0)
                {
                    using (var stream = new MemoryStream())
                    {
                        await item.CopyToAsync(stream);

                        writing.Material = stream.ToArray();
                    }
                }
            }
            Writing obj = new Writing
            {
                ID            = writing.ID,
                Title         = writing.Title,
                Category      = writing.Category,
                Author        = writing.Author,
                Material      = writing.Material,
                Description   = writing.Description,
                DatePublished = writing.DatePublished
            };

            dbContext.Writings.Update(obj);
            dbContext.SaveChanges();
            return(RedirectToAction("AdminIndex"));
        }
Esempio n. 12
0
 public Diplomat() : base(3, 0, 0, 2)
 {
     Type         = UnitType.Diplomat;
     Name         = "Diplomat";
     RequiredTech = new Writing();
     ObsoleteTech = null;
     SetIcon('C', 1, 0);
 }
Esempio n. 13
0
    /*****************************************************************************/

    void Awake()
    {
        myGenericFunctionsClassScript = transform.GetComponent <GenericFunctionsClass>();

        myResetButton = GameObject.Find("reset");
        myResetButton.GetComponent <Renderer>().material.color = buttonResetColors[0];
        myWritingScript = GameObject.Find("Black_Board").GetComponent <Writing>();
    }
    /*****************************************************************************/
    void Awake()
    {
        myGenericFunctionsClassScript = transform.GetComponent<GenericFunctionsClass>();

        myResetButton = GameObject.Find("reset");
        myResetButton.GetComponent<Renderer>().material.color = buttonResetColors[0];
        myWritingScript = GameObject.Find("Black_Board").GetComponent<Writing>();
    }
Esempio n. 15
0
        public ActionResult DeleteConfirmed(int id)
        {
            Writing writing = db.Writings.Find(id);

            db.Writings.Remove(writing);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 16
0
 public Library() : base(8, 1)
 {
     Name         = "Library";
     RequiredTech = new Writing();
     SetIcon(1, 0, true);
     SetSmallIcon(1, 0);
     Type = Building.Library;
 }
Esempio n. 17
0
 public WritingPage(Project p, Writing w)
 {
     InitializeComponent();
     project                 = p;
     writing                 = w;//new Reading(-1, -1, -1, "No Title", "First", "M.", "Last", "", "Jan.", 1, 1999, "Publisher");
     writingDoc.Text         = writing.text;
     beginningTag.DataSource = DatabaseInterface.getTags(p.projectId);
     mainGraph               = createTagGraph();
 }
Esempio n. 18
0
 public ActionResult Edit([Bind(Include = "ID,userId,text,title")] Writing writing)
 {
     if (ModelState.IsValid)
     {
         db.Entry(writing).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(writing));
 }
Esempio n. 19
0
        private void setData()
        {
            writing = (Writing)Session["UpdateWritingObject"];
            client  = (Client)Session["UpdateClientObject"];
            affair  = (Affair)Session["UpdateAffairObject"];

            protocolID = Session["UpdateProtocolID"].ToString();
            writingID  = int.Parse(Session["UpdateWritingID"].ToString());
            rbt        = Session["RBT"].ToString();

            TextBoxAct.Text        = writing.EventWriting;
            TextBoxAddressFac.Text = writing.BillingAddress;
            TextBoxAffair.Text     = affair.AffairName;
            TextBoxClient.Text     = client.ClientName;
            TextBoxIdFac.Text      = writing.BillingNumber;

            DateTime t = (DateTime)Session["UpdateDate"];

            CalendarDate.TodaysDate   = t;
            TextBoxEmailFac.Text      = writing.BillingEmail;
            TextBoxParts.Text         = writing.Parts;
            TextBoxWritingNumber.Text = writing.WritingNumber;

            string facNotary = Session["UpdateFacNotary"].ToString();

            string[] var = facNotary.Split('$');


            TextBoxNotaryFac.Text = var[1];
            loadCoNotary();


            List <string> names = new List <string>();

            foreach (GridViewRow r in GridViewCoNotary.Rows)
            {
                names.Add(r.Cells[2].Text);
            }

            List <int> list = bll.getAllCoNorariesToUpdate(writing.WritingID, names); //Names va bien
            int        i    = 0;

            foreach (GridViewRow row in GridViewCoNotary.Rows)
            {
                try
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        ((TextBox)row.FindControl("TextBoxCoNotaryAdd")).Text = list[i] + "";
                    }
                    i++;
                } catch (Exception e) {
                }
            }
        }
Esempio n. 20
0
        public ActionResult Create([Bind(Include = "ID,userId,text,title")] Writing writing)
        {
            if (ModelState.IsValid)
            {
                db.Writings.Add(writing);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(writing));
        }
Esempio n. 21
0
        //****************************[LECTURE FICHIER IMPORT ET CONTROLE COHERENCE]*******************************************************************
        /// <summary>
        /// Lit le fichier ligne par ligne.
        /// </summary>
        /// <param name="repository"> Le repository. </param>
        /// <param name="pieces"> Le dictionnaire de pièces contenant l'id de la pièce et la liste d'écritures. </param>
        /// <param name="errors"> Le dictionnaire de pièces contenant l'id de la pièce et la liste d'erreurs. </param>
        /// <param name="existing"> Les données préchargées (obligatoires) lors de l'arrivée sur la page d'import. </param>
        /// <param name="file"> Le fichier comptable texte importé. </param>
        private void ReadFile(APIRepository repository, Dictionary <string, List <Writing> > pieces, Dictionary <string, List <string> > errors, Import existing, IFormFile file)
        {
            using var reader = new StreamReader(file.OpenReadStream());

            var lineNumber = 0;
            var linePiece  = 0;
            var line       = string.Empty;

            while (!string.IsNullOrEmpty(line = reader.ReadLine()))
            {
                lineNumber++;

                //Si une ligne n'a pas le bon nombre de colonnes on sort une erreur grave et on continue le parcours pour voir si d'autres lignes dans ce cas
                if (Writing.HasIncorrectNumberOfColumns(line))
                {
                    AddErrorToPiece(lineNumber, "Nombre de colonnes incorrect", errors);
                    continue;
                }

                var writing = Writing.Create(line);

                // Contrôle cohérence et alimentation liste erreur.
                var errorLogs = new List <string>();
                writing.ControlWriting(repository, existing, errorLogs);

                // Ajout de l'écriture dans la pièce avec création préalable d'une nouvelle pièce si JOURNAL|PIECE|DATE n'existe pas dans la liste des pièces.
                if (!pieces.ContainsKey(writing.Id))
                {
                    linePiece = 0;
                    pieces.Add(writing.Id, new List <Writing>());
                }
                pieces[writing.Id].Add(writing);
                linePiece++;

                // Ajout des erreurs éventuelles de l'écriture avec création préalable d'une nouvelle liste d'erreurs pour la pièce si n'existe pas déjà
                if (errorLogs.Count > 0)
                {
                    AddErrorToPiece(writing.Id, linePiece, lineNumber, errorLogs, errors);
                }
            }

            //Maintenant qu'on a dispatché les lignes en pièces, on peut vérifier si chaque pièce est équilibrée
            foreach (var piece in pieces)
            {
                if (!IsBalanced(piece))
                {
                    AddErrorToPiece(piece.Key, "La pièce n'est pas équilibrée.", errors);
                }
            }


            reader.Close();
        }
Esempio n. 22
0
 private void deleteWritingBtn_Click(object sender, EventArgs e)
 {
     try
     {
         Writing toDelete = writingsList.SelectedItem as Writing;
         toDelete.deleted = DatabaseInterface.deleteWriting(toDelete);
         writingsList.Refresh();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Esempio n. 23
0
        private static bool Exists(Writing skill, string key)
        {
            if (skill.WrittenBookDataList.ContainsKey(key))
            {
                return(true);
            }

            if (BookData.BookWrittenDataList.ContainsKey(key + skill.SkillOwner.FullName))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 24
0
        // GET: Writings1/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Writing writing = db.Writings.Find(id);

            if (writing == null)
            {
                return(HttpNotFound());
            }
            return(View(writing));
        }
Esempio n. 25
0
 public static IConnectionConfiguration CopyWith(
     this IConnectionConfiguration configuration,
     IRetry connectionRetry                    = null,
     IVersionSupport versionSupport            = null,
     TimeSpan?requestTimeout                   = null,
     int?readBufferSize                        = null,
     int?writeBufferSize                       = null,
     bool?isTcpKeepalive                       = null,
     IEnumerable <IMembershipEncoder> encoders = null,
     ISslConfiguration sslConfiguration        = null,
     ConnectError onDisconnected               = null,
     Connecting onConnecting                   = null,
     Connecting onConnected                    = null,
     Writing onWriting            = null,
     StartingBytes onWritingBytes = null,
     FinishedBytes onWroteBytes   = null,
     WriteSuccess onWritten       = null,
     WriteError onWriteFailed     = null,
     Reading onReading            = null,
     StartingBytes onReadingBytes = null,
     FinishedBytes onReadBytes    = null,
     ReadSuccess onRead           = null,
     ReadError onReadFailed       = null,
     ProduceRequestMessages onProduceRequestMessages = null)
 {
     return(new ConnectionConfiguration(
                connectionRetry ?? configuration.ConnectionRetry,
                versionSupport ?? configuration.VersionSupport,
                requestTimeout ?? configuration.RequestTimeout,
                readBufferSize ?? configuration.ReadBufferSize,
                writeBufferSize ?? configuration.WriteBufferSize,
                isTcpKeepalive ?? configuration.IsTcpKeepalive,
                encoders ?? configuration.Encoders.Values,
                sslConfiguration ?? configuration.SslConfiguration,
                onDisconnected ?? configuration.OnDisconnected,
                onConnecting ?? configuration.OnConnecting,
                onConnected ?? configuration.OnConnected,
                onWriting ?? configuration.OnWriting,
                onWritingBytes ?? configuration.OnWritingBytes,
                onWroteBytes ?? configuration.OnWroteBytes,
                onWritten ?? configuration.OnWritten,
                onWriteFailed ?? configuration.OnWriteFailed,
                onReading ?? configuration.OnReading,
                onReadingBytes ?? configuration.OnReadingBytes,
                onReadBytes ?? configuration.OnReadBytes,
                onRead ?? configuration.OnRead,
                onReadFailed ?? configuration.OnReadFailed,
                onProduceRequestMessages ?? configuration.OnProduceRequestMessages));
 }
Esempio n. 26
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Writing = await _context.Writing.FirstOrDefaultAsync(m => m.ID == id);

            if (Writing == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 27
0
        private static bool StartNewWriting(Computer ths, Writing writingSkill, BookData.BookGenres genre)
        {
            List <string> randomList = BookData.WrittenBookTitles[genre];

            if (writingSkill.WrittenBookDataList == null)
            {
                writingSkill.WrittenBookDataList = new Dictionary <string, WrittenBookData>();
            }

            int count = 0;

            string key = null;

            while (count < 25)
            {
                key = Common.LocalizeEAString("Gameplay/Excel/Books/WrittenBookTitles:" + RandomUtil.GetRandomObjectFromList(randomList));
                count++;

                if (!Exists(writingSkill, key))
                {
                    break;
                }
            }

            if (Exists(writingSkill, key))
            {
                string oldKey = key;

                int num = 0x1;
                do
                {
                    num++;
                    key = oldKey + " " + num;
                }while (Exists(writingSkill, key));
            }

            if ((SimTypes.IsSelectable(writingSkill.SkillOwner)) || (StoryProgression.Main.GetValue <PromptToTitleOption, bool>()))
            {
                string title = StringInputDialog.Show(Common.Localize("TitleBook:Header", writingSkill.SkillOwner.IsFemale), Common.Localize("TitleBook:Prompt", writingSkill.SkillOwner.IsFemale, new object[] { writingSkill.SkillOwner }), key);
                if (!string.IsNullOrEmpty(title))
                {
                    key = title;
                }
            }

            writingSkill.AddWritingToDataList(key, writingSkill.GetNumPagesForWriting(genre), genre, true, null);
            return(true);
        }
Esempio n. 28
0
 /// <summary>
 /// Configuration for the tcp connection.
 /// </summary>
 /// <param name="connectionRetry">Retry details for (re)establishing the connection.</param>
 /// <param name="versionSupport">Support for different protocol versions for Kakfa requests and responses.</param>
 /// <param name="requestTimeout">The maximum time to wait for requests.</param>
 /// <param name="readBufferSize">The buffer size to use for the socket, when receiving bytes.</param>
 /// <param name="writeBufferSize">The buffer size to use for the socket, when sending bytes.</param>
 /// <param name="isTcpKeepalive">TCP keepalive option.</param>
 /// <param name="encoders">Custom Encoding support for different protocol types</param>
 /// <param name="sslConfiguration">Configuration for SSL encrypted communication</param>
 /// <param name="onDisconnected">Triggered when the tcp socket is disconnected.</param>
 /// <param name="onConnecting">Triggered when the tcp socket is connecting.</param>
 /// <param name="onConnected">Triggered after the tcp socket is successfully connected.</param>
 /// <param name="onWriting">Triggered when writing to the tcp stream.</param>
 /// <param name="onWritingBytes">Triggered when writing a chunk of bytes to the tcp stream.</param>
 /// <param name="onWroteBytes">Triggered after successfully writing a chunk of bytes to the tcp stream.</param>
 /// <param name="onWritten">Triggered after having successfully written to the tcp stream.</param>
 /// <param name="onWriteFailed">Triggered after failing to write to the tcp stream.</param>
 /// <param name="onReading">Triggered when starting to read a message's bytes from the tcp stream.</param>
 /// <param name="onReadingBytes">Triggered when reading a chunk of bytes from the tcp stream.</param>
 /// <param name="onReadBytes">Triggered after successfully reading a chunk of bytes from the tcp stream.</param>
 /// <param name="onRead">Triggered after having successfully read a message's bytes from the tcp stream.</param>
 /// <param name="onReadFailed">Triggered after failing to read from the tcp stream.</param>
 /// <param name="onProduceRequestMessages">Triggered when encoding ProduceRequest messages.</param>
 public ConnectionConfiguration(
     IRetry connectionRetry                    = null,
     IVersionSupport versionSupport            = null,
     TimeSpan?requestTimeout                   = null,
     int?readBufferSize                        = null,
     int?writeBufferSize                       = null,
     bool?isTcpKeepalive                       = null,
     IEnumerable <IMembershipEncoder> encoders = null,
     ISslConfiguration sslConfiguration        = null,
     ConnectError onDisconnected               = null,
     Connecting onConnecting                   = null,
     Connecting onConnected                    = null,
     Writing onWriting            = null,
     StartingBytes onWritingBytes = null,
     FinishedBytes onWroteBytes   = null,
     WriteSuccess onWritten       = null,
     WriteError onWriteFailed     = null,
     Reading onReading            = null,
     StartingBytes onReadingBytes = null,
     FinishedBytes onReadBytes    = null,
     ReadSuccess onRead           = null,
     ReadError onReadFailed       = null,
     ProduceRequestMessages onProduceRequestMessages = null
     )
 {
     ConnectionRetry          = connectionRetry ?? Defaults.ConnectionRetry();
     VersionSupport           = versionSupport ?? Connections.VersionSupport.Kafka10;
     RequestTimeout           = requestTimeout ?? TimeSpan.FromSeconds(Defaults.RequestTimeoutSeconds);
     ReadBufferSize           = readBufferSize.GetValueOrDefault(Defaults.BufferSize);
     WriteBufferSize          = writeBufferSize.GetValueOrDefault(Defaults.BufferSize);
     IsTcpKeepalive           = isTcpKeepalive ?? Defaults.IsTcpKeepalive;
     Encoders                 = Defaults.Encoders(encoders);
     SslConfiguration         = sslConfiguration;
     OnDisconnected           = onDisconnected;
     OnConnecting             = onConnecting;
     OnConnected              = onConnected;
     OnWriting                = onWriting;
     OnWritingBytes           = onWritingBytes;
     OnWroteBytes             = onWroteBytes;
     OnWritten                = onWritten;
     OnWriteFailed            = onWriteFailed;
     OnReading                = onReading;
     OnReadingBytes           = onReadingBytes;
     OnReadBytes              = onReadBytes;
     OnRead                   = onRead;
     OnReadFailed             = onReadFailed;
     OnProduceRequestMessages = onProduceRequestMessages;
 }
Esempio n. 29
0
    private void PlayNodeTypeEnd(iNode _node)
    {
        PlayNodeTypeSentence(_node);
        GameManager.Save.Key.Add(_node.ID);
        var me = UIManager.GetUI<UI_Message>();
        me.Use(new UI_Message_Context()
        {
            Title = Writing.Get(100036),
            Message = System.Text.RegularExpressions.Regex.Unescape(Writing.Get(_node.Sentences.First().Value.DialogueID)),
            CallBack = ui =>
            {

            }
        });
        //UIManager.GetUI<UI_Game>().NoNext = true;
    }
Esempio n. 30
0
File: GM.cs Progetto: lin5/MMDARPG
        /// <summary>
        /// 加载文本
        /// </summary>
        /// <returns></returns>
        public static IEnumerator LoadText(string textname, Language tar = Language.Chinese)
        {
            WWW www = new WWW(CFG.WWWstreamingAssetsPathPrefix + Application.streamingAssetsPath + "/TranslatorText.xml");

            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                Writing.Init(XElement.Parse(www.text), tar);
                //Text.AddItem(XElement.Parse(www.text), 100101, 100130).Save(Application.streamingAssetsPath + "/TranslatorText.xml");
                Writing.CurrentLanguage = tar;
            }
            else
            {
                Debuger.Log(www.error);
            }
        }
Esempio n. 31
0
    public void SetScreen()
    {
#if UNITY_STANDALONE_WIN
        UIManager.GetUI <UI_Ask>().Use(new UI_Ask_Context()
        {
            Message = Writing.Get(100033), Callback = (_oi, _ask) =>
            {
                if (_oi)
                {
                    Screen.SetResolution(1120, 630, false);
                }

                _ask.UseDone();
            }
        });
#endif
    }
Esempio n. 32
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Writing = await _context.Writing.FindAsync(id);

            if (Writing != null)
            {
                _context.Writing.Remove(Writing);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 33
0
 private void writing_Click(object sender, RoutedEventArgs e)
 {
     Writing Writing = new Writing();
     Writing.Show();
     this.Close();
 }
Esempio n. 34
0
        public void OnWorldLoadFinished()
        {
            Dictionary<BookWrittenData, bool> existing = new Dictionary<BookWrittenData, bool>();

            foreach (BookWritten book in Sims3.Gameplay.Queries.GetObjects<BookWritten>())
            {
                BookWrittenData bookData = book.Data as BookWrittenData;
                if (bookData == null) continue;

                existing[bookData] = true;
            }

            List<string> remove = new List<string>();

            foreach (SimDescription sim in SimListing.GetResidents(true).Values)
            {
                if (sim.SkillManager == null) continue;

                Writing skill = sim.SkillManager.GetSkill<Writing>(SkillNames.Writing);
                if (skill == null) continue;

                if (skill.WrittenBookDataList == null) continue;

                foreach (WrittenBookData book in skill.WrittenBookDataList.Values)
                {
                    book.Author = sim.FullName;

                    string id = book.Title + book.Author;

                    BookWrittenData bookData;
                    if (!BookData.BookWrittenDataList.TryGetValue(id, out bookData))
                    {
                        // Constructor auto-adds to dictionary
                        bookData = new BookWrittenData(book, true);
                    }

                    existing[bookData] = true;
                }
            }

            RemoveWrittenData("General");
            RemoveWrittenData("All");

            List<StoreItem> general = null, all = null;
            Bookstore.mItemDictionary.TryGetValue("General", out general);
            Bookstore.mItemDictionary.TryGetValue("All", out all);

            List<WorldType> worldTypes = new List<WorldType>();
            worldTypes.Add(GameUtils.GetCurrentWorldType());

            Writing stateSkill = new Writing();

            foreach (KeyValuePair<string,BookWrittenData> pair in BookData.BookWrittenDataList)
            {
                BookWrittenData data = pair.Value;

                if (!existing.ContainsKey(pair.Value))
                {
                    remove.Add(pair.Key);
                    continue;
                }
                else if ((string.IsNullOrEmpty(data.Title)) || (string.IsNullOrEmpty(data.Author)))
                {
                    remove.Add(pair.Key);
                    continue;
                }

                string geoState, materialState;
                stateSkill.GetGeoAndMaterialStates(data.Genre, out geoState, out materialState);

                if (string.IsNullOrEmpty(data.GeometryState))
                {
                    data.GeometryState = geoState;
                }

                if (string.IsNullOrEmpty(data.MaterialState))
                {
                    data.MaterialState = materialState;
                }

                ThumbnailKey thumb = new ThumbnailKey(new ResourceKey((ulong)ResourceUtils.XorFoldHashString32("book_standard"), 0x1661233, 0x1), ThumbnailSize.Medium, ResourceUtils.HashString32(data.GeometryState), ResourceUtils.HashString32(data.MaterialState));

                BookGeneralStoreItem item = new BookGeneralStoreItem(data.Title + " - " + data.Author, (float)data.Value, data, thumb, data.GenerateUIStoreItemID(), new CreateObjectCallback(CreateBookWrittenCallback), new ProcessObjectCallback(ProcessBookWrittenCallback), data.AllowedWorlds, worldTypes, data.Author, data.Title, data.Length, data.GenreString);

                general.Add(item);
                all.Add(item);
            }

            foreach (string id in remove)
            {
                BookData.BookWrittenDataList.Remove(id);

                BooterLogger.AddTrace("Removed: " + id);
            }
        }